From 1a03c63abab3409bfe3831bf67025cb3140fc9ef Mon Sep 17 00:00:00 2001 From: nidapeng <jp@doumee.com> Date: 星期五, 29 三月 2024 18:08:43 +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/UnionChangeServiceImpl.java | 100 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 94 insertions(+), 6 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java index 8126ff7..d113bb0 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java @@ -13,10 +13,12 @@ import com.doumee.dao.business.*; import com.doumee.dao.business.dto.SaveUnionApplyDTO; import com.doumee.dao.business.dto.SaveUnionChangeDTO; +import com.doumee.dao.business.dto.SmsCheckDTO; import com.doumee.dao.business.dto.UnionChangeBXDDTO; import com.doumee.dao.business.join.*; import com.doumee.dao.business.model.*; import com.doumee.dao.business.vo.CountCyclePriceVO; +import com.doumee.service.business.SmsEmailService; import com.doumee.service.business.UnionChangeService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -28,6 +30,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -82,6 +85,13 @@ @Autowired private InsuranceApplyMapper insuranceApplyMapper; + @Value("${debug_model}") + private boolean debugModel; + @Autowired + private SmsEmailService smsEmailService; + @Autowired + private MultifileMapper multifileMapper; + @Override public Integer create(UnionChange unionChange) { unionChangeMapper.insert(unionChange); @@ -126,6 +136,31 @@ public UnionChange findById(Integer id) { return unionChangeMapper.selectById(id); } + + + @Override + public UnionChange getDetail(Integer id){ + UnionChange unionChange = unionChangeJoinMapper.selectJoinOne(UnionChange.class, + new MPJLambdaWrapper<UnionChange>() + .selectAll(UnionChange.class) + .selectAs(UnionApply::getCode,UnionChange::getApplyCode) + .selectAs(Solutions::getName,UnionChange::getSolutionsName) + .selectAs(UnionApply::getStartTime,UnionChange::getStartTime) + .selectAs(UnionApply::getEndTime,UnionChange::getEndTime) + .selectAs(Company::getName,UnionChange::getShopName) + .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 0 )",UnionChange::getAddNum) + .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 1 )",UnionChange::getDelNum) + .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 2 )",UnionChange::getChangeNum) + .leftJoin(UnionApply.class,UnionApply::getId,UnionChange::getUnionApplyId) + .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId) + .leftJoin(Company.class,Company::getId,UnionChange::getShopId) + .eq(UnionChange::getId,id) + .last(" limit 1 ") + ); + return unionChange; + } + + @Override public UnionChange findOne(UnionChange unionChange) { @@ -389,17 +424,24 @@ /** * 鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶锛� - 鎶曚繚鐢宠绛剧讲 - * @param id + * @param smsCheckDTO * @return */ @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) - public String getSignLink(Integer id) { - if(id == null ){ + public String getSignLink(SmsCheckDTO smsCheckDTO) { + if(Objects.isNull(smsCheckDTO) + || Objects.isNull(smsCheckDTO.getBusinessId()) + || StringUtils.isBlank(smsCheckDTO.getCode()) + ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } + //楠岃瘉 楠岃瘉鐮� + if(!debugModel){ + smsEmailService.validateCode(smsCheckDTO.getCode()); + } LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); - UnionChange unionChange = this.unionChangeDetail(id); + UnionChange unionChange = this.unionChangeDetail(smsCheckDTO.getBusinessId()); if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } @@ -454,8 +496,8 @@ if(Objects.isNull(unionChangeBXDDTO) || Objects.isNull(unionChangeBXDDTO.getId()) || Objects.isNull(unionChangeBXDDTO.getApplyDate()) - || StringUtils.isBlank(unionChangeBXDDTO.getFileName()) - || StringUtils.isBlank(unionChangeBXDDTO.getFileUrl()) + || StringUtils.isBlank(unionChangeBXDDTO.getName()) + || StringUtils.isBlank(unionChangeBXDDTO.getFileurl()) || StringUtils.isBlank(unionChangeBXDDTO.getCode()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); @@ -485,14 +527,60 @@ .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode) .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) .eq(ApplyChange::getUnionChangeId,unionChange.getId())); + + //瀛樺偍鍚堝苟鍗曚繚闄╁崟 + Multifile multifile = new Multifile(); + multifile.setIsdeleted(Constants.ZERO); + multifile.setCreator(user.getId()); + multifile.setCreateDate(new Date()); + multifile.setObjId(unionChangeBXDDTO.getId()); + multifile.setCreateDate(new Date()); + multifile.setObjType(Constants.MultiFile.WTB_CA_DONE_PDF.getKey()); + multifile.setType(Constants.TWO); + multifile.setFileurl(unionChangeBXDDTO.getFileurl()); + multifile.setName(unionChangeBXDDTO.getName()); + multifileMapper.insert(multifile); + + if(CollectionUtils.isNotEmpty(unionChangeBXDDTO.getApplyChangeBXDList())){ + //鏌ヨ鏄惁涓嶅瓨鍦ㄥ綋鍓嶅悎骞跺崟鐨勬暟鎹� + if(applyChangeJoinMapper.selectCount(new QueryWrapper<ApplyChange>() + .lambda().ne(ApplyChange::getUnionChangeId,unionChangeBXDDTO.getId()) + .in(ApplyChange::getId, + unionChangeBXDDTO.getApplyChangeBXDList().stream().map(m->m.getObjId()).collect(Collectors.toList()) + ) + )>Constants.ZERO){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鎵瑰崟鏄庣粏璁板綍瀛樺湪闈炴湰鍚堝苟鍗曟暟鎹�"); + }; + for (Multifile m:unionChangeBXDDTO.getApplyChangeBXDList()) { + if(Objects.isNull(m.getObjId()) + ||StringUtils.isBlank(m.getFileurl()) + ||StringUtils.isBlank(m.getName()) + ){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍔犲噺淇�/鎹㈠巶涓氬姟鎵瑰崟鏂囦欢淇℃伅缂哄け"); + } + multifile.setIsdeleted(Constants.ZERO); + multifile.setCreator(user.getId()); + multifile.setCreateDate(new Date()); + multifile.setCreateDate(new Date()); + multifile.setObjType(Constants.MultiFile.CA_PD_PDF.getKey()); + multifile.setType(Constants.TWO); + multifileMapper.insert(multifile); + } + } + + if(CollectionUtils.isNotEmpty(applyChangeList)){ for (ApplyChange applyChange:applyChangeList) { applyChange.setApplyStartTime(unionChangeBXDDTO.getApplyDate()); applyChange.setValidTime(unionChangeBXDDTO.getApplyDate()); applyChange.setEditDate(new Date()); applyChange.setEditor(user.getId()); + applyChange.setStatus(Constants.ApplyChangeStatus.APPROVE.getKey()); List<ApplyChagneDetail> allList = applyChagneDetailJoinMapper.selectList(new QueryWrapper<ApplyChagneDetail>().lambda().eq(ApplyChagneDetail::getApplyChangeId,applyChange.getId())); this.dealApplyChangeDetail(applyChange,allList); + applyChange.setCode(unionChangeBXDDTO.getCode()); + applyChange.setCheckUserId(user.getId()); + applyChangeJoinMapper.updateById(applyChange); } } unionChangeMapper.update(null,new UpdateWrapper<UnionChange>().lambda() -- Gitblit v1.9.3