|
@ -11,9 +11,11 @@ import com.easy.admin.auth.model.SysUser; |
|
|
import com.easy.admin.auth.service.SysUserService; |
|
|
import com.easy.admin.auth.service.SysUserService; |
|
|
import com.easy.admin.common.core.common.select.Select; |
|
|
import com.easy.admin.common.core.common.select.Select; |
|
|
import com.easy.admin.common.core.exception.EasyException; |
|
|
import com.easy.admin.common.core.exception.EasyException; |
|
|
|
|
|
import com.easy.admin.common.util.CommonUtils; |
|
|
import com.easy.admin.modules.huzhou.common.HuzhouCommonUtils; |
|
|
import com.easy.admin.modules.huzhou.common.HuzhouCommonUtils; |
|
|
import com.easy.admin.modules.huzhou.common.TemplateExcelUtils; |
|
|
import com.easy.admin.modules.huzhou.common.TemplateExcelUtils; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouProcessinfoMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouProcessinfoMapper; |
|
|
|
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouProjectinfoHistoryMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouProjectinfoMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouProjectinfoMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouSubProjectinfoMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouSubProjectinfoMapper; |
|
|
import com.easy.admin.modules.huzhou.entity.*; |
|
|
import com.easy.admin.modules.huzhou.entity.*; |
|
@ -60,8 +62,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
@Autowired |
|
|
@Autowired |
|
|
private HuzhouSubProjectinfoMapper subProjectinfoMapper; |
|
|
private HuzhouSubProjectinfoMapper subProjectinfoMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private HuzhouProcessinfoMapper processinfoMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IHuzhouUserprojectService userprojectService; |
|
|
private IHuzhouUserprojectService userprojectService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IWorkflowService workflowService; |
|
|
private IWorkflowService workflowService; |
|
@ -70,20 +70,20 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IHuzhouProcessinfoService processinfoService; |
|
|
private IHuzhouProcessinfoService processinfoService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IHuzhouFieldchangehistoryService fieldchangehistoryService; |
|
|
private HuzhouProjectinfoHistoryMapper historyMapper; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public void submitProject(HuzhouProjectinfo info) { |
|
|
public void submitProject(HuzhouProjectinfo info) { |
|
|
//保存项目信息
|
|
|
//保存项目信息
|
|
|
info.setStage("1");//最开始的状态。项目入库中
|
|
|
info.setStage("1");//最开始的状态。项目入库中
|
|
|
this.save(info);//保存项目信息
|
|
|
this.save(info);//保存项目信息
|
|
|
userprojectService.saveFromProject(info,"0"); |
|
|
userprojectService.saveFromProject(info,"0");//保存项目联系人信息,0表示当前醒目是主项目
|
|
|
WorkFlow workFlow = workflowService.createFlow("creatProjectinfo",info.getId());//创建流程
|
|
|
WorkFlow workFlow = workflowService.createFlow("creatProjectinfo",info.getId());//创建流程
|
|
|
} |
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public void batchImportProjects(MultipartFile multipartFile) throws Exception { |
|
|
public void batchImportProjects(MultipartFile multipartFile) throws Exception { |
|
|
|
|
|
//是否有文件
|
|
|
if (multipartFile == null && multipartFile.getSize() == 0) { |
|
|
if (multipartFile == null && multipartFile.getSize() == 0) { |
|
|
throw new EasyException("文件上传错误,重新上传"); |
|
|
throw new EasyException("文件上传错误,重新上传"); |
|
|
} |
|
|
} |
|
@ -92,6 +92,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
if (!(filename.endsWith(".xls") || filename.endsWith(".xlsx"))) { |
|
|
if (!(filename.endsWith(".xls") || filename.endsWith(".xlsx"))) { |
|
|
throw new EasyException("文件上传格式有误,请重新上传"); |
|
|
throw new EasyException("文件上传格式有误,请重新上传"); |
|
|
} |
|
|
} |
|
|
|
|
|
//获取表格文件内的信息
|
|
|
InputStream inputStream = multipartFile.getInputStream(); |
|
|
InputStream inputStream = multipartFile.getInputStream(); |
|
|
Workbook workbook = null; |
|
|
Workbook workbook = null; |
|
|
if (filename.endsWith(".xlsx")) { |
|
|
if (filename.endsWith(".xlsx")) { |
|
@ -105,9 +106,9 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
HashMap<String, String> NameMap = new HashMap<String, String>(); |
|
|
HashMap<String, String> NameMap = new HashMap<String, String>(); |
|
|
HashMap<String, String> chineseNameMap = new HashMap<String, String>(); |
|
|
HashMap<String, String> chineseNameMap = new HashMap<String, String>(); |
|
|
|
|
|
|
|
|
Row titlerow = sheet.getRow(0); |
|
|
Row titlerow = sheet.getRow(0);//第一行字段名称
|
|
|
Row chineseTitlerow = sheet.getRow(1); |
|
|
Row chineseTitlerow = sheet.getRow(1); //第二行中文标题
|
|
|
int cellNum = 32; |
|
|
int cellNum = 32;//一共32列
|
|
|
//第一行获取字段名称
|
|
|
//第一行获取字段名称
|
|
|
for (int i = 0; i < cellNum; i++) { |
|
|
for (int i = 0; i < cellNum; i++) { |
|
|
NameMap.put(String.valueOf(i),titlerow.getCell(i).getStringCellValue()); |
|
|
NameMap.put(String.valueOf(i),titlerow.getCell(i).getStringCellValue()); |
|
@ -117,13 +118,14 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
chineseNameMap.put(String.valueOf(i),chineseTitlerow.getCell(i).getStringCellValue()); |
|
|
chineseNameMap.put(String.valueOf(i),chineseTitlerow.getCell(i).getStringCellValue()); |
|
|
} |
|
|
} |
|
|
for (int i = 2; i < physicalNumberOfRows; i++) { |
|
|
for (int i = 2; i < physicalNumberOfRows; i++) { |
|
|
Row row = sheet.getRow(i); |
|
|
Row row = sheet.getRow(i);//获取行的数据
|
|
|
HuzhouProjectinfo huzhouProjectinfo = new HuzhouProjectinfo(); |
|
|
HuzhouProjectinfo huzhouProjectinfo = new HuzhouProjectinfo(); |
|
|
for (int j = 1; j < cellNum; j++) { |
|
|
for (int j = 1; j < cellNum; j++) { |
|
|
String value = ""; |
|
|
String value = ""; |
|
|
|
|
|
//根据行,获取当前行,列的数据
|
|
|
if(row.getCell(j)!=null){ |
|
|
if(row.getCell(j)!=null){ |
|
|
row.getCell(j).setCellType(CellType.STRING); |
|
|
row.getCell(j).setCellType(CellType.STRING);//设置列的数据格式为字符串
|
|
|
value = row.getCell(j).getStringCellValue(); |
|
|
value = row.getCell(j).getStringCellValue();//获取列的数据
|
|
|
} |
|
|
} |
|
|
//管理人员入库必输字段不做校验
|
|
|
//管理人员入库必输字段不做校验
|
|
|
// if(j<=19&&(value==null||value.length()==0)){
|
|
|
// if(j<=19&&(value==null||value.length()==0)){
|
|
@ -133,8 +135,9 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
String name = NameMap.get(String.valueOf(j)); |
|
|
String name = NameMap.get(String.valueOf(j)); |
|
|
//所属任务
|
|
|
//所属任务
|
|
|
if("reformName".equals(name)){ |
|
|
if("reformName".equals(name)){ |
|
|
List<Select> reformTasks = sysDictService.selectByDictType("reformTasks"); |
|
|
List<Select> reformTasks = sysDictService.selectByDictType("reformTasks");//获取字典列表
|
|
|
String dictValue = null; |
|
|
String dictValue = null; |
|
|
|
|
|
//根据值获取名称
|
|
|
for (Select dict:reformTasks) { |
|
|
for (Select dict:reformTasks) { |
|
|
if(dict.getLabel().equals(value)){ |
|
|
if(dict.getLabel().equals(value)){ |
|
|
dictValue=dict.getValue(); |
|
|
dictValue=dict.getValue(); |
|
@ -192,25 +195,14 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
value = user.getId(); |
|
|
value = user.getId(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//保存字段的数据到huzhouProjectinfo
|
|
|
HuzhouCommonUtils.setObjectAttributes(huzhouProjectinfo,name,value); |
|
|
HuzhouCommonUtils.setObjectAttributes(huzhouProjectinfo,name,value); |
|
|
} |
|
|
} |
|
|
huzhouProjectinfo.setStage("0");//待入库
|
|
|
huzhouProjectinfo.setStage("0");//设置阶段为待入库
|
|
|
huzhouProjectinfos.add(huzhouProjectinfo); |
|
|
huzhouProjectinfos.add(huzhouProjectinfo); |
|
|
this.save(huzhouProjectinfo); |
|
|
this.save(huzhouProjectinfo);//添加到数据库
|
|
|
userprojectService.saveFromProject(huzhouProjectinfo,"0"); |
|
|
userprojectService.saveFromProject(huzhouProjectinfo,"0");//保存联系人
|
|
|
} |
|
|
} |
|
|
// WorkFlow workFlow = workflowService.createFlow("creatProjectinfo",null);
|
|
|
|
|
|
// String processInstanceId = workFlow.getProcessInstanceId();
|
|
|
|
|
|
// String businessKey = workFlow.getBusinessKey();
|
|
|
|
|
|
// for (HuzhouProjectinfo p :huzhouProjectinfos) {
|
|
|
|
|
|
// HuzhouProcessinfo huzhouProcessinfo = new HuzhouProcessinfo();
|
|
|
|
|
|
// huzhouProcessinfo.setBusinesskey(businessKey);
|
|
|
|
|
|
// huzhouProcessinfo.setProcessName("creatProjectinfo");//该项目的第一个流程
|
|
|
|
|
|
// huzhouProcessinfo.setProcessinstanceid(processInstanceId);
|
|
|
|
|
|
// huzhouProcessinfo.setProjectid(p.getId());
|
|
|
|
|
|
// huzhouProcessinfo.setProcessstatus("1");
|
|
|
|
|
|
// processinfoService.save(huzhouProcessinfo);
|
|
|
|
|
|
// }
|
|
|
|
|
|
} |
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
@ -221,7 +213,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
String projectid = projectApproveOV.getProjectid(); |
|
|
String projectid = projectApproveOV.getProjectid(); |
|
|
String flag = projectApproveOV.getFlag(); |
|
|
String flag = projectApproveOV.getFlag(); |
|
|
String isEdit = projectApproveOV.getIsEdit(); |
|
|
String isEdit = projectApproveOV.getIsEdit(); |
|
|
List<HuzhouProjectinfo> projectArr = projectApproveOV.getProjectArr(); |
|
|
|
|
|
//单个入库项目可以编辑,发起人编辑
|
|
|
//单个入库项目可以编辑,发起人编辑
|
|
|
if("1".equals(isEdit)&&"1".equals(flag)){ |
|
|
if("1".equals(isEdit)&&"1".equals(flag)){ |
|
|
if(null!=projectinfo){ |
|
|
if(null!=projectinfo){ |
|
@ -249,27 +240,32 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
// return Result.ok("作废成功!");
|
|
|
// return Result.ok("作废成功!");
|
|
|
//
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
//流程结束了
|
|
|
|
|
|
String processInstanceId = workFlow.getProcessInstanceId(); |
|
|
String processInstanceId = workFlow.getProcessInstanceId(); |
|
|
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
if(processInstance==null&&"1".equals(flag)){ |
|
|
if(processInstance==null&&"1".equals(flag)){ |
|
|
if(projectArr!=null){ |
|
|
//流程结束了,变更状态
|
|
|
//说明是批量导入项目,查询所有批量导入项目信息
|
|
|
|
|
|
List<HuzhouProcessinfo> huzhouProcessinfoList = processinfoService.getListByInstid(processInstanceId); |
|
|
|
|
|
for (HuzhouProcessinfo item:huzhouProcessinfoList) { |
|
|
|
|
|
String id = item.getProjectid(); |
|
|
|
|
|
processinfoService.modifyStatusByProjectId(id,"2","creatProjectinfo"); |
|
|
|
|
|
this.modifyStageById(id,"2"); |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
processinfoService.modifyStatusByProjectId(projectid,"2","creatProjectinfo"); |
|
|
processinfoService.modifyStatusByProjectId(projectid,"2","creatProjectinfo"); |
|
|
this.modifyStageById(projectid,"2"); |
|
|
this.modifyStageById(projectid,"2"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void modifyProjectInfoContact(HuzhouProjectinfo huzhouProjectinfo) { |
|
|
|
|
|
//查询之前的项目信息进行保存留痕
|
|
|
|
|
|
HuzhouProjectinfo historyData = getById(huzhouProjectinfo.getId()); |
|
|
|
|
|
HuzhouProjectinfoHistory huzhouProjectinfoHistory = new HuzhouProjectinfoHistory(); |
|
|
|
|
|
BeanUtils.copyProperties(historyData,huzhouProjectinfoHistory); |
|
|
|
|
|
historyMapper.insert(huzhouProjectinfoHistory); |
|
|
|
|
|
//更新项目的联系人
|
|
|
|
|
|
this.updateById(huzhouProjectinfo); |
|
|
|
|
|
userprojectService.removeByProjectId(huzhouProjectinfo.getId(),"0"); |
|
|
|
|
|
userprojectService.saveFromProject(huzhouProjectinfo,"0"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void modifyStageById(String id, String stage) { |
|
|
public void modifyStageById(String id, String stage) { |
|
|
HuzhouProjectinfo byId = getById(id); |
|
|
HuzhouProjectinfo byId = getById(id); |
|
|
|
|
|
//byId不为null 是主项目,为null是子项目
|
|
|
if(null!=byId){ |
|
|
if(null!=byId){ |
|
|
LambdaUpdateWrapper<HuzhouProjectinfo> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
LambdaUpdateWrapper<HuzhouProjectinfo> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
updateWrapper.eq(HuzhouProjectinfo::getId,id); |
|
|
updateWrapper.eq(HuzhouProjectinfo::getId,id); |
|
@ -281,35 +277,13 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
updateWrapper.set(HuzhouSubProjectinfo::getStage,stage); |
|
|
updateWrapper.set(HuzhouSubProjectinfo::getStage,stage); |
|
|
subProjectinfoMapper.update(null,updateWrapper); |
|
|
subProjectinfoMapper.update(null,updateWrapper); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void modifyismodifyById(String id, String ismodify) { |
|
|
|
|
|
LambdaUpdateWrapper<HuzhouProjectinfo> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
|
|
updateWrapper.eq(HuzhouProjectinfo::getId,id); |
|
|
|
|
|
// updateWrapper.set(HuzhouProjectinfo::getIsmodify,ismodify);
|
|
|
|
|
|
this.update(updateWrapper); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public IPage<HuzhouProjectinfo> getProjectInfoPageList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer pageSize) { |
|
|
public IPage<HuzhouProjectinfo> getProjectInfoPageList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer pageSize) { |
|
|
Page page = new Page(pageNo, pageSize); |
|
|
Page page = new Page(pageNo, pageSize); |
|
|
SysUser currentUser = ShiroUtil.getCurrentUser(); |
|
|
|
|
|
List<SysRole> roleList = currentUser.getRoleList(); |
|
|
|
|
|
Map<String, String> stringStringMap = new HashMap<>(); |
|
|
|
|
|
String roles = ""; |
|
|
|
|
|
for (SysRole role:roleList |
|
|
|
|
|
) { |
|
|
|
|
|
roles = role.getCode()+","+roles; |
|
|
|
|
|
} |
|
|
|
|
|
if(roles.contains("manageOrg")||roles.contains("sys:admin")){ |
|
|
|
|
|
|
|
|
|
|
|
}else if(roles.contains("supervisor")){ |
|
|
|
|
|
projectinfo.setSupervisorContactor(currentUser.getId()); |
|
|
|
|
|
}else { |
|
|
|
|
|
projectinfo.setProjectContacts(currentUser.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
Page<HuzhouProjectinfo> projectInfoPageList = projectinfoMapper.getProjectInfoPageList(page, projectinfo); |
|
|
Page<HuzhouProjectinfo> projectInfoPageList = projectinfoMapper.getProjectInfoPageList(page, projectinfo); |
|
|
return projectInfoPageList; |
|
|
return projectInfoPageList; |
|
|
} |
|
|
} |
|
@ -317,103 +291,52 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
@Override |
|
|
@Override |
|
|
public IPage<HuzhouProjectinfoOV> getProjectInfoAndChildPageList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer pageSize) { |
|
|
public IPage<HuzhouProjectinfoOV> getProjectInfoAndChildPageList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer pageSize) { |
|
|
Page page = new Page(pageNo, pageSize); |
|
|
Page page = new Page(pageNo, pageSize); |
|
|
SysUser currentUser = ShiroUtil.getCurrentUser(); |
|
|
projectinfo = CommonUtils.setGetProjectInfoAuth(projectinfo); |
|
|
List<SysRole> roleList = currentUser.getRoleList(); |
|
|
Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page,projectinfo); |
|
|
Map<String, String> stringStringMap = new HashMap<>(); |
|
|
List<HuzhouProjectinfoOV> records = projectAndChildInfoPageList.getRecords(); |
|
|
String roles = ""; |
|
|
records.forEach(item->{ |
|
|
for (SysRole role:roleList |
|
|
item.setMissingSubprojects(false);//设置默认是false
|
|
|
) { |
|
|
double subTotalMoney =0;//子项目的总金额
|
|
|
roles = role.getCode()+","+roles; |
|
|
List<HuzhouSubProjectinfo> subProjectinfoList = item.getChildren(); |
|
|
} |
|
|
if (subProjectinfoList.size()>0){ |
|
|
if(roles.contains("manageOrg")||roles.contains("sys:admin")){ |
|
|
subTotalMoney= subProjectinfoList.stream().mapToDouble(HuzhouProjectinfo::getTotalMoney).sum();//计算子项目总金额总和
|
|
|
|
|
|
Double totalMoney = item.getTotalMoney(); |
|
|
}else if(roles.contains("supervisor")){ |
|
|
if(subTotalMoney!=0&&totalMoney!=subTotalMoney){ |
|
|
projectinfo.setSupervisorContactor(currentUser.getId()); |
|
|
item.setMissingSubprojects(true);//子项目金额总和和主项目不一致
|
|
|
|
|
|
} |
|
|
}else{ |
|
|
}else{ |
|
|
projectinfo.setProjectContacts(currentUser.getId()); |
|
|
//没有子项目
|
|
|
|
|
|
item.setChildren(null); |
|
|
} |
|
|
} |
|
|
Page<HuzhouProjectinfo> projectInfoPageList = projectinfoMapper.getProjectInfoPageList(page, projectinfo); |
|
|
|
|
|
List<HuzhouProjectinfoOV> convertedList = new ArrayList<>(); |
|
|
|
|
|
for (HuzhouProjectinfo info : projectInfoPageList.getRecords()) { |
|
|
|
|
|
double subTotalMoney =0; |
|
|
|
|
|
HuzhouProjectinfoOV projectinfoOV=new HuzhouProjectinfoOV(); |
|
|
|
|
|
BeanUtils.copyProperties(info,projectinfoOV); |
|
|
|
|
|
String projectinfoId = projectinfoOV.getId(); |
|
|
|
|
|
projectinfoOV.setMissingSubprojects(false); |
|
|
|
|
|
LambdaQueryWrapper<HuzhouSubProjectinfo> subProjectinfoqueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
subProjectinfoqueryWrapper.eq(HuzhouSubProjectinfo::getProjectId,projectinfoId); |
|
|
|
|
|
List<HuzhouSubProjectinfo> huzhouSubProjectinfos = subProjectinfoMapper.selectList(subProjectinfoqueryWrapper); |
|
|
|
|
|
//是否有子项目
|
|
|
|
|
|
if(huzhouSubProjectinfos.size()>0){ |
|
|
|
|
|
List<HuzhouProjectinfo> objectList = new ArrayList<>(); |
|
|
|
|
|
huzhouSubProjectinfos.forEach(item->{ |
|
|
|
|
|
HuzhouProjectinfo huzhouProjectinfo = new HuzhouProjectinfo(); |
|
|
|
|
|
BeanUtils.copyProperties(item,huzhouProjectinfo); |
|
|
|
|
|
huzhouProjectinfo = updateProjectinfoField(huzhouProjectinfo); |
|
|
|
|
|
objectList.add(huzhouProjectinfo); |
|
|
|
|
|
}); |
|
|
}); |
|
|
subTotalMoney= objectList.stream().mapToDouble(HuzhouProjectinfo::getTotalMoney).sum(); |
|
|
return projectAndChildInfoPageList; |
|
|
projectinfoOV.setChildren(huzhouSubProjectinfos); |
|
|
|
|
|
// huzhouSubProjectinfos.forEach(item->{
|
|
|
|
|
|
// item.setPlanProcessStatus(getPlanProcessStatus(item.getId()));
|
|
|
|
|
|
// });
|
|
|
|
|
|
} |
|
|
|
|
|
HuzhouProjectinfo updateProjectinfoField = updateProjectinfoField(info); |
|
|
|
|
|
Double totalMoney = updateProjectinfoField.getTotalMoney(); |
|
|
|
|
|
if(subTotalMoney!=0&&totalMoney!=subTotalMoney){ |
|
|
|
|
|
projectinfoOV.setMissingSubprojects(true); |
|
|
|
|
|
} |
|
|
|
|
|
// String planProcessStatus = getPlanProcessStatus(projectinfoOV.getId());
|
|
|
|
|
|
// projectinfoOV.setPlanProcessStatus(planProcessStatus);
|
|
|
|
|
|
convertedList.add(projectinfoOV); |
|
|
|
|
|
} |
|
|
|
|
|
Page<HuzhouProjectinfoOV> newPage = new Page<>(); |
|
|
|
|
|
newPage.setRecords(convertedList); |
|
|
|
|
|
newPage.setTotal(projectInfoPageList.getTotal()); |
|
|
|
|
|
newPage.setCurrent(projectInfoPageList.getCurrent()); |
|
|
|
|
|
newPage.setSize(projectInfoPageList.getSize()); |
|
|
|
|
|
return newPage; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<HuzhouProjectinfo> getProjectInfoList(HuzhouProjectinfo projectinfo) { |
|
|
public void batchdownloadProject(HttpServletResponse response, HuzhouProjectinfo projectinfo) { |
|
|
LambdaQueryWrapper<HuzhouProjectinfo> huzhouProjectinfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
//查询主项目的信息
|
|
|
String projectName = projectinfo.getProjectName(); |
|
|
List<HuzhouProjectinfo> projectinfoList = projectinfoMapper.getProjectInfoPageList(projectinfo); |
|
|
String projectId =projectinfo.getId(); |
|
|
|
|
|
String stage = projectinfo.getStage(); |
|
|
|
|
|
huzhouProjectinfoLambdaQueryWrapper.like(StringUtils.isNotBlank(projectName),HuzhouProjectinfo::getProjectName,projectName); |
|
|
|
|
|
huzhouProjectinfoLambdaQueryWrapper.like(StringUtils.isNotBlank(projectId),HuzhouProjectinfo::getId,projectId); |
|
|
|
|
|
huzhouProjectinfoLambdaQueryWrapper.ge(StringUtils.isNotBlank(stage),HuzhouProjectinfo::getStage,stage); |
|
|
|
|
|
List<HuzhouProjectinfo> projectinfoList = this.list(huzhouProjectinfoLambdaQueryWrapper); |
|
|
|
|
|
for(int i =0;i<projectinfoList.size();i++){ |
|
|
for(int i =0;i<projectinfoList.size();i++){ |
|
|
HuzhouProjectinfo huzhouProjectinfo = projectinfoList.get(i); |
|
|
HuzhouProjectinfo huzhouProjectinfo = projectinfoList.get(i); |
|
|
|
|
|
//查询是否有子项目
|
|
|
LambdaQueryWrapper<HuzhouSubProjectinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<HuzhouSubProjectinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
queryWrapper.eq(HuzhouSubProjectinfo::getProjectId,huzhouProjectinfo.getId()); |
|
|
queryWrapper.eq(HuzhouSubProjectinfo::getProjectId,huzhouProjectinfo.getId()); |
|
|
List<HuzhouSubProjectinfo> huzhouSubProjectinfos = subProjectinfoMapper.selectList(queryWrapper); |
|
|
List<HuzhouSubProjectinfo> huzhouSubProjectinfos = subProjectinfoMapper.selectList(queryWrapper); |
|
|
if(huzhouSubProjectinfos.size()>0){ |
|
|
if(huzhouSubProjectinfos.size()>0){ |
|
|
|
|
|
//有子项目就添加到当前列表中
|
|
|
List<HuzhouProjectinfo> collect = huzhouSubProjectinfos.stream().map(sub -> { |
|
|
List<HuzhouProjectinfo> collect = huzhouSubProjectinfos.stream().map(sub -> { |
|
|
HuzhouProjectinfo projectInfo = new HuzhouProjectinfo(); |
|
|
HuzhouProjectinfo projectInfo = new HuzhouProjectinfo(); |
|
|
BeanUtils.copyProperties(sub, projectInfo); |
|
|
BeanUtils.copyProperties(sub, projectInfo); |
|
|
return projectInfo; |
|
|
return projectInfo; |
|
|
}).collect(Collectors.toList()); |
|
|
}).collect(Collectors.toList()); |
|
|
projectinfoList.addAll(i+1,collect); |
|
|
projectinfoList.addAll(i+1,collect); |
|
|
|
|
|
//索引增加
|
|
|
i+=collect.size(); |
|
|
i+=collect.size(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return projectinfoList; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void batchdownloadProject(HttpServletResponse response, HuzhouProjectinfo projectinfo) { |
|
|
|
|
|
List<HuzhouProjectinfo> projectInfoList = getProjectInfoList(projectinfo); |
|
|
|
|
|
try { |
|
|
try { |
|
|
projectInfoList.forEach(item->{ |
|
|
//因为查询结果中有些字段是字典值,要转化成字典的中文
|
|
|
item = updateProjectinfoField(item); |
|
|
projectinfoList.forEach(item->{ |
|
|
List<Select> reformTasks = sysDictService.selectByDictType("reformTasks"); |
|
|
List<Select> reformTasks = sysDictService.selectByDictType("reformTasks"); |
|
|
String dictValue = null; |
|
|
String dictValue = null; |
|
|
for (Select dict:reformTasks) { |
|
|
for (Select dict:reformTasks) { |
|
@ -445,7 +368,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
Method method1 = clazz.getMethod(setName, String.class); |
|
|
Method method1 = clazz.getMethod(setName, String.class); |
|
|
method1.invoke(item,realname); |
|
|
method1.invoke(item,realname); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
@ -453,8 +375,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
TemplateExcelUtils.downLoadExcel("项目入库导出模板", "项目入库导出模板.xlsx", projectInfoList, response); |
|
|
TemplateExcelUtils.downLoadExcel("项目入库导出模板", "项目入库导出模板.xlsx", projectinfoList, response); |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw new RuntimeException(e); |
|
|
throw new RuntimeException(e); |
|
|
} |
|
|
} |
|
@ -464,91 +385,38 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
@Override |
|
|
@Override |
|
|
public Object queryProjectInfoById(String id) { |
|
|
public Object queryProjectInfoById(String id) { |
|
|
HuzhouProjectinfo projectinfo = getById(id); |
|
|
HuzhouProjectinfo projectinfo = getById(id); |
|
|
//说明是子项目
|
|
|
//projectinfo为空说明是子项目
|
|
|
if(null==projectinfo){ |
|
|
if(null==projectinfo){ |
|
|
HuzhouSubProjectinfo huzhouSubProjectinfo = subProjectinfoMapper.selectById(id); |
|
|
HuzhouSubProjectinfo huzhouSubProjectinfo = subProjectinfoMapper.selectById(id); |
|
|
return huzhouSubProjectinfo; |
|
|
return huzhouSubProjectinfo; |
|
|
} |
|
|
} |
|
|
return projectinfo; |
|
|
return projectinfo; |
|
|
} |
|
|
} |
|
|
@Override |
|
|
|
|
|
public Object queryProjectInfoNewDataById(String id) { |
|
|
|
|
|
HuzhouProjectinfo projectinfo = getById(id); |
|
|
|
|
|
//说明是子项目
|
|
|
|
|
|
if(null==projectinfo){ |
|
|
|
|
|
HuzhouSubProjectinfo huzhouSubProjectinfo = subProjectinfoMapper.selectById(id); |
|
|
|
|
|
HuzhouProjectinfo huzhouProjectinfo = new HuzhouProjectinfo(); |
|
|
|
|
|
BeanUtils.copyProperties(huzhouSubProjectinfo,huzhouProjectinfo); |
|
|
|
|
|
huzhouProjectinfo = updateProjectinfoField(huzhouProjectinfo); |
|
|
|
|
|
return huzhouProjectinfo; |
|
|
|
|
|
}else{ |
|
|
|
|
|
projectinfo = updateProjectinfoField(projectinfo); |
|
|
|
|
|
} |
|
|
|
|
|
return projectinfo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** 暂时无用 |
|
|
* 查询当前项目是否已经发起流程计划 |
|
|
* 查询当前项目是否已经发起流程计划 |
|
|
* @param id |
|
|
* @param |
|
|
* @return 2 计划的审批流程已完成 1 是流程中, 0 是未发起流程 |
|
|
* @return 2 计划的审批流程已完成 1 是流程中, 0 是未发起流程 |
|
|
*/ |
|
|
*/ |
|
|
private String getPlanProcessStatus(String id){ |
|
|
// private String getPlanProcessStatus(String id){
|
|
|
LambdaQueryWrapper<HuzhouProcessinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
// LambdaQueryWrapper<HuzhouProcessinfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo"); |
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo");
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"1"); |
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"1");
|
|
|
List<HuzhouProcessinfo> huzhouProcessinfos = processinfoMapper.selectList(queryWrapper); |
|
|
// List<HuzhouProcessinfo> huzhouProcessinfos = processinfoMapper.selectList(queryWrapper);
|
|
|
if(huzhouProcessinfos.size()>0){ |
|
|
// if(huzhouProcessinfos.size()>0){
|
|
|
return "1"; |
|
|
// return "1";
|
|
|
} |
|
|
// }
|
|
|
queryWrapper.clear(); |
|
|
// queryWrapper.clear();
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProjectid,id); |
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProjectid,id);
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo"); |
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo");
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"2"); |
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"2");
|
|
|
huzhouProcessinfos = processinfoMapper.selectList(queryWrapper); |
|
|
// huzhouProcessinfos = processinfoMapper.selectList(queryWrapper);
|
|
|
if(huzhouProcessinfos.size()>0){ |
|
|
// if(huzhouProcessinfos.size()>0){
|
|
|
return "2"; |
|
|
// return "2";
|
|
|
} |
|
|
// }
|
|
|
return "0"; |
|
|
// return "0";
|
|
|
} |
|
|
// }
|
|
|
public HuzhouProjectinfo updateProjectinfoField(HuzhouProjectinfo huzhouProjectinfo){ |
|
|
|
|
|
String id = huzhouProjectinfo.getId(); |
|
|
|
|
|
List<HuzhouFieldchangehistory> fieldchangeList= fieldchangehistoryService.getFieldchangeListByprojectid(id); |
|
|
|
|
|
if(fieldchangeList.size()>0){ |
|
|
|
|
|
Collections.reverse(fieldchangeList); |
|
|
|
|
|
for (HuzhouFieldchangehistory field:fieldchangeList |
|
|
|
|
|
) { |
|
|
|
|
|
String fieldValue = field.getFieldValue(); |
|
|
|
|
|
try { |
|
|
|
|
|
HuzhouCommonUtils.setObjectAttributes(huzhouProjectinfo,fieldValue,field.getNewvalue()); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException("更新字段数据出错了"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return huzhouProjectinfo; |
|
|
|
|
|
} |
|
|
|
|
|
public HuzhouSubProjectinfo updateProjectinfoField(HuzhouSubProjectinfo huzhouSubProjectinfo){ |
|
|
|
|
|
String id = huzhouSubProjectinfo.getId(); |
|
|
|
|
|
HuzhouProjectinfo huzhouProjectinfo = new HuzhouProjectinfo(); |
|
|
|
|
|
BeanUtils.copyProperties(huzhouSubProjectinfo,huzhouProjectinfo); |
|
|
|
|
|
List<HuzhouFieldchangehistory> fieldchangeList= fieldchangehistoryService.getFieldchangeListByprojectid(id); |
|
|
|
|
|
if(fieldchangeList.size()>0){ |
|
|
|
|
|
Collections.reverse(fieldchangeList); |
|
|
|
|
|
for (HuzhouFieldchangehistory field:fieldchangeList |
|
|
|
|
|
) { |
|
|
|
|
|
String fieldValue = field.getFieldValue(); |
|
|
|
|
|
try { |
|
|
|
|
|
HuzhouCommonUtils.setObjectAttributes(huzhouProjectinfo,fieldValue,field.getNewvalue()); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException("更新字段数据出错了"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
BeanUtils.copyProperties(huzhouProjectinfo,huzhouSubProjectinfo); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
return huzhouSubProjectinfo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|