From c9f07c1f79e7ea9eb00925975d3ae2c9e8dcbd25 Mon Sep 17 00:00:00 2001 From: nidapeng <jp@doumee.com> Date: 星期三, 20 三月 2024 11:37:34 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/1.0.1' into 1.0.1 --- server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 48 insertions(+), 6 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java index c32d163..1398edb 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java @@ -122,6 +122,19 @@ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } + + InsuranceApply insuranceApply = insuranceApplyMapper.selectById(model.getApplyId()); + if(Objects.isNull(insuranceApply)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(insuranceApply.getIsdeleted().equals(Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鏁版嵁宸插垹闄�,鏃犳硶杩涜璇ユ搷浣�"); + } + Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); + if(Objects.isNull(solutions)){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏂规淇℃伅"); + } + if( // Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey()) // ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey()) @@ -140,6 +153,17 @@ update.setCheckUserId(user.getId()); update.setId(model.getId()); applyChangeMapper.updateById(update); + + //瀛樺偍寰呭姙淇℃伅 + Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE; + if(model.getType().equals(Constants.ONE)){ + noticeObjectType = Constants.NoticeObjectType.CHANGE_FACTORY; + } + //鍒犻櫎鍏朵粬寰呭姙 + noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); + Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(), + insuranceApply.getCompanyId(), Constants.NoticeType.FOUR); + noticesMapper.insert(notices); Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_CHECK_PASS_NO; String info =applyLogType.getInfo(); @@ -591,8 +615,8 @@ applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda() .setSql(" fee = ifnull(fee,0)+" + updateFee) .setSql(" current_fee = " + updateCurrentFee) - .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3)) - .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 2)) + .set(insuranceApply.getStartTime().compareTo(update.getApplyStartTime())!=0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3)) + .set(insuranceApply.getStartTime().compareTo(update.getApplyStartTime())==0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 2)) .set(ApplyDetail::getEditor, update.getEditor()) .set(ApplyDetail::getEditDate, update.getEditDate()) .eq(ApplyDetail::getId, oldModel.getId()) @@ -603,8 +627,8 @@ //淇敼 鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁 memberInsuranceJoinMapper.update(null, new UpdateWrapper<MemberInsurance>().lambda() .setSql(" fee = ifnull(fee,0)+" + updateFee) - .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 3)) - .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 2)) + .set(insuranceApply.getStartTime().compareTo(update.getApplyStartTime())!=0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 3)) + .set(insuranceApply.getStartTime().compareTo(update.getApplyStartTime())==0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 2)) .set(MemberInsurance::getStartTime, update.getApplyStartTime()) .eq(MemberInsurance::getRelationId, oldModel.getId()) ); @@ -723,7 +747,7 @@ //鍒犻櫎鍏朵粬寰呭姙 noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(), - model.getCompanyId(), noticeType); + insuranceApply.getCompanyId(), noticeType); noticesMapper.insert(notices); ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update)); @@ -1361,6 +1385,8 @@ @Override public PageData<ApplyChange> findPage(PageWrap<ApplyChange> pageWrap) { + + LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); IPage<ApplyChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>(); Utils.MP.blankToNull(pageWrap.getModel()); @@ -1368,6 +1394,7 @@ queryWrapper .selectAll(ApplyChange.class) .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode) + .selectAs( Solutions::getType,InsuranceApply::getSolutionType) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2 )",ApplyChange::getChangeNum) @@ -1379,10 +1406,22 @@ .in(!Objects.isNull(model.getStatus())&&model.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()),ApplyChange::getStatus, Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey(), Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey()) + .eq(!Objects.isNull(model.getSolutionType()),Solutions::getType,model.getSolutionType()) .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId()) .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId()) .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" ) .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" ); + if(loginUserInfo.getType().equals(Constants.TWO)){ + //濡傛灉鏄晢鎴锋煡鐪� + if(pageWrap.getModel().getSolutionType()!=null && pageWrap.getModel().getSolutionType() ==0){ + queryWrapper.exists("select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t1.company_id and cs.shop_id="+loginUserInfo.getCompanyId()); + }else if(pageWrap.getModel().getSolutionType()!=null && pageWrap.getModel().getSolutionType() ==1){ + queryWrapper.eq(Solutions::getShopId,loginUserInfo.getCompanyId()); + }else{ + queryWrapper.apply("((t1.type=0 and exists(select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t1.company_id and cs.shop_id="+loginUserInfo.getCompanyId()+")) or (" + + "t2.type=1 and t2.shop_id="+loginUserInfo.getCompanyId()+"))") ; + } + } for(PageWrap.SortData sortData: pageWrap.getSorts()) { if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { @@ -1413,6 +1452,7 @@ .selectAll(ApplyChange.class) .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode) .selectAs(Solutions::getName,ApplyChange::getSolutionsName) + .selectAs(Solutions::getType,ApplyChange::getSolutionType) .selectAs(Company::getName,ApplyChange::getCompanyName) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum) @@ -1428,6 +1468,7 @@ Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey()) // .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId()) // .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId()) + .eq(!Objects.isNull(model.getType()),Solutions::getType,model.getSolutionType()) .eq(!Objects.isNull(model.getApplyId()),ApplyChange::getApplyId,model.getApplyId()) .eq(!Objects.isNull(model.getBaseSolutionsId()),Solutions::getBaseId,model.getBaseSolutionsId()) .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" ) @@ -1584,6 +1625,7 @@ .selectAs(InsuranceApply::getStartTime,ApplyChange::getStartTime) .selectAs(InsuranceApply::getEndTime,ApplyChange::getEndTime) .selectAs(Solutions::getName,ApplyChange::getSolutionsName) + .selectAs(Solutions::getType,ApplyChange::getSolutionType) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2 )",ApplyChange::getChangeNum) @@ -1609,7 +1651,7 @@ applyChange.setApplyLogList(applyLogList); List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() - .eq(Multifile::getObjId,applyChange.getId()) + .eq(Multifile::getObjId,Constants.equalsInteger(applyChange.getSolutionType(),Constants.ZERO)? applyChange.getId():applyChange.getUnionChangeId()) .in(Multifile::getObjType, Arrays.asList(new Integer[]{Constants.MultiFile.CA_APPLY_JIAJIAN_SIGN.getKey() ,Constants.MultiFile.CA_PD_PDF.getKey() ,Constants.MultiFile.CA_APPLY_CHANGEUNIT_SIGN.getKey()})) -- Gitblit v1.9.3