From d0fe6ceb4dbb8531e5e7714c5d05d03ec211d3a2 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期一, 25 十一月 2024 10:04:34 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java | 102 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 94 insertions(+), 8 deletions(-) diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java index 6b76641..eb8da05 100644 --- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java +++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java @@ -9,12 +9,10 @@ import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; -import com.doumee.dao.business.YwBuildingMapper; -import com.doumee.dao.business.YwProjectMapper; -import com.doumee.dao.business.YwRoomMapper; -import com.doumee.dao.business.YwWorkorderMapper; +import com.doumee.dao.business.*; import com.doumee.dao.business.model.*; import com.doumee.dao.system.MultifileMapper; +import com.doumee.dao.system.SystemUserMapper; import com.doumee.dao.system.model.Multifile; import com.doumee.dao.system.model.SystemUser; import com.doumee.service.business.YwWorkorderService; @@ -46,6 +44,10 @@ @Autowired private YwWorkorderMapper ywWorkorderMapper; @Autowired + private SystemUserMapper systemUserMapper; + @Autowired + private YwWorkorderLogMapper ywWorkorderLogMapper; + @Autowired private SystemDictDataBiz systemDictDataBiz; @Autowired private MultifileMapper multifileMapper; @@ -55,6 +57,8 @@ private YwRoomMapper ywRoomMapper; @Autowired private YwBuildingMapper ywBuildingMapper; + @Autowired + private YwFloorMapper ywFloorMapper; @Override @Transactional(rollbackFor = {BusinessException.class,Exception.class}) @@ -90,7 +94,28 @@ if(fileList.size()>0){ multifileMapper.insert(fileList); } + dealLogBiz(model,Constants.ZERO,model.getLoginUserInfo().getRealname(),null);//璁板綍鏂板缓鏃ュ織 return model.getId(); + } + + private void dealLogBiz(YwWorkorder model, int type,String param1,String param2) { + YwWorkorderLog log = new YwWorkorderLog(); + log.setCreateDate(model.getEditDate()); + log.setCreator(model.getCreator()); + log.setJobId(model.getId()); + log.setIsdeleted(Constants.ZERO); + log.setObjId(model.getId()+""); + log.setObjType(type); + log.setParam1(param1); + log.setParam2(param2); + if(type ==0){ + log.setTitle("鍒涘缓宸ュ崟"); + }else if(type ==1){ + log.setTitle("鍒嗘淳宸ュ崟"); + }else if(type ==2){ + log.setTitle("澶勭悊宸ュ崟"); + } + ywWorkorderLogMapper.insert(log); } private void dealParamValid(YwWorkorder model) { @@ -107,13 +132,14 @@ model.setProjectId(room.getProjectId()); }else{ //濡傛灉鏄叕鍏卞尯鍩熻淇紝蹇呴』閫夋嫨妤煎畤淇℃伅 - if(model.getBuildingId()==null){ - throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨姝g‘鐨勬ゼ瀹囦俊鎭紒"); + if(model.getFloorId()==null){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨姝g‘鐨勬ゼ灞備俊鎭紒"); } - YwBuilding room = ywBuildingMapper.selectById(model.getRoomId()); + YwFloor room = ywFloorMapper.selectById(model.getFloorId()); if(room ==null || Constants.equalsInteger(room.getIsdeleted(),Constants.ONE)){ - throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨姝g‘鐨勬ゼ瀹囦俊鎭紒"); + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨姝g‘鐨勬ゼ灞備俊鎭紒"); } + model.setBuildingId(room.getBuildingId()); model.setProjectId(room.getProjectId()); } } @@ -144,6 +170,58 @@ } } + @Override + @Transactional(rollbackFor = {BusinessException.class,Exception.class}) + public void dispatchOrder(YwWorkorder ywWorkorder){ + YwWorkorder model = this.findById(ywWorkorder.getId()); + if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝宸ュ崟淇℃伅涓嶅瓨鍦紒"); + } + if(!Constants.equalsInteger(model.getDealStatus(),Constants.ZERO) && !Constants.equalsInteger(model.getDealStatus(),Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝宸ュ崟鐘舵�佸凡娴佽浆锛屼笉鏀寔褰撳墠鎿嶄綔锛�"); + } + + SystemUser user = systemUserMapper.selectById(ywWorkorder.getDealUserId()); + if(user ==null || (user.getDeleted()!=null&& user.getDeleted() )){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鍛樺伐淇℃伅涓嶅瓨鍦紒"); + } + YwWorkorder update = new YwWorkorder(); + update.setId(model.getId()); + update.setEditDate(new Date()); + update.setEditor(ywWorkorder.getLoginUserInfo().getId()); + update.setDealStatus(Constants.ONE); + update.setDispatchUserId(update.getEditor()); + update.setDispatchDate(update.getEditDate()); + update.setDispatchInfo(ywWorkorder.getDispatchInfo()); + ywWorkorderMapper.updateById(update); + dealLogBiz(model,Constants.ONE,model.getLoginUserInfo().getRealname(),user.getRealname());//璁板綍鏂板缓鏃ュ織 + } + @Override + @Transactional(rollbackFor = {BusinessException.class,Exception.class}) + public void dealOrder(YwWorkorder ywWorkorder){ + YwWorkorder model = this.findById(ywWorkorder.getId()); + if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝宸ュ崟淇℃伅涓嶅瓨鍦紒"); + } + if(!Constants.equalsInteger(model.getDealStatus(),Constants.ZERO) && !Constants.equalsInteger(model.getDealStatus(),Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝宸ュ崟鐘舵�佸凡娴佽浆锛屼笉鏀寔褰撳墠鎿嶄綔锛�"); + } + + SystemUser user = systemUserMapper.selectById(ywWorkorder.getDealUserId()); + if(user ==null || (user.getDeleted()!=null&& user.getDeleted() )){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鍛樺伐淇℃伅涓嶅瓨鍦紒"); + } + YwWorkorder update = new YwWorkorder(); + update.setId(model.getId()); + update.setEditDate(new Date()); + update.setEditor(ywWorkorder.getLoginUserInfo().getId()); + update.setDealStatus(Constants.TWO); + update.setDealUserId(update.getEditor()); + update.setDealDate(update.getEditDate()); + update.setDealInfo(ywWorkorder.getDispatchInfo()); + ywWorkorderMapper.updateById(update); + dealLogBiz(model,Constants.TWO,model.getLoginUserInfo().getRealname(),null);//璁板綍鏂板缓鏃ュ織 + } @Override @Transactional(rollbackFor = {BusinessException.class,Exception.class}) public void updateById(YwWorkorder model) { @@ -226,14 +304,22 @@ public YwWorkorder findById(Integer id) { MPJLambdaWrapper<YwWorkorder> wrapper = new MPJLambdaWrapper<>(); wrapper.selectAll(YwWorkorder.class ) + .select("t4.realname",YwWorkorder::getDealUserName) + .select("t3.realname",YwWorkorder::getDispatchUserName) .selectAs(SystemUser::getRealname,YwWorkorder::getCreatorName) .selectAs(SystemUser::getMobile,YwWorkorder::getCreatorPhone) .selectAs(Company::getCompanyNamePath,YwWorkorder::getCreatorCompany) .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getCreator) .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) + .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getDispatchUserId) + .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getDealUserId) .eq(YwWorkorder::getId,id); YwWorkorder model = ywWorkorderMapper.selectJoinOne(YwWorkorder.class,wrapper); initFiles(model);//璇诲彇闄勪欢淇℃伅 + YwWorkorderLog log = new YwWorkorderLog(); + log.setJobId(model.getId()); + log.setIsdeleted(Constants.ZERO); + model.setLogList(ywWorkorderLogMapper.selectList(new QueryWrapper<YwWorkorderLog>(log).lambda().orderByAsc(YwWorkorderLog::getCreateDate))); return model; } -- Gitblit v1.9.3