|
@@ -1,5 +1,7 @@
|
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alipay.sofa.runtime.api.annotation.SofaReference;
|
|
|
import com.alipay.sofa.runtime.api.annotation.SofaService;
|
|
|
import com.aliyun.oss.OSSClient;
|
|
@@ -27,6 +29,7 @@ import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.WarehouseBaseInfoMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.util.Const;
|
|
|
import lombok.Getter;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.httpclient.util.DateUtil;
|
|
@@ -39,6 +42,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.mock.web.MockMultipartFile;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -112,7 +116,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
private String bucket;
|
|
|
@Autowired
|
|
|
private OSSClient ossClient;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private CacheComponent cacheComponent;
|
|
|
|
|
|
/**
|
|
|
* 全部仓库
|
|
@@ -483,6 +488,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
}
|
|
|
boolean one = this.insert(warehouseBaseInfo);
|
|
|
boolean two = warehousePositionInfoService.insertBatch(warehousePositionInfoList);
|
|
|
+ cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE);
|
|
|
// 假如 都成功返回ok
|
|
|
if (one && two) {
|
|
|
return "OK";
|
|
@@ -539,6 +545,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
throw new YException(YExceptionEnum.WAREHOUSE_NAME_ERROR);
|
|
|
}
|
|
|
this.insert(warehouseBaseInfo);
|
|
|
+ cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE);
|
|
|
return warehouseBaseInfo.getId();
|
|
|
}
|
|
|
|
|
@@ -548,7 +555,29 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String editWarehouse(WarehouseBaseInfo warehouseBaseInfo) {
|
|
|
+ String personPhone = warehouseBaseInfo.getPersonPhone();
|
|
|
+ String otherPhone = warehouseBaseInfo.getOtherPersonPhone();
|
|
|
this.updateById(warehouseBaseInfo);
|
|
|
+ if(personPhone != null){
|
|
|
+ if(!personPhone.equals(warehouseBaseInfo.getPersonPhone())){
|
|
|
+ cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(warehouseBaseInfo.getPersonPhone()!=null){
|
|
|
+ cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(otherPhone != null){
|
|
|
+ if(!otherPhone.equals(warehouseBaseInfo.getOtherPersonPhone())){
|
|
|
+ cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(warehouseBaseInfo.getOtherPersonPhone()!=null){
|
|
|
+ cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (warehouseBaseInfo.getWarehouseType().equals("1")) {
|
|
|
List<WarehousePositionInfo> warehousePositionInfoList = warehouseBaseInfo.getWarehousePositionInfoList();
|
|
|
if (!CollectionUtils.isEmpty(warehousePositionInfoList)) {
|
|
@@ -803,6 +832,10 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
compId = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId();
|
|
|
}
|
|
|
List<ContractManagementInfo> temp = new ArrayList();
|
|
|
+ List<ContractManagementInfo> listRedis = cacheComponent.getObjList(Const.ADMIN_CONTRACTINFO+compId+flag,ContractManagementInfo.class);
|
|
|
+ if(listRedis != null && listRedis.size() > 0 ){
|
|
|
+ return listRedis;
|
|
|
+ }
|
|
|
//查所有合同编号
|
|
|
if (flag == null) {
|
|
|
List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
|
|
@@ -818,10 +851,13 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo.setGoodsNameKey(contractGoodsInfo.getGoodsNameKey());
|
|
|
temp.add(contractManagementInfo);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查采购合同编号
|
|
|
if (flag == 0) {
|
|
|
+
|
|
|
List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
|
|
|
.eq("comp_id", compId)
|
|
|
.eq("contract_type", "2")
|
|
@@ -835,10 +871,12 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo.setGoodsNameKey(contractGoodsInfo.getGoodsNameKey());
|
|
|
temp.add(contractManagementInfo);
|
|
|
}
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查销售合同编号
|
|
|
else if (flag == 1) {
|
|
|
+
|
|
|
List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
|
|
|
.eq("comp_id", compId)
|
|
|
.eq("contract_type", "1")
|
|
@@ -853,10 +891,12 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo.setGoodsNameKey(contractGoodsInfo.getGoodsNameKey());
|
|
|
temp.add(contractManagementInfo);
|
|
|
}
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查采购订单审核合同编号
|
|
|
else if (flag == 3) {
|
|
|
+
|
|
|
List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
|
|
|
.eq("comp_id", compId)
|
|
|
.eq("contract_type", "2")
|
|
@@ -879,6 +919,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
}
|
|
|
temp.addAll(contractManagementInfoList);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查销售订单审核合同编号
|
|
@@ -905,6 +947,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
}
|
|
|
temp.addAll(contractManagementInfoList);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查销售合同编号,以及移库任务编号
|
|
@@ -981,6 +1025,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo.setInOutType("移库出库");
|
|
|
temp.add(contractManagementInfo);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查采购合同编号(不包含自运),以及移库任务编号
|
|
@@ -1079,6 +1125,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo.setInOutType("移库入库");
|
|
|
temp.add(contractManagementInfo);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查采购合同编号(不包含自运),以及移库任务编号,销售合同
|
|
@@ -1398,6 +1446,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo1.setInOutType("移库入库");
|
|
|
temp.add(contractManagementInfo1);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//采购合同不包含自运
|
|
@@ -1416,6 +1466,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo.setGoodsNameKey(contractGoodsInfo.getGoodsNameKey());
|
|
|
temp.add(contractManagementInfo);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
//查采购、销售合同编号,以及移库任务编号
|
|
@@ -1445,6 +1497,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
contractManagementInfo.setInOutType("移库入库");
|
|
|
temp.add(contractManagementInfo);
|
|
|
}
|
|
|
+
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
|
|
|
return temp;
|
|
|
}
|
|
|
}
|
|
@@ -1464,6 +1518,10 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
if (personCharge == null || personCharge.isEmpty()) {
|
|
|
personCharge = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffMobilePhone();
|
|
|
}
|
|
|
+ List<WarehouseBaseInfo> listRedis = cacheComponent.getObjList(Const.SELF_WAREHOUSE+personCharge,WarehouseBaseInfo.class);
|
|
|
+ if(listRedis != null && listRedis.size() > 0 ){
|
|
|
+ return listRedis;
|
|
|
+ }
|
|
|
Wrapper<WarehouseBaseInfo> warehouseBaseInfoWrapper = new EntityWrapper<>();
|
|
|
warehouseBaseInfoWrapper.eq("comp_id", compId).eq("delete_flag", "0");
|
|
|
warehouseBaseInfoWrapper.andNew().eq("person_phone", personCharge).or()
|
|
@@ -1573,6 +1631,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ cacheComponent.putRaw(Const.SELF_WAREHOUSE+personCharge,JSONObject.toJSONString(warehouseBaseInfoList),60*60*24);
|
|
|
return warehouseBaseInfoList;
|
|
|
}
|
|
|
|
|
@@ -1591,6 +1650,10 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
if (personCharge == null || personCharge.isEmpty()) {
|
|
|
personCharge = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffMobilePhone();
|
|
|
}
|
|
|
+ List<WarehouseBaseInfo> listRedis = cacheComponent.getObjList(Const.SELF_WAREHOUSE+personCharge,WarehouseBaseInfo.class);
|
|
|
+ if(listRedis != null && listRedis.size() > 0 ){
|
|
|
+ return listRedis;
|
|
|
+ }
|
|
|
Wrapper<WarehouseBaseInfo> warehouseBaseInfoWrapper = new EntityWrapper<>();
|
|
|
warehouseBaseInfoWrapper.eq("comp_id", compId).eq("warehouse_type", "1")
|
|
|
.orderBy("warehouse_type", true).eq("delete_flag", "0");
|
|
@@ -1715,6 +1778,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ cacheComponent.putRaw(Const.SELF_WAREHOUSE+personCharge,JSONObject.toJSONString(warehouseBaseInfoList),60*60*24);
|
|
|
return warehouseBaseInfoList;
|
|
|
}
|
|
|
|