From f55d6c3c4f13e1564899d3c88cbe698537aefcf9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 18 六月 2024 10:21:42 +0800
Subject: [PATCH] sssssssssss
---
server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java | 39 ++++++++++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
index e090617..357be91 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
@@ -10,10 +10,7 @@
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
import com.doumee.dao.business.dto.*;
-import com.doumee.dao.business.join.DispatchUnitJoinMapper;
-import com.doumee.dao.business.join.DuLogJoinMapper;
-import com.doumee.dao.business.join.DuSolutionJoinMapper;
-import com.doumee.dao.business.join.DuWorkTypeJoinMapper;
+import com.doumee.dao.business.join.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.DispatchUnitService;
@@ -49,6 +46,9 @@
@Autowired
private DuSolutionMapper duSolutionMapper;
+
+ @Autowired
+ private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper;
@Autowired
private DuWorktypeMapper duWorktypeMapper;
@@ -156,7 +156,8 @@
newVersion = dispatchUnitMapper.selectOne(new QueryWrapper<DispatchUnit>().lambda()
.eq(DispatchUnit::getIsdeleted,Constants.ZERO)
.eq(DispatchUnit::getDataType,Constants.TWO)
- .eq(DispatchUnit::getBaseId,model.getId()).last(" limit 1"));
+ .eq(DispatchUnit::getBaseId,model.getId())
+ .last(" limit 1"));
}
if(Objects.isNull(newVersion)){
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌娲鹃仯鍗曚綅鏈�鏂扮増鏈�");
@@ -403,6 +404,7 @@
}
if(dispatchUnitMapper.selectCount(new QueryWrapper<DispatchUnit>().lambda()
.ne(DispatchUnit::getId,saveDispatchUnitDTO.getId())
+ .ne(DispatchUnit::getBaseId,saveDispatchUnitDTO.getId())
.eq(DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
.eq(DispatchUnit::getName,saveDispatchUnitDTO.getName())
.eq(DispatchUnit::getIsdeleted,Constants.ZERO)
@@ -416,6 +418,11 @@
dispatchUnit.setEditDate(new Date());
dispatchUnit.setEditor(loginUserInfo.getId());
dispatchUnitMapper.updateById(dispatchUnit);
+
+ dispatchUnitMapper.update(null,new UpdateWrapper<DispatchUnit>().lambda().set(DispatchUnit::getDataType,Constants.ONE).eq(DispatchUnit::getBaseId,dispatchUnit.getId())
+ .eq(DispatchUnit::getDataType,Constants.TWO)
+ );
+
//瀛樺偍鎿嶄綔璁板綍
this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.EDIT_UNIT,null);
@@ -506,6 +513,11 @@
if(Objects.isNull(saveDuWorkTypeDTO.getWorkTypeId())){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶄俊鎭紓甯�");
}
+ //楠岃瘉鏂规涓庡伐绉嶇殑鍏崇郴
+ if(solutionWorktypeJoinMapper.selectCount(new QueryWrapper<SolutionWorktype>().lambda().eq(SolutionWorktype::getSolutionId,saveDuSolutionDTO.getSolutionId())
+ .eq(SolutionWorktype::getWorktypeId,saveDuWorkTypeDTO.getWorkTypeId()))<=0){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶄俊鎭棤缁戝畾鍏崇郴");
+ };
if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>()
.lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId())
.eq(DuWorktype::getIsdeleted,Constants.ZERO)
@@ -664,7 +676,20 @@
@Override
public void deleteById(Integer id) {
- dispatchUnitMapper.deleteById(id);
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ DispatchUnit dispatchUnit = dispatchUnitMapper.selectById(id);
+ if(Objects.isNull(dispatchUnit)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(dispatchUnit.getUnitStatus().equals(Constants.TWO)){
+ dispatchUnitMapper.update(null,new UpdateWrapper<DispatchUnit>().lambda()
+ .set(DispatchUnit::getEditor,loginUserInfo.getId())
+ .set(DispatchUnit::getEditDate,new Date())
+ .set(DispatchUnit::getIsdeleted,Constants.ONE)
+ .eq(DispatchUnit::getId,id));
+ }else{
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠娲鹃仯鍗曚綅鐘舵�佹棤娉曡繘琛岃鎿嶄綔");
+ }
}
@Override
@@ -894,7 +919,7 @@
new MPJLambdaWrapper<DispatchUnit>().selectAll(DispatchUnit.class)
.eq(DispatchUnit::getIsdeleted,Constants.ZERO)
.eq(DispatchUnit::getStatus,Constants.ZERO)
- .select("(select b.id from du_solution b where b.isdeleted=0 and b.dispatch_unit_id=t.id and b.solution_id="+dispatchUnitQueryDTO.getSolutionId()+" limit 1) as du_solution_id" )
+ .select("(select b.id from du_solution b where b.isdeleted=0 and b.dispatch_unit_id=t.id and b.solution_id="+dispatchUnitQueryDTO.getSolutionId()+" order by b.CHECK_DATE desc limit 1) as du_solution_id" )
.eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
.eq(Objects.isNull(dispatchUnitQueryDTO.getDataType()),DispatchUnit::getDataType,Constants.TWO)
.eq(!Objects.isNull(dispatchUnitQueryDTO.getDataType()),DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType())
--
Gitblit v1.9.3