|
@@ -10,6 +10,7 @@ import org.springblade.common.utils.BaiduApiUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.manager.dto.FindAllUserByConditionDTO;
|
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
|
import org.springblade.manager.entity.*;
|
|
@@ -23,6 +24,8 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.vo.UserContractInfoVO;
|
|
|
import org.springblade.system.user.vo.UserVO2;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -38,7 +41,9 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
|
private final ProjectContractAreaMapper projectContractAreaMapper;
|
|
|
private final SaveUserInfoByProjectMapper saveUserInfoByProjectMapper;
|
|
|
+ private final SaveUserInfoByProjectServiceImpl saveUserInfoByProjectService;
|
|
|
private final WbsTreeContractMapper wbsTreeContractMapper;
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@Override
|
|
|
public List<String> getProcessContractByJLContractId(String contractId) {
|
|
@@ -116,6 +121,12 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
|
return contractInfoMapper.deleteFile(url);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<WbsTreeContractVO> tree3(String wbsId, String projectId, String contractId) {
|
|
|
+ List<WbsTreeContractVO> wbsTreeContractVOS = baseMapper.tree5(Long.parseLong(wbsId), Long.parseLong(projectId), Long.parseLong(contractId));
|
|
|
+ return buildWbsTreeByStream(wbsTreeContractVOS);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<WbsTreeContractVO> tree(String wbsId, String projectId, String contractId) {
|
|
|
List<WbsTreeContractVO> wbsTreeContractVOS = baseMapper.tree2(Long.parseLong(wbsId), Long.parseLong(projectId), Long.parseLong(contractId), null, null, null);
|
|
@@ -158,13 +169,13 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean saveAndUpdateContract(ContractInfoVO contractInfo) {
|
|
|
- if (contractInfo.getId() == null) {
|
|
|
+ if (contractInfo.getId() == null) { //新增
|
|
|
List<ContractInfo> contractInfos = baseMapper.selectList(Wrappers.<ContractInfo>query().lambda()
|
|
|
.eq(ContractInfo::getContractName, contractInfo.getContractName())
|
|
|
.eq(ContractInfo::getPId, contractInfo.getPId())
|
|
|
);
|
|
|
if (contractInfos.size() > 0) {
|
|
|
- throw new ServiceException("合同段名称已存在当前项目下,请重新输入");
|
|
|
+ throw new ServiceException("当前项目下已存在该合同段名称,请重新输入");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(String.valueOf(contractInfo.getContractType()))) {
|
|
|
throw new ServiceException("合同类型不能为空");
|
|
@@ -172,18 +183,51 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
|
|
|
|
boolean row = saveOrUpdate(contractInfo);
|
|
|
|
|
|
+ //监理、总监办
|
|
|
if (contractInfo.getContractType().equals(2) || contractInfo.getContractType().equals(3)) {
|
|
|
if (contractInfo.getIdList().size() > 0) {
|
|
|
List<WbsTreeContractVO3> infos = contractInfo.getIdList();
|
|
|
infos.forEach(info -> {
|
|
|
+ //新增关联记录信息
|
|
|
baseMapper.insertContractRelationJLYZ(SnowFlakeUtil.getId(), contractInfo.getId(), info.getContractId());
|
|
|
});
|
|
|
+
|
|
|
+ /*//把当前监理合同段中的人员同步到质检合同段中去
|
|
|
+ List<String> recordContractIds = infos.stream().map(WbsTreeContractVO3::getContractId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<SaveUserInfoByProjectDTO> userRoleInfoListSG = new ArrayList<>();
|
|
|
+
|
|
|
+ //查询当前监理合同段所有用户角色信息
|
|
|
+ String sql1 = "select * from m_project_assignment_user where contract_id = " + contractInfo.getId() + " and post_id is null and status = 1 and is_deleted = 0";
|
|
|
+ List<SaveUserInfoByProjectDTO> userRoleInfoJL = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(SaveUserInfoByProjectDTO.class));
|
|
|
+
|
|
|
+ for (String recordContractId : recordContractIds) {
|
|
|
+ String sql2 = "select * from m_project_assignment_user where contract_id = " + recordContractId + " and post_id is null and status = 1 and is_deleted = 0";
|
|
|
+ List<SaveUserInfoByProjectDTO> userRoleInfoSG = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(SaveUserInfoByProjectDTO.class));
|
|
|
+ userRoleInfoListSG.addAll(userRoleInfoSG);
|
|
|
+ }
|
|
|
+
|
|
|
+ Iterator<SaveUserInfoByProjectDTO> jlInfo = userRoleInfoJL.iterator();
|
|
|
+ while (jlInfo.hasNext()){
|
|
|
+ SaveUserInfoByProjectDTO jl = jlInfo.next();
|
|
|
+ for (SaveUserInfoByProjectDTO sg : userRoleInfoListSG) {
|
|
|
+ if (jl.getUserId().equals(sg.getUserId())){
|
|
|
+ //移除在施工合同段中已经存在的人员信息
|
|
|
+ jlInfo.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ //中西试验室
|
|
|
+ } else if (contractInfo.getContractType().equals(4)) {
|
|
|
+ //TODO
|
|
|
}
|
|
|
|
|
|
return submitContractRelevantInfo(row, contractInfo);
|
|
|
|
|
|
- } else {
|
|
|
+ } else { //编辑
|
|
|
List<ContractInfo> contractInfos = baseMapper.selectList(Wrappers.<ContractInfo>query().lambda()
|
|
|
.eq(ContractInfo::getContractName, contractInfo.getContractName())
|
|
|
.eq(ContractInfo::getPId, contractInfo.getPId())
|
|
@@ -194,6 +238,7 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
|
}
|
|
|
boolean row = saveOrUpdate(contractInfo);
|
|
|
|
|
|
+ //监理、总监办
|
|
|
if (contractInfo.getContractType().equals(2) || contractInfo.getContractType().equals(3)) {
|
|
|
List<WbsTreeContractVO3> idList = contractInfo.getIdList();
|
|
|
|
|
@@ -208,6 +253,13 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
|
baseMapper.insertContractRelationJLYZ(SnowFlakeUtil.getId(), contractInfo.getId(), ids);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ //删除当前合同段下的关联的施工合同段对应的合同段人员
|
|
|
+ //String sql = "delete from m_project_assignment_user where contract_id = " + contractInfo.getId() + " and post_id is null and status = 1 and is_deleted = 0";
|
|
|
+
|
|
|
+ //中西试验室
|
|
|
+ } else if (contractInfo.getContractType().equals(4)) {
|
|
|
+ //TODO
|
|
|
}
|
|
|
|
|
|
return submitContractRelevantInfo(row, contractInfo);
|