czh 2 лет назад
Родитель
Сommit
e3d5c13e89

+ 18 - 11
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java

@@ -115,12 +115,12 @@ public class KwcContractLogisticsService {
     }
 
     private void checkParam(LogisticsBaseInfoReqVo baseInfo, List<LogisticsGoodsInfoReqVo> goodsInfo) {
-        if(Objects.nonNull(baseInfo)) {
-            if(StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
+        if (Objects.nonNull(baseInfo)) {
+            if (StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
                 throw new SystemException("合同编号超长!");
             }
 
-            if(StringUtils.isNotBlank(baseInfo.getContractName()) && baseInfo.getContractName().length() > 20) {
+            if (StringUtils.isNotBlank(baseInfo.getContractName()) && baseInfo.getContractName().length() > 20) {
                 throw new SystemException("合同名称超长!");
             }
         }
@@ -131,11 +131,11 @@ public class KwcContractLogisticsService {
                     throw new SystemException("商品名称超长!");
                 }
 
-                if(Objects.nonNull(logisticsGoodsInfoReqVo.getLoss()) && !RegularUtils.matchNumberWithFix(logisticsGoodsInfoReqVo.getLoss().toString(), 5, 2)) {
+                if (Objects.nonNull(logisticsGoodsInfoReqVo.getLoss()) && !RegularUtils.matchNumberWithFix(logisticsGoodsInfoReqVo.getLoss().toString(), 5, 2)) {
                     throw new SystemException("合理损耗超长!");
                 }
 
-                if(Objects.nonNull(logisticsGoodsInfoReqVo.getDeficitPrice()) && !RegularUtils.matchNumberWithFix(logisticsGoodsInfoReqVo.getDeficitPrice().toString(), 5, 2)) {
+                if (Objects.nonNull(logisticsGoodsInfoReqVo.getDeficitPrice()) && !RegularUtils.matchNumberWithFix(logisticsGoodsInfoReqVo.getDeficitPrice().toString(), 5, 2)) {
                     throw new SystemException("扣亏货值超长!");
                 }
             }
@@ -379,13 +379,13 @@ public class KwcContractLogisticsService {
         String res = OkHttpUtils.doPostUploadFile("http://10.10.10.149:8840/v1/sign/getFlow", map);
     }
 
-    public static File getFileByHttpURL(String newUrl, String fileName){
+    public static File getFileByHttpURL(String newUrl, String fileName) {
         String[] suffix = newUrl.split("/");
         //得到最后一个分隔符后的名字
         File file = null;
         InputStream inputStream = null;
         OutputStream outputStream = null;
-        try{
+        try {
             file = File.createTempFile("", fileName);
             URL urlFile = new URL(newUrl);
             inputStream = urlFile.openStream();
@@ -393,12 +393,12 @@ public class KwcContractLogisticsService {
 
             int bytesRead = 0;
             byte[] buffer = new byte[8192];
-            while ((bytesRead=inputStream.read(buffer,0,8192))!=-1) {
+            while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
                 outputStream.write(buffer, 0, bytesRead);
             }
-        }catch (Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
-        }finally {
+        } finally {
             try {
                 if (null != outputStream) {
                     outputStream.close();
@@ -517,6 +517,9 @@ public class KwcContractLogisticsService {
     @Transactional(rollbackFor = {})
     public void complete(CompleteReqVo reqVo) {
         KwcContractLogistics kwcContractLogistic = kwcContractLogisticsMapper.selectById(reqVo.getId());
+        if (Objects.isNull(kwcContractLogistic)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.CONTRACT_NOT_EXISTS);
+        }
         if (!kwcContractLogistic.getStatus().equals(ContractStatusEnum.SIGNED.getCode())) {
             throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_028);
         }
@@ -573,6 +576,7 @@ public class KwcContractLogisticsService {
         if (CollectionUtils.isEmpty(queryListResDtos)) {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
+
         List<QueryListResVo> list = getQueryListResVos(queryListResDtos);
         return PageHelperUtil.getPageResult(new PageInfo<>(list), queryListResDtos, reqVo.getPageSize());
     }
@@ -684,7 +688,10 @@ public class KwcContractLogisticsService {
 
         QueryListReqDto queryListReqDto = new QueryListReqDto();
         BeanUtils.copyProperties(reqVo, queryListReqDto);
-        queryListReqDto.setEntId(LoginUserHolder.getEntId());
+        if (Objects.isNull(reqVo.getEntId())) {
+            queryListReqDto.setEntId(LoginUserHolder.getEntId());
+        }
+
         List<QueryListResDto> queryListResDtoList = kwcContractLogisticsMapper.queryList(queryListReqDto);
         if (CollectionUtils.isNotEmpty(queryListResDtoList)) {
             Map<Integer, List<QueryListResDto>> collect = queryListResDtoList.stream().collect(Collectors.groupingBy(QueryListResDto::getStatus));

+ 9 - 6
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java

@@ -92,6 +92,7 @@ public class KwcContractTradeService {
         if (CollectionUtils.isEmpty(queryListResDtos)) {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
+
         List<QueryListResVo> list = getQueryListResVos(queryListResDtos);
         return PageHelperUtil.getPageResult(new PageInfo<>(list), queryListResDtos, reqVo.getPageSize());
     }
@@ -172,23 +173,23 @@ public class KwcContractTradeService {
 
 
     private void checkParam(TradeBaseInfoReqVo baseInfo, List<TradeGoodsInfoReqVo> goodsInfo) {
-        if(Objects.nonNull(baseInfo)) {
-            if(StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
+        if (Objects.nonNull(baseInfo)) {
+            if (StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
                 throw new SystemException("合同编号超长!");
             }
 
-            if(StringUtils.isNotBlank(baseInfo.getContractName()) && baseInfo.getContractName().length() > 20) {
+            if (StringUtils.isNotBlank(baseInfo.getContractName()) && baseInfo.getContractName().length() > 20) {
                 throw new SystemException("合同名称超长!");
             }
         }
 
         if (CollectionUtils.isNotEmpty(goodsInfo)) {
             for (TradeGoodsInfoReqVo goodsInfoReqVo : goodsInfo) {
-                if(Objects.nonNull(goodsInfoReqVo.getPrice()) && !RegularUtils.matchNumberWithFix(goodsInfoReqVo.getPrice().toString(), 10, 2)) {
+                if (Objects.nonNull(goodsInfoReqVo.getPrice()) && !RegularUtils.matchNumberWithFix(goodsInfoReqVo.getPrice().toString(), 10, 2)) {
                     throw new SystemException("单价超长!");
                 }
 
-                if(Objects.nonNull(goodsInfoReqVo.getAmount()) && !RegularUtils.matchNumberWithFix(goodsInfoReqVo.getAmount().toString(), 10, 2)) {
+                if (Objects.nonNull(goodsInfoReqVo.getAmount()) && !RegularUtils.matchNumberWithFix(goodsInfoReqVo.getAmount().toString(), 10, 2)) {
                     throw new SystemException("采购数量超长!");
                 }
             }
@@ -621,7 +622,9 @@ public class KwcContractTradeService {
 
         QueryListReqDto queryListReqDto = new QueryListReqDto();
         BeanUtils.copyProperties(reqVo, queryListReqDto);
-        queryListReqDto.setEntId(LoginUserHolder.getEntId());
+        if (Objects.isNull(reqVo.getEntId())) {
+            queryListReqDto.setEntId(LoginUserHolder.getEntId());
+        }
         List<QueryListResDto> queryListResDtoList = kwcContractTradeMapper.queryList(queryListReqDto);
         if (CollectionUtils.isNotEmpty(queryListResDtoList)) {
             Map<Integer, List<QueryListResDto>> collect = queryListResDtoList.stream().collect(Collectors.groupingBy(QueryListResDto::getStatus));

+ 1 - 1
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractLogisticsMapper.xml

@@ -68,7 +68,7 @@
           left join kwc_contract_logistics_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
           left join kwc_contract_logistics_unit e on a.id = e.contract_id and e.unit_type != #{entType} and e.del_flag = 0
         where a.del_flag = 0
-          and case when a.status = 3 then a.ent_id = #{entId} else b.ent_id = #{entId} end
+          and case when a.status = 3 then a.ent_id = #{entId} and #{entType} = 3 else b.ent_id = #{entId} end
           <if test="startTime != null">
               and a.create_time >= #{startTime}
           </if>

+ 1 - 1
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml

@@ -66,7 +66,7 @@
           left join kwc_contract_trade_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
           left join kwc_contract_trade_unit e on a.id = e.contract_id and e.unit_type != #{entType} and e.del_flag = 0
          where a.del_flag = 0
-           and case when a.status = 3 then a.ent_id = #{entId} else b.ent_id = #{entId} end
+           and case when a.status = 3 then a.ent_id = #{entId} and #{entType} = 1 else b.ent_id = #{entId} end
         <if test="startTime != null">
             and a.create_time >= #{startTime}
         </if>

+ 1 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java

@@ -116,6 +116,7 @@ public class KwmCooperateApplyService {
 
 
         Long entId = LoginUserHolder.getEntId();
+        cooperateManageQueryReqDto.setCurrentEntId(entId);
         List<Long> currentEntIdList = new ArrayList<>();
         currentEntIdList.add(entId);
         Map<Long, List<EntCacheResDto>> longListMap = remoteSystemService.queryEntDeptCacheByIds(Collections.singletonList(entId));
@@ -126,7 +127,6 @@ public class KwmCooperateApplyService {
             }
         }
         cooperateManageQueryReqDto.setCurrentEntIdList(currentEntIdList);
-
         return cooperateManageQueryReqDto;
     }
 

+ 5 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -123,6 +123,7 @@ public class KwmCooperateManageService {
 
 
         Long entId = LoginUserHolder.getEntId();
+        cooperateManageQueryReqDto.setCurrentEntId(entId);
         List<Long> currentEntIdList = new ArrayList<>();
         currentEntIdList.add(entId);
         Map<Long, List<EntCacheResDto>> longListMap = remoteSystemService.queryEntDeptCacheByIds(Collections.singletonList(entId));
@@ -287,10 +288,10 @@ public class KwmCooperateManageService {
         Long id = reqVo.getId();
         Integer cooperateType = reqVo.getCooperateType();
         LambdaQueryWrapper<KwmCooperate> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(KwmCooperate::getInviterEntId, id).or().
-                eq(KwmCooperate::getInviteeEntId, id).and(
-                        wp -> wp.eq(KwmCooperate::getDelFlag, Global.NO).
-                                eq(KwmCooperate::getStatus, CooperateStatusEnum.OK.getCode())
+        wrapper.eq(KwmCooperate::getDelFlag, Global.NO).
+                eq(KwmCooperate::getStatus, CooperateStatusEnum.OK.getCode()).and(
+                        wq -> wq.eq(KwmCooperate::getInviterEntId, id).or().
+                                 eq(KwmCooperate::getInviteeEntId, id)
                 );
         List<KwmCooperate> kwmCooperates = kwmCooperateMapper.selectList(wrapper);
         if (CollectionUtils.isEmpty(kwmCooperates)) {