From 7673755cb8f1b4160ad2a6ffd79ea3fc7e25e7eb Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期四, 30 五月 2024 18:28:58 +0800 Subject: [PATCH] 代码初始化 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java | 190 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 157 insertions(+), 33 deletions(-) diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java index ad7ed25..43286ff 100644 --- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java +++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java @@ -1,16 +1,20 @@ package com.doumee.service.business.impl; +import com.alibaba.fastjson.JSONObject; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; +import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.Utils; import com.doumee.dao.business.*; import com.doumee.dao.business.dao.CompanyMapper; import com.doumee.dao.business.dto.ApproveDTO; import com.doumee.dao.business.join.ApproveJoinMapper; +import com.doumee.dao.business.join.CarUseBookJoinMapper; +import com.doumee.dao.business.join.VisitsJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.business.vo.ApproveDataVO; import com.doumee.dao.system.join.NoticesJoinMapper; @@ -74,7 +78,14 @@ private VisitsMapper visitsMapper; @Autowired + private VisitsJoinMapper visitsJoinMapper; + + @Autowired + private CarUseBookJoinMapper carUseBookJoinMapper; + @Autowired private NoticesJoinMapper noticesJoinMapper; + + @Override public Integer create(Approve approve) { @@ -301,11 +312,33 @@ for (int i = 0; i < approveParamList.size(); i++) { ApproveParam approveParam = approveParamList.get(i); List<Integer> ids = this.getApproveUserIds(approveParam,createMember); - //鐢熸垚寰呭姙 notices 琛ㄦ暟鎹� - if(i==0){ - - } - for (Integer memberId:ids) { + Integer noticeType = Constants.approveTypeToNoticeType(approveTempl.getType()); + String title = "銆愯瀹㈢敵璇枫�戠敵璇蜂汉 - "; + Map<String,Object> jsonMap = new HashMap<>(); + for (int j = 0; j < ids.size(); j++) { + Integer memberId = ids.get(j); + //鐢熸垚寰呭姙 notices 琛ㄦ暟鎹� + if(i==0){ + if(jsonMap.isEmpty()){ + title = this.createNoticesData(noticeType,businessId,title,jsonMap); + } + Notices notices = new Notices(); + notices.setCreateDate(new Date()); + notices.setIsdeleted(Constants.ZERO); + notices.setObjId(businessId); + notices.setObjType(noticeType); + notices.setType(noticeType); + notices.setTitle(title); + notices.setParam1(JSONObject.toJSONString(jsonMap)); + notices.setUserId(memberId); + notices.setPalt(Constants.ZERO); + notices.setStatus(Constants.ZERO); + notices.setReaded(Constants.ZERO); + notices.setSendacopy(Constants.ZERO); + notices.setParam2("0"); + notices.setInfo("寰呭鐞�"); + noticesJoinMapper.insert(notices); + } Approve approve = new Approve(); approve.setRemark(approveParam.getRemark()); approve.setCreateDate(new Date()); @@ -327,29 +360,59 @@ } } - public void createNoticesData(List<Approve> approveList){ - for (Approve approve:approveList) { - Notices notices = new Notices(); - notices.setCreateDate(new Date()); - notices.setIsdeleted(Constants.ZERO); - notices.setObjId(approve.getObjId()); - notices.setObjId(approve.getApproveType()); - if(Constants.equalsInteger(approve.getType(),Constants.approveObjectType.unConstructionVisit) - || Constants.equalsInteger(approve.getType(),Constants.approveObjectType.constructionVisit)){ - notices.setType(Constants.ZERO); - }else if(Constants.equalsInteger(approve.getType(),Constants.approveObjectType.visitReporting)){ - notices.setType(Constants.ONE); + + + public String createNoticesData(Integer noticeType,Integer businessId,String title,Map<String,Object> jsonMap){ + jsonMap.clear(); + if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit) + || Constants.equalsInteger(noticeType,Constants.noticesObjectType.visitReporting)){ + //璁垮璁板綍涓庤瀹㈡姤澶� + Visits visits = visitsJoinMapper.selectJoinOne(Visits.class, + new MPJLambdaWrapper<Visits>().selectAll(Visits.class) + .selectAs(Member::getName,Visits::getReceptMemberName) + .selectAs(Company::getName,Visits::getReceptMemberDepartment) + .leftJoin(Member.class,Member::getId,Visits::getReceptMemberId) + .leftJoin(Company.class,Company::getId,Member::getCompanyId) + .eq(Visits::getId,businessId) + .last(" limit 1 ") + ); + if(Objects.isNull(visits)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌涓氬姟鏁版嵁淇℃伅"); } - - - + if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit)){ + title = title + visits.getName(); + }else{ + title = "銆愯瀹㈡姤澶囥�戠敵璇蜂汉 - " + visits.getName(); + } + jsonMap.put("name", "璁块棶浜�:" + visits.getCompanyName() + " - " + visits.getReceptMemberName()); + jsonMap.put("sTime", "鍏ュ洯鏃堕棿:" + DateUtil.DateToStr(visits.getStarttime() , "yyyy-MM-dd HH:mm")); + jsonMap.put("eTime", "绂诲洯鏃堕棿:" + DateUtil.DateToStr(visits.getEndtime() , "yyyy-MM-dd HH:mm")); + jsonMap.put("reason", StringUtils.isBlank(visits.getReason())?"鏉ヨ浜嬬敱: - ": "鏉ヨ浜嬬敱:" +visits.getReason()); + jsonMap.put("carNos", StringUtils.isBlank(visits.getCarNos())?"闅忚杞﹁締: - ": "闅忚杞﹁締:" +visits.getCarNos()); + }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.useCar)){ + //鐢ㄨ溅鐢宠 + CarUseBook carUseBook = carUseBookJoinMapper.selectJoinOne(CarUseBook.class, + new MPJLambdaWrapper<CarUseBook>().selectAll(CarUseBook.class) + .selectAs(Member::getName,CarUseBook::getMemberName) + .selectAs(Company::getName,CarUseBook::getCompanyName) + .leftJoin(Member.class,Member::getId,CarUseBook::getMemberId) + .leftJoin(Company.class,Company::getId,Member::getCompanyId) + .eq(CarUseBook::getId,businessId) + .last(" limit 1 ") + ); + if(Objects.isNull(carUseBook)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌涓氬姟鏁版嵁淇℃伅"); + } + title = "銆愮敤杞︾敵璇枫�戠敵璇蜂汉 - " + carUseBook.getMemberName(); + jsonMap.put("name", "鐢宠浜�:" + carUseBook.getCompanyName() + " - " + carUseBook.getMemberName()); + jsonMap.put("sTime", "寮�濮嬫椂闂�:" + DateUtil.DateToStr(carUseBook.getStartTime() , "yyyy-MM-dd HH:mm")); + jsonMap.put("eTime", "缁撴潫鏃堕棿:" + DateUtil.DateToStr(carUseBook.getEndTime() , "yyyy-MM-dd HH:mm")); + jsonMap.put("usrNum", StringUtils.isBlank(carUseBook.getMemberIds())?"涔樿溅浜烘暟: 0浜�": "涔樿溅浜烘暟: " +carUseBook.getMemberIds().split(",").length +"浜�"); + jsonMap.put("mdd", StringUtils.isBlank(carUseBook.getAddr())?"鐩殑鍦�: - ": "鐩殑鍦�:" +carUseBook.getAddr()); + }else { + throw new BusinessException(ResponseStatus.NOT_ALLOWED); } - - - - - - + return title; } @@ -822,16 +885,18 @@ .ne(Approve::getId,approve.getId())); }else{ //澶勭悊鍏朵粬涓氬姟鏁版嵁 - if(approve.getApproveType().equals(Constants.ZERO)&&approve.getIsEndCheck()==Constants.ONE){ - //鎴栫 涓� 缁堝 + if((approve.getApproveType().equals(Constants.ZERO) + || approve.getApproveType().equals(Constants.TWO)) &&approve.getIsEndCheck()==Constants.ONE){ + //鎴栫 / 鍗曚汉瀹� 涓� 缁堝 approveJoinMapper.update(null,new UpdateWrapper<Approve>() .lambda() .set(Approve::getStatus,Constants.approveStatus.otherDeal) .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); dealBusinessBean = true; - }else if(approve.getApproveType().equals(Constants.ZERO)&&approve.getIsEndCheck()!=Constants.ONE){ - //鎴栫 闈炵粓瀹� 鍒欏紑鍚笅涓�姝ヤ笟鍔℃祦绋� + }else if((approve.getApproveType().equals(Constants.ZERO) + || approve.getApproveType().equals(Constants.TWO)) &&approve.getIsEndCheck()!=Constants.ONE){ + //鎴栫 / 鍗曚汉瀹� 闈炵粓瀹� 鍒欏紑鍚笅涓�姝ヤ笟鍔℃祦绋� /**澶勭悊鏈骇鏁版嵁**/ approveJoinMapper.update(null,new UpdateWrapper<Approve>() .lambda() @@ -846,7 +911,7 @@ .eq(Approve::getObjType,approve.getObjType()) .eq(Approve::getLevel,(approve.getLevel()+1)) ); - + //TODO 鏇存柊娑堟伅鏁版嵁 鍙戦�佷笅涓�绾ф暟鎹秷鎭� }else if(approve.getApproveType().equals(Constants.ONE)&&approve.getIsEndCheck()==Constants.ONE){ //浼氱 涓旂粓瀹� if(approveList.size()==Constants.ZERO){ @@ -867,8 +932,6 @@ //TODO 瀹℃壒鏈�氳繃閫氱煡 } - - }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( Constants.approveObjectType.unCityUseCar)){ // 甯傚唴澶栫敤杞︾敵璇� @@ -886,6 +949,67 @@ } } + public void passNextNotices(Boolean dealBusinessBean,Approve approve){ + //鏍规嵁瀹℃壒璁板綍鏌ヨ 閫氱煡璁板綍 + Integer noticeType = Constants.approveTypeToNoticeType(approve.getObjType()); + Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>().lambda() + .eq(Notices::getObjId,approve.getObjId()) + .eq(Notices::getObjType,noticeType) + .eq(Notices::getUserId,approve.getChekorId()) + .eq(Notices::getSendacopy,Constants.ZERO) + .eq(Notices::getIsdeleted,Constants.ZERO) + ); + if(Objects.isNull(notices)){ + return; + } + + + if(Constants.equalsInteger(approve.getApproveType(),Constants.ZERO)){ + //鎴栫 + //1銆佷慨鏀硅嚜宸辩殑鏁版嵁璁板綍 + + //2銆佹洿鏂颁粬浜虹殑鍚岀骇璁板綍 涓烘妱閫� + + //3銆佸鏋滀笉鏄粓瀹$敓鎴愪笅涓�绾х殑鏁版嵁璁板綍 + + + }else if(Constants.equalsInteger(approve.getApproveType(),Constants.ONE)){ + //浼氱 + //1銆佷慨鏀硅嚜宸辩殑鏁版嵁璁板綍 + + //2銆佹牴鎹槸鍚︿负鏈�鍚庝竴浣嶅鎵逛汉 濡傛灉涓嶆槸 鍒欑粨鏉� + + //3銆� 濡傛灉鏄渶鍚庝竴浣嶅鎵逛汉 涓斾笉鏄粓瀹″紑鍚笅涓�绾ф暟鎹� + + }else{ + //鍗曚汉绛� + //1銆佷慨鏀硅嚜宸辩殑鏁版嵁璁板綍 + + //2銆� 鏄惁鏄粓瀹� 寮�鍚笅涓�绾ф暟鎹� + + + } + //涓氬姟閫氳繃 淇敼瀹℃壒瀵瑰簲娑堟伅璁板綍 + if(Constants.equalsInteger(approve.getStatus(),Constants.approveStatus.pass)){ + + } + // + + //缁堝涓氬姟 鍙戦�佹妱閫� + if (Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)) { + + + + } + + + + + + + + } + public void dealBusinessData(ApproveDTO approveDTO,Approve approve,Visits visits,CarUseBook carUseBook){ if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) -- Gitblit v1.9.3