|
@@ -1,14 +1,30 @@
|
|
|
package com.jeeplus.modules.ruralprojectrecords.web;
|
|
|
|
|
|
+import com.jeeplus.common.config.Global;
|
|
|
import com.jeeplus.common.persistence.Page;
|
|
|
+import com.jeeplus.common.utils.MyBeanUtils;
|
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
|
import com.jeeplus.common.web.BaseController;
|
|
|
+import com.jeeplus.modules.historical.entity.HistoricalData;
|
|
|
+import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.service.ProjectcontentinfoService;
|
|
|
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
|
|
|
import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecordsReported;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectcontentinfo;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralReportConsultant;
|
|
|
import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageAllService;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
|
|
|
import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
|
|
|
+import com.jeeplus.modules.sys.entity.MainDictDetail;
|
|
|
import com.jeeplus.modules.sys.entity.User;
|
|
|
import com.jeeplus.modules.sys.service.UserService;
|
|
|
+import com.jeeplus.modules.sys.utils.DictUtils;
|
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
+import com.jeeplus.modules.workstaff.entity.WorkStaffCertificate;
|
|
|
import jersey.repackaged.com.google.common.collect.Lists;
|
|
|
import org.activiti.engine.HistoryService;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
@@ -19,9 +35,11 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -41,6 +59,12 @@ public class RuralProjectMessageAllController extends BaseController {
|
|
|
protected HistoryService historyService;
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectcontentinfoService projectcontentinfoService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectReportDataService projectReportDataService;
|
|
|
+ @Autowired
|
|
|
+ private RuralProjectMessageService ruralProjectMessageService;
|
|
|
|
|
|
@ModelAttribute
|
|
|
public RuralProjectRecords get(@RequestParam(required=false) String id) {
|
|
@@ -94,5 +118,258 @@ public class RuralProjectMessageAllController extends BaseController {
|
|
|
Map<String, List> map = ruralProjectMessageAllService.getProjectList(projectRecords, request, response);
|
|
|
return map;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * admin跳转修改报告页面
|
|
|
+ * @param projectcontentinfo
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @param model
|
|
|
+ * @param attr
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = {"adminEditForm"})
|
|
|
+ public String adminEditForm(RuralProjectcontentinfo projectcontentinfo, HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes attr) {
|
|
|
+ RuralProjectRecords projectRecords=new RuralProjectRecords();
|
|
|
+ if (null!=projectcontentinfo.getProjectId()){
|
|
|
+ projectRecords = projectRecordsService.get(projectcontentinfo.getProjectId());
|
|
|
+ model.addAttribute("projectRecords", projectRecords);
|
|
|
+ }
|
|
|
+ Projectcontentinfo projectcontentinfo1 = projectcontentinfoService.getByProjectId(projectcontentinfo.getProjectId());
|
|
|
+ if (null ==projectcontentinfo1){
|
|
|
+ model.addAttribute("projectReportData",null);
|
|
|
+ return "modules/ruralprojectrecords/view/reportView";
|
|
|
+ }
|
|
|
+ ProjectReportData projectReportData = projectReportDataService.getOnRural(projectcontentinfo1.getInfoId());
|
|
|
+ if (null ==projectReportData){
|
|
|
+ model.addAttribute("projectReportData",null);
|
|
|
+ return "modules/ruralprojectrecords/view/reportView";
|
|
|
+ }
|
|
|
+ projectReportData = projectReportDataService.get(projectReportData.getId());
|
|
|
+ RuralProjectRecords ruralProjectRecords = projectRecordsService.getQueryProjectUsers(projectcontentinfo1.getProject().getId());
|
|
|
+ Projectcontentinfo projectcontent = projectcontentinfoService.getByInfoId(projectReportData.getId());
|
|
|
+ projectcontent.setProjectReportData(projectReportData);
|
|
|
+ RuralProjectcontentinfo ruralProjectcontentinfo = projectRecordsService.formAccessory(projectRecords);
|
|
|
+ projectRecordsService.disposeData(ruralProjectcontentinfo);
|
|
|
+ projectcontent.setFileAttachmentList(ruralProjectcontentinfo.getFileAttachmentList());
|
|
|
+ projectcontent.setFileGistdataList(ruralProjectcontentinfo.getFileGistdataList());
|
|
|
+ projectcontent.setFileOtherList(ruralProjectcontentinfo.getFileOtherList());
|
|
|
+ //根据条件查询附件必填项
|
|
|
+ ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
|
|
|
+ //添加项目类型
|
|
|
+ relateInfo.setAttachmentProjectType(ruralProjectRecords.getProjectType());
|
|
|
+ relateInfo.setAttachmentProjectSort(ruralProjectRecords.getAttachmentProjectSort());
|
|
|
+ //判断是否为打包项目,打包项目无需查看项目送审金额是否为500w以上判定
|
|
|
+ String money=ruralProjectRecords.getSubmitMoney();
|
|
|
+ Integer approvalMoney=null;
|
|
|
+ if(StringUtils.isBlank(money)){
|
|
|
+ approvalMoney=1;
|
|
|
+ }else{
|
|
|
+ approvalMoney=Integer.parseInt(money);
|
|
|
+ }
|
|
|
+ switch (approvalMoney){
|
|
|
+ case 0:
|
|
|
+ //金额为0
|
|
|
+ relateInfo.setAttachmentProjectApprovalMoney(null);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ //500w以下金额状态
|
|
|
+ relateInfo.setAttachmentProjectApprovalMoney("1");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //500w以上金额状态
|
|
|
+ relateInfo.setAttachmentProjectApprovalMoney("2");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //添加报告类型
|
|
|
+ relateInfo.setRequiredStage(1);
|
|
|
+ relateInfo.setId(ruralProjectRecords.getId());
|
|
|
+ List<RuralReportConsultant> consultants = com.google.common.collect.Lists.newArrayList();
|
|
|
+ //将自己添加到咨询员数据中
|
|
|
+ //根据用户查询技能信息
|
|
|
+ RuralReportConsultant currentConsultant = new RuralReportConsultant();
|
|
|
+ List<WorkStaffCertificate> userCertificateList = com.google.common.collect.Lists.newArrayList();
|
|
|
+ if(StringUtils.isNotBlank(ruralProjectRecords.getProjectMasterId())){
|
|
|
+ userCertificateList = ruralProjectMessageService.getCertificateByUser(ruralProjectRecords.getProjectMasterId());
|
|
|
+ }
|
|
|
+ //获取专业类型
|
|
|
+ List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("certificate_major");
|
|
|
+ for (WorkStaffCertificate certificateInfo: userCertificateList) {
|
|
|
+ currentConsultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
+ currentConsultant.setZhucezigezhKey(certificateInfo.getName());
|
|
|
+ for (MainDictDetail type : certificateMajor) {
|
|
|
+ if(certificateInfo.getMajor().equals(type.getValue())){
|
|
|
+ currentConsultant.setMajor(type.getLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ User currentUser=userService.get(ruralProjectRecords.getProjectMasterId());
|
|
|
+ currentConsultant.setZixunyuanName(currentUser.getName());
|
|
|
+ currentConsultant.setZixunyuan(currentUser.getId());
|
|
|
+ currentConsultant.setRole("负责人");
|
|
|
+ consultants.add(currentConsultant);
|
|
|
+ }
|
|
|
+ //查询总审人员信息
|
|
|
+ RuralReportConsultant bzshbConsultant = new RuralReportConsultant();
|
|
|
+ //根据项目id查找报告咨询员信息
|
|
|
+ List<RuralReportConsultant> consultantList = ruralProjectMessageService.getConsultantsList(projectcontentinfo.getProjectId());
|
|
|
+ //使用迭代器去除重复信息
|
|
|
+ //排除 重新申请|撤销
|
|
|
+ Iterator<RuralReportConsultant> it = consultantList.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ RuralReportConsultant consultant = it.next();
|
|
|
+ if(consultant.getZixunyuan().equals(currentConsultant.getZixunyuan())){
|
|
|
+ try {
|
|
|
+ MyBeanUtils.copyBeanNotNull2Bean(consultant, currentConsultant);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ it.remove();
|
|
|
+ }else{
|
|
|
+ //根据用户查询技能信息
|
|
|
+ List<WorkStaffCertificate> certificateList = ruralProjectMessageService.getCertificateByUser(consultant.getZixunyuan());
|
|
|
+ for (WorkStaffCertificate certificateInfo: certificateList) {
|
|
|
+ if(certificateInfo.getName().equals(consultant.getZhucezigezhKey())){
|
|
|
+ consultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
+ }
|
|
|
+ for (MainDictDetail type : certificateMajor) {
|
|
|
+ if(certificateInfo.getMajor().equals(type.getValue())){
|
|
|
+ consultant.setMajor(type.getLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ User user=userService.get(consultant.getZixunyuan());
|
|
|
+ consultant.setRole("咨询员");
|
|
|
+ consultant.setZixunyuanName(user.getName());
|
|
|
+ if(consultant.getZixunyuan().equals(projectReportData.getBzshbUserId())){
|
|
|
+ bzshbConsultant = consultant;
|
|
|
+ bzshbConsultant.setZixunyuanName("陈红星("+consultant.getZixunyuanName()+"代)");
|
|
|
+ bzshbConsultant.setRole("技术负责人");
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ consultants.addAll(consultantList);
|
|
|
|
|
|
+ if(StringUtils.isNotBlank(bzshbConsultant.getZixunyuan())){
|
|
|
+ consultants.add(bzshbConsultant);
|
|
|
+ }else{
|
|
|
+ //查询总审人员信息
|
|
|
+ bzshbConsultant = new RuralReportConsultant();
|
|
|
+ List<WorkStaffCertificate> bzshbCertificateList = com.google.common.collect.Lists.newArrayList();
|
|
|
+ if(StringUtils.isNotBlank(ruralProjectRecords.getProjectMasterId())){
|
|
|
+ bzshbCertificateList = ruralProjectMessageService.getCertificateByUser(projectReportData.getBzshbUserId());
|
|
|
+ }
|
|
|
+ for (WorkStaffCertificate certificateInfo: bzshbCertificateList) {
|
|
|
+ bzshbConsultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
+ bzshbConsultant.setZhucezigezhKey(certificateInfo.getName());
|
|
|
+ for (MainDictDetail dictType : certificateMajor) {
|
|
|
+ if(certificateInfo.getMajor().equals(dictType.getValue())){
|
|
|
+ bzshbConsultant.setMajor(dictType.getLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ User bzshbUser=userService.get(projectReportData.getBzshbUserId());
|
|
|
+ bzshbConsultant.setZixunyuanName(bzshbUser.getName());
|
|
|
+ bzshbConsultant.setZixunyuan(bzshbUser.getId());
|
|
|
+ consultants.add(bzshbConsultant);
|
|
|
+ }
|
|
|
+ Iterator<RuralReportConsultant> itView = consultants.iterator();
|
|
|
+ while(itView.hasNext()){
|
|
|
+ RuralReportConsultant consultant = itView.next();
|
|
|
+ if(bzshbCertificateList.size()>0){
|
|
|
+ if(consultant.getZixunyuan().equals(bzshbConsultant.getZixunyuan())){
|
|
|
+ try {
|
|
|
+ MyBeanUtils.copyBeanNotNull2Bean(consultant, bzshbConsultant);
|
|
|
+ bzshbConsultant.setZixunyuanName("陈红星("+bzshbConsultant.getZixunyuanName()+"代)");
|
|
|
+ bzshbConsultant.setRole("技术负责人");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ itView.remove();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(consultant.getZixunyuan().equals(projectReportData.getBzshbUserId())){
|
|
|
+ try {
|
|
|
+ MyBeanUtils.copyBeanNotNull2Bean(consultant, bzshbConsultant);
|
|
|
+ bzshbConsultant.setZixunyuanName("陈红星("+bzshbConsultant.getZixunyuanName()+"代)");
|
|
|
+ bzshbConsultant.setRole("技术负责人");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ itView.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(bzshbConsultant.getZixunyuan())){
|
|
|
+ consultants.add(bzshbConsultant);
|
|
|
+ }else{
|
|
|
+ User user=userService.get(projectReportData.getBzshbUserId());
|
|
|
+ bzshbConsultant.setZixunyuanName("陈红星("+user.getName()+"代)");
|
|
|
+ bzshbConsultant.setZixunyuan(user.getId());
|
|
|
+ bzshbConsultant.setRole("技术负责人");
|
|
|
+ consultants.add(bzshbConsultant);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询总审人员信息
|
|
|
+ List<User> auditUserList = userService.getAuditUserList();
|
|
|
+ ruralProjectRecords.setBzshbUserList(auditUserList);
|
|
|
+ model.addAttribute("processInstanceId",projectReportData.getProcessInstanceId());
|
|
|
+ model.addAttribute("projectReportData",projectReportData);
|
|
|
+ model.addAttribute("projectId", projectcontentinfo1.getProject().getId());
|
|
|
+ model.addAttribute("project", projectcontentinfo1.getProject());
|
|
|
+ model.addAttribute("reportedId", projectcontentinfo.getReportedId());
|
|
|
+ model.addAttribute("projectRecords", ruralProjectRecords);
|
|
|
+ model.addAttribute("id", projectcontentinfo.getId());
|
|
|
+ model.addAttribute("projectcontentinfo", projectcontent);
|
|
|
+ model.addAttribute("consultantinfo", consultants);
|
|
|
+ //获取是否含有上报信息
|
|
|
+ RuralProjectRecordsReported reported = ruralProjectMessageService.getRuralProjectRecordsReportedById(projectcontentinfo.getReportedId());
|
|
|
+ if(null != reported){
|
|
|
+ model.addAttribute("reportedView", 1);
|
|
|
+ }
|
|
|
+ List<MainDictDetail> achievementTypes = DictUtils.getMainDictList("achievement_type");
|
|
|
+ if(null != achievementTypes){
|
|
|
+ for (MainDictDetail achievementType:achievementTypes) {
|
|
|
+ if(achievementType.getValue().equals(projectReportData.getAchievementType())){
|
|
|
+ projectReportData.setAchievementType(achievementType.getLabel());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "modules/ruralprojectrecords/ruralporjectmessage/all/adminReportEditFormAlls";
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * admin修改报告信息
|
|
|
+ * @param projectcontentinfo
|
|
|
+ * @param model
|
|
|
+ * @param redirectAttributes
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = {"adminModifyReport"})
|
|
|
+ public String adminModifyReport(Projectcontentinfo projectcontentinfo,HttpServletRequest request, Model model,RedirectAttributes redirectAttributes) {
|
|
|
+ try{
|
|
|
+ String toJson = ruralProjectMessageService.getReportToJson(projectcontentinfo);
|
|
|
+ HistoricalData historicalData = new HistoricalData();
|
|
|
+ historicalData.setDataType("1");
|
|
|
+ historicalData.setDataId(projectcontentinfo.getProjectReportData().getId());
|
|
|
+ historicalData.setIp(StringUtils.getRemoteAddr(request));
|
|
|
+ historicalData.setOperator(UserUtils.getUser().getId());
|
|
|
+ historicalData.setDataObj(toJson);
|
|
|
+ String str = ruralProjectMessageService.adminModifyReport(projectcontentinfo,historicalData);
|
|
|
+ addMessage(redirectAttributes, "修改报告"+(str.equals("true")?"成功":"失败"));
|
|
|
+ ProjectReportData projectReportData = projectcontentinfo.getProjectReportData();
|
|
|
+ if (projectReportData!=null){
|
|
|
+ if (StringUtils.isNotBlank(projectcontentinfo.getEdit()) && projectcontentinfo.getEdit().equals("edit")){
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectMessageAll/?repage";
|
|
|
+ }
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectMessageAll/?repage";
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.error("ProjectcontentinfoController save Exception e"+e);
|
|
|
+ }
|
|
|
+ if(UserUtils.isManager()){
|
|
|
+ model.addAttribute("flag","1");
|
|
|
+ }
|
|
|
+ addMessage(redirectAttributes, "修改报告失败");
|
|
|
+ ProjectRecords projectRecords = projectcontentinfo.getProject()==null?new ProjectRecords():projectcontentinfo.getProject();
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectMessageAll/?repage";
|
|
|
+ }
|
|
|
}
|