Commit 550ee063 by 李小惠

添加记账接口

parent 5a3b8ae6
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.junmp.jyzb.api.bean;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class PeriodAndDateDto {
private String locationId;
private String locationName;
private Long orgId;
private BigDecimal unitPrice;
private Integer zkCount;
private Integer warrantyPeriod;
private Date productionDate;
}
......@@ -196,4 +196,6 @@ public class InventoryReq extends BaseRequest {
private String startTime;
private String endTime;
private Integer zkCount;
}
package com.junmp.jyzb.api.bean.query;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class PeriodAndDateReq {
private String locationId;
private String locationName;
private Long orgId;
private BigDecimal unitPrice;
private Integer zkCount;
private Integer warrantyPeriod;
private Date productionDate;
}
package com.junmp.jyzb.config.rabbitMQ;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class largeSrceenRabbitConfig {
private static final String EXCHANGE_NAME = "largeScreen_exchange";
@Bean
public FanoutExchange fanoutExchange() {
return new FanoutExchange(EXCHANGE_NAME);
}
@Bean
public RabbitAdmin rabbitAdmin(ConnectionFactory connectionFactory) {
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
rabbitAdmin.declareExchange(fanoutExchange());
return rabbitAdmin;
}
}
......@@ -96,6 +96,6 @@ BussinessInventoryController {
@ApiOperation("确认结果/结束盘点")
public ApiRes<Boolean> UseOrFinished (@RequestBody UploadInventoryReq req){
//判断是否有工作流id,如果有则将状态进行修改
return ApiRes.success(BussinessInventoryService.UploadStock(req));
return ApiRes.success(BussinessInventoryService.UseOrFinished(req));
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.PeriodAndDateDto;
import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto;
import com.junmp.jyzb.api.bean.query.*;
......@@ -305,6 +306,13 @@ public class InventoryController {
return ApiRes.success(inventoryService.EqsByState(req));
}
//将装备根据质保期,维保期上产日期进行分类汇总并且返回
@PostMapping(path = "/GetByPeriodAndDate",name="根据质保期,维保期上产日期进行分类汇总#enable")
@ApiOperation("根据质保期,维保期上产日期进行分类汇总")
public ApiRes<List<PeriodAndDateDto>> GetByPeriodAndDate(@RequestBody InventoryReq req){
return ApiRes.success(inventoryService.GetByPeriodAndDate(req));
}
......
package com.junmp.jyzb.controller;
import cn.hutool.core.util.ObjectUtil;
import com.junmp.jyzb.api.bean.PeriodAndDateDto;
import com.junmp.jyzb.api.bean.dto.OrderDto;
import com.junmp.jyzb.api.bean.dto.OrderMainDto;
import com.junmp.jyzb.api.bean.dto.ProcessOrderDto;
import com.junmp.jyzb.api.bean.query.InventoryReq;
import com.junmp.jyzb.api.bean.query.OrderMainReq;
import com.junmp.jyzb.api.bean.query.OrderUploadReq;
import com.junmp.jyzb.api.bean.req.BaseOrderReq;
......@@ -87,12 +89,13 @@ public class OrderController {
return ApiRes.success(orderMainService.PushState(req));
}
//记账完成之后往消息队列推送消息表示该单子已经完成结算
@PostMapping(path="/Accounting",name="记账#logType=30")
@ApiOperation("记账")
public ApiRes<Boolean> Accounting(@RequestBody @Validated(ValidationApi.delete.class) UpdateOrderReq req){
return ApiRes.success(orderMainService.Accounting(req));
}
//记账完成之后往消息队列推送消息表示该单子已经完成结算
@PostMapping(path="/ShowAccountingPage",name="查看记账列表#enable")
......
......@@ -58,6 +58,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
......@@ -153,5 +154,11 @@ public class PublicController {
return ApiRes.success(dataByTimestampRange);
}
@PostMapping("/bbb")
public ApiRes<Date> bbb(){
return ApiRes.success(DateTimeUtil.DateByDays());
}
}
......@@ -3,6 +3,7 @@ package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.junmp.jyzb.api.bean.PeriodAndDateDto;
import com.junmp.jyzb.api.bean.dto.EqsBriefDto;
import com.junmp.jyzb.api.bean.dto.EqsSumDto;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto;
......@@ -95,6 +96,8 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
@Param("pageNo") Long pageNo,
@Param("pageSize") Long pageSize);
List<PeriodAndDateDto> GetByPeriodAndDate(@Param("req") InventoryReq req);
// IPage<InventoryDto> GetDetailByTerms(@Param("page") Page<Object> defaultPage, @Param("req") InventoryReq req);
......
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.PeriodAndDateDto;
import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto;
import com.junmp.jyzb.api.bean.query.*;
......@@ -89,4 +90,6 @@ public interface InventoryService extends IService<Inventory> {
boolean EqsImport(InventoryReq req);
PageResult<InventoryDto> EqsByState(InventoryReq req);
List<PeriodAndDateDto> GetByPeriodAndDate(InventoryReq req);
}
......@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.PeriodAndDateDto;
import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto;
import com.junmp.jyzb.api.bean.query.*;
......@@ -818,5 +819,14 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
return PageResultFactory.createPageResult(page);
}
@Override
public List<PeriodAndDateDto> GetByPeriodAndDate(InventoryReq req) {
List<PeriodAndDateDto> list=inventoryMapper.GetByPeriodAndDate(req);
if (CollectionUtil.isEmpty(list)){
return new ArrayList<>();
}
return list;
}
}
\ No newline at end of file
......@@ -5,6 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
public class DateTimeUtil {
......@@ -92,4 +94,20 @@ public class DateTimeUtil {
return format1;
}
//获取当前时间年月日,时分秒都为0
public static Date DateByDays(){
LocalDate today = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDateTime = today.atStartOfDay().format(formatter);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=new Date();
try {
date = sdf.parse(formattedDateTime);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
}
\ No newline at end of file
......@@ -91,6 +91,7 @@ public class WarehouseWebSocketServer implements WebSocketServerListener {
redisCache.put(warehouseId, jsonData);
redisCache.put(channel, warehouseId);
}
protocol.response("true");
}
catch (Exception e)
......@@ -102,9 +103,10 @@ public class WarehouseWebSocketServer implements WebSocketServerListener {
public void onClose(DefaultWebSocketServerProtocol protocol) {
String channel= protocol.requestMessage().getChannelId();
String warehouseId= redisCache.get(channel);
String orgId= redisCache.get(channel);
redisCache.remove(channel);
redisCache.remove(warehouseId);
redisCache.remove(orgId);
WebSocketServerListener.super.onClose(protocol);
}
......
......@@ -707,6 +707,41 @@
</if>
</select>
<select id="GetByPeriodAndDate" resultType="com.junmp.jyzb.api.bean.PeriodAndDateDto">
select count(*) as zkCount,location_id,max(location_name) as location_name,warranty_period,production_date,price,org_id FROM(
SELECT a.*,b.warranty_period,b.production_date,b.price FROM
(SELECT org_id,size_id,type_id,location_id,epc,location_name FROM `base_warehouse_inventory` wi
where org_id=#{req.orgId} and type_id=#{req.typeId}
and size_id=#{req.sizeId}
and location_state="in"
<if test="req.locationName != null and req.locationName != ''">
and location_name like CONCAT('%', req.locationName, '%')
</if>
)as a
left join (
select epc,warranty_period,production_date,price
FROM base_inventory bi where org_id_int=#{req.orgId}
and type_id=#{req.typeId} and size_id=#{req.sizeId}
and location_state="in")as b on a.epc=b.epc
) as t group by location_id,price,warranty_period,production_date
having 1=1
<if test="req.price != null and req.price!= ''">
and price =#{req.price}
</if>
<if test="req.zkCount != null and req.zkCount !=''">
and zkCount =#{req.zkCount}
</if>
<if test="req.warrantyPeriod != null and req.warrantyPeriod !=''">
and warranty_period =#{req.warrantyPeriod}
</if>
<if test="req.startTime!= null and req.startTime !=''">
and production_date > #{req.startTime}
</if>
<if test="req.endTime!= null and req.endTime !=''">
and production_date &lt; #{req.endTime}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -153,7 +153,7 @@
vie_price_sum_summary vpss
LEFT JOIN pub_org po ON vpss.org_id_int = po.org_id
WHERE
vpss.MONTH = 1 and vpss.`year`= #{year} and po.del_flag=1
vpss.month = 1 and vpss.`year`= #{year} and po.del_flag=1
AND (po.org_id != #{orgId} and (`po`.org_parent_ids like CONCAT('%', #{orgId}, '%')
AND(case when #{levelFlag} >=3 then 1=1 else SUBSTRING(`po`.`org_code`, 5, 2) = '00' end ))
AND (
......@@ -163,7 +163,8 @@
OR (`po`.`level_flag` = (
SELECT `level_flag` FROM `pub_org` WHERE `org_id` = #{orgId}
))))
<if test="typeIdsList!=null and typeIdsList.size() > 0">
and vpss.create_time >= '2024-01-01 00:00:00' AND vpss.create_time &lt; '2025-01-01 00:00:00'
<if test="typeIdsList!=null and typeIdsList.size() > 0">
and type_id in
<foreach collection="typeIdsList" item="item" open="(" separator="," close=")">
#{item}
......@@ -200,7 +201,8 @@
OR (`po`.`level_flag` = (
SELECT `level_flag` FROM `pub_org` WHERE `org_id` = #{orgId}
))))
<if test="typeIdsList!=null and typeIdsList.size() > 0">
and vpss.create_time >= '2024-01-01 00:00:00' AND vpss.create_time &lt; '2025-01-01 00:00:00'
<if test="typeIdsList!=null and typeIdsList.size() > 0">
and type_id in
<foreach collection="typeIdsList" item="item" open="(" separator="," close=")">
#{item}
......@@ -228,12 +230,11 @@
COALESCE(SUM(COALESCE ( start_num, 0 )),0) AS start_num,
COALESCE(SUM(COALESCE ( start_price, 0 )),0) AS start_price
FROM
vie_price_sum_summary
vie_price_sum_summary vpss
WHERE
vpss.MONTH = 1 and vpss.year=2024
vpss.month = 1 and vpss.year=#{year}
AND org_id_int = #{orgId}
and vpss.create_time >= '2024-01-01 00:00:00' AND vpss.create_time &lt; '2025-01-01 00:00:00'
AND org_id_int = #{orgId}
<if test="typeIdsList!=null and typeIdsList.size() > 0">
and type_id in
<foreach collection="typeIdsList" item="item" open="(" separator="," close=")">
......@@ -248,7 +249,6 @@
</if>
) AS t1
JOIN (
(
SELECT
COALESCE(sum( CASE WHEN vpss.MONTH = MONTH ( CURRENT_DATE ()) THEN COALESCE ( vpss.end_num, 0 ) ELSE 0 END ),0) AS end_num,
COALESCE(sum( CASE WHEN vpss.MONTH = MONTH ( CURRENT_DATE ()) THEN COALESCE ( vpss.end_price, 0 ) ELSE 0 END ),0) AS end_price,
......@@ -261,7 +261,7 @@
FROM
vie_price_sum_summary vpss
WHERE
vpss.`year` = 2024
vpss.`year` = #{year}
AND org_id_int = #{orgId}
and vpss.create_time >= '2024-01-01 00:00:00' AND vpss.create_time &lt; '2025-01-01 00:00:00'
<if test="typeIdsList!=null and typeIdsList.size() > 0">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论