Commit ba464479 by 李小惠

修改出入库和记账接口,与本地主机进行联调

parent a46c29d5
......@@ -13,6 +13,7 @@ public class EquipmentTypeDto {
private String id;
private String name;
//别名
private String nickName;
private String unit;
private String unitType;
......
......@@ -68,4 +68,7 @@ public class OrderDetailDto implements Serializable {
private String remark;
private List<DetailJsonReq> childJson;
//Epc类型(0固定资产1库存物资非固定资产)
private Integer property;
}
......@@ -2,12 +2,22 @@ package com.junmp.jyzb.api.bean.query.InAndOutRecordReq;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class DetailJsonReq {
private String locationId;
private Integer num;
private String locationName;
private String typeId;
private String typeName;
private String sizeId;
private String sizeName;
private Integer modifyQuantity;
private BigDecimal price;
//Epc类型(0固定资产1库存物资非固定资产)
private Integer property;
private List<DetailJsonReq> childDetailJson;
}
......@@ -18,5 +18,7 @@ public class DetailLogReq {
private Integer errorState;
private BigDecimal price;
private Integer equipmentType;
//Epc类型(0固定资产1库存物资非固定资产)
private Integer epcType;
}
......@@ -23,5 +23,6 @@ public class PurchaseEqsReq {
//装备类型0单件,1装备包
private Integer equipmentType;
private BigDecimal price;
private Integer epcType;
}
......@@ -73,4 +73,7 @@ public class OrderDetailReq extends BaseRequest {
*/
private Integer maintenancePeriod;
private String remark;
//Epc类型(0固定资产1库存物资非固定资产)
private Integer property;
}
package com.junmp.jyzb.api.bean.query;
import lombok.Data;
import java.util.List;
@Data
public class PoliceBindInvReq {
private Long orgId;
private String orgName;
private String policeId;
private String policeName;
private Integer totalNum;
private Integer inNum;
private Integer outNum;
private List<String> epcList;
// private List<>
}
package com.junmp.jyzb.api.bean.req;
import com.baomidou.mybatisplus.annotation.TableField;
import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.DetailJsonReq;
import com.junmp.v2.common.bean.request.ValidationApi;
import lombok.Data;
......@@ -86,4 +87,7 @@ public class UpdateOrderDetailReq implements Serializable {
private String remark;
private Long orgId;
private List<DetailJsonReq> childJson;
//Epc类型(0固定资产1库存物资非固定资产)
private Integer property;
}
......@@ -14,6 +14,7 @@ public enum OrderExceptionEnum implements IExceptionEnum {
ORDERDETAIL_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE,"子单据不一致,操作失败"),
ROLE_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE,"审核组织机构用户配置异常!请检查日志"),
ORDER_CREATE_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE,"单子创建失败"),
ORDER_NUM_IS_NULL(CommonConstant.DEFAULT_USER_ERROR_CODE,"请先选择仓库确认"),
;
/**
......
......@@ -72,9 +72,9 @@ public class BussinessInventoryController {
return ApiRes.success(BussinessInventoryService.GetPage(req));
}
//盘库申请
@PostMapping(path="/GetById",name="查询详情#enable")
@PostMapping(path="/GetDetailById",name="查询详情#enable")
@ApiOperation("查询详情")
public ApiRes<BussinessInventoryDto> GetById (@RequestBody BussinessInventoryReq req){
public ApiRes<BussinessInventoryDto> GetDetailById (@RequestBody BussinessInventoryReq req){
//判断是否有工作流id,如果有则将状态进行修改
return ApiRes.success(BussinessInventoryService.GetDetailById(req));
}
......
......@@ -318,4 +318,5 @@ public class InventoryController {
return ApiRes.success(inventoryService.EqsImport(req));
}
}
......@@ -47,6 +47,9 @@ public class OutAndInboundController {
@Resource
private LogSummarySecondService logSummarySecondService;
@Resource
private InventoryService inventoryService;
@ApiOperation("/查看出入库详情")
@PostMapping(path="/GetDetailByLogSumId",name="查看出入库详情#enable")
public ApiRes<List<LogDetailDto>> GetDetailByLogSumId(@RequestBody @Validated(ValidationApi.detail.class) LogDetailReq req){
......@@ -101,5 +104,11 @@ public class OutAndInboundController {
return ApiRes.success(orderLogService.getSecondInfoByLogSumId(req));
}
// @PostMapping(path = "bind",name = "装备绑定或解绑#enable")
// @ApiOperation("装备绑定或者解绑")
// public ApiRes<Boolean> bind (){
// return ApiRes.success(inventoryService.bind());
// }
}
......@@ -119,7 +119,7 @@ public class TjController {
}
@PostMapping("/TjOrgPriceDetail")
@ApiOperation("/查询组织机构下的财务统计明细")
@ApiOperation("/查询组织机构下的财务统计明细(改)")
public ApiRes<List<TjOrgPriceDto>> TjOrgPriceDetail(@RequestBody TjOrgPriceReq req){
return ApiRes.success(tjService.TjOrgPriceDetail(req));
}
......
......@@ -207,4 +207,8 @@ public class Inventory implements Serializable {
@TableField(exist = false)
private String bussinessType;
//Epc类型(0固定资产1库存物资非固定资产)
@TableField(value = "property")
private Integer property;
}
\ No newline at end of file
......@@ -215,6 +215,10 @@ public class InventorySummary implements Serializable {
@TableField(value = "agent_broken_num")
private Integer agentBrokenNum;
//Epc类型(0固定资产1库存物资非固定资产)
@TableField(value = "property")
private Integer property;
private static final long serialVersionUID = 1L;
......
......@@ -106,4 +106,8 @@ import java.util.Date;
@TableField("remark")
private String remark;
//Epc类型(0固定资产1库存物资非固定资产)
@TableField(value = "property")
private Integer property;
}
......@@ -104,7 +104,7 @@ public class OrderLog implements Serializable {
private String updateUser;
/**
* 过程事件(创建单据createOrder,出入库OutAndIn,记账accounting
* 过程事件(创建单据createOrder,出入库OutAndIn,记账)
*/
@TableField(value = "process_type")
private String processType;
......
......@@ -137,7 +137,7 @@ public class OrderMain implements Serializable {
private Date returnDate;
/**
* 移仓库id
* 移仓库id
*/
@TableField("location_id")
private String locationId;
......@@ -148,12 +148,12 @@ public class OrderMain implements Serializable {
private String locationName;
/**
* 移仓库id
* 移仓库id
*/
@TableField("remove_location_id")
private String removeLocationId;
/**
* 移仓库名称
* 移仓库名称
*/
@TableField("remove_location_name")
private String removeLocationName;
......
......@@ -170,6 +170,7 @@ import static com.junmp.junmpProcess.common.CommonConstants.*;
UpdateReassignmentReq updateReassignmentReq = new UpdateReassignmentReq();
one.setExamineState("finished");
BeanPlusUtil.copyProperties(one,updateReassignmentReq);
//如果同意直接讲警员基础信息进行修改
policemanService.changePoliceOrg(updateReassignmentReq);
reassignmentService.updateById(one);
} else
......
......@@ -39,6 +39,7 @@ public interface InventorySummaryMapper extends BaseMapper<InventorySummary> {
//根据组织机构,仓库,type,size,unitprice查询库存汇总信息
List<InventorySummary> selectSumByItems(@Param("list") List<Object[]> searchCriteria);
List<InventorySummary> selectSum(@Param("list") List<Object[]> searchCriteria);
//根据组织机构查询报表中的本级及下一级信息
List<TjOrgEqsDto> getByOrgId(@Param("orgId") Long orgId);
......
......@@ -42,7 +42,7 @@ public class OutInLogsReceiver {
logRecordDTO.setLogContent("OrderResult");
logRecordDTO.setRequestParams(msg);
logRecordDTO.setLogType(30);
logRecordDTO.setRequestUrl("queues = \"11111\"");
logRecordDTO.setRequestUrl("queues = \"orderResult\"");
try {
// System.out.println("msg = " + msg);
// 创建日志对象
......
package com.junmp.jyzb.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -106,7 +107,7 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
parentType.setCode(String.valueOf(newcode));
List<SupplierType> supplierType = new ArrayList<>();
//判断req.getSupplierList()是否为空,如果为空则不进行循环
if (req.getSupplierList().size()!=0){
if (CollectionUtil.isNotEmpty(req.getSupplierList())){
req.getSupplierList().forEach(supply -> {
SupplierType st = new SupplierType();
st.setId(String.valueOf(UUID.randomUUID()));
......
......@@ -158,14 +158,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
break;
}
}
// List<OrderDetail> collect = orderDetailList.stream().map(detailOrderReq -> {
// OrderDetail orderDetail = new OrderDetail();
// BeanPlusUtil.copyProperties(detailOrderReq, orderDetail);
//
// orderDetail.setModifyQuantity(detailOrderReq.getActualNum());
// orderDetail.setUpdateTime(DateTimeUtil.getCurrentDateTime());
// return orderDetail;
// }).collect(Collectors.toList());
b=orderDetailService.updateBatchById(detailList);
//2.判断业务类型,如果是采购,更新装备库存表
......@@ -255,7 +247,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
// 对出入库记录进行分类汇总存储()
public List<NormalInOutDto> saveInOutRecords(OutInLogsReq req) {
//返回结果,用于日常出入库时计算更新库存汇总表
List<SummaryLogReq> logSummaryList = req.getLogList();
......@@ -264,9 +255,16 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
List<NormalInOutDto> returnList=new ArrayList<>();
//存一个list用于修改库存inventory表的数据(采购时那么这个inventoryList就为空)
List<Inventory> inventoryList=new ArrayList<>();
//存一个list用于修改库存warehosuseInventory表的数据(采购时那么这个wInventoryList就为空)
List<WarehouseInventory> wInbentoryList=new ArrayList<>();
List<OrderLog> orderLogList=new ArrayList<>();
String orderMainId="";
// //设置全局的业务类型和出入库状态
// String bussinessType=logSummaryList.get(0).getBussinessType();
// String locationState=logSummaryList.get(0).getOutInState();
List<LogSummary> sumList=new ArrayList<>();
OrderMain ordermain=null;
for (SummaryLogReq logreq:logSummaryList) {
if (ObjectUtil.isNotNull(logreq.getPicture())){
byte[] imageBytes = Base64.getDecoder().decode(logreq.getPicture());
......@@ -283,21 +281,36 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
if (ObjectUtil.isNotNull(logreq.getOrderMainId())){
orderMainId=logreq.getOrderMainId();
}
if (ObjectUtil.isNotEmpty(orderMainId)){
ordermain = orderMainService.getById(orderMainId);
}
//如果类型为normal,那么则表示作为日常出入库的记录,否则则作为单据的出入库记录
List<DetailLogReq> logList = logreq.getLogDetailList();
//出入库list
List<LogDetail> collect = new ArrayList<>();
LogSummary logSummary = saveLogSummary(logreq);
LogSummary logSummary = saveLogSummary(logreq,logreq.getLocationId(),logreq.getLocationName(),logreq.getOutInState());
String string="";
String stringQuick="";
if (logSummary.getOutInState().equals("in")){
string=string+logSummary.getLocationName()+":入库【"+logSummary.getEquipmentList()+"】,数量:"+logSummary.getNumber()+"\n";
}else {
string=string+logSummary.getLocationName()+":出库【"+logSummary.getEquipmentList()+"】,数量:"+logSummary.getNumber()+"\n";
}
logSummaryService.save(logSummary);
LogSummary logSummaryQuick=new LogSummary();
if (logreq.getBussinessType().equals("quick")){
logSummaryQuick= saveLogSummary(logreq,ordermain.getLocationId(),ordermain.getLocationName(),"in");
sumList.add(logSummaryQuick);
stringQuick=stringQuick+logSummaryQuick.getLocationName()+":入库【"+logSummaryQuick.getEquipmentList()+"】,数量:"+logSummary.getNumber()+"\n";
}
sumList.add(logSummary);
logSummaryService.saveBatch(sumList);
Map<String, String> map = setState(logreq.getOutInState(), logreq.getBussinessType());
//无单据的时候
for (DetailLogReq detailLogReq : logList) {
//将所有装备信息进行存放(为后面计算汇总信息)
if (logreq.getBussinessType().equals("normal")) {
......@@ -313,10 +326,13 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
}
//判断logSummary是否为采购,快速移库,和领用出库
//如果是采购则不处理,因为采购的inventory是跟着单子来处理的,其他的单子直接根据出入库记录来处理
if (!logreq.getBussinessType().equals("purchase") && !logreq.getBussinessType().equals("quick") && !logreq.getBussinessType().equals("use")){
if (!logreq.getBussinessType().equals("purchase") && !logreq.getBussinessType().equals("quick") ){
// if (logreq.getOutInState().equals("in")){
Inventory inventory = saveInventory(logreq.getOrgId(),logreq.getLocationId(),logreq,detailLogReq, map, logSummary.getOutInState());
inventoryList.add(inventory);
// WarehouseInventory warehouseInventory=saveWarehouseInventory(logreq.getOrgId(),logreq.getLocationId(),logreq,detailLogReq, map, logSummary.getOutInState());
// wInbentoryList.add(warehouseInventory);
// }
// else {
// Inventory inventory = saveInventory(detailLogReq, map, logSummary.getOutInState());
......@@ -326,33 +342,45 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
}
//如果是快速移库,那么直接将物资的locationId进行修改
if(logreq.getBussinessType().equals("quick")){
Inventory inventory = saveInventory(logreq.getOrgId(),logreq.getLocationId(),logreq,detailLogReq, map, logSummary.getOutInState());
inventoryList.add(inventory);
}
//存放logdetail信息
LogDetail logDetail = new LogDetail();
LogDetail logDetailQuick=new LogDetail();
BeanPlusUtil.copyProperties(detailLogReq, logDetail);
logDetail.setSummaryId(logSummary.getId());
logDetail.setOrgId(logSummary.getOrgId());
logDetail.setBussinessType(logSummary.getBussinessType());
logDetail.setCreateTime(DateTimeUtil.getCurrentDateTime());
logDetail.setBussinessType(logreq.getBussinessType());
logDetail.setOutInState(logreq.getOutInState());
if (logreq.getBussinessType().equals("quick")){
BeanPlusUtil.copyProperties(logDetail,logDetailQuick);
logDetailQuick.setSummaryId(logSummaryQuick.getId());
logDetailQuick.setOutInState("in");
collect.add(logDetailQuick);
}
collect.add(logDetail);
}
List<LogSummarySecond> collect1 = logreq.getSumInfoList().stream().map(logSecondReq -> {
LogSummarySecond logSummarySecond = new LogSummarySecond();
BeanPlusUtil.copyProperties(logSecondReq, logSummarySecond);
logSummarySecond.setSummaryId(logSummary.getId());
logSummarySecond.setCreateTime(DateTimeUtil.getCurrentDateTime());
return logSummarySecond;
}).collect(Collectors.toList());
// List<LogSummarySecond> collect1 = logreq.getSumInfoList().stream().map(logSecondReq -> {
// LogSummarySecond logSummarySecond = new LogSummarySecond();
// BeanPlusUtil.copyProperties(logSecondReq, logSummarySecond);
// logSummarySecond.setSummaryId(logSummary.getId());
// logSummarySecond.setCreateTime(DateTimeUtil.getCurrentDateTime());
// return logSummarySecond;
// }).collect(Collectors.toList());
//
boolean b1 = logSummarySecondService.saveBatch(collect1);
// boolean b1 = logSummarySecondService.saveBatch(collect1);
boolean b = logDetailService.saveBatch(collect);
//创建出入库日志
if (ObjectUtil.isNotNull(logSummary.getOrderMainId())){
OrderLog orderLog = addLog(logSummary,string);
OrderLog qucik = new OrderLog();
if (logreq.getBussinessType().equals("quick")){
qucik=addLog(logSummaryQuick,stringQuick);
orderLogList.add(qucik);
}
orderLogList.add(orderLog);
}
}
......@@ -360,11 +388,9 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
if (orderLogList.size()>0){
boolean b = orderLogService.saveBatch(orderLogList);
}
OrderMain ordermain=null;
if (ObjectUtil.isNotEmpty(orderMainId)){
ordermain = orderMainService.getById(orderMainId);
}
//修改inventory表中的数据(如果不为空则表示不是采购单或者已经将采购单的信息过滤掉)
if (inventoryList.size()>0){
LambdaUpdateWrapper<Inventory> updateStateWrapper1 = Wrappers.lambdaUpdate();
......@@ -376,16 +402,36 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
//调拨入库
allocateInWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
.set(Inventory::getOrgId,inventory.getOrgId())
.set(Inventory::getLocationId,inventory.getLocationId());
.set(Inventory::getLocationId,inventory.getLocationId())
.set(Inventory::getLocationState,"in");
allocateInWrapper2.or().eq(WarehouseInventory::getEpc,inventory.getEpc())
.set(WarehouseInventory::getOrgId,inventory.getOrgId())
.set(WarehouseInventory::getLocationId,inventory.getLocationId());
.set(WarehouseInventory::getLocationId,inventory.getLocationId())
.set(WarehouseInventory::getLocationState,"in");
} else if (inventory.getBussinessType().equals("allocate") && inventory.getLocationState().equals("out") && !ObjectUtil.isNull(ordermain)){
//调拨出库,不操作
allocateInWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
.set(Inventory::getOrgId,null)
.set(Inventory::getLocationId,null)
.set(Inventory::getLocationState,"out");
allocateInWrapper2.or().eq(WarehouseInventory::getEpc,inventory.getEpc())
.set(WarehouseInventory::getOrgId,null)
.set(WarehouseInventory::getLocationId,null)
.set(WarehouseInventory::getLocationState,"out");
}else {
//其他情况
if (inventory.getBussinessType().equals("quick")){
updateStateWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
.set(Inventory::getLocationState,"in")
.set(Inventory::getBussinessState,"normal")
.set(Inventory::getLocationId,inventory.getLocationId())
.set(Inventory::getState,"normal");
updateStateWrapper2.or().eq(WarehouseInventory::getEpc,inventory.getEpc())
.set(WarehouseInventory::getLocationId,inventory.getLocationId())
.set(WarehouseInventory::getLocationState,"in");
}else {
updateStateWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
.set(Inventory::getLocationState,inventory.getLocationState())
.set(Inventory::getBussinessState,inventory.getBussinessState())
......@@ -396,6 +442,9 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
}
}
}
if (!updateStateWrapper1.isEmptyOfWhere()){
inventoryService.update(updateStateWrapper1);
......@@ -415,7 +464,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
private OrderLog addLog(LogSummary logSummary,String string){
OrderLog orderLog = new OrderLog();
orderLog.setId(UUID.randomUUID().toString());
string=string.substring(0,string.length()-1);
orderLog.setHistoryMsg(string);
orderLog.setOrderCode(logSummary.getOrderCode());
orderLog.setBussinessType(logSummary.getBussinessType());
......@@ -428,10 +476,12 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
return orderLog;
}
// 创建logsummary
private LogSummary saveLogSummary(SummaryLogReq req){
private LogSummary saveLogSummary(SummaryLogReq req,String locationId,String locationName,String outInState){
LogSummary logSummary = new LogSummary();
BeanPlusUtil.copyProperties(req,logSummary);
logSummary.setOutInState(req.getOutInState());
logSummary.setOutInState(outInState);
logSummary.setLocationId(locationId);
logSummary.setLocationName(locationName);
logSummary.setCreateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setUpdateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setBussinessType(req.getBussinessType());
......@@ -453,6 +503,15 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
inventory.setBussinessType(logreq.getBussinessType());
return inventory;
}
private WarehouseInventory saveWarehouseInventory(Long orgId,String locationId,SummaryLogReq logreq,DetailLogReq req,Map<String, String> map,String outInState){
WarehouseInventory warehouseInventory=new WarehouseInventory();
BeanPlusUtil.copyProperties(req,warehouseInventory);
warehouseInventory.setLocationState(outInState);
warehouseInventory.setLocationId(locationId);
warehouseInventory.setEpc(req.getEpc());
warehouseInventory.setOrgId(orgId);
return warehouseInventory;
}
private Map<String,String> setState(String outInState,String bussinessType){
Map<String,String> map=new HashMap<>();
......@@ -463,6 +522,7 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
case "return":
case "gift":
case "other":
case "repair":
state="normal";
bussinessState="normal";
break;
......@@ -470,11 +530,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
state="normal";
bussinessState="allocate";
break;
case "repair":
state="normal";
bussinessState="repair";
break;
}
}else {
......@@ -499,7 +554,10 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
state="normal";
bussinessState="normal";
break;
case "quick":
state="normal";
bussinessState="quick";
break;
}
}
map.put("state",state);
......
......@@ -142,6 +142,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
@Autowired
private RabbitMQSendMsg MQ;
@Resource
private WarehouseInventoryService warehouseInventoryService;
@Transactional(rollbackFor = Exception.class)
@Override
......@@ -811,19 +814,51 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
List<DetailJsonReq> detailJsonReqs = JSONObject.parseArray(detailJson, DetailJsonReq.class);
List<OrderDetailDto> orderDetailDtoList=new ArrayList<>();
List<DetailJsonReq> child=new ArrayList<>();
for (OrderDetail orderDetail:list) {
OrderDetailDto orderDetailDto = new OrderDetailDto();
BeanPlusUtil.copyProperties(orderDetail,orderDetailDto);
Map<String, DetailJsonReq> summaryMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(detailJsonReqs)) {
for (DetailJsonReq json :detailJsonReqs) {
json.setModifyQuantity(json.getNum());
if (orderDetail.getTypeId().equals(json.getTypeId()) && orderDetail.getSizeId().equals(json.getSizeId())){
child.add(json);
String key = json.getLocationId() + "_" + json.getSizeId() + "_" + json.getTypeId();
DetailJsonReq summary = summaryMap.get(key);
if (summary == null) {
summary = new DetailJsonReq();
summary.setLocationId(json.getLocationId());
summary.setLocationName(json.getLocationName());
summary.setSizeId(json.getSizeId());
summary.setTypeId(json.getTypeId());
summary.setChildDetailJson(new ArrayList<>());
summaryMap.put(key, summary);
}
// 汇总数量
if (json.getNum() != null) {
Integer newNum = summary.getNum() != null ? summary.getNum() + json.getNum() : json.getNum();
summary.setNum(newNum);
}
// 汇总子数据
if (json.getChildDetailJson() != null) {
summary.getChildDetailJson().addAll(json.getChildDetailJson());
}
}
orderDetailDto.setChildJson(child);
}
List<DetailJsonReq> filteredValues = summaryMap.entrySet().stream()
.filter(entry -> {
String[] keyParts = entry.getKey().split("_");
String typeId = keyParts[2];
String sizeId = keyParts[1];
return typeId.equals(orderDetail.getTypeId()) && sizeId.equals(orderDetail.getSizeId());
})
.map(Map.Entry::getValue)
.collect(Collectors.toList());
orderDetailDto.setChildJson(filteredValues);
orderDetailDtoList.add(orderDetailDto);
}
orderDto.setDetailList(orderDetailDtoList);
......@@ -892,7 +927,15 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
String s="";
//比较两个子单id完全一致,判断传递的子单据id在数据库中是否存在,如果不存在则抛出子单据不存在异常
if (collect.size() == existingIds.size() && collect.containsAll(existingIds) && existingIds.containsAll(collect)){
UpdateOrderDetailReq data = new UpdateOrderDetailReq();
//新增空装备
List<Inventory> addInvList=new ArrayList<>();
//删除空装备
List<Inventory> delInvList=new ArrayList<>();
List<WarehouseInventory> addWareInvList=new ArrayList<>();
List<WarehouseInventory> delWareInvList=new ArrayList<>();
//遍历子单
List<DetailJsonReq> sumList=new ArrayList<>();
for (UpdateOrderDetailReq uploadDetailReq : reqList) {
OrderDetail orderDetail = new OrderDetail();
BeanPlusUtil.copyProperties(uploadDetailReq,orderDetail);
......@@ -900,25 +943,20 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
uploadDetailReq.setActualNum(0);
}
//获取修改后的数量并且记录(modifyQuantity表示有记账数量)
if (ObjectUtil.isNull(uploadDetailReq.getModifyQuantity())){
throw new ServiceException(OrderExceptionEnum.ORDER_NUM_IS_NULL);
}
if (uploadDetailReq.getModifyQuantity() >= 0 ){
//记账内容
List<DetailJsonReq> childJson = uploadDetailReq.getChildJson();
for (DetailJsonReq child:childJson) {
s = s+child.getLocationName()+"--"+uploadDetailReq.getTypeName()+"【"+
uploadDetailReq.getSizeName()+"】,单价:"+uploadDetailReq.getPrice()+",数量实入:"+child.getNum()+",记账:"+child.getModifyQuantity()+"\n";
data.setPlanNum(uploadDetailReq.getPlanNum());
// data.setOrgId(uploadDetailReq.getOrgId());
data.setWarehouseId(child.getLocationId());
data.setSizeId(uploadDetailReq.getSizeId());
data.setTypeId(uploadDetailReq.getTypeId());
data.setPrice(uploadDetailReq.getPrice());
data.setModifyQuantity(child.getModifyQuantity());
data.setSizeName(uploadDetailReq.getSizeName());
data.setTypeName(uploadDetailReq.getTypeName());
data.setWarehouseName(child.getLocationName());
orderDetailReqList.add(data);
for (DetailJsonReq detailJsonReq:childJson) {
detailJsonReq.setSizeName(uploadDetailReq.getSizeName());
detailJsonReq.setTypeName(uploadDetailReq.getTypeName());
detailJsonReq.setPrice(uploadDetailReq.getPrice());
}
sumList.addAll(childJson);
// AccountingDto accountingDto = new AccountingDto();
// BeanPlusUtil.copyProperties(uploadDetailReq,accountingDto);
......@@ -935,6 +973,127 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
throw new ServiceException(OrderExceptionEnum.ORDERDETAIL_ERROR);
}
}
String detailJson = orderMain.getDetailJson();
//出入库传递的具体汇总信息
List<DetailJsonReq> detailJsonList = JSONObject.parseArray(detailJson, DetailJsonReq.class);
//sumList已经是汇总信息
for (DetailJsonReq child:sumList) {
if (ObjectUtil.isNull(child.getNum())){
child.setNum(0);
}
Integer num=0;
BigDecimal price=BigDecimal.ZERO;
for (DetailJsonReq detail:detailJsonList) {
if (child.getSizeId().equals(detail.getSizeId())&& child.getLocationId().equals(detail.getLocationId())&&child.getTypeId().equals(detail.getTypeId())){
num+=detail.getNum();
price=detail.getPrice();
UpdateOrderDetailReq data = new UpdateOrderDetailReq();
data.setActualNum(detail.getNum());
// data.setOrgId(uploadDetailReq.getOrgId());
data.setWarehouseId(child.getLocationId());
data.setSizeId(child.getSizeId());
data.setTypeId(child.getTypeId());
data.setPrice(child.getPrice());
data.setProperty(detail.getProperty());
data.setSizeName(child.getSizeName());
data.setTypeName(child.getTypeName());
if (detail.getProperty()==0 && detail.getNum()>child.getNum()){
data.setModifyQuantity(detail.getModifyQuantity()-detail.getNum()+child.getNum());
}else {
data.setModifyQuantity(child.getModifyQuantity());
}
orderDetailReqList.add(data);
}
}
s = s+child.getLocationName()+"--"+child.getTypeName()+"【"+
child.getSizeName()+"】,单价:"+price+",数量实入:"+num+",记账:"+child.getModifyQuantity()+"\n";
Inventory inventory = new Inventory();
WarehouseInventory warehouseInventory=new WarehouseInventory();
if (ObjectUtil.isNull(child.getModifyQuantity())){
throw new ServiceException(OrderExceptionEnum.ORDER_NUM_IS_NULL);
}
if (child.getNum()<child.getModifyQuantity()){
//实际出库或者入库数量大于实际数量,则对空数据进行增删改查
if (orderMain.getOrderType().equals("in")){
for (int i = 0; i < child.getModifyQuantity()-child.getNum(); i++) {
inventory.setEpc("0");
inventory.setLocationId(child.getLocationId());
inventory.setSizeId(child.getSizeId());
inventory.setTypeId(child.getTypeId());
inventory.setOrgId(orderMain.getEndOrgId());
inventory.setLocationType(0);
inventory.setPrice(child.getPrice());
addInvList.add(inventory);
warehouseInventory.setOrgId(orderMain.getEndOrgId());
warehouseInventory.setLocationId(child.getLocationId());
warehouseInventory.setTypeId(child.getTypeId());
warehouseInventory.setSizeId(child.getSizeId());
warehouseInventory.setLocationType("0");
addWareInvList.add(warehouseInventory);
}
}else {
int number=child.getModifyQuantity()-child.getNum();
List<Inventory> list1 = inventoryService.list(new LambdaQueryWrapper<Inventory>()
.eq(Inventory::getEpc, "0")
.eq(Inventory::getLocationId, child.getLocationId())
.eq(Inventory::getSizeId, child.getSizeId())
.eq(Inventory::getOrgId, orderMain.getStartOrgId())
.eq(Inventory::getTypeId, child.getTypeId())
.eq(Inventory::getPrice, child.getPrice())
.eq(Inventory::getLocationType, "0"));
List<WarehouseInventory> list2 = warehouseInventoryService.list(new LambdaQueryWrapper<WarehouseInventory>()
.eq(WarehouseInventory::getEpc, "0")
.eq(WarehouseInventory::getLocationId, child.getLocationId())
.eq(WarehouseInventory::getOrgId, orderMain.getStartOrgId())
.eq(WarehouseInventory::getSizeId, child.getSizeId())
.eq(WarehouseInventory::getTypeId, child.getTypeId()));
if (list1.size()>0){
if (number>=list1.size()){
delInvList.addAll(list1);
}else {
for (int i = 0; i < number; i++) {
delInvList.add(list1.get(i));
}
}
}
if (list2.size()>0){
if (number>=list2.size()){
delWareInvList.addAll(list2);
}else {
for (int i = 0; i < number; i++) {
delInvList.add(list1.get(i));
}
}
}
}
}
}
if (addWareInvList.size()>0){
inventoryService.saveBatch(addInvList);
}
if (addInvList.size()>0){
warehouseInventoryService.saveBatch(addWareInvList);
}
if (delInvList.size()>0){
inventoryService.removeBatchByIds(delInvList);
}
if (delWareInvList.size()>0){
warehouseInventoryService.removeBatchByIds(delWareInvList);
}
}else {
throw new ServiceException(OrderExceptionEnum.ORDERDETAIL_ERROR);
}
......@@ -975,15 +1134,15 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
}
//如果是领用,警员绑定装备
boolean e=true;
// if (req.getBussinessType().equals("use")){
//
// e = policeBindEqs(req, reqList, orgId);
// }
if (req.getBussinessType().equals("use")){
e = policeBindEqs(req, reqList, orgId);
}
// //如果是归还入库,将警员下面的装备进行处理
boolean f=true;
// if (req.getBussinessType().equals("return")){
// f = policeUnBindEqs(req, reqList, orgId);
// }
if (req.getBussinessType().equals("return")){
f = policeUnBindEqs(req, reqList, orgId);
}
//记账结束之后往消息队列中推送一条消息
String exchangeName="orderExchange";
......@@ -1105,12 +1264,12 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
List<Object[]> searchCriteria=new ArrayList<>();
for (UpdateOrderDetailReq upReq: orderDetailReqList) {
Object[] criteria=new Object[]{orgId,upReq.getWarehouseId(),upReq.getTypeId(),upReq.getSizeId(),upReq.getPrice()};
Object[] criteria=new Object[]{orgId,upReq.getWarehouseId(),upReq.getTypeId(),upReq.getSizeId(),upReq.getPrice(),upReq.getProperty()};
searchCriteria.add(criteria);
}
//库存信息
List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchCriteria);
List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSum(searchCriteria);
List<InventorySummary> addList=new ArrayList<>();
List<InventorySummary> updateList=new ArrayList<>();
for (UpdateOrderDetailReq upReq: orderDetailReqList) {
......@@ -1120,20 +1279,6 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
&& upReq.getTypeId().equals(is.getTypeId()) && upReq.getPrice().compareTo(is.getUnitPrice())==0){
is.setUpdateTime(DateTimeUtil.getCurrentDateTime());
//修改各种数量和价格
// if (req.getOrderType().equals("in")){//入库没有关系
// is.setOutboundNumber(is.getOutboundNumber()-upReq.getModifyQuantity());
// is.setStockNumber(is.getStockNumber()+upReq.getModifyQuantity());
// is.setPrice(is.getPrice().add(BigDecimal.valueOf(upReq.getModifyQuantity()).multiply(upReq.getPrice())) );
// }else if (req.getOrderType().equals("out") && req.getBussinessType().equals("destruction")){//销毁出库直接减库存,减金额
// is.setPrice(is.getPrice().subtract(BigDecimal.valueOf(upReq.getModifyQuantity()).multiply(upReq.getPrice())));
// is.setNumber(is.getNumber()-upReq.getModifyQuantity());
// is.setStockNumber(is.getStockNumber()-upReq.getModifyQuantity());
// is.setDestructionNumber(is.getDestructionNumber()+upReq.getModifyQuantity());
// }else {//其他出库就直接正常计算
// is.setOutboundNumber(is.getOutboundNumber()+upReq.getModifyQuantity());
// is.setStockNumber(is.getStockNumber()-upReq.getModifyQuantity());
// is.setPrice(is.getPrice().subtract(BigDecimal.valueOf(upReq.getModifyQuantity()).multiply(upReq.getPrice())) );
// }
if (req.getOrderType().equals("in")){
switch (req.getBussinessType()){
case "purchase":
......@@ -1166,20 +1311,20 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
is.setNumber(is.getNumber() + upReq.getPlanNum());
is.setStockNumber(is.getStockNumber() + upReq.getPlanNum());
is.setNumber(is.getNumber()-upReq.getModifyQuantity());
is.setNumber(Math.max(is.getNumber() - upReq.getModifyQuantity(), 0));
is.setPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getNumber())));
is.setStockNumber(is.getStockNumber()-upReq.getModifyQuantity());
is.setStockNumber(Math.max(is.getStockNumber()-upReq.getModifyQuantity(),0));
is.setDestructionNumber(is.getDestructionNumber()+upReq.getModifyQuantity());
is.setDestructionNumberPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getDestructionNumber())));
break;
case "allocate":
is.setNumber(is.getNumber()-upReq.getModifyQuantity());
is.setStockNumber(is.getStockNumber()-upReq.getModifyQuantity());
is.setNumber(Math.max(is.getNumber() - upReq.getModifyQuantity(), 0));
is.setStockNumber(Math.max(is.getStockNumber() - upReq.getModifyQuantity(), 0));
is.setPrice(is.getPrice().subtract(BigDecimal.valueOf(upReq.getModifyQuantity()).multiply(upReq.getPrice())) );
break;
case "use":
is.setOutboundNumber(is.getOutboundNumber()+upReq.getModifyQuantity());
is.setStockNumber(is.getStockNumber()-upReq.getModifyQuantity());
is.setStockNumber(Math.max(is.getStockNumber() - upReq.getModifyQuantity(), 0));
is.setPrice(is.getPrice().subtract(BigDecimal.valueOf(upReq.getModifyQuantity()).multiply(upReq.getPrice())) );
if (ObjectUtil.isNull(is.getUseCount())){
is.setUseCount(0);
......@@ -1192,7 +1337,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
break;
case "repair":
is.setOutboundNumber(is.getOutboundNumber()+upReq.getModifyQuantity());
is.setStockNumber(is.getStockNumber()-upReq.getModifyQuantity());
is.setStockNumber(Math.max(is.getStockNumber() - upReq.getModifyQuantity(), 0));
is.setPrice(is.getPrice().subtract(BigDecimal.valueOf(upReq.getModifyQuantity()).multiply(upReq.getPrice())) );
if (ObjectUtil.isNull(is.getFixCount())){
is.setFixCount(0);
......@@ -1201,7 +1346,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
break;
case "other":
is.setOutboundNumber(is.getOutboundNumber()+upReq.getModifyQuantity());
is.setStockNumber(is.getStockNumber()-upReq.getModifyQuantity());
is.setStockNumber(Math.max(is.getStockNumber() - upReq.getModifyQuantity(), 0));
is.setPrice(is.getPrice().subtract(BigDecimal.valueOf(upReq.getModifyQuantity()).multiply(upReq.getPrice())) );
break;
// case "quick":
......@@ -1220,7 +1365,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
inventorySummary.setOrgCode(orgCode);
inventorySummary.setOrgName(orgName);
inventorySummary.setOrgId(orgId);
inventorySummary.setValuekey(orgCode+upReq.getSizeId());
inventorySummary.setValuekey(orgCode+upReq.getWarehouseId()+upReq.getTypeId()+upReq.getSizeId()+upReq.getPrice());
inventorySummary.setSizeId(upReq.getSizeId());
inventorySummary.setSizeName(upReq.getSizeName());
inventorySummary.setTypeName(upReq.getTypeName());
......@@ -1236,6 +1381,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
inventorySummary.setNearBrokenNumber(0);
inventorySummary.setNumber(upReq.getModifyQuantity());
inventorySummary.setCreateTime(DateTimeUtil.getCurrentDateTime());
inventorySummary.setProperty(upReq.getProperty());
if (req.getOrderType().equals("in")){
inventorySummary.setOutboundNumber(0);
inventorySummary.setUseNumber(0);
......
......@@ -866,8 +866,14 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
Integer inventoryQuantity=0;
Integer actualQuantity=0;
List<PoliceEquipment> reqEquipments = JSON.parseArray(req.getDetailList(), PoliceEquipment.class);
//查询出该警员的所有装备信息
LambdaQueryWrapper<PoliceEquipment> eq = new LambdaQueryWrapper<PoliceEquipment>()
.eq(PoliceEquipment::getPoliceId, policeman.getId());
//查询该警员是否存在装备信息,如果存在则进行删除
List<PoliceEquipment> list1 = policeEquipmentService.list(eq);
//判断是调入单还是调出单
//0是调入警员,1是调出警员
//assign是调入
if(req.getReassignmentType().equals(itemValue) && itemValue.equals("assign")){
//添加账号和组织机构的绑定关系
SysUserOrg sysUserOrg = new SysUserOrg();
......@@ -877,23 +883,33 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
sysUserOrgService.save(sysUserOrg);
//将警员中的组织机构id设置
policeman.setOrgId(req.getOrgId());
policeman.setState(1);
//如果调入的警员携带装备,那么我应该怎么处理呢
stringBuilder.append("警员:"+req.getPoliceName()+",警号为:"+req.getPoliceCode()+",因调岗携带以下装备:");
if(ObjectUtil.isNotNull(reqEquipments)){
if(CollectionUtil.isNotEmpty(reqEquipments)){
for (PoliceEquipment equipment:reqEquipments) {
stringBuilder.append(equipment.getTypeName()+"【"+equipment.getSizeName()+"】,数量为:"+equipment.getNum()+"\n");
inventoryQuantity+=equipment.getNum();
actualQuantity+=equipment.getNum();
}
}
if (CollectionUtil.isNotEmpty(list1)){
for (PoliceEquipment pe:list1) {
pe.setOrgId(req.getOrgId());
}
policeEquipmentService.updateBatchById(list1);
}
//(调岗调入时在配置箱门的时候进行添加装备信息)
}else if (req.getReassignmentType().equals(itemValue1) && itemValue1.equals("reassign")){
}
//assign是调出
else if (req.getReassignmentType().equals(itemValue1) && itemValue1.equals("reassign")){
//将其组织机构号设为空
policeman.setOrgId(null);
policeman.setState(2);
//将账号与组织机构关联表进行删除
sysUserOrgService.remove(new LambdaQueryWrapper<SysUserOrg>().eq(SysUserOrg::getUserId,policeman.getUserId()));
......@@ -901,20 +917,16 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>()
.eq(CabinetBoxPolice::getPoliceId,policeman.getId()));
//查询出该警员的所有装备信息
LambdaQueryWrapper<PoliceEquipment> eq = new LambdaQueryWrapper<PoliceEquipment>()
.eq(PoliceEquipment::getPoliceId, policeman.getId());
//查询该警员是否存在装备信息,如果存在则进行删除
List<PoliceEquipment> list1 = policeEquipmentService.list(eq);
//判断前端传递的装备列表字段是否为空,如果为空则表示该警员不拿走任何装备信息
//判断前端传递的装备列表字段是否为空,如果为空则表示该警员不拿走任何装备信息(不做任何操作)
if (ObjectUtil.isNull(req.getDetailList()) || req.getDetailList().trim().isEmpty()){
if (list1.size()>0){
// policeEquipmentService.remove(eq);
policeEquipmentService.removeBatchByIds(list1);
}
// if (list1.size()>0){
//// policeEquipmentService.remove(eq);
// policeEquipmentService.removeBatchByIds(list1);
// }
} else {//将该警员拿走的装备的组织机构设置为空,并且其他装备进行跟警员进行解绑删除
List<PoliceEquipment> removeList=new ArrayList<>();
//更新装备(将装备信息进行删除)
List<PoliceEquipment> updateList=new ArrayList<>();
List<Object[]> searchItem=new ArrayList<>();
......@@ -945,26 +957,26 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
policeEquipmentService.updateBatchById(updateList);
policeEquipmentService.removeBatchByIds(removeList);
if (searchItem.size()>0)
{
//修改库存数量
List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchItem);
List<InventorySummary> updateSummaryList=new ArrayList<>();
for (InventorySummary is:inventorySummaryList) {
for ( Object[] one: searchItem) {
if (is.getLocationId().equals(one[1]) && is.getTypeId().equals(one[2])
&& is.getSizeId().equals(one[3]) && is.getUnitPrice().compareTo(new BigDecimal(one[4].toString()))==0){
is.setOutboundNumber(is.getOutboundNumber()-Integer.parseInt(one[5].toString()));
is.setNumber(is.getNumber()-Integer.parseInt(one[5].toString()));
updateSummaryList.add(is);
break;
}
}
}
if (updateSummaryList.size()>0){
inventorySummaryService.updateBatchById(updateSummaryList);
}
}
// if (searchItem.size()>0)
// {
// //修改库存数量
// List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchItem);
// List<InventorySummary> updateSummaryList=new ArrayList<>();
// for (InventorySummary is:inventorySummaryList) {
// for ( Object[] one: searchItem) {
// if (is.getLocationId().equals(one[1]) && is.getTypeId().equals(one[2])
// && is.getSizeId().equals(one[3]) && is.getUnitPrice().compareTo(new BigDecimal(one[4].toString()))==0){
// is.setOutboundNumber(is.getOutboundNumber()-Integer.parseInt(one[5].toString()));
// is.setNumber(is.getNumber()-Integer.parseInt(one[5].toString()));
// updateSummaryList.add(is);
// break;
// }
// }
// }
// if (updateSummaryList.size()>0){
// inventorySummaryService.updateBatchById(updateSummaryList);
// }
// }
}
//记录日志(如果警员携带装备,则进行记录 )
if (ObjectUtil.isNotNull(reqEquipments)){
......@@ -1104,6 +1116,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return reassignment.getId();
}
reassignment.setCreateTime(DateTimeUtil.getCurrentDateTime());
reassignment.setUpdateTime(DateTimeUtil.getCurrentDateTime());
//如果id是空默认是新建单据,name生成新的单据编号
if (ObjectUtil.isNull(req.getId()) || req.getId().isEmpty()){
OrderNum orderNum = stocktakeService.setOrderCode(req.getBussinessType(), req.getOrgId());
String codeValue=String.format("%04d",orderNum.getNum());
......@@ -1112,7 +1126,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
String.format("%02d",LocalDateTime.now().getDayOfMonth())+codeValue);
reassignmentService.save(reassignment);
}
//执行工作流
//执行工作流(如果点击提交接入审核流)
if (req.getExamineState().equals("working"))
{
StartProcessInstanceDTO startProcessInstanceDTO = setParams(req,reassignment);
......
......@@ -435,20 +435,30 @@ public class TjServiceImpl implements TjService {
List<String> orgList= inventorySummaryMapper.getTotalData(String.valueOf(req.getOrgId()));
List<TjOrgPriceDto> tjOrgPriceDtoList=new ArrayList<>();
//根据条件查询财务汇总表
//循环遍历下一级以及它下面的汇总信息
for (String orgId:orgList) {
TjOrgPriceDto OrgData=priceSumSummaryMapper.TjOrgPrice(orgId, req.getYear(),req.getTypeIdsList(),req.getSizeNameList() );
OrgData.setAddNum(ObjectUtil.isNull(OrgData.getAddNum())?0:OrgData.getAddNum());
OrgData.setEndNum(ObjectUtil.isNull(OrgData.getEndNum())?0:OrgData.getEndNum());
OrgData.setStartNum(ObjectUtil.isNull(OrgData.getStartNum())?0:OrgData.getStartNum());
OrgData.setDestoryNum(ObjectUtil.isNull(OrgData.getDestoryNum())?0:OrgData.getDestoryNum());
OrgData.setStartPrice(ObjectUtil.isNull(OrgData.getStartPrice())?BigDecimal.ZERO:OrgData.getStartPrice());
OrgData.setEndPrice(ObjectUtil.isNull(OrgData.getEndPrice())?BigDecimal.ZERO:OrgData.getEndPrice());
OrgData.setAddPrice(ObjectUtil.isNull(OrgData.getAddPrice())?BigDecimal.ZERO:OrgData.getAddPrice());
OrgData.setDestoryPrice(ObjectUtil.isNull(OrgData.getDestoryPrice())?BigDecimal.ZERO:OrgData.getDestoryPrice());
tjOrgPriceDtoList.add(OrgData);
}
if (req.getOrgId()!=1369509498032808905L){
TjOrgPriceDto OrgData=priceSumSummaryMapper.TjOrgPriceLeve4(req.getOrgId(), req.getYear(),req.getTypeIdsList(),req.getSizeNameList(),pubOrg.getLevelFlag());
TjOrgPriceDto OrgData=priceSumSummaryMapper.TjOrgPriceLeve4(req.getOrgId(), req.getYear(),req.getTypeIdsList(),
req.getSizeNameList(),pubOrg.getLevelFlag());
tjOrgPriceDtoList.add(OrgData);//把本级数据加进去
}
//查询出来的组织机构进行判断,如果该组织机构下的装备装备总数为0,那么将该组织机构从list中移除
// if (req.getRemoveEmpty()){
// tjOrgPriceDtoList.removeIf(tjOrgEqsDto -> tjOrgEqsDto.getStartNum() == 0 && tjOrgEqsDto.getEndNum() == 0
// && tjOrgEqsDto.getDestoryNum()==0);
// }
if (req.getRemoveEmpty()){
tjOrgPriceDtoList.removeIf(tjOrgEqsDto -> tjOrgEqsDto.getStartNum() == 0 && tjOrgEqsDto.getEndNum() == 0
&& tjOrgEqsDto.getDestoryNum()==0);
}
//对组织机构进行排序
Comparator<TjOrgPriceDto> orgComparator = createOrgComparator();
......@@ -468,15 +478,6 @@ public class TjServiceImpl implements TjService {
}
@Override
public FinalTjOrgPriceDto TjOrgPriceSum(TjOrgPriceReq req) {
// FinalTjOrgPriceDto finalTjOrgPriceDto= priceSumSummaryMapper.TjOrgPriceSum(req.getOrgId(), req.getYear(),
// req.getTypeIdsList(),req.getSizeNameList());
// if (ObjectUtil.isNotNull(finalTjOrgPriceDto)) {
//
// return finalTjOrgPriceDto;
// }else {
// return new FinalTjOrgPriceDto();
// }
PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
FinalTjOrgPriceDto finalTjOrgPriceDto = new FinalTjOrgPriceDto();
finalTjOrgPriceDto.setAddNum(0);
......@@ -499,6 +500,8 @@ public class TjServiceImpl implements TjService {
tjOrgPriceDtoList.add(OrgData);//把本级数据加进去
}
for (TjOrgPriceDto tj:tjOrgPriceDtoList) {
System.out.println("tj.getStartNum() = " + tj.getStartNum());
System.out.println("ObjectUtil.isNull(tj.getAddNum()) = " + ObjectUtil.isNull(tj.getAddNum()));
tj.setAddNum(ObjectUtil.isNull(tj.getAddNum())?0:tj.getAddNum());
tj.setStartNum(ObjectUtil.isNull(tj.getStartNum())?0:tj.getStartNum());
tj.setEndNum(ObjectUtil.isNull(tj.getEndNum())?0:tj.getEndNum());
......
......@@ -36,22 +36,22 @@ public class ClearLogAction implements JobAction {
@Override
public void action() {
//获取两月前的日期
// ConfigExpander.getClearLogOffsetValue()
Integer offset = 60;
//Date maxTime = DateUtil.offsetMonth(new Date(), offset);
Date maxTime = DateUtil.offsetDay(new Date(),offset);
//配置过滤条件
LogRequest request = new LogRequest();
request.setLogType(10);
request.setEndDate(DateUtil.formatDate(maxTime));
logManagerApi.clearLog(request);
LogRequest requestType30 = new LogRequest();
requestType30.setLogType(30);
requestType30.setEndDate(DateUtil.formatDate(maxTime));
logManagerApi.clearLog(requestType30);
log.warn(StrUtil.format("{} 清理日志完成",
DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)));
// //获取两月前的日期
//// ConfigExpander.getClearLogOffsetValue()
// Integer offset = 60;
// //Date maxTime = DateUtil.offsetMonth(new Date(), offset);
// Date maxTime = DateUtil.offsetDay(new Date(),offset);
// //配置过滤条件
// LogRequest request = new LogRequest();
// request.setLogType(10);
// request.setEndDate(DateUtil.formatDate(maxTime));
//
// logManagerApi.clearLog(request);
// LogRequest requestType30 = new LogRequest();
// requestType30.setLogType(30);
// requestType30.setEndDate(DateUtil.formatDate(maxTime));
// logManagerApi.clearLog(requestType30);
// log.warn(StrUtil.format("{} 清理日志完成",
// DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)));
}
}
......@@ -17,7 +17,7 @@ public class MonthEnd implements JobAction{
//月末执行以计算金额
@Override
public void action() {
inventorySummaryService.MonthEndSum();
// inventorySummaryService.MonthEndSum();
}
}
......@@ -17,7 +17,7 @@ public class MonthStart implements JobAction{
//月初执行
@Override
public void action() {
inventorySummaryService.MonthStartSum();
// inventorySummaryService.MonthStartSum();
}
}
......@@ -288,12 +288,27 @@
<select id="selectSumByItems" resultType="com.junmp.jyzb.entity.InventorySummary">
select id,valuekey,org_id_int as org_id,org_name,org_code,type_id,type_name,size_id,size_name,location_id,location_name,location_type,
number,unit_price,price,stock_number,outbound_number,destruction_price,destruction_number,expire_number,expire_price,
broken_price,broken_number,near_broken_price,near_broken_number,use_number,agent_broken_num,fix_count,use_count,create_time,update_time,threshold
broken_price,broken_number,near_broken_price,near_broken_number,use_number,agent_broken_num,fix_count,use_count,create_time,update_time,threshold,property
from base_inventory_summary where
<foreach collection="list" item="item" separator="or">
(
org_id_int = ${item[0]} AND location_id = '${item[1]}' AND type_id = ${item[2]} AND size_id = '${item[3]}'
AND unit_price = ${item[4]}
)
</foreach>
</select>
<select id="selectSum" resultType="com.junmp.jyzb.entity.InventorySummary">
select id,valuekey,org_id_int as org_id,org_name,org_code,type_id,type_name,size_id,size_name,location_id,location_name,location_type,
number,unit_price,price,stock_number,outbound_number,destruction_price,destruction_number,expire_number,expire_price,
broken_price,broken_number,near_broken_price,near_broken_number,use_number,agent_broken_num,fix_count,use_count,create_time,update_time,threshold,property
from base_inventory_summary where
<foreach collection="list" item="item" separator="or">
(
org_id_int = ${item[0]} AND location_id = '${item[1]}' AND type_id = ${item[2]} AND size_id = '${item[3]}'
AND unit_price = ${item[4]}
and property=${item[5]}
)
</foreach>
......
......@@ -188,7 +188,33 @@
) as t2
</select>
<select id="TjOrgPriceTotalNum" resultType="com.junmp.jyzb.api.bean.dto.TjDto.TjOrgPriceDto">
select sum(COALESCE(vpss.start_num,0)) as start_num,sum(COALESCE(vpss.start_price,0)) as start_price,
sum(COALESCE(vpss.end_num,0)) as end_num,sum(COALESCE(vpss.end_price,0)) as end_price,
sum(COALESCE(vpss.add_num,0)) as add_num,sum(COALESCE(vpss.destory_num,0)) as destory_num,
sum(COALESCE(vpss.add_price,0)) as add_price,sum(COALESCE(vpss.destory_price,0)) as destory_price,vpss.type_name,vpss.type_id
FROM vie_price_sum_summary vpss
left join pub_org po on vpss.org_id_int=po.org_id
where vpss.`year`= 2024 and `po`.`del_flag` = 1 and (po.org_id=#{orgId} or (`po`.org_parent_ids like CONCAT('%', #{orgId}, '%')
<if test="levelNum !=0">
AND SUBSTRING(`po`.`org_code`, 5, 2) = '00'
</if>
))
and (`po`.level_flag>(select level_flag FROM pub_org where org_id=#{orgId} )+#{levelNum} or
`po`.level_flag=(select level_flag FROM pub_org where org_id=#{orgId}))
<if test="typeIdsList!=null and typeIdsList.size() > 0">
and type_id in
<foreach collection="typeIdsList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="sizeNameList!=null and sizeNameList.size() > 0">
AND
<foreach collection="sizeNameList " item="item" open="(" separator="or" close=")">
size_name like CONCAT('%', #{item}, '%')
</foreach>
</if>
GROUP BY vpss.type_id,vpss.type_name
ORDER BY vpss.type_id
</select>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@ scanner:
easy-es:
enable: true
address: 192.168.2.76:9200
address: 192.168.3.188:9200
username:
password:
......@@ -38,7 +38,7 @@ spring:
redis:
#host: 192.168.3.188
host: 192.168.2.76
host: 192.168.3.188
port: 6379
database: 1
password:
......
......@@ -4,7 +4,7 @@
easy-es:
enable: true
address: 192.168.2.76:9200
address: 192.168.3.188:9200
username:
password:
server:
......@@ -14,14 +14,14 @@ server:
spring:
elasticsearch:
rest:
uris: http://192.168.2.76:9200
uris: http://192.168.3.188:9200
main:
#bea同名类进行注册时,准许覆盖注册
allow-bean-definition-overriding: true
application:
name: jyzb-app
rabbitmq:
host: 192.168.2.76
host: 192.168.3.121
port: 5672
username: root
password: 123456
......
......@@ -361,7 +361,6 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
quickSuggestionsMapper.updateBusForm(task.getProcessInstanceId());
break;
case "reassignment":
quickSuggestionsMapper.updateReassignment(task.getProcessInstanceId());
break;
}
......
......@@ -12,7 +12,7 @@ public class RabbitMQUtils {
static{
//重量级资源 类加载执行之执行一次
connectionFactory = new ConnectionFactory();
connectionFactory.setHost("192.168.2.76");
connectionFactory.setHost("192.168.3.121");
connectionFactory.setPort(5672);
connectionFactory.setVirtualHost("/");
connectionFactory.setUsername("root");
......
......@@ -8,7 +8,7 @@ import java.io.IOException;
import java.util.concurrent.TimeoutException;
@Component
public class RabbitMQUtils2 {
private static final String host = "192.168.2.76";
private static final String host = "192.168.3.121";
private static final int port = 5672;
private static final String username = "root";
private static final String password = "123456";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论