From 142bcc9b22f48a8a2098a66b2964fe10c97c6fe8 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期二, 20 五月 2025 11:19:49 +0800 Subject: [PATCH] git ch --- server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java | 125 ++++++++++++++++++++++++++--------------- 1 files changed, 78 insertions(+), 47 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java index f55fd08..268b6b1 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java @@ -1790,11 +1790,23 @@ @Override - public List<CompensationVO> getCompensation(Integer id){ - SettleClaims settleClaims = settleClaimsMapper.selectById(id); + public List<CompensationVO> getCompensation(CompensationFeeDTO compensationFeeDTO){ + if(Objects.isNull(compensationFeeDTO) + || Objects.isNull(compensationFeeDTO.getType()) + ){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + SettleClaims settleClaims = null; + if(Objects.nonNull(compensationFeeDTO.getId())){ + settleClaims = settleClaimsMapper.selectById(compensationFeeDTO.getId()); + } List<CompensationVO> modelList = new ArrayList<>(); - if (Objects.nonNull(settleClaims)&&StringUtils.isNotBlank(settleClaims.getAccountContent())) { - modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class); + if (Objects.nonNull(settleClaims)) { + if(Constants.equalsInteger(compensationFeeDTO.getType(),Constants.ONE)&&StringUtils.isNotBlank(settleClaims.getAccountContent())){ + modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class); + }else if(Constants.equalsInteger(compensationFeeDTO.getType(),Constants.TWO)&&StringUtils.isNotBlank(settleClaims.getHpAccountContent())){ + modelList = JSONArray.parseArray(settleClaims.getHpAccountContent(),CompensationVO.class); + } } Constants.compensation [] compensations = Constants.compensation.values(); List<CompensationVO> list = new ArrayList<>(); @@ -1837,7 +1849,7 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~"); } - List<CompensationVO> modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class); + List<CompensationVO> modelList = JSONArray.parseArray(dto.getCompensationJson(),CompensationVO.class); SettleClaims update = new SettleClaims(); update.setEditDate(new Date()); @@ -1925,18 +1937,14 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~"); } - List<CompensationVO> modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class); + + List<CompensationVO> modelList = JSONArray.parseArray(dto.getCompensationJson(),CompensationVO.class); SettleClaims update = new SettleClaims(); update.setEditDate(new Date()); update.setEditor(loginUserInfo.getId()); - update.setYlClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.YL_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); - update.setWgClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.WG_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); - update.setScClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SC_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); - update.setSwClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SW_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); - update.setClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); - update.setOtherAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); - update.setAccountContent(dto.getCompensationJson()); + update.setHpAccountContent(dto.getCompensationJson()); + update.setHpAccount(modelList.stream().map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); update.setId(settleClaims.getId()); update.setStatus(Constants.SettleClaimsStatus.COMPENSATION.getKey()); settleClaimsMapper.updateById(update); @@ -1985,7 +1993,7 @@ update.setSwClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SW_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); update.setClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); //澶勭悊鍘嗗彶鏁版嵁 - List<CompensationVO> oldList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class); + List<CompensationVO> oldList = JSONArray.parseArray(settleClaims.getHpAccountContent(),CompensationVO.class); for (CompensationVO compensationVO:oldList) { if(compensationVO.getName().equals(Constants.compensation.YL_COMPENSATION.getName())){ compensationVO.setFee(update.getYlClaimAccount()); @@ -1999,7 +2007,6 @@ continue; } } - update.setAccountContent(dto.getCompensationJson()); update.setAccountContent(JSONArray.toJSONString(oldList)); update.setId(settleClaims.getId()); settleClaimsMapper.updateById(update); @@ -2039,38 +2046,62 @@ } -// @Override -// @Transactional(rollbackFor = {BusinessException.class,Exception.class}) -// public void payCash(PayCashDTO dto){ -// if(Objects.isNull(dto) -// || Objects.isNull(dto.getId()) -// || StringUtils.isBlank(dto.getDescribe()) -// ){ -// throw new BusinessException(ResponseStatus.BAD_REQUEST); -// } -// LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); -// if(!loginUserInfo.getType().equals(Constants.ZERO)){ -// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�"); -// } -// SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId()); -// if(Objects.isNull(settleClaims)){ -// throw new BusinessException(ResponseStatus.DATA_EMPTY); -// } -// if(!Constants.equalsInteger(Constants.SettleClaimsStatus.COMPENSATION.getKey(),settleClaims.getStatus())){ -// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~"); -// } -// SettleClaims update = new SettleClaims(); -// update.setEditDate(new Date()); -// update.setEditor(loginUserInfo.getId()); -// update.setStatus(Constants.SettleClaimsStatus.WAIT_DEAL.getKey()); -// update.setId(settleClaims.getId()); -// settleClaimsMapper.updateById(update); -// -// //瀛樺偍鏃ュ織 -// this.saveSettleClaimsLog(settleClaims, -// Constants.SettleClaimsLogType.CONFIRM_FEE, -// Constants.SettleClaimsLogType.CONFIRM_FEE.getInfo()); -// } + @Override + @Transactional(rollbackFor = {BusinessException.class,Exception.class}) + public void payCash(PayCashDTO dto){ + if(Objects.isNull(dto) + || Objects.isNull(dto.getId()) + || StringUtils.isBlank(dto.getDescribe()) + ){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + if(!loginUserInfo.getType().equals(Constants.ZERO)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�"); + } + SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId()); + if(Objects.isNull(settleClaims)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(!Constants.equalsInteger(Constants.SettleClaimsStatus.CONFIRM_FEE.getKey(),settleClaims.getStatus())){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~"); + } + SettleClaims update = new SettleClaims(); + update.setEditDate(new Date()); + update.setEditor(loginUserInfo.getId()); + update.setStatus(Constants.SettleClaimsStatus.CLOSE_CASE.getKey()); + update.setId(settleClaims.getId()); + settleClaimsMapper.updateById(update); + + if(CollectionUtils.isNotEmpty(dto.getMultifileList())){ + List<Multifile> fileList = dto.getMultifileList(); + if(CollectionUtils.isNotEmpty(fileList)){ + for (int i = 0; i < fileList.size(); i++) { + Multifile multifile = fileList.get(i); + if(Objects.isNull(multifile.getFileurl()) + || Objects.isNull(multifile.getType()) + || StringUtils.isBlank(multifile.getName()) + ){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父"); + } + multifile.setCreator(loginUserInfo.getId()); + multifile.setCreateDate(new Date()); + multifile.setIsdeleted(Constants.ZERO); + multifile.setObjId(settleClaims.getId()); + //娣诲姞鏉愭枡鏀惧叆 鍏朵粬鏉愭枡涓氬姟鍐� + multifile.setObjType(Constants.MultiFile.LP_PAY_FILE.getKey()); + multifile.setSortnum(i+1); + multifileJoinMapper.insert(multifile); + } + } + } + + + //瀛樺偍鏃ュ織 + this.saveSettleClaimsLog(settleClaims, + Constants.SettleClaimsLogType.PLATFORM_FINISH, + dto.getDescribe()); + } -- Gitblit v1.9.3