|
@@ -8,10 +8,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.jeeplus.business.workContractInfo.domain.JyContractParticipant;
|
|
|
import com.jeeplus.business.workContractInfo.domain.JyWorkContractInfo;
|
|
|
import com.jeeplus.business.workContractInfo.mapper.JyContractParticipantMapper;
|
|
|
import com.jeeplus.business.workContractInfo.mapper.JyWorkContractInfoMapper;
|
|
|
+import com.jeeplus.business.workContractInfo.service.dto.InformUserInfoDTO;
|
|
|
import com.jeeplus.business.workContractInfo.service.dto.JyWorkContractInfoDto;
|
|
|
import com.jeeplus.common.TokenProvider;
|
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
@@ -236,7 +238,7 @@ public class JyWorkContractService {
|
|
|
//抄送给财务,副总经理,总经理
|
|
|
ArrayList<UserDTO> userDTOS = new ArrayList<>();
|
|
|
|
|
|
- PostDTO postDTOByName = SpringUtil.getBean(IPostApi.class).getPostDTOByName("财务");
|
|
|
+ /*PostDTO postDTOByName = SpringUtil.getBean(IPostApi.class).getPostDTOByName("财务");
|
|
|
PostDTO postDTOByName1 = SpringUtil.getBean(IPostApi.class).getPostDTOByName("财务管理员");
|
|
|
List<UserDTO> listByPostId = SpringUtil.getBean(IUserApi.class).findListByPostId(postDTOByName.getId());
|
|
|
List<UserDTO> listByPostId1 = SpringUtil.getBean(IUserApi.class).findListByPostId(postDTOByName1.getId());
|
|
@@ -247,24 +249,35 @@ public class JyWorkContractService {
|
|
|
PostDTO zjl = SpringUtil.getBean(IPostApi.class).getPostDTOByName("总经理");
|
|
|
List<UserDTO> zjlInfo = SpringUtil.getBean(IUserApi.class).findListByPostId(zjl.getId());
|
|
|
userDTOS.addAll(fzjlInfo);
|
|
|
- userDTOS.addAll(zjlInfo);
|
|
|
- Set<UserDTO> uniqueUsers = new HashSet<>(userDTOS);
|
|
|
- List<UserDTO> uniqueUserList = new ArrayList<>(uniqueUsers);
|
|
|
- for (UserDTO user : uniqueUserList) {
|
|
|
- String id1 = UUID.randomUUID().toString().replace("-", "");
|
|
|
- FlowCopy flowCopy = new FlowCopy();
|
|
|
- flowCopy.setCreateById(userDTO.getId());
|
|
|
- flowCopy.setCreateTime(new Date());
|
|
|
- flowCopy.setUpdateById(userDTO.getId());
|
|
|
- flowCopy.setUpdateTime(new Date());
|
|
|
- String tenderName = userDTO.getName()+"创建了合同-"+workContractInfoDto.getContractName()+"编号为-"+contractNo;
|
|
|
- flowCopy.setProcInsName(tenderName);
|
|
|
- flowCopy.setProcInsId(id);
|
|
|
- flowCopy.setProcDefId(id);
|
|
|
- flowCopy.setUserId(user.getId());
|
|
|
- flowCopy.setId(id1);
|
|
|
- flowCopy.setDelFlag(0);
|
|
|
- SpringUtil.getBean(IFlowableApi.class).add(flowCopy);
|
|
|
+ userDTOS.addAll(zjlInfo);*/
|
|
|
+
|
|
|
+ for (InformUserInfoDTO informUserInfoDTO : workContractInfoDto.getInformUserList()) {
|
|
|
+ //将人员id和合同id进行保存
|
|
|
+ informUserInfoDTO.setContractId(info.getId());
|
|
|
+ jyWorkContractInfoMapper.insertInformUser(informUserInfoDTO);
|
|
|
+ UserDTO user = SpringUtil.getBean(IUserApi.class).getById(informUserInfoDTO.getUserId());
|
|
|
+ userDTOS.add(user);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(userDTOS.size()>0){
|
|
|
+ Set<UserDTO> uniqueUsers = new HashSet<>(userDTOS);
|
|
|
+ List<UserDTO> uniqueUserList = new ArrayList<>(uniqueUsers);
|
|
|
+ for (UserDTO user : uniqueUserList) {
|
|
|
+ String id1 = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ FlowCopy flowCopy = new FlowCopy();
|
|
|
+ flowCopy.setCreateById(userDTO.getId());
|
|
|
+ flowCopy.setCreateTime(new Date());
|
|
|
+ flowCopy.setUpdateById(userDTO.getId());
|
|
|
+ flowCopy.setUpdateTime(new Date());
|
|
|
+ String tenderName = userDTO.getName()+"创建了合同-"+workContractInfoDto.getContractName()+"编号为-"+contractNo;
|
|
|
+ flowCopy.setProcInsName(tenderName);
|
|
|
+ flowCopy.setProcInsId(id);
|
|
|
+ flowCopy.setProcDefId(id);
|
|
|
+ flowCopy.setUserId(user.getId());
|
|
|
+ flowCopy.setId(id1);
|
|
|
+ flowCopy.setDelFlag(0);
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).add(flowCopy);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return id;
|
|
@@ -319,6 +332,21 @@ public class JyWorkContractService {
|
|
|
info.setNo(contractNo); //合同编号
|
|
|
info.setContractType(newType);//合同类型(小类)
|
|
|
info.setContractTypeFirst(contractTypes.get(0).get(0));
|
|
|
+ }else{
|
|
|
+ //合同编号生成
|
|
|
+ List<List<String>> contractTypes = new ArrayList<>();
|
|
|
+ String newType="";
|
|
|
+ contractTypes = workContractInfoDto.getContractTypes();
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (List<String> contractType : contractTypes) {
|
|
|
+ //判断合同类型是否有二级
|
|
|
+ if (contractType.size()>1){
|
|
|
+ sb.append(contractType.get(1)+",");
|
|
|
+ newType=sb.substring(0,sb.lastIndexOf(","));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info.setContractType(newType);//合同类型(小类)
|
|
|
+ info.setContractTypeFirst(contractTypes.get(0).get(0));
|
|
|
}
|
|
|
info.setName(workContractInfoDto.getContractName()); //合同名称
|
|
|
jyWorkContractInfoMapper.updateById(info);
|
|
@@ -346,6 +374,85 @@ public class JyWorkContractService {
|
|
|
// updateFiles(list, userDTO, workContractInfoDto.getId());
|
|
|
// }
|
|
|
updateFiles(list, userDTO, workContractInfoDto.getId());
|
|
|
+
|
|
|
+ //修改合同被通知人信息,并进行发送抄送
|
|
|
+ //先查出现有的数据信息
|
|
|
+ List<InformUserInfoDTO> userInfoList = jyWorkContractInfoMapper.getInformUserByContractId(workContractInfoDto.getId());
|
|
|
+ List<String> userIdList = Lists.newArrayList();
|
|
|
+ List<String> repetitionUserIdList = Lists.newArrayList();
|
|
|
+ for (InformUserInfoDTO userInfoDTO : userInfoList) {
|
|
|
+ userIdList.add(userInfoDTO.getUserId());
|
|
|
+
|
|
|
+ for (InformUserInfoDTO informUserInfoDTO : workContractInfoDto.getInformUserList()) {
|
|
|
+
|
|
|
+ if(userInfoDTO.getUserId().equals(informUserInfoDTO.getUserId())){
|
|
|
+ repetitionUserIdList.add(userInfoDTO.getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //在将数据库中现有的数据信息进行删除
|
|
|
+ //jyWorkContractInfoMapper.deleteInformUserByContractId(workContractInfoDto.getId());
|
|
|
+ //判定新获取的被通知人员是否存在已被通知的人员信息中,不存在的进行新增,原通知的被删除的则将抄送进行删除
|
|
|
+ //遍历userIdList 并处理完成之后,剩下的就是应该从原有人员表中进行剔除的人员id(并且剔除抄送信息)
|
|
|
+ Iterator<String> iterator = userIdList.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ String item = iterator.next();
|
|
|
+ for (String repetitionUserId : repetitionUserIdList) {
|
|
|
+ if(repetitionUserId.equals(item)){
|
|
|
+ iterator.remove(); // 删除元素
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //将已经处理后的userIdList中的人员信息从合同通知人表种进行删除,并进行剔除抄送信息
|
|
|
+ for (String userId : userIdList) {
|
|
|
+ jyWorkContractInfoMapper.deleteInformUserByContractIdAndUserId(workContractInfoDto.getId(), userId);
|
|
|
+ //删除抄送信息
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).deleteByUserIdAndProcInsId(userId,workContractInfoDto.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //对提交的被通知人员信息与数据库中的已经被通知的人员信息进行比对,已通知的 则进行剔除,剩下的就是需要再次进行发送通知的人员信息
|
|
|
+ Iterator<InformUserInfoDTO> repetitionIterator = workContractInfoDto.getInformUserList().iterator();
|
|
|
+ while (repetitionIterator.hasNext()) {
|
|
|
+ InformUserInfoDTO item = repetitionIterator.next();
|
|
|
+ for (String userId : repetitionUserIdList) {
|
|
|
+ if(item.getUserId().equals(userId)){
|
|
|
+ repetitionIterator.remove(); // 删除元素
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (InformUserInfoDTO userInfoDTO : workContractInfoDto.getInformUserList()) {
|
|
|
+
|
|
|
+ //将人员id和合同id进行保存
|
|
|
+ userInfoDTO.setContractId(info.getId());
|
|
|
+ jyWorkContractInfoMapper.insertInformUser(userInfoDTO);
|
|
|
+
|
|
|
+ UserDTO user = SpringUtil.getBean(IUserApi.class).getById(userInfoDTO.getUserId());
|
|
|
+
|
|
|
+ String id1 = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ FlowCopy flowCopy = new FlowCopy();
|
|
|
+ flowCopy.setCreateById(userDTO.getId());
|
|
|
+ flowCopy.setCreateTime(new Date());
|
|
|
+ flowCopy.setUpdateById(userDTO.getId());
|
|
|
+ flowCopy.setUpdateTime(new Date());
|
|
|
+ String tenderName = userDTO.getName()+"创建了合同-"+workContractInfoDto.getContractName()+"编号为-"+workContractInfoDto.getContractNo();
|
|
|
+ flowCopy.setProcInsName(tenderName);
|
|
|
+ flowCopy.setProcInsId(workContractInfoDto.getId());
|
|
|
+ flowCopy.setProcDefId(workContractInfoDto.getId());
|
|
|
+ flowCopy.setUserId(user.getId());
|
|
|
+ flowCopy.setId(id1);
|
|
|
+ flowCopy.setDelFlag(0);
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).add(flowCopy);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return workContractInfoDto.getId();
|
|
|
}
|
|
|
|
|
@@ -391,6 +498,9 @@ public class JyWorkContractService {
|
|
|
dto.setTaskId(info.getTaskId());
|
|
|
dto.setDepartment(info.getDepartment());
|
|
|
dto.setCreateName(info.getCreateName());
|
|
|
+ //获取合同被通知人员信息
|
|
|
+ List<InformUserInfoDTO> informUserByContractId = jyWorkContractInfoMapper.getInformUserByContractId(dto.getId());
|
|
|
+ dto.setInformUserList(informUserByContractId);
|
|
|
//获取委托人列表
|
|
|
List<JyContractParticipant> list = new ArrayList<>();
|
|
|
List<JyContractParticipant> byInfoId = jyContractParticipantMapper.findByInfoId(id);
|