|
|
@ -11,9 +11,11 @@ import com.easy.admin.auth.model.SysUser; |
|
|
|
import com.easy.admin.auth.service.SysUserService; |
|
|
|
import com.easy.admin.common.core.common.select.Select; |
|
|
|
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.TemplateExcelUtils; |
|
|
|
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.HuzhouSubProjectinfoMapper; |
|
|
|
import com.easy.admin.modules.huzhou.entity.*; |
|
|
@ -60,8 +62,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
@Autowired |
|
|
|
private HuzhouSubProjectinfoMapper subProjectinfoMapper; |
|
|
|
@Autowired |
|
|
|
private HuzhouProcessinfoMapper processinfoMapper; |
|
|
|
@Autowired |
|
|
|
private IHuzhouUserprojectService userprojectService; |
|
|
|
@Autowired |
|
|
|
private IWorkflowService workflowService; |
|
|
@ -70,20 +70,20 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
@Autowired |
|
|
|
private IHuzhouProcessinfoService processinfoService; |
|
|
|
@Autowired |
|
|
|
private IHuzhouFieldchangehistoryService fieldchangehistoryService; |
|
|
|
|
|
|
|
private HuzhouProjectinfoHistoryMapper historyMapper; |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void submitProject(HuzhouProjectinfo info) { |
|
|
|
//保存项目信息
|
|
|
|
info.setStage("1");//最开始的状态。项目入库中
|
|
|
|
this.save(info);//保存项目信息
|
|
|
|
userprojectService.saveFromProject(info,"0"); |
|
|
|
userprojectService.saveFromProject(info,"0");//保存项目联系人信息,0表示当前醒目是主项目
|
|
|
|
WorkFlow workFlow = workflowService.createFlow("creatProjectinfo",info.getId());//创建流程
|
|
|
|
} |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void batchImportProjects(MultipartFile multipartFile) throws Exception { |
|
|
|
//是否有文件
|
|
|
|
if (multipartFile == null && multipartFile.getSize() == 0) { |
|
|
|
throw new EasyException("文件上传错误,重新上传"); |
|
|
|
} |
|
|
@ -92,6 +92,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
if (!(filename.endsWith(".xls") || filename.endsWith(".xlsx"))) { |
|
|
|
throw new EasyException("文件上传格式有误,请重新上传"); |
|
|
|
} |
|
|
|
//获取表格文件内的信息
|
|
|
|
InputStream inputStream = multipartFile.getInputStream(); |
|
|
|
Workbook workbook = null; |
|
|
|
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> chineseNameMap = new HashMap<String, String>(); |
|
|
|
|
|
|
|
Row titlerow = sheet.getRow(0); |
|
|
|
Row chineseTitlerow = sheet.getRow(1); |
|
|
|
int cellNum = 32; |
|
|
|
Row titlerow = sheet.getRow(0);//第一行字段名称
|
|
|
|
Row chineseTitlerow = sheet.getRow(1); //第二行中文标题
|
|
|
|
int cellNum = 32;//一共32列
|
|
|
|
//第一行获取字段名称
|
|
|
|
for (int i = 0; i < cellNum; i++) { |
|
|
|
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()); |
|
|
|
} |
|
|
|
for (int i = 2; i < physicalNumberOfRows; i++) { |
|
|
|
Row row = sheet.getRow(i); |
|
|
|
Row row = sheet.getRow(i);//获取行的数据
|
|
|
|
HuzhouProjectinfo huzhouProjectinfo = new HuzhouProjectinfo(); |
|
|
|
for (int j = 1; j < cellNum; j++) { |
|
|
|
String value = ""; |
|
|
|
//根据行,获取当前行,列的数据
|
|
|
|
if(row.getCell(j)!=null){ |
|
|
|
row.getCell(j).setCellType(CellType.STRING); |
|
|
|
value = row.getCell(j).getStringCellValue(); |
|
|
|
row.getCell(j).setCellType(CellType.STRING);//设置列的数据格式为字符串
|
|
|
|
value = row.getCell(j).getStringCellValue();//获取列的数据
|
|
|
|
} |
|
|
|
//管理人员入库必输字段不做校验
|
|
|
|
// 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)); |
|
|
|
//所属任务
|
|
|
|
if("reformName".equals(name)){ |
|
|
|
List<Select> reformTasks = sysDictService.selectByDictType("reformTasks"); |
|
|
|
List<Select> reformTasks = sysDictService.selectByDictType("reformTasks");//获取字典列表
|
|
|
|
String dictValue = null; |
|
|
|
//根据值获取名称
|
|
|
|
for (Select dict:reformTasks) { |
|
|
|
if(dict.getLabel().equals(value)){ |
|
|
|
dictValue=dict.getValue(); |
|
|
@ -192,25 +195,14 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
value = user.getId(); |
|
|
|
} |
|
|
|
} |
|
|
|
//保存字段的数据到huzhouProjectinfo
|
|
|
|
HuzhouCommonUtils.setObjectAttributes(huzhouProjectinfo,name,value); |
|
|
|
} |
|
|
|
huzhouProjectinfo.setStage("0");//待入库
|
|
|
|
huzhouProjectinfo.setStage("0");//设置阶段为待入库
|
|
|
|
huzhouProjectinfos.add(huzhouProjectinfo); |
|
|
|
this.save(huzhouProjectinfo); |
|
|
|
userprojectService.saveFromProject(huzhouProjectinfo,"0"); |
|
|
|
this.save(huzhouProjectinfo);//添加到数据库
|
|
|
|
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 |
|
|
|
@Transactional |
|
|
@ -221,7 +213,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
String projectid = projectApproveOV.getProjectid(); |
|
|
|
String flag = projectApproveOV.getFlag(); |
|
|
|
String isEdit = projectApproveOV.getIsEdit(); |
|
|
|
List<HuzhouProjectinfo> projectArr = projectApproveOV.getProjectArr(); |
|
|
|
//单个入库项目可以编辑,发起人编辑
|
|
|
|
if("1".equals(isEdit)&&"1".equals(flag)){ |
|
|
|
if(null!=projectinfo){ |
|
|
@ -249,27 +240,32 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
// return Result.ok("作废成功!");
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
//流程结束了
|
|
|
|
String processInstanceId = workFlow.getProcessInstanceId(); |
|
|
|
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
|
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"); |
|
|
|
this.modifyStageById(projectid,"2"); |
|
|
|
} |
|
|
|
//流程结束了,变更状态
|
|
|
|
processinfoService.modifyStatusByProjectId(projectid,"2","creatProjectinfo"); |
|
|
|
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 |
|
|
|
public void modifyStageById(String id, String stage) { |
|
|
|
HuzhouProjectinfo byId = getById(id); |
|
|
|
//byId不为null 是主项目,为null是子项目
|
|
|
|
if(null!=byId){ |
|
|
|
LambdaUpdateWrapper<HuzhouProjectinfo> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(HuzhouProjectinfo::getId,id); |
|
|
@ -281,35 +277,13 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
updateWrapper.set(HuzhouSubProjectinfo::getStage,stage); |
|
|
|
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 |
|
|
|
public IPage<HuzhouProjectinfo> getProjectInfoPageList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer 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); |
|
|
|
return projectInfoPageList; |
|
|
|
} |
|
|
@ -317,103 +291,52 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
@Override |
|
|
|
public IPage<HuzhouProjectinfoOV> getProjectInfoAndChildPageList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer 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); |
|
|
|
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(); |
|
|
|
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); |
|
|
|
projectinfo = CommonUtils.setGetProjectInfoAuth(projectinfo); |
|
|
|
Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page,projectinfo); |
|
|
|
List<HuzhouProjectinfoOV> records = projectAndChildInfoPageList.getRecords(); |
|
|
|
records.forEach(item->{ |
|
|
|
item.setMissingSubprojects(false);//设置默认是false
|
|
|
|
double subTotalMoney =0;//子项目的总金额
|
|
|
|
List<HuzhouSubProjectinfo> subProjectinfoList = item.getChildren(); |
|
|
|
if (subProjectinfoList.size()>0){ |
|
|
|
subTotalMoney= subProjectinfoList.stream().mapToDouble(HuzhouProjectinfo::getTotalMoney).sum();//计算子项目总金额总和
|
|
|
|
Double totalMoney = item.getTotalMoney(); |
|
|
|
if(subTotalMoney!=0&&totalMoney!=subTotalMoney){ |
|
|
|
item.setMissingSubprojects(true);//子项目金额总和和主项目不一致
|
|
|
|
} |
|
|
|
}else{ |
|
|
|
//没有子项目
|
|
|
|
item.setChildren(null); |
|
|
|
} |
|
|
|
// 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; |
|
|
|
}); |
|
|
|
return projectAndChildInfoPageList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<HuzhouProjectinfo> getProjectInfoList(HuzhouProjectinfo projectinfo) { |
|
|
|
LambdaQueryWrapper<HuzhouProjectinfo> huzhouProjectinfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
String projectName = projectinfo.getProjectName(); |
|
|
|
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); |
|
|
|
public void batchdownloadProject(HttpServletResponse response, HuzhouProjectinfo projectinfo) { |
|
|
|
//查询主项目的信息
|
|
|
|
List<HuzhouProjectinfo> projectinfoList = projectinfoMapper.getProjectInfoPageList(projectinfo); |
|
|
|
for(int i =0;i<projectinfoList.size();i++){ |
|
|
|
HuzhouProjectinfo huzhouProjectinfo = projectinfoList.get(i); |
|
|
|
//查询是否有子项目
|
|
|
|
LambdaQueryWrapper<HuzhouSubProjectinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(HuzhouSubProjectinfo::getProjectId,huzhouProjectinfo.getId()); |
|
|
|
List<HuzhouSubProjectinfo> huzhouSubProjectinfos = subProjectinfoMapper.selectList(queryWrapper); |
|
|
|
if(huzhouSubProjectinfos.size()>0){ |
|
|
|
//有子项目就添加到当前列表中
|
|
|
|
List<HuzhouProjectinfo> collect = huzhouSubProjectinfos.stream().map(sub -> { |
|
|
|
HuzhouProjectinfo projectInfo = new HuzhouProjectinfo(); |
|
|
|
BeanUtils.copyProperties(sub, projectInfo); |
|
|
|
return projectInfo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
projectinfoList.addAll(i+1,collect); |
|
|
|
//索引增加
|
|
|
|
i+=collect.size(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return projectinfoList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void batchdownloadProject(HttpServletResponse response, HuzhouProjectinfo projectinfo) { |
|
|
|
List<HuzhouProjectinfo> projectInfoList = getProjectInfoList(projectinfo); |
|
|
|
try { |
|
|
|
projectInfoList.forEach(item->{ |
|
|
|
item = updateProjectinfoField(item); |
|
|
|
//因为查询结果中有些字段是字典值,要转化成字典的中文
|
|
|
|
projectinfoList.forEach(item->{ |
|
|
|
List<Select> reformTasks = sysDictService.selectByDictType("reformTasks"); |
|
|
|
String dictValue = null; |
|
|
|
for (Select dict:reformTasks) { |
|
|
@ -445,7 +368,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
Method method1 = clazz.getMethod(setName, String.class); |
|
|
|
method1.invoke(item,realname); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} 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) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
@ -464,91 +385,38 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
|
@Override |
|
|
|
public Object queryProjectInfoById(String id) { |
|
|
|
HuzhouProjectinfo projectinfo = getById(id); |
|
|
|
//说明是子项目
|
|
|
|
//projectinfo为空说明是子项目
|
|
|
|
if(null==projectinfo){ |
|
|
|
HuzhouSubProjectinfo huzhouSubProjectinfo = subProjectinfoMapper.selectById(id); |
|
|
|
return huzhouSubProjectinfo; |
|
|
|
} |
|
|
|
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 是未发起流程 |
|
|
|
*/ |
|
|
|
private String getPlanProcessStatus(String id){ |
|
|
|
LambdaQueryWrapper<HuzhouProcessinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo"); |
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"1"); |
|
|
|
List<HuzhouProcessinfo> huzhouProcessinfos = processinfoMapper.selectList(queryWrapper); |
|
|
|
if(huzhouProcessinfos.size()>0){ |
|
|
|
return "1"; |
|
|
|
} |
|
|
|
queryWrapper.clear(); |
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProjectid,id); |
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo"); |
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"2"); |
|
|
|
huzhouProcessinfos = processinfoMapper.selectList(queryWrapper); |
|
|
|
if(huzhouProcessinfos.size()>0){ |
|
|
|
return "2"; |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
// private String getPlanProcessStatus(String id){
|
|
|
|
// LambdaQueryWrapper<HuzhouProcessinfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo");
|
|
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"1");
|
|
|
|
// List<HuzhouProcessinfo> huzhouProcessinfos = processinfoMapper.selectList(queryWrapper);
|
|
|
|
// if(huzhouProcessinfos.size()>0){
|
|
|
|
// return "1";
|
|
|
|
// }
|
|
|
|
// queryWrapper.clear();
|
|
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProjectid,id);
|
|
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessName,"createPlaninfo");
|
|
|
|
// queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"2");
|
|
|
|
// huzhouProcessinfos = processinfoMapper.selectList(queryWrapper);
|
|
|
|
// if(huzhouProcessinfos.size()>0){
|
|
|
|
// return "2";
|
|
|
|
// }
|
|
|
|
// return "0";
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|