|
@@ -19,15 +19,12 @@ import com.jeeplus.common.redis.RedisUtils;
|
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
import com.jeeplus.finance.contractRegistration.domain.ContractInfo;
|
|
|
import com.jeeplus.finance.contractRegistration.mapper.ContractInfoMapper;
|
|
|
-import com.jeeplus.finance.projectRecords.domain.CwProjectClientContact;
|
|
|
-import com.jeeplus.finance.projectRecords.domain.CwProjectMembers;
|
|
|
-import com.jeeplus.finance.projectRecords.domain.CwProjectRecords;
|
|
|
+import com.jeeplus.finance.projectRecords.domain.*;
|
|
|
import com.jeeplus.finance.projectRecords.mapper.CwProjectClientContactMapper;
|
|
|
+import com.jeeplus.finance.projectRecords.mapper.CwProjectPlanDetailsMapper;
|
|
|
+import com.jeeplus.finance.projectRecords.mapper.CwProjectPlanMapper;
|
|
|
import com.jeeplus.finance.projectRecords.mapper.CwProjectRecordsMapper;
|
|
|
-import com.jeeplus.finance.projectRecords.service.dto.CwProjectClientContactDTO;
|
|
|
-import com.jeeplus.finance.projectRecords.service.dto.CwProjectClientInfoDTO;
|
|
|
-import com.jeeplus.finance.projectRecords.service.dto.CwProjectMembersDTO;
|
|
|
-import com.jeeplus.finance.projectRecords.service.dto.CwProjectRecordsDTO;
|
|
|
+import com.jeeplus.finance.projectRecords.service.dto.*;
|
|
|
import com.jeeplus.finance.projectRecords.service.mapstruct.CwProjectClientContactWrapper;
|
|
|
import com.jeeplus.finance.projectRecords.service.mapstruct.CwProjectMembersWrapper;
|
|
|
import com.jeeplus.finance.projectRecords.service.mapstruct.CwProjectRecordsWrapper;
|
|
@@ -35,6 +32,7 @@ import com.jeeplus.finance.workClientInfo.domain.CwWorkClientContact;
|
|
|
import com.jeeplus.finance.workClientInfo.service.CwWorkClientContactService;
|
|
|
import com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBaseDTO;
|
|
|
import com.jeeplus.sys.domain.User;
|
|
|
+import com.jeeplus.sys.domain.WorkAttachmentInfo;
|
|
|
import com.jeeplus.sys.feign.IUserApi;
|
|
|
import com.jeeplus.sys.feign.IWorkAttachmentApi;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
@@ -78,6 +76,11 @@ public class CwProjectRecordsService extends ServiceImpl<CwProjectRecordsMapper,
|
|
|
private CwWorkClientContactService cwWorkClientContactService;
|
|
|
@Resource
|
|
|
private CwProjectMembersService cwProjectMembersService;
|
|
|
+ @Resource
|
|
|
+ private CwProjectPlanMapper cwProjectPlanMapper;
|
|
|
+ @Resource
|
|
|
+ private CwProjectPlanDetailsMapper cwProjectPlanDetailsMapper;
|
|
|
+
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -171,6 +174,14 @@ public class CwProjectRecordsService extends ServiceImpl<CwProjectRecordsMapper,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //根据项目id查询项目计划表中的数据
|
|
|
+ CwProjectPlan cwProjectPlan = cwProjectPlanMapper.selectOne(new QueryWrapper<CwProjectPlan>().eq("project_id", li.getId()).eq("del_flag", 0));
|
|
|
+ if (ObjectUtil.isEmpty(cwProjectPlan)){
|
|
|
+ li.setIsHavePlan("0");
|
|
|
+ }else {
|
|
|
+ li.setIsHavePlan("1");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
});
|
|
|
return list;
|
|
@@ -698,4 +709,195 @@ public class CwProjectRecordsService extends ServiceImpl<CwProjectRecordsMapper,
|
|
|
public List<String> findAllList(String id) {
|
|
|
return cwProjectRecordsMapper.findAllList(id);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询项目计划详情
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public CwProjectRecordsDTO queryPlanById(String id) {
|
|
|
+ CwProjectRecordsDTO cwProjectRecordsDTO = cwProjectRecordsMapper.queryPlanById(id);
|
|
|
+ //根据项目表中的计划id查询计划详情信息
|
|
|
+ if (StringUtils.isNotBlank(cwProjectRecordsDTO.getPlanId())){
|
|
|
+ List<CwProjectPlanDetails> planDetailsList = cwProjectRecordsMapper.getListByPlanId(cwProjectRecordsDTO.getPlanId());
|
|
|
+ cwProjectRecordsDTO.setPlanDetailsList(planDetailsList);
|
|
|
+ //查询附件信息
|
|
|
+ List<WorkAttachmentInfo> list=cwProjectRecordsMapper.getFileList(cwProjectRecordsDTO.getPlanId());
|
|
|
+ cwProjectRecordsDTO.setPlanFileList(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ return cwProjectRecordsDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出项目计划详情
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<CwProjectPlanDetails> findPlanList(String id) {
|
|
|
+ List<CwProjectPlanDetails> cwProjectPlanDetails=cwProjectRecordsMapper.findPlanList(id);
|
|
|
+ return cwProjectPlanDetails;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目组成员树形
|
|
|
+ * @param name
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<CwTreeUserDto> userTree(String name,String id) {
|
|
|
+ List<CwTreeUserDto> userList = new ArrayList<>();
|
|
|
+ //根据项目id查询项目组成员
|
|
|
+ List<String> membersId = cwProjectRecordsMapper.getMemberId(id);
|
|
|
+ if (CollectionUtil.isNotEmpty(membersId)){
|
|
|
+ for (String s : membersId) {
|
|
|
+ // 查询用户
|
|
|
+ List<CwTreeUserDto> treeUserDtoList = cwProjectRecordsMapper.findUserList(name,s);
|
|
|
+ if (CollectionUtils.isNotEmpty(treeUserDtoList)) {
|
|
|
+ userList.addAll(treeUserDtoList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 查询部门
|
|
|
+ List<CwTreeUserDto> officeList = cwProjectRecordsMapper.findOfficeList();
|
|
|
+ List<CwTreeUserDto> list = new ArrayList<>();
|
|
|
+ list =disposeUserTree(userList, officeList);
|
|
|
+ //去重
|
|
|
+ List<CwTreeUserDto> newList = list.stream().collect(Collectors.collectingAndThen(
|
|
|
+ Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CwTreeUserDto::getId))), ArrayList::new)
|
|
|
+ );
|
|
|
+ return newList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户树形数据处理
|
|
|
+ * @param userList
|
|
|
+ * @param officeList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<CwTreeUserDto> disposeUserTree(List<CwTreeUserDto> userList, List<CwTreeUserDto> officeList){
|
|
|
+ List<CwTreeUserDto> list = new ArrayList<>();
|
|
|
+ for (CwTreeUserDto userDto : userList) {
|
|
|
+
|
|
|
+ for (CwTreeUserDto officeDto : officeList) {
|
|
|
+ if(StringUtils.isNotBlank(userDto.getParentId()) && userDto.getParentId().equals(officeDto.getId())){
|
|
|
+ list.add(officeDto);
|
|
|
+ list.add(userDto);
|
|
|
+ List<CwTreeUserDto> treeUserDtos = disposeOfficeTree(officeDto, officeList);
|
|
|
+ if(null!= treeUserDtos && treeUserDtos.size()>0){
|
|
|
+ list.addAll(treeUserDtos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户树形数据处理
|
|
|
+ * @param officeInfo
|
|
|
+ * @param officeList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<CwTreeUserDto> disposeOfficeTree(CwTreeUserDto officeInfo, List<CwTreeUserDto> officeList){
|
|
|
+ List<CwTreeUserDto> listAll = Lists.newArrayList();
|
|
|
+ for (CwTreeUserDto officeDto : officeList) {
|
|
|
+ if(officeInfo.getParentId().equals(officeDto.getId())){
|
|
|
+ listAll.add(officeDto);
|
|
|
+ disposeOfficeTree(officeDto,officeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return listAll;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存项目计划信息
|
|
|
+ * @param cwProjectRecordsDTO
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+
|
|
|
+ public ResponseEntity savePlanForm(CwProjectRecordsDTO cwProjectRecordsDTO) throws Exception{
|
|
|
+ CwProjectRecordsDTO projectRecordsDTO = cwProjectRecordsMapper.queryPlanById(cwProjectRecordsDTO.getId());
|
|
|
+ String planId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ //如果计划id不为空,则将详情表中原来的数据进行逻辑删除,然后新增新的计划信息
|
|
|
+ if (StringUtils.isNotBlank(projectRecordsDTO.getPlanId())){
|
|
|
+ //将原来的数据进行删除
|
|
|
+ List<CwProjectPlanDetails> cwProjectPlanDetails = cwProjectPlanDetailsMapper.selectList(new QueryWrapper<CwProjectPlanDetails>().eq("plan_id", projectRecordsDTO.getPlanId()));
|
|
|
+ for (CwProjectPlanDetails cwProjectPlanDetail : cwProjectPlanDetails) {
|
|
|
+ cwProjectPlanDetailsMapper.deleteById(cwProjectPlanDetail.getId());
|
|
|
+ }
|
|
|
+ //将新的计划信息添加到表中
|
|
|
+ for (CwProjectPlanDetails projectPlanDetails : cwProjectRecordsDTO.getPlanDetailsList()) {
|
|
|
+ CwProjectPlanDetails details = new CwProjectPlanDetails();
|
|
|
+ details.setAchiever(projectPlanDetails.getAchiever());
|
|
|
+ details.setTaskPhase(projectPlanDetails.getTaskPhase());
|
|
|
+ details.setPlanStartDate(projectPlanDetails.getPlanStartDate());
|
|
|
+ details.setPlanEndDate(projectPlanDetails.getPlanEndDate());
|
|
|
+ details.setWarnUser(projectPlanDetails.getWarnUser());
|
|
|
+ details.setPlanId(projectRecordsDTO.getPlanId());
|
|
|
+ cwProjectPlanDetailsMapper.insert(details);
|
|
|
+ }
|
|
|
+ planId=projectRecordsDTO.getPlanId();
|
|
|
+ }else {
|
|
|
+ //在计划表中新增一条数据
|
|
|
+ CwProjectPlan cwProjectPlan = new CwProjectPlan();
|
|
|
+ cwProjectPlan.setProjectId(cwProjectRecordsDTO.getId());
|
|
|
+ cwProjectPlan.setId(planId);
|
|
|
+ cwProjectPlanMapper.insert(cwProjectPlan);
|
|
|
+ //往计划明细表中添加数据
|
|
|
+ for (CwProjectPlanDetails projectPlanDetails : cwProjectRecordsDTO.getPlanDetailsList()) {
|
|
|
+ CwProjectPlanDetails details = new CwProjectPlanDetails();
|
|
|
+ details.setAchiever(projectPlanDetails.getAchiever());
|
|
|
+ details.setTaskPhase(projectPlanDetails.getTaskPhase());
|
|
|
+ details.setPlanStartDate(projectPlanDetails.getPlanStartDate());
|
|
|
+ details.setPlanEndDate(projectPlanDetails.getPlanEndDate());
|
|
|
+ details.setWarnUser(projectPlanDetails.getWarnUser());
|
|
|
+ details.setPlanId(planId);
|
|
|
+ cwProjectPlanDetailsMapper.insert(details);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //修改项目表中的计划开始时间和结束时间
|
|
|
+ CwProjectRecords cwProjectRecords = new CwProjectRecords();
|
|
|
+ cwProjectRecords.setId(cwProjectRecordsDTO.getId());
|
|
|
+ cwProjectRecords.setPlanStartDate(cwProjectRecordsDTO.getPlanStartDate());
|
|
|
+ cwProjectRecords.setPlanEndDate(cwProjectRecordsDTO.getPlanEndDate());
|
|
|
+ cwProjectRecordsMapper.updateById(cwProjectRecords);
|
|
|
+ //保存附件
|
|
|
+ if (CollectionUtil.isNotEmpty(cwProjectRecordsDTO.getPlanFileList())){
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ String fileList = JSON.toJSONString((cwProjectRecordsDTO.getPlanFileList()));
|
|
|
+ String attachmentId = planId;
|
|
|
+ String attachmentFlag = "cw_project_plan";
|
|
|
+ map.put("fileList",fileList);
|
|
|
+ map.put("attachmentId",attachmentId);
|
|
|
+ map.put("attachmentFlag",attachmentFlag);
|
|
|
+ map.put("currentToken", TokenProvider.getCurrentToken ( ));
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).saveOrUpdateFileList(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return ResponseEntity.ok("保存成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有的任务阶段
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<String> getTaskPhase() {
|
|
|
+ List<String> data = cwProjectRecordsMapper.getTaskPhase();
|
|
|
+ //去重
|
|
|
+ List<String> uniqueData = new ArrayList<>(new LinkedHashSet<>(data));
|
|
|
+ // 对去重后的数据进行排序
|
|
|
+ List<String> sortedUniqueData = uniqueData.stream().sorted().collect(Collectors.toList());
|
|
|
+ return sortedUniqueData;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取项目计划详情
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<CwProjectPlanDetails> getPlanDetails() {
|
|
|
+ List<CwProjectPlanDetails> list=cwProjectRecordsMapper.getPlanDetails();
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|