Enford il y a 5 ans
Parent
commit
37ce49a330
100 fichiers modifiés avec 23042 ajouts et 0 suppressions
  1. 24 0
      src/main/java/com/jeeplus/modules/workdailyroutine/dao/WorkDailyRoutineDao.java
  2. 20 0
      src/main/java/com/jeeplus/modules/workdailyroutine/dao/WorkDailyRoutineDetailDao.java
  3. 146 0
      src/main/java/com/jeeplus/modules/workdailyroutine/entity/WorkDailyRoutine.java
  4. 76 0
      src/main/java/com/jeeplus/modules/workdailyroutine/entity/WorkDailyRoutineDetail.java
  5. 95 0
      src/main/java/com/jeeplus/modules/workdailyroutine/service/WorkDailyRoutineDetailService.java
  6. 204 0
      src/main/java/com/jeeplus/modules/workdailyroutine/service/WorkDailyRoutineService.java
  7. 281 0
      src/main/java/com/jeeplus/modules/workdailyroutine/web/WorkDailyRoutineController.java
  8. 23 0
      src/main/java/com/jeeplus/modules/workdevicerecord/dao/WorkDeviceRecordDao.java
  9. 21 0
      src/main/java/com/jeeplus/modules/workdevicerecord/dao/WorkDeviceXjRecordDao.java
  10. 95 0
      src/main/java/com/jeeplus/modules/workdevicerecord/entity/WorkDeviceRecord.java
  11. 65 0
      src/main/java/com/jeeplus/modules/workdevicerecord/entity/WorkDeviceXjRecord.java
  12. 59 0
      src/main/java/com/jeeplus/modules/workdevicerecord/service/WorkDeviceRecordService.java
  13. 74 0
      src/main/java/com/jeeplus/modules/workdevicerecord/service/WorkDeviceXjRecordService.java
  14. 192 0
      src/main/java/com/jeeplus/modules/workdevicerecord/web/WorkDeviceRecordController.java
  15. 212 0
      src/main/java/com/jeeplus/modules/workdevicerecord/web/WorkDeviceXjRecordController.java
  16. 21 0
      src/main/java/com/jeeplus/modules/workeffect/dao/WorkEffectDao.java
  17. 112 0
      src/main/java/com/jeeplus/modules/workeffect/entity/WorkEffect.java
  18. 42 0
      src/main/java/com/jeeplus/modules/workeffect/entity/WorkEffectExcel.java
  19. 98 0
      src/main/java/com/jeeplus/modules/workeffect/service/WorkEffectService.java
  20. 295 0
      src/main/java/com/jeeplus/modules/workeffect/web/WorkEffectController.java
  21. 24 0
      src/main/java/com/jeeplus/modules/workeffectdetail/dao/WorkEffectDetailDao.java
  22. 85 0
      src/main/java/com/jeeplus/modules/workeffectdetail/entity/WorkEffectDetail.java
  23. 56 0
      src/main/java/com/jeeplus/modules/workeffectdetail/service/WorkEffectDetailService.java
  24. 197 0
      src/main/java/com/jeeplus/modules/workeffectdetail/web/WorkEffectDetailController.java
  25. 19 0
      src/main/java/com/jeeplus/modules/workengineeringprice/dao/WorkEngineeringPriceDao.java
  26. 117 0
      src/main/java/com/jeeplus/modules/workengineeringprice/entity/WorkEngineeringPrice.java
  27. 53 0
      src/main/java/com/jeeplus/modules/workengineeringprice/service/WorkEngineeringPriceService.java
  28. 196 0
      src/main/java/com/jeeplus/modules/workengineeringprice/web/WorkEngineeringPriceController.java
  29. 70 0
      src/main/java/com/jeeplus/modules/workengineeringproject/dao/WorkEngineeringProjectDao.java
  30. 691 0
      src/main/java/com/jeeplus/modules/workengineeringproject/entity/WorkEngineeringProject.java
  31. 129 0
      src/main/java/com/jeeplus/modules/workengineeringproject/entity/WorkProjectPlan.java
  32. 30 0
      src/main/java/com/jeeplus/modules/workengineeringproject/entity/WorkProjectPlanEdit.java
  33. 1196 0
      src/main/java/com/jeeplus/modules/workengineeringproject/service/WorkEngineeringProjectService.java
  34. 1394 0
      src/main/java/com/jeeplus/modules/workengineeringproject/web/WorkEngineeringProjectController.java
  35. 481 0
      src/main/java/com/jeeplus/modules/workengineeringproject/web/WorkEngineeringRecordController.java
  36. 511 0
      src/main/java/com/jeeplus/modules/workengineeringproject/web/WorkProjectManagementController.java
  37. 19 0
      src/main/java/com/jeeplus/modules/workevaluationroom/dao/WorkEvaluationRoomDao.java
  38. 86 0
      src/main/java/com/jeeplus/modules/workevaluationroom/entity/WorkEvaluationRoom.java
  39. 50 0
      src/main/java/com/jeeplus/modules/workevaluationroom/service/WorkEvaluationRoomService.java
  40. 210 0
      src/main/java/com/jeeplus/modules/workevaluationroom/web/WorkEvaluationRoomController.java
  41. 40 0
      src/main/java/com/jeeplus/modules/workexample/dao/WorkExampleDao.java
  42. 31 0
      src/main/java/com/jeeplus/modules/workexample/dao/WorkExampleIndicesDao.java
  43. 19 0
      src/main/java/com/jeeplus/modules/workexample/dao/WorkExampleInfoDao.java
  44. 46 0
      src/main/java/com/jeeplus/modules/workexample/entity/ExcelList.java
  45. 660 0
      src/main/java/com/jeeplus/modules/workexample/entity/WorkExample.java
  46. 49 0
      src/main/java/com/jeeplus/modules/workexample/entity/WorkExampleExcel.java
  47. 145 0
      src/main/java/com/jeeplus/modules/workexample/entity/WorkExampleIndices.java
  48. 144 0
      src/main/java/com/jeeplus/modules/workexample/entity/WorkExampleInfo.java
  49. 436 0
      src/main/java/com/jeeplus/modules/workexample/service/WorkExampleIndicesService.java
  50. 1062 0
      src/main/java/com/jeeplus/modules/workexample/service/WorkExampleService.java
  51. 671 0
      src/main/java/com/jeeplus/modules/workexample/web/ImportExampleController.java
  52. 613 0
      src/main/java/com/jeeplus/modules/workexample/web/WorkExampleController.java
  53. 583 0
      src/main/java/com/jeeplus/modules/workexample/web/WorkExampleIndicesController.java
  54. 208 0
      src/main/java/com/jeeplus/modules/workexample/web/WorkExampleInfoController.java
  55. 97 0
      src/main/java/com/jeeplus/modules/workexample/web/WorkExamplesController.java
  56. 19 0
      src/main/java/com/jeeplus/modules/workexampleimplog/dao/WorkExampleImplogDao.java
  57. 151 0
      src/main/java/com/jeeplus/modules/workexampleimplog/entity/WorkExampleImplog.java
  58. 50 0
      src/main/java/com/jeeplus/modules/workexampleimplog/service/WorkExampleImplogService.java
  59. 198 0
      src/main/java/com/jeeplus/modules/workexampleimplog/web/WorkExampleImplogController.java
  60. 21 0
      src/main/java/com/jeeplus/modules/workexplore/dao/WorkExploreDao.java
  61. 37 0
      src/main/java/com/jeeplus/modules/workexplore/entity/WorkExplore.java
  62. 55 0
      src/main/java/com/jeeplus/modules/workexplore/service/WorkExploreService.java
  63. 202 0
      src/main/java/com/jeeplus/modules/workexplore/web/WorkExploreController.java
  64. 42 0
      src/main/java/com/jeeplus/modules/workfield/dao/WorkFieldDao.java
  65. 240 0
      src/main/java/com/jeeplus/modules/workfield/entity/WorkField.java
  66. 750 0
      src/main/java/com/jeeplus/modules/workfield/service/WorkFieldService.java
  67. 367 0
      src/main/java/com/jeeplus/modules/workfield/web/WorkFieldController.java
  68. 31 0
      src/main/java/com/jeeplus/modules/workfullconstructsheet/dao/WorkFullConstructsheetDao.java
  69. 248 0
      src/main/java/com/jeeplus/modules/workfullconstructsheet/entity/WorkFullConstructsheet.java
  70. 667 0
      src/main/java/com/jeeplus/modules/workfullconstructsheet/service/WorkFullConstructsheetService.java
  71. 504 0
      src/main/java/com/jeeplus/modules/workfullconstructsheet/web/WorkFullConstructsheetController.java
  72. 31 0
      src/main/java/com/jeeplus/modules/workfulldesignchange/dao/WorkFullDesignchangeDao.java
  73. 258 0
      src/main/java/com/jeeplus/modules/workfulldesignchange/entity/WorkFullDesignchange.java
  74. 664 0
      src/main/java/com/jeeplus/modules/workfulldesignchange/service/WorkFullDesignchangeService.java
  75. 512 0
      src/main/java/com/jeeplus/modules/workfulldesignchange/web/WorkFullDesignchangeController.java
  76. 37 0
      src/main/java/com/jeeplus/modules/workfullexecute/dao/WorkFullExecuteDao.java
  77. 259 0
      src/main/java/com/jeeplus/modules/workfullexecute/entity/WorkFullExecute.java
  78. 767 0
      src/main/java/com/jeeplus/modules/workfullexecute/service/WorkFullExecuteService.java
  79. 555 0
      src/main/java/com/jeeplus/modules/workfullexecute/web/WorkFullExecuteController.java
  80. 18 0
      src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullConstructDao.java
  81. 18 0
      src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullDesignDao.java
  82. 53 0
      src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullManageDao.java
  83. 56 0
      src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullPayDao.java
  84. 40 0
      src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullRecordDao.java
  85. 18 0
      src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullSurveyDao.java
  86. 57 0
      src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullConstruct.java
  87. 57 0
      src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullDesign.java
  88. 795 0
      src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullManage.java
  89. 227 0
      src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullPay.java
  90. 413 0
      src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullRecord.java
  91. 57 0
      src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullSurvey.java
  92. 49 0
      src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullConstructService.java
  93. 49 0
      src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullDesignService.java
  94. 468 0
      src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullManageService.java
  95. 616 0
      src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullPayService.java
  96. 335 0
      src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullRecordService.java
  97. 49 0
      src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullSurveyService.java
  98. 214 0
      src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullConstructController.java
  99. 215 0
      src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullDesignController.java
  100. 0 0
      src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullManageController.java

+ 24 - 0
src/main/java/com/jeeplus/modules/workdailyroutine/dao/WorkDailyRoutineDao.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdailyroutine.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutine;
+
+import java.util.List;
+
+/**
+ * 日常事务DAO接口
+ * @author ssrh
+ * @version 2018-07-11
+ */
+@MyBatisDao
+public interface WorkDailyRoutineDao extends CrudDao<WorkDailyRoutine> {
+
+
+    void updateStatusById(WorkDailyRoutine workDailyRoutine);
+
+    List<WorkDailyRoutine> findBySourceId(String sourceId);
+}

+ 20 - 0
src/main/java/com/jeeplus/modules/workdailyroutine/dao/WorkDailyRoutineDetailDao.java

@@ -0,0 +1,20 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdailyroutine.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutineDetail;
+
+/**
+ * 日常事务DAO接口
+ * @author ssrh
+ * @version 2018-07-11
+ */
+@MyBatisDao
+public interface WorkDailyRoutineDetailDao extends CrudDao<WorkDailyRoutineDetail> {
+
+
+    Integer countUndone(WorkDailyRoutineDetail select);
+}

+ 146 - 0
src/main/java/com/jeeplus/modules/workdailyroutine/entity/WorkDailyRoutine.java

@@ -0,0 +1,146 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdailyroutine.entity;
+
+import java.util.Date;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.modules.sys.entity.Office;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+
+/**
+ * 日常事务Entity
+ * @author ssrh
+ * @version 2018-07-11
+ */
+public class WorkDailyRoutine extends DataEntity<WorkDailyRoutine> {
+	
+	private static final long serialVersionUID = 1L;
+    public static final String ATTACHMENT_TYPE = "105";
+    private String name;		// 事务名称
+	private String source;		// 事务来源
+	private String status;		// 事务状态
+	private Office office;		// 部门
+	private Office company;		// 公司
+	private Date beginCreateDate;		// 开始 创建时间
+	private Date endCreateDate;		// 结束 创建时间
+    private List<WorkDailyRoutineDetail> detailList;
+    private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
+    private String sourceId;
+    private String sOr;
+    private String subStatus;
+
+	public WorkDailyRoutine() {
+		super();
+	}
+
+	public WorkDailyRoutine(String id){
+		super(id);
+	}
+
+	@ExcelField(title="事务名称", align=2, sort=7)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@ExcelField(title="事务来源", align=2, sort=8)
+	public String getSource() {
+		return source;
+	}
+
+	public void setSource(String source) {
+		this.source = source;
+	}
+	
+	@ExcelField(title="事务状态", align=2, sort=9)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+	@ExcelField(title="部门", align=2, sort=10)
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+	
+	@ExcelField(title="公司", align=2, sort=11)
+	public Office getCompany() {
+		return company;
+	}
+
+	public void setCompany(Office company) {
+		this.company = company;
+	}
+	
+	public Date getBeginCreateDate() {
+		return beginCreateDate;
+	}
+
+	public void setBeginCreateDate(Date beginCreateDate) {
+		this.beginCreateDate = beginCreateDate;
+	}
+	
+	public Date getEndCreateDate() {
+		return endCreateDate;
+	}
+
+	public void setEndCreateDate(Date endCreateDate) {
+		this.endCreateDate = endCreateDate;
+	}
+
+    public List<WorkDailyRoutineDetail> getDetailList() {
+        return detailList;
+    }
+
+    public void setDetailList(List<WorkDailyRoutineDetail> detailList) {
+        this.detailList = detailList;
+    }
+
+    public List<WorkClientAttachment> getWorkAttachments() {
+        return workAttachments;
+    }
+
+    public void setWorkAttachments(List<WorkClientAttachment> workAttachments) {
+        this.workAttachments = workAttachments;
+    }
+
+    public String getSourceId() {
+        return sourceId;
+    }
+
+    public void setSourceId(String sourceId) {
+        this.sourceId = sourceId;
+    }
+
+    public String getsOr() {
+        return sOr;
+    }
+
+    public void setsOr(String sOr) {
+        this.sOr = sOr;
+    }
+
+    public String getSubStatus() {
+        return subStatus;
+    }
+
+    public void setSubStatus(String subStatus) {
+        this.subStatus = subStatus;
+    }
+}

+ 76 - 0
src/main/java/com/jeeplus/modules/workdailyroutine/entity/WorkDailyRoutineDetail.java

@@ -0,0 +1,76 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdailyroutine.entity;
+
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Office;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 日常事务Entity
+ * @author ssrh
+ * @version 2018-07-11
+ */
+public class WorkDailyRoutineDetail extends DataEntity<WorkDailyRoutineDetail> {
+	
+	private static final long serialVersionUID = 1L;
+	private WorkDailyRoutine workDailyRoutine;		// 日常事务ID
+	private User operator;		// 负责人
+	private Office office;		// 部门
+	private String status;		// 状态
+    private String home;
+	
+	public WorkDailyRoutineDetail() {
+		super();
+	}
+
+	public WorkDailyRoutineDetail(String id){
+		super(id);
+	}
+
+    public WorkDailyRoutine getWorkDailyRoutine() {
+        return workDailyRoutine;
+    }
+
+    public void setWorkDailyRoutine(WorkDailyRoutine workDailyRoutine) {
+        this.workDailyRoutine = workDailyRoutine;
+    }
+
+    @ExcelField(title="负责人", align=2, sort=2)
+	public User getOperator() {
+		return operator;
+	}
+
+	public void setOperator(User operator) {
+		this.operator = operator;
+	}
+	
+	@ExcelField(title="部门", align=2, sort=3)
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+	
+	@ExcelField(title="状态", align=2, sort=4)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+    public String getHome() {
+        return home;
+    }
+
+    public void setHome(String home) {
+        this.home = home;
+    }
+}

+ 95 - 0
src/main/java/com/jeeplus/modules/workdailyroutine/service/WorkDailyRoutineDetailService.java

@@ -0,0 +1,95 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdailyroutine.service;
+
+import java.util.Date;
+import java.util.List;
+
+import com.jeeplus.common.utils.IdGen;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workdailyroutine.dao.WorkDailyRoutineDao;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutine;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutineDetail;
+import com.jeeplus.modules.workdailyroutine.dao.WorkDailyRoutineDetailDao;
+
+/**
+ * 日常事务Service
+ * @author ssrh
+ * @version 2018-07-11
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkDailyRoutineDetailService extends CrudService<WorkDailyRoutineDetailDao, WorkDailyRoutineDetail> {
+
+    @Autowired
+    private WorkDailyRoutineDao workDailyRoutineDao;
+    @Autowired
+    private WorkClientAttachmentDao workClientAttachmentDao;
+
+	public WorkDailyRoutineDetail get(String id) {
+        WorkDailyRoutineDetail workDailyRoutineDetail = super.get(id);
+        if(workDailyRoutineDetail!=null && workDailyRoutineDetail.getWorkDailyRoutine()!=null && StringUtils.isNotBlank(workDailyRoutineDetail.getWorkDailyRoutine().getId())){
+            workDailyRoutineDetail.setWorkDailyRoutine(workDailyRoutineDao.get(workDailyRoutineDetail.getWorkDailyRoutine().getId()));
+        }
+        return workDailyRoutineDetail;
+	}
+	
+	public List<WorkDailyRoutineDetail> findList(WorkDailyRoutineDetail workDailyRoutineDetail) {
+		return super.findList(workDailyRoutineDetail);
+	}
+	
+	public Page<WorkDailyRoutineDetail> findPage(Page<WorkDailyRoutineDetail> page, WorkDailyRoutineDetail workDailyRoutineDetail) {
+		return super.findPage(page, workDailyRoutineDetail);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkDailyRoutineDetail workDailyRoutineDetail) {
+	    if(workDailyRoutineDetail.getIsNewRecord()) {
+            workDailyRoutineDetail.setId(IdGen.uuid());
+            dao.insert(workDailyRoutineDetail);
+        }else {
+	        dao.update(workDailyRoutineDetail);
+        }
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkDailyRoutineDetail workDailyRoutineDetail) {
+		super.delete(workDailyRoutineDetail);
+	}
+
+    public Integer countUndone(WorkDailyRoutineDetail select) {
+        return dao.countUndone(select);
+    }
+
+    public WorkDailyRoutineDetail getByDailyId(String notifyId) {
+        WorkDailyRoutineDetail select = new WorkDailyRoutineDetail();
+        select.setWorkDailyRoutine(new WorkDailyRoutine(notifyId));
+        select.setOperator(UserUtils.getUser());
+        List<WorkDailyRoutineDetail> list = this.findList(select);
+        if (list==null||list.size()<=0)return null;
+        WorkDailyRoutineDetail workDailyRoutineDetail = list.get(0);
+        if(workDailyRoutineDetail!=null && workDailyRoutineDetail.getWorkDailyRoutine()!=null && StringUtils.isNotBlank(workDailyRoutineDetail.getWorkDailyRoutine().getId())){
+            WorkDailyRoutine workDailyRoutine = workDailyRoutineDao.get(workDailyRoutineDetail.getWorkDailyRoutine().getId());
+            workDailyRoutineDetail.setWorkDailyRoutine(workDailyRoutine);
+            if(workDailyRoutine!=null&&StringUtils.isNotBlank(workDailyRoutine.getId())){
+                WorkClientAttachment attachment = new WorkClientAttachment();
+                attachment.setAttachmentId(workDailyRoutine.getId());
+                workDailyRoutine.setWorkAttachments(workClientAttachmentDao.findList(attachment));
+            }
+            if(workDailyRoutineDetail.getUpdateDate()==null){
+                workDailyRoutineDetail.setUpdateDate(new Date());
+            }
+        }
+        return workDailyRoutineDetail;
+    }
+}

+ 204 - 0
src/main/java/com/jeeplus/modules/workdailyroutine/service/WorkDailyRoutineService.java

@@ -0,0 +1,204 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdailyroutine.service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutineDetail;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutine;
+import com.jeeplus.modules.workdailyroutine.dao.WorkDailyRoutineDao;
+
+/**
+ * 日常事务Service
+ * @author ssrh
+ * @version 2018-07-11
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkDailyRoutineService extends CrudService<WorkDailyRoutineDao, WorkDailyRoutine> {
+    @Autowired
+    private WorkDailyRoutineDetailService routineDetailService;
+    @Autowired
+    private WorkClientAttachmentDao workClientAttachmentDao;
+    @Autowired
+    private WorkProjectNotifyService workProjectNotifyService;
+
+	public WorkDailyRoutine get(String id) {
+        WorkDailyRoutine workDailyRoutine = super.get(id);
+        queryDetails(workDailyRoutine);
+        return workDailyRoutine;
+	}
+
+    public void queryDetails(WorkDailyRoutine workDailyRoutine) {
+        if(workDailyRoutine!=null&& StringUtils.isNotBlank(workDailyRoutine.getId())){
+            WorkClientAttachment attachment = new WorkClientAttachment();
+            attachment.setAttachmentId(workDailyRoutine.getId());
+            workDailyRoutine.setWorkAttachments(workClientAttachmentDao.findList(attachment));
+            WorkDailyRoutineDetail routineDetail = new WorkDailyRoutineDetail();
+            routineDetail.setWorkDailyRoutine(workDailyRoutine);
+            workDailyRoutine.setDetailList(routineDetailService.findList(routineDetail));
+        }
+    }
+
+    public List<WorkDailyRoutine> findList(WorkDailyRoutine workDailyRoutine) {
+        if(!UserUtils.getUser().isAdmin()) {
+            String dataScopeSql = dataScopeFilter(workDailyRoutine.getCurrentUser(), "o", "u", "s", MenuStatusEnum.WORK_DAILYROUTINE.getValue());
+            workDailyRoutine.getSqlMap().put("dsf", dataScopeSql);
+        }
+		return super.findList(workDailyRoutine);
+	}
+	
+	public Page<WorkDailyRoutine> findPage(Page<WorkDailyRoutine> page, WorkDailyRoutine workDailyRoutine) {
+        if(!UserUtils.getUser().isAdmin()) {
+            String dataScopeSql = dataScopeFilter(workDailyRoutine.getCurrentUser(), "o", "u", "s", MenuStatusEnum.WORK_DAILYROUTINE.getValue());
+            workDailyRoutine.getSqlMap().put("dsf", dataScopeSql);
+        }
+		return super.findPage(page, workDailyRoutine);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkDailyRoutine workDailyRoutine) {
+	    if(workDailyRoutine.getOffice()==null){
+	        workDailyRoutine.setOffice(UserUtils.getSelectOffice());
+        }
+        if(workDailyRoutine.getCompany()==null){
+	        workDailyRoutine.setCompany(UserUtils.getSelectCompany());
+        }
+		super.save(workDailyRoutine);
+        this.saveAttachments(workDailyRoutine);
+        List<User> userList = this.saveDetail(workDailyRoutine);
+        if (userList==null||userList.size()<=0){
+            return;
+        }
+        String contentStr = "创建人:"+workDailyRoutine.getCreateBy().getName()+",事务来源:"+ workDailyRoutine.getSource()+",创建时间:"+DateUtils.formatDate(workDailyRoutine.getCreateDate());
+        String titleStr = "事务名称:"+ workDailyRoutine.getName();
+        String remark = "待处理";
+        this.sendMessage(workDailyRoutine,userList,"58",contentStr,titleStr,remark);
+	}
+
+    private void sendMessage(WorkDailyRoutine workDailyRoutine, List<User> userList, String type,String contentStr, String titleStr, String remark) {
+        WorkProjectNotify workProjectNotify = UtilNotify.saveNotify(workDailyRoutine.getId(),null, workDailyRoutine.getCompany().getId(),
+                titleStr, contentStr,type,"0",remark,"");
+        List<String> userIds = new ArrayList<>(userList.size());
+        for (User u : userList){
+            userIds.add(u.getId());
+            workProjectNotify.setUser(u);
+            workProjectNotify.setId("");
+            workProjectNotify.setNotifyRole("");
+            workProjectNotify.setCreateBy(u);
+            workProjectNotify.setUpdateBy(u);
+            workProjectNotifyService .save(workProjectNotify);
+        }
+        UserUtils.pushIm(userIds,contentStr);
+    }
+
+    private List<User> saveDetail(WorkDailyRoutine workDailyRoutine) {
+        if(workDailyRoutine==null||workDailyRoutine.getDetailList()==null){
+            return null;
+        }
+        List<User> userList = new ArrayList<>();
+        for (WorkDailyRoutineDetail routineDetail : workDailyRoutine.getDetailList()) {
+            routineDetail.setWorkDailyRoutine(workDailyRoutine);
+            routineDetail.setOffice(UserUtils.get(routineDetail.getOperator().getId()).getOffice());
+            routineDetail.setStatus("未完成");
+            routineDetailService.save(routineDetail);
+            userList.add(routineDetail.getOperator());
+        }
+        return userList;
+    }
+
+    private void saveAttachments(WorkDailyRoutine workDailyRoutine) {
+	    if(workDailyRoutine==null||workDailyRoutine.getWorkAttachments()== null){
+	        return;
+        }
+        for (WorkClientAttachment workClientAttachment : workDailyRoutine.getWorkAttachments()) {
+            if (workClientAttachment.getId() == null) {
+                continue;
+            }
+            if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())) {
+                workClientAttachment.setAttachmentId(workDailyRoutine.getId());
+                workClientAttachment.setAttachmentFlag(WorkDailyRoutine.ATTACHMENT_TYPE);
+                workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
+                if (StringUtils.isBlank(workClientAttachment.getId()) || "null".equals(workClientAttachment.getId())) {
+                    workClientAttachment.preInsert();
+                    workClientAttachmentDao.insert(workClientAttachment);
+                } else {
+                    workClientAttachment.preUpdate();
+                    workClientAttachmentDao.update(workClientAttachment);
+                }
+            } else {
+                workClientAttachmentDao.delete(workClientAttachment);
+            }
+        }
+    }
+
+    @Transactional(readOnly = false)
+	public void delete(WorkDailyRoutine workDailyRoutine) {
+		super.delete(workDailyRoutine);
+	}
+
+    @Transactional(readOnly = false)
+    public void close(String id) {
+        WorkDailyRoutine workDailyRoutine = new WorkDailyRoutine();
+        workDailyRoutine.setStatus("已关闭");
+        workDailyRoutine.setId(id);
+        dao.updateStatusById(workDailyRoutine);
+        WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+        workProjectNotify.setNotifyId(workDailyRoutine.getId());
+        workProjectNotifyService.readByNotifyId(workProjectNotify);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(WorkDailyRoutineDetail workDailyRoutineDetail) {
+        workDailyRoutineDetail.setStatus("已完成");
+        if(workDailyRoutineDetail.getCreateDate()==null) {
+            workDailyRoutineDetail.setUpdateDate(new Date());
+        }
+        routineDetailService.save(workDailyRoutineDetail);
+        WorkDailyRoutine workDailyRoutine = dao.get(workDailyRoutineDetail.getWorkDailyRoutine().getId());
+        if("已关闭".equals(workDailyRoutine.getStatus())||"已完成".equals(workDailyRoutine.getStatus())){
+            return;
+        }
+        WorkDailyRoutineDetail select = new WorkDailyRoutineDetail();
+        select.setWorkDailyRoutine(workDailyRoutine);
+        select.setStatus("未完成");
+        Integer count = routineDetailService.countUndone(select);
+        if(count==null||count==0){
+            workDailyRoutine.setStatus("已完成");
+            dao.updateStatusById(workDailyRoutine);
+        }
+        WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+        workProjectNotify.setNotifyId(workDailyRoutine.getId());
+        workProjectNotify.setUser(workDailyRoutineDetail.getOperator());
+        workProjectNotifyService.readByNotifyIdAndNotifyUser(workProjectNotify);
+        String contentStr = "事务来源:"+workDailyRoutine.getSource()+",执行人:"+workDailyRoutineDetail.getOperator().getName()+",完成日期:"+ DateUtils.formatDate(workDailyRoutineDetail.getUpdateDate());
+        String titleStr = "事务名称:"+ workDailyRoutine.getName();
+        String remark = "待通知";
+        List<User> userList = new ArrayList<>();
+        userList.add(workDailyRoutine.getCreateBy());
+        this.sendMessage(workDailyRoutine,userList,"58",contentStr,titleStr,remark);
+    }
+
+    public List<WorkDailyRoutine> findBySourceId(String sourceId) {
+	    return dao.findBySourceId(sourceId);
+    }
+}

+ 281 - 0
src/main/java/com/jeeplus/modules/workdailyroutine/web/WorkDailyRoutineController.java

@@ -0,0 +1,281 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdailyroutine.web;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutineDetail;
+import com.jeeplus.modules.workdailyroutine.service.WorkDailyRoutineDetailService;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.workdailyroutine.entity.WorkDailyRoutine;
+import com.jeeplus.modules.workdailyroutine.service.WorkDailyRoutineService;
+
+/**
+ * 日常事务Controller
+ * @author ssrh
+ * @version 2018-07-11
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workdailyroutine/workDailyRoutine")
+public class WorkDailyRoutineController extends BaseController {
+
+	@Autowired
+	private WorkDailyRoutineService workDailyRoutineService;
+	@Autowired
+    private WorkDailyRoutineDetailService workDailyRoutineDetailService;
+	
+	@ModelAttribute
+	public WorkDailyRoutine get(@RequestParam(required=false) String id) {
+		WorkDailyRoutine entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workDailyRoutineService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkDailyRoutine();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 日常事务列表页面
+	 */
+	@RequiresPermissions("workdailyroutine:workDailyRoutine:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkDailyRoutine workDailyRoutine, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkDailyRoutine> page = workDailyRoutineService.findPage(new Page<WorkDailyRoutine>(request, response), workDailyRoutine); 
+		model.addAttribute("page", page);
+		return "modules/workdailyroutine/workDailyRoutineList";
+	}
+
+	/**
+	 * 查看,增加,编辑日常事务表单页面
+	 */
+	@RequiresPermissions(value={"workdailyroutine:workDailyRoutine:add","workdailyroutine:workDailyRoutine:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkDailyRoutine workDailyRoutine, Model model) {
+	    if(StringUtils.isBlank(workDailyRoutine.getSource())){
+	        workDailyRoutine.setSource("手工发送");
+        }
+	    if(StringUtils.isBlank(workDailyRoutine.getStatus())){
+	        workDailyRoutine.setStatus("未完成");
+        }
+        if(workDailyRoutine.getCreateBy()==null){
+	        workDailyRoutine.setCreateBy(UserUtils.getUser());
+        }
+        if(workDailyRoutine.getCreateDate()==null){
+	        workDailyRoutine.setCreateDate(new Date());
+        }
+        if(workDailyRoutine.getOffice()==null||StringUtils.isBlank(workDailyRoutine.getOffice().getId())){
+	        workDailyRoutine.setOffice(UserUtils.getSelectOffice());
+        }
+        if(StringUtils.isNotBlank(workDailyRoutine.getId())){
+            workDailyRoutineService.queryDetails(workDailyRoutine);
+        }
+		model.addAttribute("workDailyRoutine", workDailyRoutine);
+		return "modules/workdailyroutine/workDailyRoutineForm";
+	}
+	/**
+	 * 查看,增加,编辑日常事务表单页面
+	 */
+	@RequiresPermissions(value={"workdailyroutine:workDailyRoutine:view"},logical=Logical.OR)
+	@RequestMapping(value = "view")
+	public String view(WorkDailyRoutine workDailyRoutine, Model model) {
+        if(StringUtils.isNotBlank(workDailyRoutine.getId())){
+            workDailyRoutineService.queryDetails(workDailyRoutine);
+        }
+		model.addAttribute("workDailyRoutine", workDailyRoutine);
+		return "modules/workdailyroutine/workDailyRoutineView";
+	}
+
+	/**
+	 * 保存日常事务
+	 */
+	@RequiresPermissions(value={"workdailyroutine:workDailyRoutine:add","workdailyroutine:workDailyRoutine:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkDailyRoutine workDailyRoutine, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workDailyRoutine)){
+			return form(workDailyRoutine, model);
+		}
+		if(!workDailyRoutine.getIsNewRecord()){//编辑表单保存
+			WorkDailyRoutine t = workDailyRoutineService.get(workDailyRoutine.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workDailyRoutine, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workDailyRoutineService.save(t);//保存
+		}else{//新增表单保存
+			workDailyRoutineService.save(workDailyRoutine);//保存
+		}
+		addMessage(redirectAttributes, "保存日常事务成功");
+		return "redirect:"+Global.getAdminPath()+"/workdailyroutine/workDailyRoutine/?repage";
+	}
+
+    @RequestMapping(value = "detailView")
+    public String detailView(WorkDailyRoutine workDailyRoutine, Model model) {
+        WorkDailyRoutineDetail workDailyRoutineDetail = workDailyRoutineDetailService.getByDailyId(workDailyRoutine.getId());
+        model.addAttribute("workDailyRoutineDetail", workDailyRoutineDetail);
+        return "modules/workdailyroutine/workDailyRoutineDetailView";
+    }
+
+    @RequestMapping(value = "detailForm")
+    public String detailForm(WorkDailyRoutine workDailyRoutine, Model model) {
+        WorkDailyRoutineDetail workDailyRoutineDetail = workDailyRoutineDetailService.getByDailyId(workDailyRoutine.getId());
+        model.addAttribute("workDailyRoutineDetail", workDailyRoutineDetail);
+        return "modules/workdailyroutine/workDailyRoutineDetailForm";
+    }
+
+    /**
+     * 保存日常事务
+     */
+    @RequestMapping(value = "saveDetail")
+    public String saveDetai(WorkDailyRoutineDetail workDailyRoutineDetail, Model model, RedirectAttributes redirectAttributes) throws Exception{
+        if (!beanValidator(model, workDailyRoutineDetail)){
+            addMessage(redirectAttributes, "保存日常事务失败:"+model.asMap().get("message"));
+            return "redirect:" + Global.getAdminPath() + "/home/?repage";
+        }
+        if(!workDailyRoutineDetail.getIsNewRecord()){//编辑表单保存
+            WorkDailyRoutineDetail t = workDailyRoutineDetailService.get(workDailyRoutineDetail.getId());//从数据库取出记录的值
+            MyBeanUtils.copyBeanNotNull2Bean(workDailyRoutineDetail, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+            workDailyRoutineService.save(t);//保存
+        }else{//新增表单保存
+            workDailyRoutineService.save(workDailyRoutineDetail);//保存
+        }
+        addMessage(redirectAttributes, "保存日常事务成功");
+        if (StringUtils.isNotBlank(workDailyRoutineDetail.getHome()) && "home".equals(workDailyRoutineDetail.getHome())){
+            return "redirect:" + Global.getAdminPath() + "/home/?repage";
+        }else {
+            return "redirect:" + Global.getAdminPath() + "/workdailyroutine/workDailyRoutine/?repage";
+        }
+    }
+	
+	/**
+	 * 删除日常事务
+	 */
+	@RequiresPermissions("workdailyroutine:workDailyRoutine:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkDailyRoutine workDailyRoutine, RedirectAttributes redirectAttributes) {
+		workDailyRoutineService.delete(workDailyRoutine);
+		addMessage(redirectAttributes, "删除日常事务成功");
+		return "redirect:"+Global.getAdminPath()+"/workdailyroutine/workDailyRoutine/?repage";
+	}
+
+	/**
+	 * 删除日常事务
+	 */
+	@RequiresPermissions("workdailyroutine:workDailyRoutine:edit")
+	@RequestMapping(value = "close")
+	public String close(String id, RedirectAttributes redirectAttributes) {
+		workDailyRoutineService.close(id);
+		addMessage(redirectAttributes, "关闭日常事务成功");
+		return "redirect:"+Global.getAdminPath()+"/workdailyroutine/workDailyRoutine/?repage";
+	}
+
+	/**
+	 * 批量删除日常事务
+	 */
+	@RequiresPermissions("workdailyroutine:workDailyRoutine:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workDailyRoutineService.delete(workDailyRoutineService.get(id));
+		}
+		addMessage(redirectAttributes, "删除日常事务成功");
+		return "redirect:"+Global.getAdminPath()+"/workdailyroutine/workDailyRoutine/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workdailyroutine:workDailyRoutine:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkDailyRoutine workDailyRoutine, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "日常事务"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkDailyRoutine> page = workDailyRoutineService.findPage(new Page<WorkDailyRoutine>(request, response, -1), workDailyRoutine);
+    		new ExportExcel("日常事务", WorkDailyRoutine.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出日常事务记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdailyroutine/workDailyRoutine/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workdailyroutine:workDailyRoutine:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkDailyRoutine> list = ei.getDataList(WorkDailyRoutine.class);
+			for (WorkDailyRoutine workDailyRoutine : list){
+				try{
+					workDailyRoutineService.save(workDailyRoutine);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条日常事务记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条日常事务记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入日常事务失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdailyroutine/workDailyRoutine/?repage";
+    }
+	
+	/**
+	 * 下载导入日常事务数据模板
+	 */
+	@RequiresPermissions("workdailyroutine:workDailyRoutine:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "日常事务数据导入模板.xlsx";
+    		List<WorkDailyRoutine> list = Lists.newArrayList(); 
+    		new ExportExcel("日常事务数据", WorkDailyRoutine.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdailyroutine/workDailyRoutine/?repage";
+    }
+	
+	
+	
+
+}

+ 23 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/dao/WorkDeviceRecordDao.java

@@ -0,0 +1,23 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceRecord;
+
+import java.util.List;
+
+/**
+ * 设备询价记录DAO接口
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@MyBatisDao
+public interface WorkDeviceRecordDao extends CrudDao<WorkDeviceRecord> {
+
+	public List<WorkDeviceRecord> findListByXjId(WorkDeviceRecord workDeviceRecord);
+
+	int deleteByProId(WorkDeviceRecord workDeviceRecord);
+}

+ 21 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/dao/WorkDeviceXjRecordDao.java

@@ -0,0 +1,21 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceXjRecord;
+
+/**
+ * 设备询价记录DAO接口
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@MyBatisDao
+public interface WorkDeviceXjRecordDao extends CrudDao<WorkDeviceXjRecord> {
+
+    int deleteByProId(WorkDeviceXjRecord workDeviceXjRecord);
+
+    public WorkDeviceXjRecord findListByXjId(WorkDeviceXjRecord workDeviceXjRecord);
+}

+ 95 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/entity/WorkDeviceRecord.java

@@ -0,0 +1,95 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 设备询价记录Entity
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+public class WorkDeviceRecord extends DataEntity<WorkDeviceRecord> {
+	
+	private static final long serialVersionUID = 1L;
+	private String deviceName;		// 设备名称
+	private String deviceKind;		// 设备型号
+	private String deviceUnit;		// 单位
+	private String deviceCreator;		// 生产厂家
+	private String devicePhone;		// 联系电话
+	private Double devicePrice;		// 设备单价
+	private String deviceXjId;	//询价主表id
+	
+	public WorkDeviceRecord() {
+		super();
+	}
+
+	public WorkDeviceRecord(String id){
+		super(id);
+	}
+
+	@ExcelField(title="设备名称", align=2, sort=7)
+	public String getDeviceName() {
+		return deviceName;
+	}
+
+	public void setDeviceName(String deviceName) {
+		this.deviceName = deviceName;
+	}
+	
+	@ExcelField(title="设备型号", align=2, sort=8)
+	public String getDeviceKind() {
+		return deviceKind;
+	}
+
+	public void setDeviceKind(String deviceKind) {
+		this.deviceKind = deviceKind;
+	}
+	
+	@ExcelField(title="单位", align=2, sort=9)
+	public String getDeviceUnit() {
+		return deviceUnit;
+	}
+
+	public void setDeviceUnit(String deviceUnit) {
+		this.deviceUnit = deviceUnit;
+	}
+	
+	@ExcelField(title="生产厂家", align=2, sort=10)
+	public String getDeviceCreator() {
+		return deviceCreator;
+	}
+
+	public void setDeviceCreator(String deviceCreator) {
+		this.deviceCreator = deviceCreator;
+	}
+	
+	@ExcelField(title="联系电话", align=2, sort=11)
+	public String getDevicePhone() {
+		return devicePhone;
+	}
+
+	public void setDevicePhone(String devicePhone) {
+		this.devicePhone = devicePhone;
+	}
+	
+	@ExcelField(title="设备单价", align=2, sort=12)
+	public Double getDevicePrice() {
+		return devicePrice;
+	}
+
+	public void setDevicePrice(Double devicePrice) {
+		this.devicePrice = devicePrice;
+	}
+
+	public String getDeviceXjId() {
+		return deviceXjId;
+	}
+
+	public void setDeviceXjId(String deviceXjId) {
+		this.deviceXjId = deviceXjId;
+	}
+}

+ 65 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/entity/WorkDeviceXjRecord.java

@@ -0,0 +1,65 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.entity;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.modules.sys.entity.User;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 设备询价记录Entity
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+public class WorkDeviceXjRecord extends DataEntity<WorkDeviceXjRecord> {
+	
+	private static final long serialVersionUID = 1L;
+	private Date askTime;		// 询价时间
+	private User askUser;		// 询价人员
+	private String projectId;	//项目编号
+	private List<WorkDeviceRecord> workDeviceRecordList = Lists.newArrayList();  //设备清单记录
+	
+	public WorkDeviceXjRecord() {
+		super();
+	}
+
+	public WorkDeviceXjRecord(String id){
+		super(id);
+	}
+
+	public Date getAskTime() {
+		return askTime;
+	}
+
+	public void setAskTime(Date askTime) {
+		this.askTime = askTime;
+	}
+
+	public User getAskUser() {
+		return askUser;
+	}
+
+	public void setAskUser(User askUser) {
+		this.askUser = askUser;
+	}
+
+	public List<WorkDeviceRecord> getWorkDeviceRecordList() {
+		return workDeviceRecordList;
+	}
+
+	public void setWorkDeviceRecordList(List<WorkDeviceRecord> workDeviceRecordList) {
+		this.workDeviceRecordList = workDeviceRecordList;
+	}
+
+	public String getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+}

+ 59 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/service/WorkDeviceRecordService.java

@@ -0,0 +1,59 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.service;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workdevicerecord.dao.WorkDeviceRecordDao;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceRecord;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 设备询价记录Service
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkDeviceRecordService extends CrudService<WorkDeviceRecordDao, WorkDeviceRecord> {
+	@Autowired
+	private WorkDeviceRecordDao workDeviceRecordDao;
+
+	public WorkDeviceRecord get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkDeviceRecord> findList(WorkDeviceRecord workDeviceRecord) {
+		return super.findList(workDeviceRecord);
+	}
+	
+	public Page<WorkDeviceRecord> findPage(Page<WorkDeviceRecord> page, WorkDeviceRecord workDeviceRecord) {
+		return super.findPage(page, workDeviceRecord);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkDeviceRecord workDeviceRecord) {
+		super.save(workDeviceRecord);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkDeviceRecord workDeviceRecord) {
+		super.delete(workDeviceRecord);
+	}
+
+	/**
+	 * 获取记录列表
+	 * @param workDeviceRecord
+	 * @return
+	 */
+	public List<WorkDeviceRecord> findListByXjId(WorkDeviceRecord workDeviceRecord){
+		return workDeviceRecordDao.findListByXjId(workDeviceRecord);
+	}
+	
+	
+}

+ 74 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/service/WorkDeviceXjRecordService.java

@@ -0,0 +1,74 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.service;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workdevicerecord.dao.WorkDeviceRecordDao;
+import com.jeeplus.modules.workdevicerecord.dao.WorkDeviceXjRecordDao;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceRecord;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceXjRecord;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 设备询价记录Service
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkDeviceXjRecordService extends CrudService<WorkDeviceXjRecordDao, WorkDeviceXjRecord> {
+
+	@Autowired
+	private WorkDeviceRecordDao workDeviceRecordDao;
+	@Autowired
+	private WorkDeviceXjRecordDao workDeviceXjRecordDao;
+
+	public WorkDeviceXjRecord get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkDeviceXjRecord> findList(WorkDeviceXjRecord workDeviceXjRecord) {
+		return super.findList(workDeviceXjRecord);
+	}
+	
+	public Page<WorkDeviceXjRecord> findPage(Page<WorkDeviceXjRecord> page, WorkDeviceXjRecord workDeviceXjRecord) {
+		return super.findPage(page, workDeviceXjRecord);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkDeviceXjRecord workDeviceXjRecord) {
+		super.save(workDeviceXjRecord);
+		List<WorkDeviceRecord> workDeviceRecordList = workDeviceXjRecord.getWorkDeviceRecordList();
+		for(WorkDeviceRecord workDeviceRecord:workDeviceRecordList){
+			if (WorkDeviceRecord.DEL_FLAG_NORMAL.equals(workDeviceRecord.getDelFlag())) {
+				workDeviceRecord.setDeviceXjId(workDeviceXjRecord.getId());
+				if (workDeviceRecord.getIsNewRecord()) {
+					workDeviceRecord.preInsert();
+					workDeviceRecordDao.insert(workDeviceRecord);
+				} else {
+					workDeviceRecord.preUpdate();
+					workDeviceRecordDao.update(workDeviceRecord);
+				}
+			}else{
+				workDeviceRecordDao.delete(workDeviceRecord);
+			}
+		}
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkDeviceXjRecord workDeviceXjRecord) {
+		super.delete(workDeviceXjRecord);
+	}
+
+
+	public WorkDeviceXjRecord findListByXjId(WorkDeviceXjRecord workDeviceXjRecord){
+		return workDeviceXjRecordDao.findListByXjId(workDeviceXjRecord);
+	}
+	
+}

+ 192 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/web/WorkDeviceRecordController.java

@@ -0,0 +1,192 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceRecord;
+import com.jeeplus.modules.workdevicerecord.service.WorkDeviceRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.List;
+
+/**
+ * 设备询价记录Controller
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workdevicerecord/workDeviceRecord")
+public class WorkDeviceRecordController extends BaseController {
+
+	@Autowired
+	private WorkDeviceRecordService workDeviceRecordService;
+	
+	@ModelAttribute
+	public WorkDeviceRecord get(@RequestParam(required=false) String id) {
+		WorkDeviceRecord entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workDeviceRecordService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkDeviceRecord();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 设备询价记录列表页面
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceRecord:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkDeviceRecord workDeviceRecord, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkDeviceRecord> page = workDeviceRecordService.findPage(new Page<WorkDeviceRecord>(request, response), workDeviceRecord); 
+		model.addAttribute("page", page);
+		return "modules/workdevicerecord/workDeviceRecordList";
+	}
+
+	/**
+	 * 查看,增加,编辑设备询价记录表单页面
+	 */
+//	@RequiresPermissions(value={"workdevicerecord:workDeviceRecord:view","workdevicerecord:workDeviceRecord:add","workdevicerecord:workDeviceRecord:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkDeviceRecord workDeviceRecord, Model model) {
+		model.addAttribute("workDeviceRecord", workDeviceRecord);
+		return "modules/workdevicerecord/workDeviceRecordForm";
+	}
+
+	/**
+	 * 保存设备询价记录
+	 */
+//	@RequiresPermissions(value={"workdevicerecord:workDeviceRecord:add","workdevicerecord:workDeviceRecord:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkDeviceRecord workDeviceRecord, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workDeviceRecord)){
+			return form(workDeviceRecord, model);
+		}
+		if(!workDeviceRecord.getIsNewRecord()){//编辑表单保存
+			WorkDeviceRecord t = workDeviceRecordService.get(workDeviceRecord.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workDeviceRecord, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workDeviceRecordService.save(t);//保存
+		}else{//新增表单保存
+			workDeviceRecordService.save(workDeviceRecord);//保存
+		}
+		addMessage(redirectAttributes, "保存设备询价记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceRecord/?repage";
+	}
+	
+	/**
+	 * 删除设备询价记录
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceRecord:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkDeviceRecord workDeviceRecord, RedirectAttributes redirectAttributes) {
+		workDeviceRecordService.delete(workDeviceRecord);
+		addMessage(redirectAttributes, "删除设备询价记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceRecord/?repage";
+	}
+	
+	/**
+	 * 批量删除设备询价记录
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceRecord:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workDeviceRecordService.delete(workDeviceRecordService.get(id));
+		}
+		addMessage(redirectAttributes, "删除设备询价记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceRecord/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceRecord:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkDeviceRecord workDeviceRecord, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "设备询价记录"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkDeviceRecord> page = workDeviceRecordService.findPage(new Page<WorkDeviceRecord>(request, response, -1), workDeviceRecord);
+    		new ExportExcel("设备询价记录", WorkDeviceRecord.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出设备询价记录记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceRecord/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceRecord:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkDeviceRecord> list = ei.getDataList(WorkDeviceRecord.class);
+			for (WorkDeviceRecord workDeviceRecord : list){
+				try{
+					workDeviceRecordService.save(workDeviceRecord);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条设备询价记录记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条设备询价记录记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入设备询价记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceRecord/?repage";
+    }
+	
+	/**
+	 * 下载导入设备询价记录数据模板
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceRecord:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "设备询价记录数据导入模板.xlsx";
+    		List<WorkDeviceRecord> list = Lists.newArrayList(); 
+    		new ExportExcel("设备询价记录数据", WorkDeviceRecord.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceRecord/?repage";
+    }
+	
+	
+	
+
+}

+ 212 - 0
src/main/java/com/jeeplus/modules/workdevicerecord/web/WorkDeviceXjRecordController.java

@@ -0,0 +1,212 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workdevicerecord.web;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceRecord;
+import com.jeeplus.modules.workdevicerecord.entity.WorkDeviceXjRecord;
+import com.jeeplus.modules.workdevicerecord.service.WorkDeviceRecordService;
+import com.jeeplus.modules.workdevicerecord.service.WorkDeviceXjRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.List;
+
+/**
+ * 设备询价记录Controller
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workdevicerecord/workDeviceXjRecord")
+public class WorkDeviceXjRecordController extends BaseController {
+
+	@Autowired
+	private WorkDeviceXjRecordService workDeviceXjRecordService;
+	@Autowired
+	private WorkDeviceRecordService workDeviceRecordService;
+	
+	@ModelAttribute
+	public WorkDeviceXjRecord get(@RequestParam(required=false) String id) {
+		WorkDeviceXjRecord entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workDeviceXjRecordService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkDeviceXjRecord();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 设备询价记录列表页面
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceXjRecord:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkDeviceXjRecord workDeviceXjRecord, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkDeviceXjRecord> page = workDeviceXjRecordService.findPage(new Page<WorkDeviceXjRecord>(request, response), workDeviceXjRecord); 
+		model.addAttribute("page", page);
+		return "modules/workdevicerecord/workDeviceXjRecordList";
+	}
+
+	/**
+	 * 查看,增加,编辑设备询价记录表单页面
+	 */
+//	@RequiresPermissions(value={"workdevicerecord:workDeviceXjRecord:view","workdevicerecord:workDeviceXjRecord:add","workdevicerecord:workDeviceXjRecord:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkDeviceXjRecord workDeviceXjRecord, HttpServletRequest request,Model model) {
+		String view = request.getParameter("view");
+		if("view".equals(view)){
+			view = "modules/workdevicerecord/workDeviceXjRecordFormView";
+		}else{
+			view = "modules/workdevicerecord/workDeviceXjRecordForm";
+		}
+		if(!Strings.isNullOrEmpty(workDeviceXjRecord.getProjectId())){
+			workDeviceXjRecord = workDeviceXjRecordService.findListByXjId(workDeviceXjRecord);
+			if(!workDeviceXjRecord.getIsNewRecord()){
+				WorkDeviceRecord workDeviceRecord = new WorkDeviceRecord();
+				workDeviceRecord.setDeviceXjId(workDeviceXjRecord.getId());
+				List<WorkDeviceRecord> listByXjId = workDeviceRecordService.findListByXjId(workDeviceRecord);
+				workDeviceXjRecord.setWorkDeviceRecordList(listByXjId);
+			}
+		}
+		model.addAttribute("workDeviceXjRecord", workDeviceXjRecord);
+		return view;
+	}
+
+	/**
+	 * 保存设备询价记录
+	 */
+//	@RequiresPermissions(value={"workdevicerecord:workDeviceXjRecord:add","workdevicerecord:workDeviceXjRecord:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkDeviceXjRecord workDeviceXjRecord, HttpServletRequest request,Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workDeviceXjRecord)){
+			return form(workDeviceXjRecord, request,model);
+		}
+		if(!workDeviceXjRecord.getIsNewRecord()){//编辑表单保存
+			WorkDeviceXjRecord t = workDeviceXjRecordService.get(workDeviceXjRecord.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workDeviceXjRecord, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workDeviceXjRecordService.save(t);//保存
+		}else{//新增表单保存
+			workDeviceXjRecordService.save(workDeviceXjRecord);//保存
+		}
+		addMessage(redirectAttributes, "保存设备询价记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceXjRecord/?repage";
+	}
+	
+	/**
+	 * 删除设备询价记录
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceXjRecord:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkDeviceXjRecord workDeviceXjRecord, RedirectAttributes redirectAttributes) {
+		workDeviceXjRecordService.delete(workDeviceXjRecord);
+		addMessage(redirectAttributes, "删除设备询价记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceXjRecord/?repage";
+	}
+	
+	/**
+	 * 批量删除设备询价记录
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceXjRecord:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workDeviceXjRecordService.delete(workDeviceXjRecordService.get(id));
+		}
+		addMessage(redirectAttributes, "删除设备询价记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceXjRecord/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceXjRecord:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkDeviceXjRecord workDeviceXjRecord, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "设备询价记录"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkDeviceXjRecord> page = workDeviceXjRecordService.findPage(new Page<WorkDeviceXjRecord>(request, response, -1), workDeviceXjRecord);
+    		new ExportExcel("设备询价记录", WorkDeviceXjRecord.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出设备询价记录记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceXjRecord/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceXjRecord:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkDeviceXjRecord> list = ei.getDataList(WorkDeviceXjRecord.class);
+			for (WorkDeviceXjRecord workDeviceXjRecord : list){
+				try{
+					workDeviceXjRecordService.save(workDeviceXjRecord);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条设备询价记录记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条设备询价记录记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入设备询价记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceXjRecord/?repage";
+    }
+	
+	/**
+	 * 下载导入设备询价记录数据模板
+	 */
+//	@RequiresPermissions("workdevicerecord:workDeviceXjRecord:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "设备询价记录数据导入模板.xlsx";
+    		List<WorkDeviceXjRecord> list = Lists.newArrayList(); 
+    		new ExportExcel("设备询价记录数据", WorkDeviceXjRecord.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workdevicerecord/workDeviceXjRecord/?repage";
+    }
+	
+	
+	
+
+}

+ 21 - 0
src/main/java/com/jeeplus/modules/workeffect/dao/WorkEffectDao.java

@@ -0,0 +1,21 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffect.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workeffect.entity.WorkEffect;
+
+/**
+ * 绩效DAO接口
+ * @author ssrh
+ * @version 2018-09-11
+ */
+@MyBatisDao
+public interface WorkEffectDao extends CrudDao<WorkEffect> {
+
+     void updateEffectNum(WorkEffect workEffect);
+
+    void updateMoney(WorkEffect workEffect);
+}

+ 112 - 0
src/main/java/com/jeeplus/modules/workeffect/entity/WorkEffect.java

@@ -0,0 +1,112 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffect.entity;
+
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.workeffectdetail.entity.WorkEffectDetail;
+
+import javax.validation.constraints.Size;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 绩效Entity
+ * @author ssrh
+ * @version 2018-09-11
+ */
+public class WorkEffect extends DataEntity<WorkEffect> {
+	
+	private static final long serialVersionUID = 1L;
+	private Date month;		// 月份
+	private String companyId;		// 公司
+	private Office office;		// 部门
+	private String officeNum;		// 部门人数
+	private String effectNum;		// 绩效人数
+	private String effectMoney;		// 绩效总金额
+	private String status;		// 状态 (effect_status 1未获取2已获取)
+
+	//绩效明细
+	private List<WorkEffectDetail> effectDetailList = Lists.newArrayList();
+	public WorkEffect() {
+		super();
+	}
+
+	public WorkEffect(String id){
+		super(id);
+	}
+
+	public List<WorkEffectDetail> getEffectDetailList() {
+		return effectDetailList;
+	}
+
+	public void setEffectDetailList(List<WorkEffectDetail> effectDetailList) {
+		this.effectDetailList = effectDetailList;
+	}
+
+	public Date getMonth() {
+		return month;
+	}
+
+	public void setMonth(Date month) {
+		this.month = month;
+	}
+
+	@ExcelField(title="公司", align=2, sort=8)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+
+	@ExcelField(title="部门人数", align=2, sort=10)
+	public String getOfficeNum() {
+		return officeNum;
+	}
+
+	public void setOfficeNum(String officeNum) {
+		this.officeNum = officeNum;
+	}
+	
+	@ExcelField(title="绩效人数", align=2, sort=11)
+	public String getEffectNum() {
+		return effectNum;
+	}
+
+	public void setEffectNum(String effectNum) {
+		this.effectNum = effectNum;
+	}
+	
+	@ExcelField(title="绩效总金额", align=2, sort=12)
+	public String getEffectMoney() {
+		return effectMoney;
+	}
+
+	public void setEffectMoney(String effectMoney) {
+		this.effectMoney = effectMoney;
+	}
+	
+	@ExcelField(title="状态", align=2, sort=13)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+}

+ 42 - 0
src/main/java/com/jeeplus/modules/workeffect/entity/WorkEffectExcel.java

@@ -0,0 +1,42 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffect.entity;
+
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.workeffectdetail.entity.WorkEffectDetail;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 绩效Entity
+ * @author ssrh
+ * @version 2018-09-11
+ */
+public class WorkEffectExcel extends DataEntity<WorkEffectExcel> {
+	private static final long serialVersionUID = 1L;
+
+	private Date month;		// 月份
+	private Office office;		// 部门
+
+	public Date getMonth() {
+		return month;
+	}
+
+	public void setMonth(Date month) {
+		this.month = month;
+	}
+
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+}

+ 98 - 0
src/main/java/com/jeeplus/modules/workeffect/service/WorkEffectService.java

@@ -0,0 +1,98 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffect.service;
+
+import java.util.List;
+
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.workeffectdetail.dao.WorkEffectDetailDao;
+import com.jeeplus.modules.workeffectdetail.entity.WorkEffectDetail;
+import com.jeeplus.modules.workeffectdetail.service.WorkEffectDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workeffect.entity.WorkEffect;
+import com.jeeplus.modules.workeffect.dao.WorkEffectDao;
+
+/**
+ * 绩效Service
+ * @author ssrh
+ * @version 2018-09-11
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkEffectService extends CrudService<WorkEffectDao, WorkEffect> {
+	@Autowired
+	private WorkEffectDetailService workEffectDetailService;
+	@Autowired
+	private WorkEffectDetailDao workEffectDetailDao;
+
+	public WorkEffect get(String id) {
+		WorkEffect workEffect = super.get(id);
+		if(workEffect!=null){
+			//明细
+			WorkEffectDetail workEffectDetail = new WorkEffectDetail();
+			workEffectDetail.setEffectId(id);
+			List<WorkEffectDetail> list = workEffectDetailService.findList(workEffectDetail);
+			workEffect.setEffectDetailList(list);
+		}
+		return workEffect;
+
+	}
+	
+	public List<WorkEffect> findList(WorkEffect workEffect) {
+		return super.findList(workEffect);
+	}
+	
+	public Page<WorkEffect> findPage(Page<WorkEffect> page, WorkEffect workEffect) {
+		workEffect.getSqlMap().put("dsf", dataScopeFilter(workEffect.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_EFFECT.getValue()));
+		workEffect.setPage(page);
+		page.setList(findList(workEffect));
+		return page;
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkEffect workEffect) {
+		super.save(workEffect);
+		for (WorkEffectDetail workEffectDetail : workEffect.getEffectDetailList()){
+			if (workEffectDetail.getId() == null){
+				continue;
+			}
+			if (workEffectDetail.DEL_FLAG_NORMAL.equals(workEffectDetail.getDelFlag())){
+				workEffectDetail.setEffectId(workEffect.getId());
+				if (StringUtils.isBlank(workEffectDetail.getId())){
+					//workEffectDetail.preInsert();
+					//workEffectDetailDao.insert(workEffectDetail);
+				}else{
+					workEffectDetail.preUpdate();
+					//修改金额
+					workEffectDetailDao.updateMoney(workEffectDetail);
+				}
+			}else{
+				//workEffectDetailDao.delete(workEffectDetail);
+			}
+		}
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkEffect workEffect) {
+		super.delete(workEffect);
+		//删除子表
+		if(workEffect!=null &&StringUtils.isNotBlank(workEffect.getId())){
+			workEffectDetailDao.deleteByEffectId(workEffect.getId());
+		}
+	}
+	@Transactional(readOnly = false)
+	public void updateEffectNum(WorkEffect workEffect) {
+		dao.updateEffectNum(workEffect);
+	}
+	@Transactional(readOnly = false)
+	public void updateMoney(WorkEffect workEffect) {
+		dao.updateMoney(workEffect);
+	}
+}

+ 295 - 0
src/main/java/com/jeeplus/modules/workeffect/web/WorkEffectController.java

@@ -0,0 +1,295 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffect.web;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.UserService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workeffect.entity.WorkEffectExcel;
+import com.jeeplus.modules.workeffectdetail.entity.WorkEffectDetail;
+import com.jeeplus.modules.workeffectdetail.service.WorkEffectDetailService;
+import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
+import com.jeeplus.modules.workstaff.service.WorkStaffBasicInfoService;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.workeffect.entity.WorkEffect;
+import com.jeeplus.modules.workeffect.service.WorkEffectService;
+
+/**
+ * 绩效Controller
+ * @author ssrh
+ * @version 2018-09-11
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workeffect/workEffect")
+public class WorkEffectController extends BaseController {
+
+	@Autowired
+	private WorkEffectService workEffectService;
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private WorkEffectDetailService workEffectDetailService;
+	@Autowired
+	private WorkStaffBasicInfoService workStaffBasicInfoService;
+	@Autowired
+	private UserService userService;
+
+	@ModelAttribute
+	public WorkEffect get(@RequestParam(required=false) String id) {
+		WorkEffect entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workEffectService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkEffect();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 绩效列表页面
+	 */
+	@RequiresPermissions("workeffect:workEffect:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkEffect workEffect, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkEffect> page = workEffectService.findPage(new Page<WorkEffect>(request, response), workEffect); 
+		model.addAttribute("page", page);
+		return "modules/workeffect/workEffectList";
+	}
+
+	/**
+	 * 查看,增加,编辑绩效表单页面
+	 */
+	@RequiresPermissions(value={"workeffect:workEffect:view","workeffect:workEffect:add","workeffect:workEffect:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkEffect workEffect, Model model) {
+		model.addAttribute("workEffect", workEffect);
+		String tabId = request.getParameter("tabId");
+		if("1".equals(tabId)){
+			return "modules/workeffect/workEffectView";
+		}
+		return "modules/workeffect/workEffectForm";
+	}
+
+	/**
+	 * 保存绩效
+	 */
+	@RequiresPermissions(value={"workeffect:workEffect:add","workeffect:workEffect:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkEffect workEffect, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workEffect)){
+			return form(workEffect, model);
+		}
+		if(!workEffect.getIsNewRecord()){//编辑表单保存
+			WorkEffect t = workEffectService.get(workEffect.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workEffect, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workEffectService.save(t);//保存
+		}else{//新增表单保存
+			workEffectService.save(workEffect);//保存
+		}
+		addMessage(redirectAttributes, "保存绩效成功");
+		return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+	}
+	
+	/**
+	 * 删除绩效
+	 */
+	@RequiresPermissions("workeffect:workEffect:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkEffect workEffect, RedirectAttributes redirectAttributes) {
+		workEffectService.delete(workEffect);
+		addMessage(redirectAttributes, "删除绩效成功");
+		return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+	}
+	
+	/**
+	 * 批量删除绩效
+	 */
+	@RequiresPermissions("workeffect:workEffect:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workEffectService.delete(workEffectService.get(id));
+		}
+		addMessage(redirectAttributes, "删除绩效成功");
+		return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workeffect:workEffect:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkEffect workEffect, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "绩效"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkEffect> page = workEffectService.findPage(new Page<WorkEffect>(request, response, -1), workEffect);
+    		new ExportExcel("绩效", WorkEffect.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出绩效记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workeffect:workEffect:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(WorkEffectExcel workEffectExcel,@RequestParam(value = "file",required = false) MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			Date month = null;
+			Office office = null;
+			if(workEffectExcel != null){
+				month = workEffectExcel.getMonth();
+				office = workEffectExcel.getOffice();
+			}
+			if(month == null ){
+				addMessage(redirectAttributes, "导入绩效失败!失败信息:月份信息未获取");
+				return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+			}
+			if(office == null || (office!=null && StringUtils.isBlank(office.getId()))){
+				addMessage(redirectAttributes, "导入绩效失败!失败信息:部门信息未获取");
+				return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+			}
+			WorkEffect workEffect = new WorkEffect();
+			workEffect.setMonth(month);
+			workEffect.setOffice(office);
+			//绩效数据
+			List<WorkEffect> list = workEffectService.findList(workEffect);
+			if(list == null || list.size() == 0){
+				workEffect.setId("");
+				workEffect.setCompanyId(UserUtils.getSelectCompany().getId());
+				workEffect.setStatus("1");
+				Integer count = userService.userCount(office.getId());
+				workEffect.setOfficeNum(count+"");
+				workEffectService.save(workEffect);
+			}else{
+				workEffect = list.get(0);
+			}
+			//绩效明细数据
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkEffectDetail> dataList = ei.getDataList(WorkEffectDetail.class);
+			for (WorkEffectDetail workEffectDetail : dataList){
+				try{
+					//根据工号  姓名找人
+					if(StringUtils.isNotBlank(workEffectDetail.getNo()) && StringUtils.isNotBlank(workEffectDetail.getName())){
+						WorkStaffBasicInfo workStaffBasicInfo = new WorkStaffBasicInfo();
+						workStaffBasicInfo.setNo(workEffectDetail.getNo());
+						workStaffBasicInfo.setName(workEffectDetail.getName());
+						workStaffBasicInfo.setCompany(UserUtils.getSelectCompany());
+						workStaffBasicInfo = workStaffBasicInfoService.getByNoName(workStaffBasicInfo);
+						if(workStaffBasicInfo!=null && StringUtils.isNotBlank(workStaffBasicInfo.getId())){
+							workEffectDetail.setEffectId(workEffect.getId());
+							workEffectDetail.setWorkStaffBasicInfo(workStaffBasicInfo);
+							workEffectDetail.setJobGrade(workStaffBasicInfo.getJobGrade().getName());
+							Integer count = workEffectDetailService.effectCount(workEffectDetail);
+							if (count == null || count==0){
+								workEffectDetailService.save(workEffectDetail);
+								successNum++;
+							}else {
+								failureNum++;
+							}
+
+						}else{
+							failureNum++;
+						}
+					}
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			//绩效人数
+			if(StringUtils.isNotBlank(workEffect.getId())){
+				WorkEffectDetail workEffectDetail2 = new WorkEffectDetail();
+				workEffectDetail2.setEffectId(workEffect.getId());
+				List<WorkEffectDetail> workEffectDetailList = workEffectDetailService.findList(workEffectDetail2);
+				if(workEffectDetailList!=null){
+					workEffect.setEffectNum(workEffectDetailList.size()+"");
+					workEffect.preUpdate();
+					workEffectService.updateEffectNum(workEffect);
+					Double money = 0.00;
+					//绩效总金额
+					for (WorkEffectDetail WorkEffectDetail:
+							workEffectDetailList) {
+						if(StringUtils.isNotBlank(WorkEffectDetail.getMoney())){
+							money += new Double(WorkEffectDetail.getMoney());
+						}
+					}
+					workEffect.setEffectMoney(money+"");
+					workEffect.preUpdate();
+					workEffectService.updateMoney(workEffect);
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条绩效记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条绩效记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入绩效失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+    }
+	
+	/**
+	 * 下载导入绩效数据模板
+	 */
+	@RequiresPermissions("workeffect:workEffect:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "绩效数据导入模板.xlsx";
+    		List<WorkEffect> list = Lists.newArrayList(); 
+    		new ExportExcel("绩效数据", WorkEffect.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workeffect/workEffect/?repage";
+    }
+
+	@RequestMapping(value = "importDialogre")
+	public String form(WorkEffectExcel workEffectExcel, Model model) {
+		model.addAttribute("workEffectExcel", workEffectExcel);
+		return "modules/workeffect/workEffectExcel";
+	}
+	
+
+}

+ 24 - 0
src/main/java/com/jeeplus/modules/workeffectdetail/dao/WorkEffectDetailDao.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffectdetail.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workeffectdetail.entity.WorkEffectDetail;
+
+/**
+ * 绩效明细DAO接口
+ * @author ssrh
+ * @version 2018-09-11
+ */
+@MyBatisDao
+public interface WorkEffectDetailDao extends CrudDao<WorkEffectDetail> {
+
+	int deleteByEffectId(String effectId);
+
+	void updateMoney(WorkEffectDetail workEffectDetail);
+
+	Integer effectCount(WorkEffectDetail workEffectDetail);
+
+}

+ 85 - 0
src/main/java/com/jeeplus/modules/workeffectdetail/entity/WorkEffectDetail.java

@@ -0,0 +1,85 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffectdetail.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
+
+/**
+ * 绩效明细Entity
+ * @author ssrh
+ * @version 2018-09-11
+ */
+public class WorkEffectDetail extends DataEntity<WorkEffectDetail> {
+	
+	private static final long serialVersionUID = 1L;
+	private String effectId;		// 绩效
+	private String no;		// 工号
+	private String name;		// 姓名
+	private WorkStaffBasicInfo workStaffBasicInfo;		// 档案
+	private String jobGrade;		// 职级
+	private String money;		// 金额
+	
+	public WorkEffectDetail() {
+		super();
+	}
+
+	public WorkEffectDetail(String id){
+		super(id);
+	}
+
+	public String getEffectId() {
+		return effectId;
+	}
+
+	public void setEffectId(String effectId) {
+		this.effectId = effectId;
+	}
+	
+	@ExcelField(title="工号", align=2, sort=8)
+	public String getNo() {
+		return no;
+	}
+
+	public void setNo(String no) {
+		this.no = no;
+	}
+	
+	@ExcelField(title="姓名", align=2, sort=9)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public WorkStaffBasicInfo getWorkStaffBasicInfo() {
+		return workStaffBasicInfo;
+	}
+
+	public void setWorkStaffBasicInfo(WorkStaffBasicInfo workStaffBasicInfo) {
+		this.workStaffBasicInfo = workStaffBasicInfo;
+	}
+
+	public String getJobGrade() {
+		return jobGrade;
+	}
+
+	public void setJobGrade(String jobGrade) {
+		this.jobGrade = jobGrade;
+	}
+	
+	@ExcelField(title="金额", align=2, sort=12)
+	public String getMoney() {
+		return money;
+	}
+
+	public void setMoney(String money) {
+		this.money = money;
+	}
+	
+}

+ 56 - 0
src/main/java/com/jeeplus/modules/workeffectdetail/service/WorkEffectDetailService.java

@@ -0,0 +1,56 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffectdetail.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workeffectdetail.entity.WorkEffectDetail;
+import com.jeeplus.modules.workeffectdetail.dao.WorkEffectDetailDao;
+
+/**
+ * 绩效明细Service
+ * @author ssrh
+ * @version 2018-09-11
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkEffectDetailService extends CrudService<WorkEffectDetailDao, WorkEffectDetail> {
+
+	public WorkEffectDetail get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkEffectDetail> findList(WorkEffectDetail workEffectDetail) {
+		return super.findList(workEffectDetail);
+	}
+	
+	public Page<WorkEffectDetail> findPage(Page<WorkEffectDetail> page, WorkEffectDetail workEffectDetail) {
+		return super.findPage(page, workEffectDetail);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkEffectDetail workEffectDetail) {
+		super.save(workEffectDetail);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkEffectDetail workEffectDetail) {
+		super.delete(workEffectDetail);
+	}
+
+
+	@Transactional(readOnly = false)
+	public void deleteByEffectId(String effectId) {
+		dao.deleteByEffectId(effectId);
+	}
+
+	public Integer effectCount(WorkEffectDetail workEffectDetail){
+		return dao.effectCount(workEffectDetail);
+	}
+}

+ 197 - 0
src/main/java/com/jeeplus/modules/workeffectdetail/web/WorkEffectDetailController.java

@@ -0,0 +1,197 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workeffectdetail.web;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.workeffectdetail.entity.WorkEffectDetail;
+import com.jeeplus.modules.workeffectdetail.service.WorkEffectDetailService;
+
+/**
+ * 绩效明细Controller
+ * @author ssrh
+ * @version 2018-09-11
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workeffectdetail/workEffectDetail")
+public class WorkEffectDetailController extends BaseController {
+
+	@Autowired
+	private WorkEffectDetailService workEffectDetailService;
+	@Autowired
+	private HttpServletRequest request;
+	@ModelAttribute
+	public WorkEffectDetail get(@RequestParam(required=false) String id) {
+		WorkEffectDetail entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workEffectDetailService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkEffectDetail();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 绩效明细列表页面
+	 */
+	@RequiresPermissions("workeffectdetail:workEffectDetail:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkEffectDetail workEffectDetail, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkEffectDetail> page = workEffectDetailService.findPage(new Page<WorkEffectDetail>(request, response), workEffectDetail); 
+		model.addAttribute("page", page);
+		return "modules/workeffectdetail/workEffectDetailList";
+	}
+
+	/**
+	 * 查看,增加,编辑绩效明细表单页面
+	 */
+	@RequiresPermissions(value={"workeffectdetail:workEffectDetail:view","workeffectdetail:workEffectDetail:add","workeffectdetail:workEffectDetail:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkEffectDetail workEffectDetail, Model model) {
+		model.addAttribute("workEffectDetail", workEffectDetail);
+		return "modules/workeffectdetail/workEffectDetailForm";
+	}
+
+	/**
+	 * 保存绩效明细
+	 */
+	@RequiresPermissions(value={"workeffectdetail:workEffectDetail:add","workeffectdetail:workEffectDetail:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkEffectDetail workEffectDetail, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workEffectDetail)){
+			return form(workEffectDetail, model);
+		}
+		if(!workEffectDetail.getIsNewRecord()){//编辑表单保存
+			WorkEffectDetail t = workEffectDetailService.get(workEffectDetail.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workEffectDetail, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workEffectDetailService.save(t);//保存
+		}else{//新增表单保存
+			workEffectDetailService.save(workEffectDetail);//保存
+		}
+		addMessage(redirectAttributes, "保存绩效明细成功");
+		return "redirect:"+Global.getAdminPath()+"/workeffectdetail/workEffectDetail/?repage";
+	}
+	
+	/**
+	 * 删除绩效明细
+	 */
+	@RequiresPermissions("workeffectdetail:workEffectDetail:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkEffectDetail workEffectDetail, RedirectAttributes redirectAttributes) {
+		workEffectDetailService.delete(workEffectDetail);
+		addMessage(redirectAttributes, "删除绩效明细成功");
+		return "redirect:"+Global.getAdminPath()+"/workeffectdetail/workEffectDetail/?repage";
+	}
+	
+	/**
+	 * 批量删除绩效明细
+	 */
+	@RequiresPermissions("workeffectdetail:workEffectDetail:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workEffectDetailService.delete(workEffectDetailService.get(id));
+		}
+		addMessage(redirectAttributes, "删除绩效明细成功");
+		return "redirect:"+Global.getAdminPath()+"/workeffectdetail/workEffectDetail/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workeffectdetail:workEffectDetail:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkEffectDetail workEffectDetail, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "绩效明细"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkEffectDetail> page = workEffectDetailService.findPage(new Page<WorkEffectDetail>(request, response, -1), workEffectDetail);
+    		new ExportExcel("绩效明细", WorkEffectDetail.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出绩效明细记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workeffectdetail/workEffectDetail/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	//@RequiresPermissions("workeffectdetail:workEffectDetail:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkEffectDetail> list = ei.getDataList(WorkEffectDetail.class);
+			for (WorkEffectDetail workEffectDetail : list){
+				try{
+					workEffectDetailService.save(workEffectDetail);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条绩效明细记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条绩效明细记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入绩效明细失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workeffectdetail/workEffectDetail/?repage";
+    }
+	
+	/**
+	 * 下载导入绩效明细数据模板
+	 */
+	//@RequiresPermissions("workeffectdetail:workEffectDetail:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "绩效明细数据导入模板.xlsx";
+    		List<WorkEffectDetail> list = Lists.newArrayList(); 
+    		new ExportExcel("绩效明细数据", WorkEffectDetail.class, 1).setDataList(list).write(response, fileName,request.getHeader("USER-AGENT")).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workeffectdetail/workEffectDetail/?repage";
+    }
+	
+	
+	
+
+}

+ 19 - 0
src/main/java/com/jeeplus/modules/workengineeringprice/dao/WorkEngineeringPriceDao.java

@@ -0,0 +1,19 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringprice.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workengineeringprice.entity.WorkEngineeringPrice;
+
+/**
+ * 工程咨询项目三级校审项目信息DAO接口
+ * @author 杨帆
+ * @version 2018-01-10
+ */
+@MyBatisDao
+public interface WorkEngineeringPriceDao extends CrudDao<WorkEngineeringPrice> {
+
+    WorkEngineeringPrice getByEngineeringId(WorkEngineeringPrice workEngineeringPrice);
+}

+ 117 - 0
src/main/java/com/jeeplus/modules/workengineeringprice/entity/WorkEngineeringPrice.java

@@ -0,0 +1,117 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringprice.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 工程咨询项目三级校审项目信息Entity
+ * @author 杨帆
+ * @version 2018-01-10
+ */
+public class WorkEngineeringPrice extends DataEntity<WorkEngineeringPrice> {
+	
+	private static final long serialVersionUID = 1L;
+	private String sendPrice;		// 送审价
+	private String approvedPrice;		// 审定价
+	private String contractPrice;		// 合同价
+	private String addEditAmount;		// 核增核减额
+	private String addEditRate;		// 核增核减率
+	private String consultAmount ;		// 咨询标的额
+	private String civilEngineeringCost;		// 其中土建造价
+	private String installationCost;		// 其中安装造价
+	private String engineeringId;		// 工程咨询项目id
+	
+	public WorkEngineeringPrice() {
+		super();
+	}
+
+	public WorkEngineeringPrice(String id){
+		super(id);
+	}
+
+	@ExcelField(title="送审价", align=2, sort=7)
+	public String getSendPrice() {
+		return sendPrice;
+	}
+
+	public void setSendPrice(String sendPrice) {
+		this.sendPrice = sendPrice;
+	}
+	
+	@ExcelField(title="审定价", align=2, sort=8)
+	public String getApprovedPrice() {
+		return approvedPrice;
+	}
+
+	public void setApprovedPrice(String approvedPrice) {
+		this.approvedPrice = approvedPrice;
+	}
+	
+	@ExcelField(title="合同价", align=2, sort=9)
+	public String getContractPrice() {
+		return contractPrice;
+	}
+
+	public void setContractPrice(String contractPrice) {
+		this.contractPrice = contractPrice;
+	}
+	
+	@ExcelField(title="核增核减额", align=2, sort=10)
+	public String getAddEditAmount() {
+		return addEditAmount;
+	}
+
+	public void setAddEditAmount(String addEditAmount) {
+		this.addEditAmount = addEditAmount;
+	}
+	
+	@ExcelField(title="核增核减率", align=2, sort=11)
+	public String getAddEditRate() {
+		return addEditRate;
+	}
+
+	public void setAddEditRate(String addEditRate) {
+		this.addEditRate = addEditRate;
+	}
+	
+	@ExcelField(title="咨询标的额", align=2, sort=12)
+	public String getConsultAmount () {
+		return consultAmount ;
+	}
+
+	public void setConsultAmount (String consultAmount ) {
+		this.consultAmount  = consultAmount ;
+	}
+	
+	@ExcelField(title="其中土建造价", align=2, sort=13)
+	public String getCivilEngineeringCost() {
+		return civilEngineeringCost;
+	}
+
+	public void setCivilEngineeringCost(String civilEngineeringCost) {
+		this.civilEngineeringCost = civilEngineeringCost;
+	}
+	
+	@ExcelField(title="其中安装造价", align=2, sort=14)
+	public String getInstallationCost() {
+		return installationCost;
+	}
+
+	public void setInstallationCost(String installationCost) {
+		this.installationCost = installationCost;
+	}
+	
+	@ExcelField(title="工程咨询项目id", align=2, sort=15)
+	public String getEngineeringId() {
+		return engineeringId;
+	}
+
+	public void setEngineeringId(String engineeringId) {
+		this.engineeringId = engineeringId;
+	}
+	
+}

+ 53 - 0
src/main/java/com/jeeplus/modules/workengineeringprice/service/WorkEngineeringPriceService.java

@@ -0,0 +1,53 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringprice.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workengineeringprice.entity.WorkEngineeringPrice;
+import com.jeeplus.modules.workengineeringprice.dao.WorkEngineeringPriceDao;
+
+/**
+ * 工程咨询项目三级校审项目信息Service
+ * @author 杨帆
+ * @version 2018-01-10
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkEngineeringPriceService extends CrudService<WorkEngineeringPriceDao, WorkEngineeringPrice> {
+
+	public WorkEngineeringPrice get(String id) {
+		return super.get(id);
+	}
+	public WorkEngineeringPrice getByEngineeringId(WorkEngineeringPrice workEngineeringPrice) {
+		return dao.getByEngineeringId(workEngineeringPrice);
+	}
+
+	public List<WorkEngineeringPrice> findList(WorkEngineeringPrice workEngineeringPrice) {
+		return super.findList(workEngineeringPrice);
+	}
+	
+	public Page<WorkEngineeringPrice> findPage(Page<WorkEngineeringPrice> page, WorkEngineeringPrice workEngineeringPrice) {
+		return super.findPage(page, workEngineeringPrice);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkEngineeringPrice workEngineeringPrice) {
+		super.save(workEngineeringPrice);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkEngineeringPrice workEngineeringPrice) {
+		super.delete(workEngineeringPrice);
+	}
+	
+	
+	
+	
+}

+ 196 - 0
src/main/java/com/jeeplus/modules/workengineeringprice/web/WorkEngineeringPriceController.java

@@ -0,0 +1,196 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringprice.web;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.workengineeringprice.entity.WorkEngineeringPrice;
+import com.jeeplus.modules.workengineeringprice.service.WorkEngineeringPriceService;
+
+/**
+ * 工程咨询项目三级校审项目信息Controller
+ * @author 杨帆
+ * @version 2018-01-10
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workengineeringprice/workEngineeringPrice")
+public class WorkEngineeringPriceController extends BaseController {
+
+	@Autowired
+	private WorkEngineeringPriceService workEngineeringPriceService;
+	
+	@ModelAttribute
+	public WorkEngineeringPrice get(@RequestParam(required=false) String id) {
+		WorkEngineeringPrice entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workEngineeringPriceService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkEngineeringPrice();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 工程咨询项目三级校审项目信息列表页面
+	 */
+	@RequiresPermissions("workengineeringprice:workEngineeringPrice:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkEngineeringPrice workEngineeringPrice, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkEngineeringPrice> page = workEngineeringPriceService.findPage(new Page<WorkEngineeringPrice>(request, response), workEngineeringPrice); 
+		model.addAttribute("page", page);
+		return "modules/workengineeringprice/workEngineeringPriceList";
+	}
+
+	/**
+	 * 查看,增加,编辑工程咨询项目三级校审项目信息表单页面
+	 */
+	@RequiresPermissions(value={"workengineeringprice:workEngineeringPrice:view","workengineeringprice:workEngineeringPrice:add","workengineeringprice:workEngineeringPrice:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkEngineeringPrice workEngineeringPrice, Model model) {
+		model.addAttribute("workEngineeringPrice", workEngineeringPrice);
+		return "modules/workengineeringprice/workEngineeringPriceForm";
+	}
+
+	/**
+	 * 保存工程咨询项目三级校审项目信息
+	 */
+	@RequiresPermissions(value={"workengineeringprice:workEngineeringPrice:add","workengineeringprice:workEngineeringPrice:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkEngineeringPrice workEngineeringPrice, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workEngineeringPrice)){
+			return form(workEngineeringPrice, model);
+		}
+		if(!workEngineeringPrice.getIsNewRecord()){//编辑表单保存
+			WorkEngineeringPrice t = workEngineeringPriceService.get(workEngineeringPrice.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workEngineeringPrice, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workEngineeringPriceService.save(t);//保存
+		}else{//新增表单保存
+			workEngineeringPriceService.save(workEngineeringPrice);//保存
+		}
+		addMessage(redirectAttributes, "保存工程咨询项目三级校审项目信息成功");
+		return "redirect:"+Global.getAdminPath()+"/workengineeringprice/workEngineeringPrice/?repage";
+	}
+	
+	/**
+	 * 删除工程咨询项目三级校审项目信息
+	 */
+	@RequiresPermissions("workengineeringprice:workEngineeringPrice:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkEngineeringPrice workEngineeringPrice, RedirectAttributes redirectAttributes) {
+		workEngineeringPriceService.delete(workEngineeringPrice);
+		addMessage(redirectAttributes, "删除工程咨询项目三级校审项目信息成功");
+		return "redirect:"+Global.getAdminPath()+"/workengineeringprice/workEngineeringPrice/?repage";
+	}
+	
+	/**
+	 * 批量删除工程咨询项目三级校审项目信息
+	 */
+	@RequiresPermissions("workengineeringprice:workEngineeringPrice:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workEngineeringPriceService.delete(workEngineeringPriceService.get(id));
+		}
+		addMessage(redirectAttributes, "删除工程咨询项目三级校审项目信息成功");
+		return "redirect:"+Global.getAdminPath()+"/workengineeringprice/workEngineeringPrice/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workengineeringprice:workEngineeringPrice:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkEngineeringPrice workEngineeringPrice, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "工程咨询项目三级校审项目信息"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkEngineeringPrice> page = workEngineeringPriceService.findPage(new Page<WorkEngineeringPrice>(request, response, -1), workEngineeringPrice);
+    		new ExportExcel("工程咨询项目三级校审项目信息", WorkEngineeringPrice.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出工程咨询项目三级校审项目信息记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workengineeringprice/workEngineeringPrice/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workengineeringprice:workEngineeringPrice:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkEngineeringPrice> list = ei.getDataList(WorkEngineeringPrice.class);
+			for (WorkEngineeringPrice workEngineeringPrice : list){
+				try{
+					workEngineeringPriceService.save(workEngineeringPrice);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条工程咨询项目三级校审项目信息记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条工程咨询项目三级校审项目信息记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入工程咨询项目三级校审项目信息失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workengineeringprice/workEngineeringPrice/?repage";
+    }
+	
+	/**
+	 * 下载导入工程咨询项目三级校审项目信息数据模板
+	 */
+	@RequiresPermissions("workengineeringprice:workEngineeringPrice:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "工程咨询项目三级校审项目信息数据导入模板.xlsx";
+    		List<WorkEngineeringPrice> list = Lists.newArrayList(); 
+    		new ExportExcel("工程咨询项目三级校审项目信息数据", WorkEngineeringPrice.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workengineeringprice/workEngineeringPrice/?repage";
+    }
+	
+	
+	
+
+}

+ 70 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/dao/WorkEngineeringProjectDao.java

@@ -0,0 +1,70 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringproject.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workbidproject.entity.WorkBidProject;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workengineeringproject.entity.WorkEngineeringProject;
+import com.jeeplus.modules.workengineeringproject.entity.WorkProjectPlan;
+import com.jeeplus.modules.workengineeringproject.entity.WorkProjectPlanEdit;
+import com.jeeplus.modules.workproject.entity.WorkProject;
+
+import java.util.List;
+
+/**
+ * 工程项目信息DAO接口
+ * @author 杨帆
+ * @version 2017-10-23
+ */
+@MyBatisDao
+public interface WorkEngineeringProjectDao extends CrudDao<WorkEngineeringProject> {
+
+	 List<WorkContractInfo> findListBycontractId(WorkContractInfo contractId);
+	 List<WorkProjectPlan> findProjectPlans(WorkEngineeringProject workEngineeringProject);
+	 List<WorkProjectPlanEdit> findProjectPlanEdit(WorkEngineeringProject workEngineeringProject);
+	 List<WorkEngineeringProject> findProjectManagementList(WorkEngineeringProject workEngineeringProject);
+	 List<WorkBidProject> findListByprojectId(WorkBidProject projectId);
+
+	 int insertPlan(WorkEngineeringProject workEngineeringProject);
+	 int deletePlan(WorkEngineeringProject workEngineeringProject);
+	 int updateRemakes(WorkEngineeringProject workEngineeringProject);
+	 int updateProjectPlan(WorkProjectPlan workProjectPlan);
+	/**
+	 * 更新流程实例ID
+	 * @param workEngineeringProject
+	 * @return
+	 */
+	 int updateProcessInstanceId(WorkEngineeringProject workEngineeringProject);
+	/**
+	 * 更新流程实例ID
+	 * @param workEngineeringProject
+	 * @return
+	 */
+	 int updateProcessInstanceProofreadId(WorkEngineeringProject workEngineeringProject);
+
+	/**
+	 * 根据流程实例ID获取Leave
+	 * @param processInstanceId
+	 * @return
+	 */
+	WorkEngineeringProject getByProcessInstanceId(String processInstanceId);
+	/**
+	 * 根据流程实例ID获取Leave
+	 * @param processInstanceProofreadId
+	 * @return
+	 */
+	WorkEngineeringProject getByProcessInstanceProofreadId(String processInstanceProofreadId);
+
+	 WorkProjectPlan getProjectPlan(String id);
+
+	//根据总项目外键获取
+	public WorkEngineeringProject getByPId(WorkProject workProject);
+
+	public List<WorkEngineeringProject> findListByprojectt(WorkEngineeringProject workEngineeringProject);
+
+	public List<WorkEngineeringProject> findByList(WorkEngineeringProject workEngineeringProject);
+
+}

+ 691 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/entity/WorkEngineeringProject.java

@@ -0,0 +1,691 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringproject.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.Collections3;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workengineeringprice.entity.WorkEngineeringPrice;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullRecord;
+import com.jeeplus.modules.workproject.entity.WorkProject;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 工程项目信息Entity
+ * @author 杨帆
+ * @version 2017-10-23
+ */
+public class WorkEngineeringProject extends ActEntity<WorkEngineeringProject> {
+	
+	private static final long serialVersionUID = 1L;
+	private String reportNumber;		// 报告号
+	private String isExt;		// 是否签署合同 0 是 1 不是
+	private WorkContractInfo contractId;		// 合同外键id
+	private String contractInfoName;
+	private WorkProject projectId;		// 项目外键id
+	private String businessType;		// 业务类型
+	private Double preTrialAmount;		// 预送审金额
+	private Date workStartDate;		// 工作开始时间
+	private Date workEndDate;		// 工作结束时间
+	private String emploperRequire;		// 业主要求
+	private Area area;		// 工程所在地
+	private Office office;		// 所属公司/部门
+	private String hostOffice;		// 主办部门
+	private String hostOfficeName;		// 主办部门
+	private String jointlyOffice;		// 协办部门
+	private String jointlyOfficeName;		// 协办部门
+	private String hostOfficeMaster;		// 主办部门负责人
+	private String hostOfficeMasterName;		// 主办部门负责人
+	private String jointlyOfficeMaster;		// 协办部门负责人
+	private String jointlyOfficeMasterName;		// 协办部门负责人
+	private String hostOfficeMember;		// 主办部门项目组成员
+	private String hostOfficeMemberNames;		// 主办部门项目组成员
+	private String jointlyOfficeMember;		// 协办部门项目组成员
+	private String jointlyOfficeMemberNames;		// 协办部门项目组成员
+	private String status;		// 工程状态
+	private String processInstanceId;		// 实例流程id
+	private String name;
+	private String ids;
+	private String idNames;
+	private String contractName;
+	private String projectName;
+	private WorkClientLinkman workClientLinkman;
+	private WorkClientInfo workClientInfo;
+	private String plan;
+	private String processInstanceProofreadId;// 三级校审实例流程id
+	private String proofreadStatus;// 三级校审状态
+	private String proofreadMaster;// 三级校审负责人
+	private String proofreadTotal;// 三级校审总工角色
+	private String psort;//行业大分类
+	private String ssort; //行业详细分类
+	private String problem;
+	private String reject;
+	private String queryCon;
+	private String masterId;
+	private WorkFullRecord workFullRecord; //项目归档实体类
+	private WorkEngineeringPrice workEngineeringPrice;
+	private String totalProjectId;	//总项目编号
+	private String totalProjectName;	//总项目名称
+	private String isTotal;	//是否是总项目
+	private String totalProjectIds; //父项目集合
+	private String commonFlag;
+	private String isTotalName;
+	private Integer sort = 30;
+
+	private List<User> hostOfficeMemberList = Lists.newArrayList();	//用户列表
+	private List<User> jointlyOfficeMemberList = Lists.newArrayList();	//用户列表
+	private List<WorkProjectPlan> workProjectPlans = Lists.newArrayList();	//用户列表
+	private List<Workattachment> workAttachments = Lists.newArrayList();	//附件列表
+
+	public List<WorkProjectPlan> getWorkProjectPlans() {
+		return workProjectPlans;
+	}
+
+	public void setWorkProjectPlans(List<WorkProjectPlan> workProjectPlans) {
+		this.workProjectPlans = workProjectPlans;
+	}
+
+	@ExcelField(title="项目成员", align=2, sort=13)
+	public String getHostOfficeMemberIds() {
+		return Collections3.extractToString(hostOfficeMemberList, "id", ",") ;
+	}
+
+	public void setHostOfficeMemberIds(String hostOfficeMember) {
+		this.hostOfficeMemberList = Lists.newArrayList();
+		for (String id : StringUtils.split(hostOfficeMember, ",")){
+			this.hostOfficeMemberList.add(new User(id));
+		}
+	}
+
+	@ExcelField(title="项目成员", align=2, sort=13)
+	public String getJointlyOfficeMemberIds() {
+		return Collections3.extractToString(jointlyOfficeMemberList, "id", ",") ;
+	}
+
+	public void setJointlyOfficeMemberIds(String jointlyOfficeMember) {
+		this.jointlyOfficeMemberList = Lists.newArrayList();
+		for (String id : StringUtils.split(jointlyOfficeMember, ",")){
+			this.jointlyOfficeMemberList.add(new User(id));
+		}
+	}
+
+	public String getPsort() {
+		return psort;
+	}
+
+	public void setPsort(String psort) {
+		this.psort = psort;
+	}
+
+	public String getSsort() {
+		return ssort;
+	}
+
+	public void setSsort(String ssort) {
+		this.ssort = ssort;
+	}
+
+	public String getPlan() {
+		return plan;
+	}
+
+	public void setPlan(String plan) {
+		this.plan = plan;
+	}
+
+	public String getHostOfficeMemberNames() {
+		return hostOfficeMemberNames ;
+	}
+
+
+	public String getHostOfficeName() {
+		return hostOfficeName;
+	}
+
+	public void setHostOfficeName(String hostOfficeName) {
+		this.hostOfficeName = hostOfficeName;
+	}
+
+	public String getJointlyOfficeName() {
+		return jointlyOfficeName;
+	}
+
+	public void setJointlyOfficeName(String jointlyOfficeName) {
+		this.jointlyOfficeName = jointlyOfficeName;
+	}
+
+	public String getHostOfficeMasterName() {
+		return hostOfficeMasterName;
+	}
+
+	public void setHostOfficeMasterName(String hostOfficeMasterName) {
+		this.hostOfficeMasterName = hostOfficeMasterName;
+	}
+
+	public String getJointlyOfficeMasterName() {
+		return jointlyOfficeMasterName;
+	}
+
+	public void setJointlyOfficeMasterName(String jointlyOfficeMasterName) {
+		this.jointlyOfficeMasterName = jointlyOfficeMasterName;
+	}
+
+	public void setHostOfficeMemberNames(String hostOfficeMemberNames) {
+		this.hostOfficeMemberNames = hostOfficeMemberNames;
+	}
+
+	public String getJointlyOfficeMemberNames() {
+		return jointlyOfficeMemberNames;
+	}
+
+	public void setJointlyOfficeMemberNames(String jointlyOfficeMemberNames) {
+		this.jointlyOfficeMemberNames = jointlyOfficeMemberNames;
+	}
+
+	public List<User> getHostOfficeMemberList() {
+		return hostOfficeMemberList;
+	}
+
+	public void setHostOfficeMemberList(List<User> hostOfficeMemberList) {
+		this.hostOfficeMemberList = hostOfficeMemberList;
+	}
+
+	public List<User> getJointlyOfficeMemberList() {
+		return jointlyOfficeMemberList;
+	}
+
+	public void setJointlyOfficeMemberList(List<User> jointlyOfficeMemberList) {
+		this.jointlyOfficeMemberList = jointlyOfficeMemberList;
+	}
+
+	public WorkClientInfo getWorkClientInfo() {
+		return workClientInfo;
+	}
+
+	public void setWorkClientInfo(WorkClientInfo workClientInfo) {
+		this.workClientInfo = workClientInfo;
+	}
+
+	// -- 临时属性 --//
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	private String companyId;  //公司id
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public String getIds() {
+		List<String> idList = Lists.newArrayList();
+		if (StringUtils.isNotBlank(ids)) {
+			String ss = ids.trim().replace(" ", ",").replace(" ", ",").replace(",", ",").replace("'", "");
+			for (String s : ss.split(",")) {
+				// if(s.matches("\\d*")) {
+				idList.add("'" + s + "'");
+				// }
+			}
+		}
+		return StringUtils.join(idList, ",");
+	}
+
+	public void setIds(String ids) {
+		this.ids = ids;
+	}
+
+	public String getIdNames() {
+		List<String> idList = Lists.newArrayList();
+		if (StringUtils.isNotBlank(idNames)) {
+			String ss = idNames.trim().replace(" ", ",").replace(" ", ",").replace(",", ",").replace("'", "");
+			for (String s : ss.split(",")) {
+				// if(s.matches("\\d*")) {
+				idList.add("'" + s + "'");
+				// }
+			}
+		}
+		return StringUtils.join(idList, ",");
+	}
+
+	public void setIdNames(String idNames) {
+		this.idNames = idNames;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getContractName() {
+		return contractName;
+	}
+
+	public void setContractName(String contractName) {
+		this.contractName = contractName;
+	}
+
+	public String getProjectName() {
+		return projectName;
+	}
+
+	public void setProjectName(String projectName) {
+		this.projectName = projectName;
+	}
+
+	public WorkEngineeringProject() {
+		super();
+	}
+
+	public WorkEngineeringProject(String id){
+		super(id);
+	}
+
+	@ExcelField(title="报告号", align=2, sort=1)
+	public String getReportNumber() {
+		return reportNumber;
+	}
+
+	public void setReportNumber(String reportNumber) {
+		this.reportNumber = reportNumber;
+	}
+	
+	@NotNull(message="合同外键id不能为空")
+	@ExcelField(title="合同外键id", align=2, sort=8)
+	public WorkContractInfo getContractId() {
+		return contractId;
+	}
+
+	public void setContractId(WorkContractInfo contractId) {
+		this.contractId = contractId;
+	}
+
+	public WorkClientLinkman getWorkClientLinkman() {
+		return workClientLinkman;
+	}
+
+	public void setWorkClientLinkman(WorkClientLinkman workClientLinkman) {
+		this.workClientLinkman = workClientLinkman;
+	}
+
+	@NotNull(message="项目外键id不能为空")
+	@ExcelField(title="项目外键id", align=2, sort=9)
+	public WorkProject getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(WorkProject projectId) {
+		this.projectId = projectId;
+	}
+	
+	@ExcelField(title="业务类型", mainDictType="business_type", align=2, sort=10)
+	public String getBusinessType() {
+		return businessType;
+	}
+
+	public void setBusinessType(String businessType) {
+		this.businessType = businessType;
+	}
+	
+	@ExcelField(title="预送审金额", align=2, sort=11)
+	public Double getPreTrialAmount() {
+		return preTrialAmount;
+	}
+
+	public void setPreTrialAmount(Double preTrialAmount) {
+		this.preTrialAmount = preTrialAmount;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@NotNull(message="工作开始时间不能为空")
+	@ExcelField(title="工作开始时间", align=2, sort=12)
+	public Date getWorkStartDate() {
+		return workStartDate;
+	}
+
+	public void setWorkStartDate(Date workStartDate) {
+		this.workStartDate = workStartDate;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@NotNull(message="工作结束时间不能为空")
+	@ExcelField(title="工作结束时间", align=2, sort=13)
+	public Date getWorkEndDate() {
+		return workEndDate;
+	}
+
+	public void setWorkEndDate(Date workEndDate) {
+		this.workEndDate = workEndDate;
+	}
+	
+	@ExcelField(title="业主要求", align=2, sort=14)
+	public String getEmploperRequire() {
+		return emploperRequire;
+	}
+
+	public void setEmploperRequire(String emploperRequire) {
+		this.emploperRequire = emploperRequire;
+	}
+	
+	@ExcelField(title="工程所在地", align=2, sort=15)
+	public Area getArea() {
+		return area;
+	}
+
+	public void setArea(Area area) {
+		this.area = area;
+	}
+	
+	@NotNull(message="所属公司/部门不能为空")
+	@ExcelField(title="所属公司/部门", fieldType=Office.class, value="office.name", align=2, sort=16)
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+	
+	@ExcelField(title="主办部门", align=2, sort=17)
+	public String getHostOffice() {
+		return hostOffice;
+	}
+
+	public void setHostOffice(String hostOffice) {
+		this.hostOffice = hostOffice;
+	}
+	
+	@ExcelField(title="协办部门", align=2, sort=18)
+	public String getJointlyOffice() {
+		return jointlyOffice;
+	}
+
+	public void setJointlyOffice(String jointlyOffice) {
+		this.jointlyOffice = jointlyOffice;
+	}
+	
+	@ExcelField(title="主办部门负责人", align=2, sort=19)
+	public String getHostOfficeMaster() {
+		return hostOfficeMaster;
+	}
+
+	public void setHostOfficeMaster(String hostOfficeMaster) {
+		this.hostOfficeMaster = hostOfficeMaster;
+	}
+	
+	@ExcelField(title="协办部门负责人", align=2, sort=20)
+	public String getJointlyOfficeMaster() {
+		return jointlyOfficeMaster;
+	}
+
+	public void setJointlyOfficeMaster(String jointlyOfficeMaster) {
+		this.jointlyOfficeMaster = jointlyOfficeMaster;
+	}
+	
+	@ExcelField(title="主办部门项目组成员", align=2, sort=21)
+	public String getHostOfficeMember() {
+		return hostOfficeMember;
+	}
+
+	public void setHostOfficeMember(String hostOfficeMember) {
+		this.hostOfficeMember = hostOfficeMember;
+	}
+	
+	@ExcelField(title="协办部门项目组成员", align=2, sort=22)
+	public String getJointlyOfficeMember() {
+		return jointlyOfficeMember;
+	}
+
+	public void setJointlyOfficeMember(String jointlyOfficeMember) {
+		this.jointlyOfficeMember = jointlyOfficeMember;
+	}
+	
+	@ExcelField(title="工程状态", dictType="engineering_type", align=2, sort=23)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+	@ExcelField(title="实例流程id", align=2, sort=24)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	public String getProcessInstanceProofreadId() {
+		return processInstanceProofreadId;
+	}
+
+	public void setProcessInstanceProofreadId(String processInstanceProofreadId) {
+		this.processInstanceProofreadId = processInstanceProofreadId;
+	}
+
+	public String getProofreadStatus() {
+		return proofreadStatus;
+	}
+
+	public void setProofreadStatus(String proofreadStatus) {
+		this.proofreadStatus = proofreadStatus;
+	}
+
+	public String getProofreadMaster() {
+		return proofreadMaster;
+	}
+
+	public void setProofreadMaster(String proofreadMaster) {
+		this.proofreadMaster = proofreadMaster;
+	}
+
+	public String getProofreadTotal() {
+		return proofreadTotal;
+	}
+
+	public void setProofreadTotal(String proofreadTotal) {
+		this.proofreadTotal = proofreadTotal;
+	}
+
+	public String getProblem() {
+		return problem;
+	}
+
+	public void setProblem(String problem) {
+		this.problem = problem;
+	}
+
+	public String getReject() {
+		return reject;
+	}
+
+	public void setReject(String reject) {
+		this.reject = reject;
+	}
+
+	public String getQueryCon() {
+		return queryCon;
+	}
+
+	public void setQueryCon(String queryCon) {
+		this.queryCon = queryCon;
+	}
+
+	public WorkFullRecord getWorkFullRecord() {
+		return workFullRecord;
+	}
+
+	public void setWorkFullRecord(WorkFullRecord workFullRecord) {
+		this.workFullRecord = workFullRecord;
+	}
+
+	public List<Workattachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<Workattachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	public String getMasterId() {
+		return masterId;
+	}
+
+	public void setMasterId(String masterId) {
+		this.masterId = masterId;
+	}
+
+	public String getIsExt() {
+		return isExt;
+	}
+
+	public void setIsExt(String isExt) {
+		this.isExt = isExt;
+	}
+
+	public String getContractInfoName() {
+		return contractInfoName;
+	}
+
+	public void setContractInfoName(String contractInfoName) {
+		this.contractInfoName = contractInfoName;
+	}
+
+	public WorkEngineeringPrice getWorkEngineeringPrice() {
+		return workEngineeringPrice;
+	}
+
+	public void setWorkEngineeringPrice(WorkEngineeringPrice workEngineeringPrice) {
+		this.workEngineeringPrice = workEngineeringPrice;
+	}
+
+	public String getTotalProjectId() {
+		return totalProjectId;
+	}
+
+	public void setTotalProjectId(String totalProjectId) {
+		this.totalProjectId = totalProjectId;
+	}
+
+	public String getTotalProjectName() {
+		return totalProjectName;
+	}
+
+	public void setTotalProjectName(String totalProjectName) {
+		this.totalProjectName = totalProjectName;
+	}
+
+	public String getIsTotal() {
+		return isTotal;
+	}
+
+	public void setIsTotal(String isTotal) {
+		this.isTotal = isTotal;
+	}
+
+	public String getTotalProjectIds() {
+		return totalProjectIds;
+	}
+
+	public void setTotalProjectIds(String totalProjectIds) {
+		this.totalProjectIds = totalProjectIds;
+	}
+
+	public String getCommonFlag() {
+		return commonFlag;
+	}
+
+	public void setCommonFlag(String commonFlag) {
+		this.commonFlag = commonFlag;
+	}
+
+	public String getIsTotalName() {
+		return isTotalName;
+	}
+
+	public void setIsTotalName(String isTotalName) {
+		this.isTotalName = isTotalName;
+	}
+
+	public Integer getSort() {
+		return sort;
+	}
+
+	public void setSort(Integer sort) {
+		this.sort = sort;
+	}
+}

+ 129 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/entity/WorkProjectPlan.java

@@ -0,0 +1,129 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringproject.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractAnnex;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 合同管理Entity
+ * @author 丁旭
+ * @version 2017-03-21
+ */
+public class WorkProjectPlan extends DataEntity<WorkProjectPlan> {
+
+	private static final long serialVersionUID = 1L;
+	private String projectId;
+	private String taskCount;
+	private String taskName;
+	private Date startTime;
+	private Date endTime;
+	private User remindUser;
+	private Date remindDate;
+	private User completeUser;
+	private Date completeDate;
+	private String type;
+	private String status;
+
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public String getTaskCount() {
+		return taskCount;
+	}
+
+	public void setTaskCount(String taskCount) {
+		this.taskCount = taskCount;
+	}
+
+	public String getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+
+	public String getTaskName() {
+		return taskName;
+	}
+
+	public void setTaskName(String taskName) {
+		this.taskName = taskName;
+	}
+
+	public Date getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+
+	public User getRemindUser() {
+		return remindUser;
+	}
+
+	public void setRemindUser(User remindUser) {
+		this.remindUser = remindUser;
+	}
+
+	public Date getRemindDate() {
+		return remindDate;
+	}
+
+	public void setRemindDate(Date remindDate) {
+		this.remindDate = remindDate;
+	}
+
+	public User getCompleteUser() {
+		return completeUser;
+	}
+
+	public void setCompleteUser(User completeUser) {
+		this.completeUser = completeUser;
+	}
+
+	public Date getCompleteDate() {
+		return completeDate;
+	}
+
+	public void setCompleteDate(Date completeDate) {
+		this.completeDate = completeDate;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+}

+ 30 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/entity/WorkProjectPlanEdit.java

@@ -0,0 +1,30 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringproject.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 出差流程Entity
+ * @author 丁旭
+ * @version 2017-05-22
+ */
+public class WorkProjectPlanEdit extends DataEntity<WorkProjectPlanEdit> {
+
+	private static final long serialVersionUID = 1L;
+
+}

Fichier diff supprimé car celui-ci est trop grand
+ 1196 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/service/WorkEngineeringProjectService.java


Fichier diff supprimé car celui-ci est trop grand
+ 1394 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/web/WorkEngineeringProjectController.java


+ 481 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/web/WorkEngineeringRecordController.java

@@ -0,0 +1,481 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringproject.web;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.dao.RoleDao;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.SystemService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workclientinfo.service.WorkClientInfoService;
+import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
+import com.jeeplus.modules.workengineeringproject.entity.WorkEngineeringProject;
+import com.jeeplus.modules.workengineeringproject.service.WorkEngineeringProjectService;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullRecord;
+import com.jeeplus.modules.workfullmanage.service.WorkFullRecordService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workreimbursement.utils.VarStr;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.namedparam.NamedParameterUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 工程项目信息Controller
+ * @author 杨帆
+ * @version 2017-10-23
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/engineeringrecord/engineeringrecord")
+public class WorkEngineeringRecordController extends BaseController {
+
+	@Autowired
+	private WorkEngineeringProjectService workEngineeringProjectService;
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private WorkContractInfoService workContractInfoService;
+	@Autowired
+	private WorkClientInfoService workClientInfoService;
+	@Autowired
+	protected RuntimeService runtimeService;
+	@Autowired
+	protected TaskService taskService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	protected HistoryService historyService;
+	@Autowired
+	protected RepositoryService repositoryService;
+	@Autowired
+	private WorkattachmentService workattachmentService;
+	@Autowired
+	private WorkFullRecordService workFullRecordService;
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private RoleDao roleDao;
+	@Autowired
+	private SystemService systemService;
+
+	@ModelAttribute
+	public WorkFullRecord get(@RequestParam(required=false) String id) {
+		WorkFullRecord entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workFullRecordService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkFullRecord();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 工程项目信息列表页面
+	 */
+	@RequiresPermissions("engineeringrecord:engineeringrecord:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkEngineeringProject workEngineeringProject, HttpServletRequest request, HttpServletResponse response, Model model) {
+		//只是普通员工
+		if(!UserUtils.getSelectRoleInfo()){
+			String id = UserUtils.getUser().getId();
+			workEngineeringProject.setQueryCon(id);
+		}
+		Page<WorkEngineeringProject> page = workEngineeringProjectService.findPage(new Page<WorkEngineeringProject>(request, response), workEngineeringProject);
+		List<WorkEngineeringProject> list = page.getList();
+		for (WorkEngineeringProject entity :list){
+			String hostOfficeMaster = entity.getHostOfficeMaster();
+			if (StringUtils.isNotBlank(hostOfficeMaster)){
+				String[] ids = hostOfficeMaster.split(",");
+				String name = "";
+				for (String str:ids) {
+					User user = UserUtils.get(str);
+					name += user.getName()+",";
+				}
+				if (StringUtils.isNotBlank(name)){
+					name = name.substring(0,name.length() - 1);
+				}
+				entity.setHostOfficeMasterName(name);
+			}
+		}
+		model.addAttribute("page", page);
+		model.addAttribute("name", false);
+		model.addAttribute("glygd", false);
+		return "modules/workengineeringproject/workEngineeringRecordList";
+	}
+
+	/**
+	 * 查看,增加,编辑项目归档表单页面
+	 */
+	@RequestMapping(value = "form")
+	public String form(WorkFullRecord workFullRecord, Model model, RedirectAttributes redirectAttributes) {
+		String view = "workEngineeringRecordForm";
+		String tabId = request.getParameter("tabId");
+		String engineeringId = request.getParameter("engineeringId");
+		WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.get(engineeringId);
+		workFullRecord.setWorkEngineeringProject(workEngineeringProject);
+
+		List<Workattachment> workReportList = workattachmentService.findAttachment(workEngineeringProject.getId(),"39");
+		List<Workattachment> workBasisInformationList = workattachmentService.findAttachment(workEngineeringProject.getId(),"40");
+		List<Workattachment> workRemoteControlList = workattachmentService.findAttachment(workEngineeringProject.getId(),"41");
+		List<Workattachment> workSummaryList = workattachmentService.findAttachment(workEngineeringProject.getId(),"42");
+		List<Workattachment> workOtherList = workattachmentService.findAttachment(workEngineeringProject.getId(),"43");
+		model.addAttribute("workEngineeringProject", workEngineeringProject);
+		model.addAttribute("workReportList", workReportList);
+		model.addAttribute("workBasisInformationList", workBasisInformationList);
+		model.addAttribute("workRemoteControlList", workRemoteControlList);
+		model.addAttribute("workSummaryList", workSummaryList);
+		model.addAttribute("workOtherList", workOtherList);
+		// 环节编号
+		String taskDefKey = workFullRecord.getAct().getTaskDefKey();
+		Act act = workFullRecord.getAct();
+		WorkFullRecord workFullManageId = workFullRecordService.findUniqueByProperty("work_full_manage_id", engineeringId);
+		if(workFullManageId!=null){
+			workFullRecord = workFullRecordService.getById(workFullManageId.getId());
+			workFullRecord.setAct(act);
+		}
+		workEngineeringProject.setWorkFullRecord(workFullRecord);
+		workFullRecord.setRecordName(workEngineeringProject.getProjectId().getName());
+		workFullRecord.setRecordNumber(workEngineeringProject.getProjectId().getNumber());
+		if(workFullRecord!=null && StringUtils.isNotBlank(workFullRecord.getManageUser())) {
+			workFullRecord.setManageId(UserUtils.get(workFullRecord.getManageUser()).getName());
+		}
+		model.addAttribute("workFullRecord", workFullRecord);
+		if("4".equals(tabId) || StringUtils.isNotBlank(taskDefKey) && workFullRecord.getAct().isFinishTask()
+				){
+			model.addAttribute("workEngineeringProject",workEngineeringProject);
+			view = "workEngineeringRecordForm";
+		}
+		// 修改环节
+		else if ("deptLeaderAudit".equals(taskDefKey) ||
+				"recordUser".equals(taskDefKey)|| "modifyApply".equals(taskDefKey)){
+			Role role = UserUtils.getSelectRole().get(0);
+			model.addAttribute("glygd",role.getEnname().contains("glygd")?true:false);
+			view = "workEngineeringRecordAudit";
+		}
+		if("10".equals(tabId)){
+			view = "workEngineeringRecordView";
+		}
+		return "modules/workengineeringproject/" + view;
+	}
+
+	/**
+	 * 保存项目归档
+	 */
+	@RequestMapping(value = "startposs")
+	public String startposs(WorkFullRecord workFullRecord, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workFullRecord)){
+			return form(workFullRecord, model,redirectAttributes);
+		}
+		String engineeringId = request.getParameter("engineeringId");
+		Map<String, Object> variables = Maps.newHashMap();
+		Role role = UserUtils.getSelectRole().get(0);
+		StringBuffer buffer = DateUtils.getByEnnme(role.getEnname());
+		StringBuffer gly = DateUtils.getByEnnme(role.getEnname());
+
+		buffer.append("bmzr");
+		gly.append("glygd");
+		variables.put("bmzr", buffer.toString()); //设置部门负责人
+		variables.put("gly", gly.toString()); //设置部门负责人
+		if(!workFullRecord.getIsNewRecord()){//编辑表单保存
+			addMessage(redirectAttributes, "归档已存在!");
+			return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+		}else{//新增表单保存
+			WorkFullRecord workFullManageId = workFullRecordService.findUniqueByProperty("work_full_manage_id", engineeringId);
+			if(workFullManageId != null){
+				addMessage(redirectAttributes, "项目归档已申请,不能重新申请");
+				return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullRecord/?repage";
+			}else {
+				workFullManageId = new WorkFullRecord();
+			}
+			workFullManageId.preInsert();
+			WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.get(engineeringId);
+			workFullManageId.setCompanyId(UserUtils.getSelectCompany().getId());
+			workFullManageId.setType("1");
+			workFullManageId.setWorkFullManage(new WorkFullManage(engineeringId));
+			workFullManageId.setBackRecordStatus(VarStr.BACKRECORD_STATUS[1]);
+			workFullManageId.setStartTime(workEngineeringProject.getWorkStartDate());
+			workFullManageId.setEndTime(workEngineeringProject.getWorkEndDate());
+			workFullManageId.setRecordName(workEngineeringProject.getProjectId().getName());
+			workFullManageId.setRecordNumber(workEngineeringProject.getProjectId().getNumber());
+			Role r = new Role();
+			r.setEnname(gly.toString());
+			r.setCompany(UserUtils.getSelectCompany());
+			r.setOffice(UserUtils.getSelectOffice());
+			Role rolegd =  roleDao.getByEnname(r);
+			List<User> userList = systemService.findUser(new User(new Role(rolegd.getId())));
+			workFullManageId.setManageUser(userList==null||userList.size()==0?"":userList.get(0).getId());
+			workFullRecordService.startposs(workFullManageId,variables,false,"4",buffer.toString());//保存
+		}
+		addMessage(redirectAttributes, "保存项目归档成功");
+		return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 保存项目归档
+	 */
+	@RequestMapping(value = "save")
+	public String save(WorkFullRecord workFullRecord, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workFullRecord)){
+			return form(workFullRecord, model,redirectAttributes);
+		}
+		if(!workFullRecord.getIsNewRecord()){//编辑表单保存
+			WorkFullRecord t = workFullRecordService.get(workFullRecord.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workFullRecord, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workFullRecordService.save(t);//保存
+		}else{//新增表单保存
+			WorkFullRecord workFullManageId = workFullRecordService.findUniqueByProperty("work_full_manage_id", workFullRecord.getWorkEngineeringProject().getId());
+			if(workFullManageId != null){
+				addMessage(redirectAttributes, "项目归档已申请,不能重新申请");
+				return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullRecord/?repage";
+			}
+			WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.get(workFullRecord.getWorkEngineeringProject().getId());
+			workFullRecord.setCompanyId(UserUtils.getSelectCompany().getId());
+			workFullRecord.setType("1");
+			workFullRecord.setWorkFullManage(new WorkFullManage(workFullRecord.getWorkEngineeringProject().getId()));
+			workFullRecord.setBackRecordStatus(VarStr.BACKRECORD_STATUS[1]);
+			workFullRecord.setStartTime(workEngineeringProject.getWorkStartDate());
+			workFullRecord.setEndTime(workEngineeringProject.getWorkEndDate());
+			workFullRecord.setRecordName(workEngineeringProject.getProjectId().getName());
+			workFullRecord.setRecordNumber(workEngineeringProject.getProjectId().getName());
+			workFullRecordService.save(workFullRecord);//保存
+		}
+		addMessage(redirectAttributes, "保存项目归档成功");
+		return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 删除项目归档
+	 */
+	@RequestMapping(value = "delete")
+	public String delete(WorkFullRecord workFullRecord, RedirectAttributes redirectAttributes) {
+		workFullRecordService.delete(workFullRecord);
+		addMessage(redirectAttributes, "删除项目归档成功");
+		return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 批量删除项目归档
+	 */
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workFullRecordService.delete(workFullRecordService.get(id));
+		}
+		addMessage(redirectAttributes, "删除项目归档成功");
+		return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 导出excel文件
+	 */
+	@RequestMapping(value = "export", method=RequestMethod.POST)
+	public String exportFile(WorkFullRecord workFullRecord, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+			String fileName = "项目归档"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+			Page<WorkFullRecord> page = workFullRecordService.findPage(new Page<WorkFullRecord>(request, response, -1), workFullRecord);
+			new ExportExcel("项目归档", WorkFullRecord.class).setDataList(page.getList()).write(response, fileName).dispose();
+			return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出项目归档记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequestMapping(value = "import", method=RequestMethod.POST)
+	public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkFullRecord> list = ei.getDataList(WorkFullRecord.class);
+			for (WorkFullRecord workFullRecord : list){
+				try{
+					workFullRecordService.save(workFullRecord);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条项目归档记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条项目归档记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入项目归档失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 下载导入项目归档数据模板
+	 */
+	@RequestMapping(value = "import/template")
+	public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+			String fileName = "项目归档数据导入模板.xlsx";
+			List<WorkFullRecord> list = Lists.newArrayList();
+			new ExportExcel("项目归档数据", WorkFullRecord.class, 1).setDataList(list).write(response, fileName).dispose();
+			return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 查询待办列表
+	 * @return
+	 */
+
+	@RequestMapping("/queryToList")
+	public String queryToList(Act act,Model model){
+		act.setProcDefKey("engineeringrecord");
+		List<Act> list = actTaskService.todoList(act);
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+		List<WorkFullRecord> lists = new ArrayList<WorkFullRecord>();
+		for (Act a : list) {
+			WorkFullRecord workFullRecord = workFullRecordService.getByProcessInstanceId(a.getProcInsId());
+			if (workFullRecord!=null && StringUtils.isNotBlank(workFullRecord.getManageUser())) {
+				workFullRecord.setManageId(UserUtils.get(workFullRecord.getManageUser()).getName());
+			}
+			if (workFullRecord != null && workFullRecord.getCompanyId().equals(companyId) && workFullRecord.getBackRecordStatus() !=null && !workFullRecord.getBackRecordStatus().equals("3")) {
+				workFullRecord.setCreateBy(UserUtils.get(workFullRecord.getCreateBy().getId()));
+				if (a.getVars().getMap().get("applyUserId")!=null){
+					User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+					if (user!=null) {
+						a.getVars().getMap().put("applyUserId", UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+					}
+				}
+				workFullRecord.setAct(a);
+				lists.add(workFullRecord);
+			}
+		}
+		model.addAttribute("list", lists);
+		return "modules/workengineeringproject/recordTodoList";
+	}
+
+	/**
+	 * 查询已办列表
+	 * @return
+	 */
+	@RequestMapping("/queryCompleteList")
+	public String queryCompleteList(Act act,Model model){
+		act.setProcDefKey("engineeringrecord");
+		List<WorkFullRecord> page = workFullRecordService.historicList(act);
+		for (WorkFullRecord workFullRecord : page){
+			if (workFullRecord!=null && StringUtils.isNotBlank(workFullRecord.getManageUser())) {
+				workFullRecord.setManageId(UserUtils.get(workFullRecord.getManageUser()).getName());
+			}
+		}
+		model.addAttribute("list",page);
+		return "modules/workengineeringproject/recordHistoricList";
+	}
+
+	/**
+	 * 审核信息
+	 * @param response
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "applyOnRecord")
+	public String applyOnRecord(Act act, HttpServletResponse response, Model model) {
+		String engineeringId = request.getParameter("engineeringId");
+		// 获取流程XML上的表单KEY
+		String formkey = "/engineeringrecord/engineeringrecord/form?engineeringId="+engineeringId;
+//		String formKey = actTaskService.getFormKey(act.getProcDefId(), act.getTaskDefKey());
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+		}
+		return "redirect:" + ActUtils.getFormUrl(formkey, act);
+	}
+
+	/**
+	 * 工单执行(完成任务)
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "saveAudit")
+	public String saveAudit(WorkFullRecord workFullRecord, Model model, RedirectAttributes redirectAttributes) {
+		/*if (StringUtils.isBlank(workFullRecord.getAct().getFlag())
+				|| StringUtils.isBlank(workFullRecord.getAct().getComment())){
+			addMessage(model, "请填写审核意见。");
+			return form(workFullRecord, model,redirectAttributes);
+		}*/
+		String type = "4";
+		workFullRecordService.auditSave(workFullRecord, VarStr.BACKRECORD_STATUS,type);
+		Role role = UserUtils.getSelectRole().get(0);
+		if(role.getEnname().contains("glygd")) {
+			workFullRecordService.save(workFullRecord);
+		}
+		addMessage(redirectAttributes, "项目归档流程已审批!");
+		return "redirect:" + adminPath +"/engineeringrecord/engineeringrecord/?repage";
+	}
+
+	/**
+	 * 读取单个实体流程
+	 * @return
+	 */
+	@RequestMapping(value = "getProcessOne")
+	public String getProcessOne(String engineeringId, Model model) {
+		WorkFullRecord workFullManageId = workFullRecordService.findUniqueByProperty("work_full_manage_id", engineeringId);
+		String processInstanceId = "";
+		if (workFullManageId!=null){
+			processInstanceId = workFullManageId.getProcessInstanceId();
+		}
+		model.addAttribute("processInstanceId", processInstanceId);
+		return "modules/workengineeringproject/workRecordTrack";
+	}
+
+}

+ 511 - 0
src/main/java/com/jeeplus/modules/workengineeringproject/web/WorkProjectManagementController.java

@@ -0,0 +1,511 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workengineeringproject.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.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workengineeringprice.entity.WorkEngineeringPrice;
+import com.jeeplus.modules.workengineeringproject.entity.WorkEngineeringProject;
+import com.jeeplus.modules.workengineeringproject.service.WorkEngineeringProjectService;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 工程项目信息Controller
+ * @author 杨帆
+ * @version 2017-10-23
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/projectManagement/projectManagement")
+public class WorkProjectManagementController extends BaseController {
+
+	@Autowired
+	private WorkEngineeringProjectService workEngineeringProjectService;
+	@Autowired
+	protected RuntimeService runtimeService;
+	@Autowired
+	protected TaskService taskService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	protected HistoryService historyService;
+	@Autowired
+	protected RepositoryService repositoryService;
+	@Autowired
+	private WorkattachmentService workattachmentService;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private ActivityService activityService;
+
+	@ModelAttribute
+	public WorkEngineeringProject get(@RequestParam(required=false) String id) {
+		WorkEngineeringProject entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workEngineeringProjectService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkEngineeringProject();
+		}
+		return entity;
+	}
+
+	@RequestMapping(value = "form")
+	public String form(WorkEngineeringProject workEngineeringProject, Model model) {
+		if (StringUtils.isBlank(workEngineeringProject.getId())) {
+			workEngineeringProject.setOffice(UserUtils.getSelectOffice());
+		}
+		List<Workattachment> workReportList = workattachmentService.findAttachment(workEngineeringProject.getId(),"39");
+		List<Workattachment> workBasisInformationList = workattachmentService.findAttachment(workEngineeringProject.getId(),"40");
+		List<Workattachment> workRemoteControlList = workattachmentService.findAttachment(workEngineeringProject.getId(),"41");
+		List<Workattachment> workSummaryList = workattachmentService.findAttachment(workEngineeringProject.getId(),"42");
+		List<Workattachment> workOtherList = workattachmentService.findAttachment(workEngineeringProject.getId(),"43");
+		model.addAttribute("workEngineeringProject", workEngineeringProject);
+		model.addAttribute("workReportList", workReportList);
+		model.addAttribute("workBasisInformationList", workBasisInformationList);
+		model.addAttribute("workRemoteControlList", workRemoteControlList);
+		model.addAttribute("workSummaryList", workSummaryList);
+		model.addAttribute("workOtherList", workOtherList);
+		if (!workEngineeringProject.getBusinessType().contains("2") && !workEngineeringProject.getBusinessType().contains("H")){
+			if (workEngineeringProject.getAct()!=null && StringUtils.isNotBlank(workEngineeringProject.getAct().getTaskId())){
+				return "modules/workprojectManagement/workThreeGradeExamination";
+			}else if (StringUtils.isNotBlank(workEngineeringProject.getName()) && workEngineeringProject.getName().equals("1")){
+				return "modules/workprojectManagement/workThreeGradeExamination";
+			}{
+				return "modules/workprojectManagement/workThreeGradeExaminationView";
+			}
+		}else {
+			if (workEngineeringProject.getAct()!=null && StringUtils.isNotBlank(workEngineeringProject.getAct().getTaskId())){
+				return "modules/workprojectManagement/workThreeExamination";
+			} else if (StringUtils.isNotBlank(workEngineeringProject.getName()) && workEngineeringProject.getName().equals("1")){
+				return "modules/workprojectManagement/workThreeGradeExamination";
+			}else {
+				return "modules/workprojectManagement/workThreeExaminationView";
+			}
+		}
+	}
+
+
+	/**
+	 * 工程项目信息列表页面
+	 */
+	@RequiresPermissions("projectManagement:projectManagement:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkEngineeringProject workEngineeringProject, HttpServletRequest request, HttpServletResponse response, Model model) {
+		//只是普通员工
+		if(!UserUtils.getSelectRoleInfo()){
+			String id = UserUtils.getUser().getId();
+			workEngineeringProject.setQueryCon(id);
+		}
+		Page<WorkEngineeringProject> page = workEngineeringProjectService.findProjectManagementPage(new Page<WorkEngineeringProject>(request, response), workEngineeringProject);
+		List<WorkEngineeringProject> list = page.getList();
+		for (WorkEngineeringProject entity :list){
+			String hostOfficeMaster = entity.getHostOfficeMaster();
+			if (StringUtils.isNotBlank(hostOfficeMaster)){
+				String[] ids = hostOfficeMaster.split(",");
+				String name = "";
+				for (String str:ids) {
+					User user = UserUtils.get(str);
+					name += user.getName()+",";
+				}
+				if (StringUtils.isNotBlank(name)){
+					name = name.substring(0,name.length() - 1);
+				}
+				entity.setHostOfficeMasterName(name);
+			}
+			if(StringUtils.isNotBlank(entity.getProcessInstanceProofreadId())){
+				boolean state = actTaskService.isProcessEnd(entity.getProcessInstanceProofreadId());
+				if (state){
+					entity.setQueryCon("true");
+				}
+			}
+		}
+		model.addAttribute("page", page);
+		model.addAttribute("name", UserUtils.getSelectRole().get(0).getEnname());
+		return "modules/workprojectManagement/workProjectManagementList";
+	}
+
+	@RequestMapping(value = "startThreeGradeExamination")
+	public String startThreeGradeExamination(WorkEngineeringProject workEngineeringProject, Model model) {
+		if (StringUtils.isBlank(workEngineeringProject.getId())) {
+			workEngineeringProject.setOffice(UserUtils.getSelectOffice());
+		}
+		List<Workattachment> workReportList = workattachmentService.findAttachment(workEngineeringProject.getId(),"39");
+		List<Workattachment> workBasisInformationList = workattachmentService.findAttachment(workEngineeringProject.getId(),"40");
+		List<Workattachment> workRemoteControlList = workattachmentService.findAttachment(workEngineeringProject.getId(),"41");
+		List<Workattachment> workSummaryList = workattachmentService.findAttachment(workEngineeringProject.getId(),"42");
+		List<Workattachment> workOtherList = workattachmentService.findAttachment(workEngineeringProject.getId(),"43");
+		model.addAttribute("workEngineeringProject", workEngineeringProject);
+		model.addAttribute("workReportList", workReportList);
+		model.addAttribute("workBasisInformationList", workBasisInformationList);
+		model.addAttribute("workRemoteControlList", workRemoteControlList);
+		model.addAttribute("workSummaryList", workSummaryList);
+		model.addAttribute("workOtherList", workOtherList);
+		/*if (workEngineeringProject.getName().equals("4")){
+			String processInstanceId = workEngineeringProject.getProcessInstanceProofreadId();
+			HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+			if(historicProcessInstance!=null) {
+				workEngineeringProject.setHistoricProcessInstance(historicProcessInstance);
+				workEngineeringProject.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId(historicProcessInstance.getProcessDefinitionId()).singleResult());
+			} else {
+				ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).active().singleResult();
+				if (processInstance != null){
+					workEngineeringProject.setProcessInstance(processInstance);
+					workEngineeringProject.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult());
+				}
+			}
+			ProcessInstance processInstance = actTaskService.getProcIns(processInstanceId);
+			if (processInstance!=null) {
+				List<Task> taskList = actTaskService.getCurrentTaskList(processInstance);
+				if(taskList!=null && taskList.size()>1){
+					for (Task taskInfok:taskList) {
+						if (taskInfok.getAssignee().equals(UserUtils.getUser().getId())) {
+							Act act = new Act();
+							act.setTaskId(taskInfok.getId());
+							act.setTaskName(taskInfok.getName());
+							act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+							act.setProcDefId(taskInfok.getProcessDefinitionId());
+							act.setProcInsId(taskInfok.getProcessInstanceId());
+							act.setTask(taskInfok);
+							workEngineeringProject.setAct(act);
+						}
+					}
+				}else {
+					Task task = actTaskService.getCurrentTaskInfo(processInstance);
+					Act act = new Act();
+					act.setTaskId(task.getId());
+					act.setTaskName(task.getName());
+					act.setTaskDefKey(task.getTaskDefinitionKey());
+					act.setProcDefId(task.getProcessDefinitionId());
+					act.setProcInsId(task.getProcessInstanceId());
+					act.setTask(task);
+					workEngineeringProject.setAct(act);
+				}
+			}
+			model.addAttribute("workEngineeringProject", workEngineeringProject);
+		}*/
+		if (!workEngineeringProject.getBusinessType().contains("2") && !workEngineeringProject.getBusinessType().contains("H")){
+			if (workEngineeringProject.getAct()!=null && StringUtils.isNotBlank(workEngineeringProject.getAct().getTaskId())){
+				return "modules/workprojectManagement/workThreeGradeExamination";
+			}else if (StringUtils.isNotBlank(workEngineeringProject.getName()) && workEngineeringProject.getName().equals("1")){
+				return "modules/workprojectManagement/workThreeGradeExamination";
+			}else if (StringUtils.isNotBlank(workEngineeringProject.getName()) && workEngineeringProject.getName().equals("5")){
+				return "modules/workprojectManagement/startThreeGradeExamination";
+			}{
+				return "modules/workprojectManagement/workThreeGradeExaminationView";
+			}
+		}else {
+			if (workEngineeringProject.getAct()!=null && StringUtils.isNotBlank(workEngineeringProject.getAct().getTaskId())){
+				return "modules/workprojectManagement/workThreeExamination";
+			} else if (StringUtils.isNotBlank(workEngineeringProject.getName()) && workEngineeringProject.getName().equals("1")){
+				return "modules/workprojectManagement/workThreeGradeExamination";
+			}else if (StringUtils.isNotBlank(workEngineeringProject.getName()) && workEngineeringProject.getName().equals("5")){
+				return "modules/workprojectManagement/startThreeGradeExamination";
+			}else {
+				return "modules/workprojectManagement/workThreeExaminationView";
+			}
+		}
+
+	}
+
+	/**
+	 * 保存项目实施记录
+	 */
+	@RequestMapping(value = "save")
+	public String save(WorkEngineeringProject workEngineeringProject, Model model, RedirectAttributes redirectAttributes,HttpServletRequest request,
+					   HttpServletResponse response) throws Exception{
+		WorkEngineeringProject t = workEngineeringProjectService.get(workEngineeringProject.getId());//从数据库取出记录的值
+		WorkEngineeringPrice workEngineeringPrice = workEngineeringProject.getWorkEngineeringPrice();
+		workEngineeringPrice.setEngineeringId(workEngineeringProject.getId());
+		t.setWorkEngineeringPrice(workEngineeringPrice);
+		Map map = new HashMap();
+		workEngineeringProjectService.saveProjectManagement(t, map);//保存
+		addMessage(redirectAttributes, "三级校审已启动!");
+		return "redirect:"+Global.getAdminPath()+"/projectManagement/projectManagement/?repage";
+
+	}
+
+	/**
+	 * 审核信息
+	 * @param response
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "applyOnWorkprojectManagement")
+	public String applyOnWorkprojectManagement(Act act, HttpServletResponse response, Model model) {
+		// 获取流程XML上的表单KEY
+		String formKey = "/workengineeringproject/workEngineeringProject/startThreeGradeExamination";
+		//logger.info("------formKeys:"+formKeys);
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+		}
+		return "redirect:" + ActUtils.getFormUrl(formKey, act);
+	}
+
+	/**
+	 * 工单执行(完成任务)
+	 * @param workEngineeringProject
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "saveAudit")
+	public String saveAudit(WorkEngineeringProject workEngineeringProject, Map<String, Object> vars, Model model, RedirectAttributes redirectAttributes) {
+		String flag = workEngineeringProject.getAct()==null?"2":workEngineeringProject.getAct().getFlag();
+		WorkEngineeringPrice workEngineeringPrice = workEngineeringProject.getWorkEngineeringPrice();
+		workEngineeringPrice.setEngineeringId(workEngineeringProject.getId());
+		WorkEngineeringProject t = workEngineeringProjectService.get(workEngineeringProject.getId());//从数据库取出记录的值
+		t.setWorkEngineeringPrice(workEngineeringPrice);
+		Map map = new HashMap();
+		boolean b = workEngineeringProjectService.saveProjectManagement(t, map);//保存
+
+		if (b){
+			addMessage(redirectAttributes, "三级校审已发起!");
+		}else {
+			if(StringUtils.isNotBlank(workEngineeringProject.getProofreadStatus()) && workEngineeringProject.getProofreadStatus().equals("4")){
+				String processInstanceProofreadId = workEngineeringProject.getProcessInstanceProofreadId();
+				HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceProofreadId).singleResult();
+				if(historicProcessInstance!=null) {
+					workEngineeringProject.setHistoricProcessInstance(historicProcessInstance);
+					workEngineeringProject.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId(historicProcessInstance.getProcessDefinitionId()).singleResult());
+				} else {
+					ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceProofreadId).active().singleResult();
+					if (processInstance != null){
+						workEngineeringProject.setProcessInstance(processInstance);
+						workEngineeringProject.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult());
+					}
+				}
+				ProcessInstance processInstance = actTaskService.getProcIns(workEngineeringProject.getProcessInstanceProofreadId());
+				if (processInstance!=null) {
+					Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+					Act act = new Act();
+					act.setTaskId(taskInfok.getId());
+					act.setTaskName(taskInfok.getName());
+					act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+					act.setProcDefId(taskInfok.getProcessDefinitionId());
+					act.setProcInsId(taskInfok.getProcessInstanceId());
+					act.setTask(taskInfok);
+					act.setFlag(flag);
+					workEngineeringProject.setAct(act);
+				}
+				if (StringUtils.isNotBlank(t.getRemarks()) && t.getRemarks().equals("yes")){
+					addMessage(redirectAttributes, "重新申请三级校审成功");
+				}else {
+					addMessage(redirectAttributes, "三级校审已撤销");
+				}
+				t.setRemarks("");
+			}
+
+			String str = workEngineeringProjectService.auditProofreadSave(workEngineeringProject);
+			addMessage(redirectAttributes, str);
+		}
+		return "redirect:"+Global.getAdminPath()+"/projectManagement/projectManagement/?repage";
+	}
+
+	/**
+	 * 启动流程
+	 * @return
+	 */
+	@RequestMapping(value = "startposs")
+	public String startposs(WorkEngineeringProject workEngineeringProject, HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes redirectAttributes)throws Exception {
+		Map<String, Object> variables = new HashMap<String, Object>();
+		WorkEngineeringProject t = workEngineeringProjectService.get(workEngineeringProject.getId());//从数据库取出记录的值
+		MyBeanUtils.copyBeanNotNull2Bean(workEngineeringProject, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+		t.setStatus("2");
+		t.preUpdate();
+		workEngineeringProjectService.update(t);
+		workEngineeringProjectService.startProofreadProcess(t,variables);
+		addMessage(redirectAttributes, "启动流程成功");
+		return "redirect:"+Global.getAdminPath()+"/projectManagement/projectManagement/?repage";
+	}
+
+	/**
+	 * 附件列表
+	 * @return
+	 */
+	@RequestMapping(value = "getAttachmentList")
+	public String getAttachmentList(WorkEngineeringProject workEngineeringProject, HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes redirectAttributes)throws Exception {
+		if (StringUtils.isBlank(workEngineeringProject.getId())) {
+			workEngineeringProject.setOffice(UserUtils.getSelectOffice());
+		}
+		List<Workattachment> workReportList = workattachmentService.findAttachment(workEngineeringProject.getId(),"39");
+		List<Workattachment> workBasisInformationList = workattachmentService.findAttachment(workEngineeringProject.getId(),"40");
+		List<Workattachment> workRemoteControlList = workattachmentService.findAttachment(workEngineeringProject.getId(),"41");
+		List<Workattachment> workSummaryList = workattachmentService.findAttachment(workEngineeringProject.getId(),"42");
+		List<Workattachment> workOtherList = workattachmentService.findAttachment(workEngineeringProject.getId(),"43");
+		model.addAttribute("workEngineeringProject", workEngineeringProject);
+		model.addAttribute("workReportList", workReportList);
+		model.addAttribute("workBasisInformationList", workBasisInformationList);
+		model.addAttribute("workRemoteControlList", workRemoteControlList);
+		model.addAttribute("workSummaryList", workSummaryList);
+		model.addAttribute("workOtherList", workOtherList);
+		return "modules/workprojectManagement/workAttachmentListView";
+	}
+
+	/**
+	 * 待办任务列表页面
+	 * @param request
+	 * @param response
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = {"workProjectManagementTodoList"})
+	public String workProjectManagementTodoList(Act act, HttpServletRequest request, HttpServletResponse response, Model model) {
+		act.setProcDefKey("threeexamination");
+		List<Act> list = new ArrayList<>();
+		list.addAll(actTaskService.todoList(act));
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+		List<Activity> activities = activityService.groupByActivityMenu("7864872f45b84acd893010e66a3db2c8",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			list.addAll(actTaskService.todoList(act));
+		}
+		List<WorkEngineeringProject> lists = new ArrayList<WorkEngineeringProject>();
+		Role role = UserUtils.getSelectRole().get(0);
+		String officeId = "";
+		if (role.getDataScope().contains("4")){
+			User user = UserUtils.getUser();
+			officeId = user.getOffice().getId();
+		}
+		for (Act a : list) {
+			WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.getByProcessInstanceProofreadId(a.getTask().getProcessInstanceId());
+			if (workEngineeringProject != null && workEngineeringProject.getCompanyId().equals(companyId) && workEngineeringProject.getProofreadStatus() !=null && !workEngineeringProject.getProofreadStatus().equals("4") && workEngineeringProject.getStatus() !=null && workEngineeringProject.getStatus().equals("4")) {
+				User createBy = UserUtils.get(workEngineeringProject.getCreateBy().getId());
+				if (StringUtils.isNotBlank(officeId)){
+					if (officeId.equals(createBy.getOffice().getId())){
+						if (a.getVars().getMap().get("applyUserId")!=null) {
+							User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+							if (user != null) {
+								a.getVars().getMap().put("applyUserId", UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+							}
+						}
+						workEngineeringProject.setAct(a);
+						if (com.jeeplus.common.utils.StringUtils.isNotBlank(workEngineeringProject.getId())){
+							workEngineeringProject.setName(officeService.get(companyId).getName());
+						}
+						lists.add(workEngineeringProject);
+					}
+				}else {
+					if (a.getVars().getMap().get("applyUserId")!=null) {
+						User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+						if (user != null) {
+							a.getVars().getMap().put("applyUserId", UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+						}
+					}
+					workEngineeringProject.setAct(a);
+					if (com.jeeplus.common.utils.StringUtils.isNotBlank(workEngineeringProject.getId())){
+						workEngineeringProject.setName(officeService.get(companyId).getName());
+					}
+					lists.add(workEngineeringProject);
+				}
+			}
+		}
+		model.addAttribute("list", lists);
+		return "modules/workprojectManagement/workProjectManagementTodoList";
+	}
+
+	/**
+	 * 已办任务
+	 * @param act
+	 * @param request
+	 * @param response
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = {"workProjectManagementHistoricList"})
+	public String workProjectManagementHistoricList (Act act, HttpServletRequest request, HttpServletResponse response, Model model){
+		act.setProcDefKey("threeexamination");
+		List<Act> list = actTaskService.historicList(act);
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+		List<Activity> activities = activityService.groupByActivityMenu("7864872f45b84acd893010e66a3db2c8",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			list.addAll(actTaskService.historicList(act));
+		}
+		List<WorkEngineeringProject> lists = new ArrayList<WorkEngineeringProject>();
+		for (Act a : list) {
+			try {
+				WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.getByProcessInstanceProofreadId(a.getHistTask().getProcessInstanceId());
+				if (workEngineeringProject != null && workEngineeringProject.getCompanyId().equals(companyId)) {
+					if (a.getVars().getMap().get("applyUserId")!=null){
+						a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+					}
+					workEngineeringProject.setAct(a);
+					if (com.jeeplus.common.utils.StringUtils.isNotBlank(workEngineeringProject.getId())){
+						workEngineeringProject.setName(officeService.get(companyId).getName());
+					}
+					lists.add(workEngineeringProject);
+				}
+			}catch (Exception e){
+				logger.info("Exception e"+e);
+			}
+
+		}
+		model.addAttribute("list", lists);
+
+		return "modules/workprojectManagement/workProjectManagementHistoricList";
+	}
+
+	/**
+	 * 审核信息
+	 * @param response
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "applyOnWorkProjectManagement")
+	public String applyOnWorkEngineeringProject(Act act, HttpServletResponse response, Model model) {
+		// 获取流程XML上的表单KEY
+		String formKey = "/projectManagement/projectManagement/form";
+		//logger.info("------formKeys:"+formKeys);
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+		}
+		return "redirect:" + ActUtils.getFormUrl(formKey, act);
+	}
+
+}

+ 19 - 0
src/main/java/com/jeeplus/modules/workevaluationroom/dao/WorkEvaluationRoomDao.java

@@ -0,0 +1,19 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workevaluationroom.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workevaluationroom.entity.WorkEvaluationRoom;
+
+/**
+ * 评标室管理DAO接口
+ * @author 杨帆
+ * @version 2017-12-28
+ */
+@MyBatisDao
+public interface WorkEvaluationRoomDao extends CrudDao<WorkEvaluationRoom> {
+
+	
+}

+ 86 - 0
src/main/java/com/jeeplus/modules/workevaluationroom/entity/WorkEvaluationRoom.java

@@ -0,0 +1,86 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workevaluationroom.entity;
+
+import com.jeeplus.modules.sys.entity.Office;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 评标室管理Entity
+ * @author 杨帆
+ * @version 2017-12-28
+ */
+public class WorkEvaluationRoom extends DataEntity<WorkEvaluationRoom> {
+	
+	private static final long serialVersionUID = 1L;
+	private String address;		// 地址
+	private String floor;		// 楼层
+	private String houseNumber;		// 门牌号码
+	private String companyId;		// company_id
+	private Office office;		// office_id
+	private String name;		// office_id
+
+	public WorkEvaluationRoom() {
+		super();
+	}
+
+	public WorkEvaluationRoom(String id){
+		super(id);
+	}
+
+	@ExcelField(title="地址", align=2, sort=7)
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+	
+	@ExcelField(title="楼层", align=2, sort=8)
+	public String getFloor() {
+		return floor;
+	}
+
+	public void setFloor(String floor) {
+		this.floor = floor;
+	}
+	
+	@ExcelField(title="门牌号码", align=2, sort=9)
+	public String getHouseNumber() {
+		return houseNumber;
+	}
+
+	public void setHouseNumber(String houseNumber) {
+		this.houseNumber = houseNumber;
+	}
+	
+	@ExcelField(title="company_id", align=2, sort=10)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="office_id", fieldType=Office.class, value="office.name", align=2, sort=11)
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+}

+ 50 - 0
src/main/java/com/jeeplus/modules/workevaluationroom/service/WorkEvaluationRoomService.java

@@ -0,0 +1,50 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workevaluationroom.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workevaluationroom.entity.WorkEvaluationRoom;
+import com.jeeplus.modules.workevaluationroom.dao.WorkEvaluationRoomDao;
+
+/**
+ * 评标室管理Service
+ * @author 杨帆
+ * @version 2017-12-28
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkEvaluationRoomService extends CrudService<WorkEvaluationRoomDao, WorkEvaluationRoom> {
+
+	public WorkEvaluationRoom get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkEvaluationRoom> findList(WorkEvaluationRoom workEvaluationRoom) {
+		return super.findList(workEvaluationRoom);
+	}
+	
+	public Page<WorkEvaluationRoom> findPage(Page<WorkEvaluationRoom> page, WorkEvaluationRoom workEvaluationRoom) {
+		return super.findPage(page, workEvaluationRoom);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkEvaluationRoom workEvaluationRoom) {
+		super.save(workEvaluationRoom);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkEvaluationRoom workEvaluationRoom) {
+		super.delete(workEvaluationRoom);
+	}
+	
+	
+	
+	
+}

+ 210 - 0
src/main/java/com/jeeplus/modules/workevaluationroom/web/WorkEvaluationRoomController.java

@@ -0,0 +1,210 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workevaluationroom.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workevaluationroom.entity.WorkEvaluationRoom;
+import com.jeeplus.modules.workevaluationroom.service.WorkEvaluationRoomService;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.List;
+
+/**
+ * 评标室管理Controller
+ * @author 杨帆
+ * @version 2017-12-28
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workevaluationroom/workEvaluationRoom")
+public class WorkEvaluationRoomController extends BaseController {
+
+	@Autowired
+	private WorkEvaluationRoomService workEvaluationRoomService;
+	
+	@ModelAttribute
+	public WorkEvaluationRoom get(@RequestParam(required=false) String id) {
+		WorkEvaluationRoom entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workEvaluationRoomService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkEvaluationRoom();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 评标室管理列表页面
+	 */
+	@RequiresPermissions("workevaluationroom:workEvaluationRoom:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkEvaluationRoom workEvaluationRoom, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Role role = UserUtils.getSelectRole().get(0);
+		Office office = UserUtils.getSelectOffice();
+		Page<WorkEvaluationRoom> page = new Page<>();
+		if(!office.getName().contains("招标")){
+			page.setPageNo(1);
+			page.setPageSize(10);
+			model.addAttribute("page", page);
+			model.addAttribute("addBtn","addBtn");
+			return "modules/workevaluationroom/workEvaluationRoomList";
+		}
+		page = workEvaluationRoomService.findPage(new Page<WorkEvaluationRoom>(request, response), workEvaluationRoom);
+		model.addAttribute("page", page);
+		return "modules/workevaluationroom/workEvaluationRoomList";
+	}
+
+	/**
+	 * 查看,增加,编辑评标室管理表单页面
+	 */
+	@RequiresPermissions(value={"workevaluationroom:workEvaluationRoom:view","workevaluationroom:workEvaluationRoom:add","workevaluationroom:workEvaluationRoom:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkEvaluationRoom workEvaluationRoom, Model model) {
+		model.addAttribute("workEvaluationRoom", workEvaluationRoom);
+		if(StringUtils.isNotBlank(workEvaluationRoom.getName()) && workEvaluationRoom.getName().equals("view")){
+			return "modules/workevaluationroom/workEvaluationRoomView";
+		}
+		return "modules/workevaluationroom/workEvaluationRoomForm";
+	}
+
+	/**
+	 * 保存评标室管理
+	 */
+	@RequiresPermissions(value={"workevaluationroom:workEvaluationRoom:add","workevaluationroom:workEvaluationRoom:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkEvaluationRoom workEvaluationRoom, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workEvaluationRoom)){
+			return form(workEvaluationRoom, model);
+		}
+		if(!workEvaluationRoom.getIsNewRecord()){//编辑表单保存
+			WorkEvaluationRoom t = workEvaluationRoomService.get(workEvaluationRoom.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workEvaluationRoom, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workEvaluationRoomService.save(t);//保存
+		}else{//新增表单保存
+			workEvaluationRoomService.save(workEvaluationRoom);//保存
+		}
+		addMessage(redirectAttributes, "保存评标室管理成功");
+		return "redirect:"+Global.getAdminPath()+"/workevaluationroom/workEvaluationRoom/?repage";
+	}
+	
+	/**
+	 * 删除评标室管理
+	 */
+	@RequiresPermissions("workevaluationroom:workEvaluationRoom:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkEvaluationRoom workEvaluationRoom, RedirectAttributes redirectAttributes) {
+		workEvaluationRoomService.delete(workEvaluationRoom);
+		addMessage(redirectAttributes, "删除评标室管理成功");
+		return "redirect:"+Global.getAdminPath()+"/workevaluationroom/workEvaluationRoom/?repage";
+	}
+	
+	/**
+	 * 批量删除评标室管理
+	 */
+	@RequiresPermissions("workevaluationroom:workEvaluationRoom:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workEvaluationRoomService.delete(workEvaluationRoomService.get(id));
+		}
+		addMessage(redirectAttributes, "删除评标室管理成功");
+		return "redirect:"+Global.getAdminPath()+"/workevaluationroom/workEvaluationRoom/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workevaluationroom:workEvaluationRoom:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkEvaluationRoom workEvaluationRoom, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "评标室管理"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkEvaluationRoom> page = workEvaluationRoomService.findPage(new Page<WorkEvaluationRoom>(request, response, -1), workEvaluationRoom);
+    		new ExportExcel("评标室管理", WorkEvaluationRoom.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出评标室管理记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workevaluationroom/workEvaluationRoom/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workevaluationroom:workEvaluationRoom:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkEvaluationRoom> list = ei.getDataList(WorkEvaluationRoom.class);
+			for (WorkEvaluationRoom workEvaluationRoom : list){
+				try{
+					workEvaluationRoomService.save(workEvaluationRoom);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条评标室管理记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条评标室管理记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入评标室管理失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workevaluationroom/workEvaluationRoom/?repage";
+    }
+	
+	/**
+	 * 下载导入评标室管理数据模板
+	 */
+	@RequiresPermissions("workevaluationroom:workEvaluationRoom:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "评标室管理数据导入模板.xlsx";
+    		List<WorkEvaluationRoom> list = Lists.newArrayList(); 
+    		new ExportExcel("评标室管理数据", WorkEvaluationRoom.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workevaluationroom/workEvaluationRoom/?repage";
+    }
+	
+	
+	
+
+}

+ 40 - 0
src/main/java/com/jeeplus/modules/workexample/dao/WorkExampleDao.java

@@ -0,0 +1,40 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workexample.entity.WorkExample;
+
+import java.math.BigDecimal;
+
+/**
+ * 案例DAO接口
+ * @author ssrh
+ * @version 2018-08-27
+ */
+@MyBatisDao
+public interface WorkExampleDao extends CrudDao<WorkExample> {
+
+    /**
+     * 根据类型获取平均值
+     * @param workExample
+     * @return
+     */
+    public WorkExample getByTypes(WorkExample workExample);
+    public BigDecimal getSumBuildScale(WorkExample workExample);
+    /**
+     * 更新流程实例ID
+     * @return
+     */
+    public int updateProcessInstanceId(WorkExample workExample);
+
+    /**
+     * 根据流程实例ID获取
+     * @param processInstanceId
+     * @return
+     */
+    public WorkExample getByProcessInstanceId(String processInstanceId);
+
+}

+ 31 - 0
src/main/java/com/jeeplus/modules/workexample/dao/WorkExampleIndicesDao.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workexample.entity.WorkExampleIndices;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 指标项目字典DAO接口
+ * @author 杨帆
+ * @version 2018-08-27
+ */
+@MyBatisDao
+public interface WorkExampleIndicesDao extends CrudDao<WorkExampleIndices> {
+        Integer getOrderNum(String id);
+        List<WorkExampleIndices> findListInfo(WorkExampleIndices workExampleIndices);
+        List<WorkExampleIndices> findByParentId(String id);
+        List<WorkExampleIndices> findByParentIds(WorkExampleIndices workExampleIndices);
+        Integer updateStatus(WorkExampleIndices workExampleIndices);
+        Integer exampleIndicesCount(@Param("workExampleId")String workExampleId, @Param("exampleIndicesId")String exampleIndicesId);
+        void saveExampleIndices(@Param("workExampleId")String workExampleId, @Param("exampleIndicesId")String exampleIndicesId);
+        List<WorkExampleIndices> findByName(WorkExampleIndices workExampleIndices);
+        List<WorkExampleIndices> findExampleIndices(String parentId);
+        List<WorkExampleIndices> find(WorkExampleIndices workExampleIndices);
+        void deleteExampleIndices(@Param("workExampleId")String workExampleId, @Param("exampleIndicesId")String exampleIndicesId);
+}

+ 19 - 0
src/main/java/com/jeeplus/modules/workexample/dao/WorkExampleInfoDao.java

@@ -0,0 +1,19 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workexample.entity.WorkExampleInfo;
+
+/**
+ * 指标项目字典DAO接口
+ * @author 杨帆
+ * @version 2018-08-27
+ */
+@MyBatisDao
+public interface WorkExampleInfoDao extends CrudDao<WorkExampleInfo> {
+        Integer updateStatus(WorkExampleInfo WorkExampleInfo);
+        Integer getOrderNum(String id);
+}

+ 46 - 0
src/main/java/com/jeeplus/modules/workexample/entity/ExcelList.java

@@ -0,0 +1,46 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.entity;
+
+import com.jeeplus.common.persistence.ActEntity;
+
+/**
+ * 案例Entity
+ * @author ssrh
+ * @version 2018-08-27
+ */
+public class ExcelList extends ActEntity<ExcelList> {
+	private static final long serialVersionUID = 1L;
+	private String sheetName;
+	private String name;
+	private String id;
+
+	@Override
+	public String getId() {
+		return id;
+	}
+
+	@Override
+	public void setId(String id) {
+		this.id = id;
+	}
+
+
+
+	public String getSheetName() {
+		return sheetName;
+	}
+
+	public void setSheetName(String sheetName) {
+		this.sheetName = sheetName;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+}

+ 660 - 0
src/main/java/com/jeeplus/modules/workexample/entity/WorkExample.java

@@ -0,0 +1,660 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.entity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.exampleeconomics.entity.ExampleEconomics;
+import com.jeeplus.modules.exampleexpend.entity.ExampleExpend;
+import com.jeeplus.modules.exampleproject.entity.ExampleProject;
+import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.MainDictDetail;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+/**
+ * 案例Entity
+ * @author ssrh
+ * @version 2018-08-27
+ */
+public class WorkExample extends ActEntity<WorkExample> {
+	//通知类型 76    //ggh3125f1f194c82b0000uuyic750904
+	private static final long serialVersionUID = 1L;
+	private String companyId;		// 公司
+	private String officeId;		// 部门
+	private String officeName;      //所属部门
+	private Area area;		// 地区Id
+	private String status;		// 状态
+	private String name;		// 工程名称
+	private String type;		// 工程类型
+	private String address;		// 工程地点
+	private String buildScale;		// 建设规模
+	private String modus;		// 结构形式
+	private String basicType;		// 基础类型
+	private String scale;		// 规       模
+	private String safeLevel;		// 结构安全等级
+	private String stage;		// 编制阶段
+	private String investmentType;		// 投资类型
+	private String valuationType;		// 计价类型
+	private String valuationAccording;		// 计价依据
+	private String biddingPrice;		// 招标基准信息价
+	private String taxModel;		// 计税模式
+	private Date startDate;		// 开工日期
+	private Date endDate;		//  竣工日期
+	private String abovegroundArea;		// 地上建筑面积
+	private String undergroundArea;		// 地下建筑面积
+	private String civilArea;		// 人防建筑面积
+	private String garageArea;		// 车库建筑面积
+	private String abovegroundLayer;		// 地上层数
+	private String undergroundLayer;		// 地下层数
+	private String abovegroundHeight;		// 地上层高
+	private String undergroundHeight;		// 地下层高
+	private String totalHeight;		// 总  层  数
+	private String eavesHeight;		// 檐       高
+	private String insideDecoration;		// 内墙面装修
+	private String outsideDecoration;		// 外墙面装修
+	private String skylightDecoration;		// 天棚装修
+	private String floorDecoration;		// 楼地面装修
+	private String door;		// 门
+	private String window;		// 窗
+	private String instruction;		// 其他说明
+	private String indexId;		// 预留id
+	private String itemId;		// 预留id2
+	private String processInstanceId;		// 流程
+	private String home;
+	private Date beginContractDate;		// 开始
+	private Date endContractDate;		// 结束
+	private String exampleType;
+	private String exampleTypeName;
+	private String workType; //工程类型
+	private BigDecimal counts;
+	private BigDecimal avgs;
+	private BigDecimal sums;
+	private BigDecimal mins;
+	private BigDecimal maxs;
+	private String dictId;
+	private List<ExampleProject> exampleProjectList = Lists.newArrayList();; //主要工程量指标
+	private List<ExampleExpend> exampleExpendList = Lists.newArrayList();; //主要工料价格及消耗量指标
+	private List<ExampleEconomics> exampleEconomicsList = Lists.newArrayList();;//经济指标
+
+	private MainDictDetail mainDictDetail;
+	// 流程任务
+
+	//单项工程造价指标
+	private List<ExampleSingle> exampleSingleList = Lists.newArrayList();
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public Area getArea() {
+		return area;
+	}
+
+	public MainDictDetail getMainDictDetail() {
+		return mainDictDetail;
+	}
+
+	public void setMainDictDetail(MainDictDetail mainDictDetail) {
+		this.mainDictDetail = mainDictDetail;
+	}
+
+	public void setArea(Area area) {
+		this.area = area;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public WorkExample() {
+		super();
+	}
+
+	public WorkExample(String id){
+		super(id);
+	}
+
+	@ExcelField(title="公司", align=2, sort=7)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="部门", align=2, sort=8)
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+	
+	@ExcelField(title="状态", align=2, sort=9)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public String getOfficeName() {
+		return officeName;
+	}
+
+	public void setOfficeName(String officeName) {
+		this.officeName = officeName;
+	}
+
+	public String getHome() {
+		return home;
+	}
+
+	public void setHome(String home) {
+		this.home = home;
+	}
+
+	@ExcelField(title="工程名称", align=2, sort=10)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@ExcelField(title="工程类型", align=2, sort=11)
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public List<ExampleSingle> getExampleSingleList() {
+		return exampleSingleList;
+	}
+
+	public void setExampleSingleList(List<ExampleSingle> exampleSingleList) {
+		this.exampleSingleList = exampleSingleList;
+	}
+
+	@ExcelField(title="工程地点", align=2, sort=12)
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+
+	public Date getBeginContractDate() {
+		return beginContractDate;
+	}
+
+	public void setBeginContractDate(Date beginContractDate) {
+		this.beginContractDate = beginContractDate;
+	}
+
+	public Date getEndContractDate() {
+		return endContractDate;
+	}
+
+	public void setEndContractDate(Date endContractDate) {
+		this.endContractDate = endContractDate;
+	}
+
+	@ExcelField(title="建设规模", align=2, sort=13)
+	public String getBuildScale() {
+		return buildScale;
+	}
+
+	public void setBuildScale(String buildScale) {
+		this.buildScale = buildScale;
+	}
+	
+	@ExcelField(title="结构形式", align=2, sort=14)
+	public String getModus() {
+		return modus;
+	}
+
+	public void setModus(String modus) {
+		this.modus = modus;
+	}
+	
+	@ExcelField(title="基础类型", align=2, sort=15)
+	public String getBasicType() {
+		return basicType;
+	}
+
+	public void setBasicType(String basicType) {
+		this.basicType = basicType;
+	}
+	
+	@ExcelField(title="规       模", align=2, sort=16)
+	public String getScale() {
+		return scale;
+	}
+
+	public void setScale(String scale) {
+		this.scale = scale;
+	}
+	
+	@ExcelField(title="结构安全等级", align=2, sort=17)
+	public String getSafeLevel() {
+		return safeLevel;
+	}
+
+	public void setSafeLevel(String safeLevel) {
+		this.safeLevel = safeLevel;
+	}
+	
+	@ExcelField(title="编制阶段", align=2, sort=18)
+	public String getStage() {
+		return stage;
+	}
+
+	public void setStage(String stage) {
+		this.stage = stage;
+	}
+	
+	@ExcelField(title="投资类型", align=2, sort=19)
+	public String getInvestmentType() {
+		return investmentType;
+	}
+
+	public void setInvestmentType(String investmentType) {
+		this.investmentType = investmentType;
+	}
+	
+	@ExcelField(title="计价类型", align=2, sort=20)
+	public String getValuationType() {
+		return valuationType;
+	}
+
+	public void setValuationType(String valuationType) {
+		this.valuationType = valuationType;
+	}
+	
+	@ExcelField(title="计价依据", align=2, sort=21)
+	public String getValuationAccording() {
+		return valuationAccording;
+	}
+
+	public void setValuationAccording(String valuationAccording) {
+		this.valuationAccording = valuationAccording;
+	}
+	
+	@ExcelField(title="招标基准信息价", align=2, sort=22)
+	public String getBiddingPrice() {
+		return biddingPrice;
+	}
+
+	public void setBiddingPrice(String biddingPrice) {
+		this.biddingPrice = biddingPrice;
+	}
+	
+	@ExcelField(title="计税模式", align=2, sort=23)
+	public String getTaxModel() {
+		return taxModel;
+	}
+
+	public void setTaxModel(String taxModel) {
+		this.taxModel = taxModel;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="开工日期", align=2, sort=24)
+	public Date getStartDate() {
+		return startDate;
+	}
+
+	public void setStartDate(Date startDate) {
+		this.startDate = startDate;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title=" 竣工日期", align=2, sort=25)
+	public Date getEndDate() {
+		return endDate;
+	}
+
+	public void setEndDate(Date endDate) {
+		this.endDate = endDate;
+	}
+	
+	@ExcelField(title="地上建筑面积", align=2, sort=26)
+	public String getAbovegroundArea() {
+		return abovegroundArea;
+	}
+
+	public void setAbovegroundArea(String abovegroundArea) {
+		this.abovegroundArea = abovegroundArea;
+	}
+	
+	@ExcelField(title="地下建筑面积", align=2, sort=27)
+	public String getUndergroundArea() {
+		return undergroundArea;
+	}
+
+	public void setUndergroundArea(String undergroundArea) {
+		this.undergroundArea = undergroundArea;
+	}
+	
+	@ExcelField(title="人防建筑面积", align=2, sort=28)
+	public String getCivilArea() {
+		return civilArea;
+	}
+
+	public void setCivilArea(String civilArea) {
+		this.civilArea = civilArea;
+	}
+	
+	@ExcelField(title="车库建筑面积", align=2, sort=29)
+	public String getGarageArea() {
+		return garageArea;
+	}
+
+	public void setGarageArea(String garageArea) {
+		this.garageArea = garageArea;
+	}
+	
+	@ExcelField(title="地上层数", align=2, sort=30)
+	public String getAbovegroundLayer() {
+		return abovegroundLayer;
+	}
+
+	public void setAbovegroundLayer(String abovegroundLayer) {
+		this.abovegroundLayer = abovegroundLayer;
+	}
+	
+	@ExcelField(title="地下层数", align=2, sort=31)
+	public String getUndergroundLayer() {
+		return undergroundLayer;
+	}
+
+	public void setUndergroundLayer(String undergroundLayer) {
+		this.undergroundLayer = undergroundLayer;
+	}
+	
+	@ExcelField(title="地上层高", align=2, sort=32)
+	public String getAbovegroundHeight() {
+		return abovegroundHeight;
+	}
+
+	public void setAbovegroundHeight(String abovegroundHeight) {
+		this.abovegroundHeight = abovegroundHeight;
+	}
+	
+	@ExcelField(title="地下层高", align=2, sort=33)
+	public String getUndergroundHeight() {
+		return undergroundHeight;
+	}
+
+	public void setUndergroundHeight(String undergroundHeight) {
+		this.undergroundHeight = undergroundHeight;
+	}
+	
+	@ExcelField(title="总  层  数", align=2, sort=34)
+	public String getTotalHeight() {
+		return totalHeight;
+	}
+
+	public void setTotalHeight(String totalHeight) {
+		this.totalHeight = totalHeight;
+	}
+	
+	@ExcelField(title="檐       高", align=2, sort=35)
+	public String getEavesHeight() {
+		return eavesHeight;
+	}
+
+	public void setEavesHeight(String eavesHeight) {
+		this.eavesHeight = eavesHeight;
+	}
+
+	@ExcelField(title="内墙面装修", align=2, sort=36)
+	public String getInsideDecoration() {
+		return insideDecoration;
+	}
+
+	public void setInsideDecoration(String insideDecoration) {
+		this.insideDecoration = insideDecoration;
+	}
+
+	@ExcelField(title="外墙面装修", align=2, sort=37)
+	public String getOutsideDecoration() {
+		return outsideDecoration;
+	}
+
+	public void setOutsideDecoration(String outsideDecoration) {
+		this.outsideDecoration = outsideDecoration;
+	}
+	
+	@ExcelField(title="天棚装修", align=2, sort=38)
+	public String getSkylightDecoration() {
+		return skylightDecoration;
+	}
+
+	public void setSkylightDecoration(String skylightDecoration) {
+		this.skylightDecoration = skylightDecoration;
+	}
+	
+	@ExcelField(title="楼地面装修", align=2, sort=39)
+	public String getFloorDecoration() {
+		return floorDecoration;
+	}
+
+	public void setFloorDecoration(String floorDecoration) {
+		this.floorDecoration = floorDecoration;
+	}
+	
+	@ExcelField(title="门", align=2, sort=40)
+	public String getDoor() {
+		return door;
+	}
+
+	public void setDoor(String door) {
+		this.door = door;
+	}
+	
+	@ExcelField(title="窗", align=2, sort=41)
+	public String getWindow() {
+		return window;
+	}
+
+	public void setWindow(String window) {
+		this.window = window;
+	}
+	
+	@ExcelField(title="其他说明", align=2, sort=42)
+	public String getInstruction() {
+		return instruction;
+	}
+
+	public void setInstruction(String instruction) {
+		this.instruction = instruction;
+	}
+	
+	@ExcelField(title="预留id", align=2, sort=43)
+	public String getIndexId() {
+		return indexId;
+	}
+
+	public void setIndexId(String indexId) {
+		this.indexId = indexId;
+	}
+	
+	@ExcelField(title="预留id2", align=2, sort=44)
+	public String getItemId() {
+		return itemId;
+	}
+
+	public void setItemId(String itemId) {
+		this.itemId = itemId;
+	}
+	
+	@ExcelField(title="流程", align=2, sort=45)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+    public String getExampleType() {
+        return exampleType;
+    }
+
+    public void setExampleType(String exampleType) {
+        this.exampleType = exampleType;
+    }
+
+    public BigDecimal getCounts() {
+        return counts;
+    }
+
+    public void setCounts(BigDecimal counts) {
+        this.counts = counts;
+    }
+
+    public BigDecimal getAvgs() {
+        return avgs;
+    }
+
+    public void setAvgs(BigDecimal avgs) {
+        this.avgs = avgs;
+    }
+
+    public BigDecimal getMins() {
+        return mins;
+    }
+
+    public void setMins(BigDecimal mins) {
+        this.mins = mins;
+    }
+
+    public BigDecimal getMaxs() {
+        return maxs;
+    }
+
+    public void setMaxs(BigDecimal maxs) {
+        this.maxs = maxs;
+    }
+
+    public BigDecimal getSums() {
+        return sums;
+    }
+
+    public void setSums(BigDecimal sums) {
+        this.sums = sums;
+    }
+
+    public String getDictId() {
+        return dictId;
+    }
+
+    public void setDictId(String dictId) {
+        this.dictId = dictId;
+    }
+
+	public String getWorkType() {
+		return workType;
+	}
+
+	public void setWorkType(String workType) {
+		this.workType = workType;
+	}
+
+	public List<ExampleProject> getExampleProjectList() {
+		return exampleProjectList;
+	}
+
+	public void setExampleProjectList(List<ExampleProject> exampleProjectList) {
+		this.exampleProjectList = exampleProjectList;
+	}
+
+	public List<ExampleExpend> getExampleExpendList() {
+		return exampleExpendList;
+	}
+
+	public void setExampleExpendList(List<ExampleExpend> exampleExpendList) {
+		this.exampleExpendList = exampleExpendList;
+	}
+
+	public List<ExampleEconomics> getExampleEconomicsList() {
+		return exampleEconomicsList;
+	}
+
+	public void setExampleEconomicsList(List<ExampleEconomics> exampleEconomicsList) {
+		this.exampleEconomicsList = exampleEconomicsList;
+	}
+
+	public String getExampleTypeName() {
+		return exampleTypeName;
+	}
+
+	public void setExampleTypeName(String exampleTypeName) {
+		this.exampleTypeName = exampleTypeName;
+	}
+}

+ 49 - 0
src/main/java/com/jeeplus/modules/workexample/entity/WorkExampleExcel.java

@@ -0,0 +1,49 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.exampleeconomics.entity.ExampleEconomics;
+import com.jeeplus.modules.exampleexpend.entity.ExampleExpend;
+import com.jeeplus.modules.exampleproject.entity.ExampleProject;
+import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 案例Entity
+ * @author ssrh
+ * @version 2018-08-27
+ */
+public class WorkExampleExcel extends ActEntity<WorkExampleExcel> {
+	private static final long serialVersionUID = 1L;
+	//private String file;
+	private List<ExcelList> excelList;
+
+	public List<ExcelList> getExcelList() {
+		return excelList;
+	}
+
+	public void setExcelList(List<ExcelList> excelList) {
+		this.excelList = excelList;
+	}
+
+	/*public String getFile() {
+		return file;
+	}
+
+	public void setFile(String file) {
+		this.file = file;
+	}*/
+
+}

+ 145 - 0
src/main/java/com/jeeplus/modules/workexample/entity/WorkExampleIndices.java

@@ -0,0 +1,145 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.entity;
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 指标项目字典Entity
+ * @author 杨帆
+ * @version 2018-08-27
+ */
+public class WorkExampleIndices extends DataEntity<WorkExampleIndices> {
+	
+	private static final long serialVersionUID = 1L;
+	private WorkExampleIndices parent;		// 父ID
+	private String name;		// 指标名称
+	private String parentIds;		// 所有父ID
+	private String orderNum;		// 排序
+	private String companyId;		// 公司ID
+	private String isDisable;		// 是否禁用,0:否,1:是
+	private String oneItems;		// 其中项
+	private String itemUnit;		// 项单位
+	private String decimalCount;		// 小数位数
+	private String type;		// 类型
+	private String view;
+	private WorkExample workExample;
+
+	public WorkExampleIndices() {
+		super();
+	}
+
+	public WorkExampleIndices(String id){
+		super(id);
+	}
+
+	@JsonBackReference
+	@ExcelField(title="父ID", align=2, sort=7)
+	public WorkExampleIndices getParent() {
+		return parent;
+	}
+
+	public void setParent(WorkExampleIndices parent) {
+		this.parent = parent;
+	}
+	
+	@ExcelField(title="指标名称", align=2, sort=8)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@ExcelField(title="所有父ID", align=2, sort=9)
+	public String getParentIds() {
+		return parentIds;
+	}
+
+	public void setParentIds(String parentIds) {
+		this.parentIds = parentIds;
+	}
+	
+	@ExcelField(title="排序", align=2, sort=10)
+	public String getOrderNum() {
+		return orderNum;
+	}
+
+	public void setOrderNum(String orderNum) {
+		this.orderNum = orderNum;
+	}
+	
+	@ExcelField(title="公司ID", align=2, sort=11)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="是否禁用,0:否,1:是", align=2, sort=12)
+	public String getIsDisable() {
+		return isDisable;
+	}
+
+	public void setIsDisable(String isDisable) {
+		this.isDisable = isDisable;
+	}
+	
+	@ExcelField(title="其中项", align=2, sort=13)
+	public String getOneItems() {
+		return oneItems;
+	}
+
+	public void setOneItems(String oneItems) {
+		this.oneItems = oneItems;
+	}
+	
+	@ExcelField(title="项单位", align=2, sort=14)
+	public String getItemUnit() {
+		return itemUnit;
+	}
+
+	public void setItemUnit(String itemUnit) {
+		this.itemUnit = itemUnit;
+	}
+	
+	@ExcelField(title="小数位数", align=2, sort=15)
+	public String getDecimalCount() {
+		return decimalCount;
+	}
+
+	public void setDecimalCount(String decimalCount) {
+		this.decimalCount = decimalCount;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getView() {
+		return view;
+	}
+
+	public void setView(String view) {
+		this.view = view;
+	}
+
+	public WorkExample getWorkExample() {
+		return workExample;
+	}
+
+	public void setWorkExample(WorkExample workExample) {
+		this.workExample = workExample;
+	}
+}

+ 144 - 0
src/main/java/com/jeeplus/modules/workexample/entity/WorkExampleInfo.java

@@ -0,0 +1,144 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.entity;
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 指标项目字典Entity
+ * @author 杨帆
+ * @version 2018-08-27
+ */
+public class WorkExampleInfo extends DataEntity<WorkExampleInfo> {
+
+	private static final long serialVersionUID = 1L;
+	private WorkExampleInfo parent;		// 父ID
+	private String name;		// 指标名称
+	private String parentIds;		// 所有父ID
+	private String orderNum;		// 排序
+	private String companyId;		// 公司ID
+	private String isDisable;		// 是否禁用,0:否,1:是
+	private String oneItems;		// 其中项
+	private String itemUnit;		// 项单位
+	private String decimalCount;		// 小数位数
+	private String type;		// 小数位数
+	private String view;
+	private WorkExample workExample;		// 工程概况
+
+	public WorkExampleInfo() {
+		super();
+	}
+
+	public WorkExampleInfo(String id){
+		super(id);
+	}
+
+	@JsonBackReference
+	@ExcelField(title="父ID", align=2, sort=7)
+	public WorkExampleInfo getParent() {
+		return parent;
+	}
+
+	public void setParent(WorkExampleInfo parent) {
+		this.parent = parent;
+	}
+	
+	@ExcelField(title="指标名称", align=2, sort=8)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@ExcelField(title="所有父ID", align=2, sort=9)
+	public String getParentIds() {
+		return parentIds;
+	}
+
+	public void setParentIds(String parentIds) {
+		this.parentIds = parentIds;
+	}
+	
+	@ExcelField(title="排序", align=2, sort=10)
+	public String getOrderNum() {
+		return orderNum;
+	}
+
+	public void setOrderNum(String orderNum) {
+		this.orderNum = orderNum;
+	}
+	
+	@ExcelField(title="公司ID", align=2, sort=11)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="是否禁用,0:否,1:是", align=2, sort=12)
+	public String getIsDisable() {
+		return isDisable;
+	}
+
+	public void setIsDisable(String isDisable) {
+		this.isDisable = isDisable;
+	}
+	
+	@ExcelField(title="其中项", align=2, sort=13)
+	public String getOneItems() {
+		return oneItems;
+	}
+
+	public void setOneItems(String oneItems) {
+		this.oneItems = oneItems;
+	}
+	
+	@ExcelField(title="项单位", align=2, sort=14)
+	public String getItemUnit() {
+		return itemUnit;
+	}
+
+	public void setItemUnit(String itemUnit) {
+		this.itemUnit = itemUnit;
+	}
+	
+	@ExcelField(title="小数位数", align=2, sort=15)
+	public String getDecimalCount() {
+		return decimalCount;
+	}
+
+	public void setDecimalCount(String decimalCount) {
+		this.decimalCount = decimalCount;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getView() {
+		return view;
+	}
+
+	public void setView(String view) {
+		this.view = view;
+	}
+
+	public WorkExample getWorkExample() {
+		return workExample;
+	}
+
+	public void setWorkExample(WorkExample workExample) {
+		this.workExample = workExample;
+	}
+}

+ 436 - 0
src/main/java/com/jeeplus/modules/workexample/service/WorkExampleIndicesService.java

@@ -0,0 +1,436 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.jeeplus.common.utils.IdGen;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workexample.dao.WorkExampleInfoDao;
+import com.jeeplus.modules.workexample.entity.WorkExampleInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workexample.entity.WorkExampleIndices;
+import com.jeeplus.modules.workexample.dao.WorkExampleIndicesDao;
+
+/**
+ * 指标项目字典Service
+ * @author 杨帆
+ * @version 2018-08-27
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkExampleIndicesService extends CrudService<WorkExampleIndicesDao, WorkExampleIndices> {
+	@Autowired
+	private WorkExampleInfoDao workExampleInfoDao;
+
+	public WorkExampleIndices get(String id) {
+		return super.get(id);
+	}
+	public WorkExampleInfo getWorkExampleInfo(String id) {
+		return workExampleInfoDao.get(id);
+	}
+	public Integer getOrderNum(String id) {
+		return dao.getOrderNum(id);
+	}
+	public Integer exampleIndicesCount(String id,String workExampleId) {
+		return dao.exampleIndicesCount(id,workExampleId);
+	}
+	@Transactional(readOnly = false)
+	public void saveExampleIndices(String id,String workExampleId) {
+		dao.saveExampleIndices(id,workExampleId);
+	}
+
+	public List<WorkExampleIndices> findList(WorkExampleIndices workExampleIndices) {
+		Office company = UserUtils.getSelectCompany();
+		workExampleIndices.setCompanyId(company.getId());
+		return super.findList(workExampleIndices);
+	}
+
+	@Transactional(readOnly = false)
+	public List<WorkExampleIndices> findLists(WorkExampleIndices workExampleIndices) {
+		List<WorkExampleIndices> list = new ArrayList<>();
+		Office company = UserUtils.getSelectCompany();
+		workExampleIndices.setCompanyId(company.getId());
+		list = super.findList(workExampleIndices);
+		if (list==null || list.size()==0){
+			saveCompanyInfo(company);
+		}
+		return list;
+	}
+	public List<WorkExampleIndices> findByParentId(String id) {
+		return dao.findByParentId(id);
+	}
+	public Page<WorkExampleIndices> findPageByParentId(Page<WorkExampleIndices> page, WorkExampleIndices workExampleIndices) {
+		workExampleIndices.setPage(page);
+		page.setList(dao.findByParentIds(workExampleIndices));
+		return page;
+	}
+	public List<WorkExampleIndices> findListInfo(WorkExampleIndices workExampleIndices) {
+		return dao.findListInfo(workExampleIndices);
+	}
+	public List<WorkExampleInfo> treeDataInfo(WorkExampleInfo workExampleInfo) {
+		return workExampleInfoDao.findList(workExampleInfo);
+	}
+
+	public Page<WorkExampleIndices> findPage(Page<WorkExampleIndices> page, WorkExampleIndices workExampleIndices) {
+		return super.findPage(page, workExampleIndices);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkExampleIndices workExampleIndices) {
+		super.save(workExampleIndices);
+	}
+	@Transactional(readOnly = false)
+	public void saveCompanyInfo(Office company) {
+		WorkExampleIndices workExampleIndices = new WorkExampleIndices();
+		workExampleIndices.setCompanyId(company.getId());
+		workExampleIndices.preInsert();
+		workExampleIndices.setIsDisable("0");
+		workExampleIndices.setName("单项工程造价指标");
+		workExampleIndices.setOrderNum("1");
+		workExampleIndices.setParentIds("0,");
+		workExampleIndices.setParent(new WorkExampleIndices("0"));
+		workExampleIndices.setType("1");
+		dao.insert(workExampleIndices);
+		String ids = IdGen.uuid();
+		String parentIds = "0,"+ids+",";
+		workExampleIndices.setName("单位工程造价指标");
+		workExampleIndices.setOrderNum("2");
+		workExampleIndices.setType("2");
+		workExampleIndices.setId(ids);
+		dao.insert(workExampleIndices);
+		String id1 = IdGen.uuid();
+		String id2 = IdGen.uuid();
+		String id3 = IdGen.uuid();
+		String id4 = IdGen.uuid();
+		String id5 = IdGen.uuid();
+		String id6 = IdGen.uuid();
+		String id7 = IdGen.uuid();
+		String id8 = IdGen.uuid();
+		String id9 = IdGen.uuid();
+		String id10 = IdGen.uuid();
+		workExampleIndices.setName("房屋建筑工程指标");
+		workExampleIndices.setOrderNum("201");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id1);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("房屋装饰工程指标");
+		workExampleIndices.setOrderNum("202");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id2);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("电气工程指标");
+		workExampleIndices.setOrderNum("203");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id3);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("建筑智能化安装工程指标");
+		workExampleIndices.setOrderNum("204");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id4);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("通风空调工程指标");
+		workExampleIndices.setOrderNum("205");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id5);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("消防工程指标");
+		workExampleIndices.setOrderNum("206");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id6);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("给排水工程指标");
+		workExampleIndices.setOrderNum("207");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id7);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("采暖工程指标");
+		workExampleIndices.setOrderNum("208");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id8);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("燃气工程指标");
+		workExampleIndices.setOrderNum("209");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id9);
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("医疗气体工程指标");
+		workExampleIndices.setOrderNum("210");
+		workExampleIndices.setParentIds(parentIds);
+		workExampleIndices.setParent(new WorkExampleIndices(ids));
+		workExampleIndices.setType("3");
+		workExampleIndices.setId(id10);
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("房屋建筑工程经济指标");
+		workExampleIndices.setOrderNum("20101");
+		workExampleIndices.setParentIds(parentIds+id1+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id1));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("房屋建筑工程主要工程量指标");
+		workExampleIndices.setOrderNum("20102");
+		workExampleIndices.setParentIds(parentIds+id1+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id1));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("房屋建筑工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20103");
+		workExampleIndices.setParentIds(parentIds+id1+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id1));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("房屋装饰工程经济指标");
+		workExampleIndices.setOrderNum("20201");
+		workExampleIndices.setParentIds(parentIds+id2+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id2));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("房屋装饰工程主要工程量指标");
+		workExampleIndices.setOrderNum("20202");
+		workExampleIndices.setParentIds(parentIds+id2+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id2));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("房屋装饰工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20203");
+		workExampleIndices.setParentIds(parentIds+id2+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id2));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("电气工程经济指标");
+		workExampleIndices.setOrderNum("20301");
+		workExampleIndices.setParentIds(parentIds+id3+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id3));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("电气工程主要工程量指标");
+		workExampleIndices.setOrderNum("20302");
+		workExampleIndices.setParentIds(parentIds+id3+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id3));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("电气工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20303");
+		workExampleIndices.setParentIds(parentIds+id3+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id3));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("建筑智能化安装工程经济指标");
+		workExampleIndices.setOrderNum("20401");
+		workExampleIndices.setParentIds(parentIds+id4+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id4));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("建筑智能化安装工程主要工程量指标");
+		workExampleIndices.setOrderNum("20402");
+		workExampleIndices.setParentIds(parentIds+id4+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id4));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("建筑智能化安装工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20403");
+		workExampleIndices.setParentIds(parentIds+id4+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id4));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("通风空调工程经济指标");
+		workExampleIndices.setOrderNum("20501");
+		workExampleIndices.setParentIds(parentIds+id5+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id5));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("通风空调工程主要工程量指标");
+		workExampleIndices.setOrderNum("20502");
+		workExampleIndices.setParentIds(parentIds+id5+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id5));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("通风空调工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20503");
+		workExampleIndices.setParentIds(parentIds+id5+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id5));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("消防工程经济指标");
+		workExampleIndices.setOrderNum("20601");
+		workExampleIndices.setParentIds(parentIds+id6+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id6));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("消防工程主要工程量指标");
+		workExampleIndices.setOrderNum("20602");
+		workExampleIndices.setParentIds(parentIds+id6+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id6));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("消防工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20603");
+		workExampleIndices.setParentIds(parentIds+id6+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id6));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("给排水工程经济指标");
+		workExampleIndices.setOrderNum("20701");
+		workExampleIndices.setParentIds(parentIds+id7+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id7));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("给排水工程主要工程量指标");
+		workExampleIndices.setOrderNum("20702");
+		workExampleIndices.setParentIds(parentIds+id7+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id7));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("给排水工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20703");
+		workExampleIndices.setParentIds(parentIds+id7+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id7));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("采暖工程经济指标");
+		workExampleIndices.setOrderNum("20801");
+		workExampleIndices.setParentIds(parentIds+id8+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id8));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("采暖工程主要工程量指标");
+		workExampleIndices.setOrderNum("20802");
+		workExampleIndices.setParentIds(parentIds+id8+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id8));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("采暖工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20803");
+		workExampleIndices.setParentIds(parentIds+id8+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id8));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("燃气工程经济指标");
+		workExampleIndices.setOrderNum("20901");
+		workExampleIndices.setParentIds(parentIds+id9+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id9));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("燃气工程主要工程量指标");
+		workExampleIndices.setOrderNum("20902");
+		workExampleIndices.setParentIds(parentIds+id9+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id9));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("燃气工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("20903");
+		workExampleIndices.setParentIds(parentIds+id9+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id9));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+		workExampleIndices.setName("医疗气体工程经济指标");
+		workExampleIndices.setOrderNum("21001");
+		workExampleIndices.setParentIds(parentIds+id10+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id10));
+		workExampleIndices.preInsert();
+		workExampleIndices.setType("4");
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("医疗气体工程主要工程量指标");
+		workExampleIndices.setOrderNum("21002");
+		workExampleIndices.setParentIds(parentIds+id10+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id10));
+		workExampleIndices.setType("5");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+		workExampleIndices.setName("医疗气体工程主要工料价格及消耗量指标");
+		workExampleIndices.setOrderNum("21003");
+		workExampleIndices.setParentIds(parentIds+id10+",");
+		workExampleIndices.setParent(new WorkExampleIndices(id10));
+		workExampleIndices.setType("6");
+		workExampleIndices.preInsert();
+		dao.insert(workExampleIndices);
+
+	}
+
+	@Transactional(readOnly = false)
+	public void delete(WorkExampleIndices workExampleIndices) {
+		super.delete(workExampleIndices);
+	}
+	@Transactional(readOnly = false)
+	public void updateStatus(WorkExampleIndices workExampleIndices) {
+		dao.updateStatus(workExampleIndices);
+	}
+
+	public List<WorkExampleIndices> findByName(WorkExampleIndices workExampleIndices) {
+		return dao.findByName(workExampleIndices);
+	}
+	public List<WorkExampleIndices> find(WorkExampleIndices workExampleIndices) {
+		return dao.find(workExampleIndices);
+	}
+	public List<WorkExampleIndices> findExampleIndices(String parentId) {
+		return dao.findExampleIndices(parentId);
+	}
+
+	@Transactional(readOnly = false)
+	public void deleteExampleIndices(String workExampleId,String exampleIndicesId) {
+		dao.deleteExampleIndices(workExampleId,exampleIndicesId);
+	}
+}

Fichier diff supprimé car celui-ci est trop grand
+ 1062 - 0
src/main/java/com/jeeplus/modules/workexample/service/WorkExampleService.java


+ 671 - 0
src/main/java/com/jeeplus/modules/workexample/web/ImportExampleController.java

@@ -0,0 +1,671 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.web;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.IdGen;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.exampleeconomics.entity.ExampleEconomics;
+import com.jeeplus.modules.exampleeconomics.service.ExampleEconomicsService;
+import com.jeeplus.modules.exampleexpend.entity.ExampleExpend;
+import com.jeeplus.modules.exampleexpend.service.ExampleExpendService;
+import com.jeeplus.modules.exampleproject.entity.ExampleProject;
+import com.jeeplus.modules.exampleproject.service.ExampleProjectService;
+import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
+import com.jeeplus.modules.examplesingle.service.ExampleSingleService;
+import com.jeeplus.modules.sys.dao.AreaDao;
+import com.jeeplus.modules.sys.dao.MainDictDetailDao;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.MainDictDetail;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workexample.dao.WorkExampleDao;
+import com.jeeplus.modules.workexample.entity.ExcelList;
+import com.jeeplus.modules.workexample.entity.WorkExample;
+import com.jeeplus.modules.workexample.entity.WorkExampleExcel;
+import com.jeeplus.modules.workexample.entity.WorkExampleIndices;
+import com.jeeplus.modules.workexample.service.WorkExampleIndicesService;
+import com.jeeplus.modules.workexample.service.WorkExampleService;
+import com.jeeplus.modules.workexampleimplog.dao.WorkExampleImplogDao;
+import com.jeeplus.modules.workexampleimplog.entity.WorkExampleImplog;
+import com.jeeplus.modules.workmonthlyplan.entity.WorkMonthlyPlan;
+import com.jeeplus.modules.workmonthlyplan.entity.WorkMonthlyPlanThis;
+import com.jeeplus.modules.workreceiptsregister.entity.ResponseEntity;
+import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * 案例Controller
+ * @author ssrh
+ * @version 2018-08-27
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workexample/workExample")
+public class ImportExampleController extends BaseController {
+	@Autowired
+	private WorkExampleService workExampleService;
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private ExampleSingleService exampleSingleService;
+	@Autowired
+	private WorkExampleDao workExampleDao;
+	@Autowired
+	private WorkExampleIndicesService workExampleIndicesService;
+	@Autowired
+	private ExampleProjectService exampleProjectService;
+	@Autowired
+	private ExampleExpendService exampleExpendService;
+	@Autowired
+	private ExampleEconomicsService exampleEconomicsService;
+	@Autowired
+	private MainDictDetailDao mainDictDetailDao;
+	@Autowired
+	private AreaDao areaDao;
+    @Autowired
+    private WorkExampleImplogDao workExampleImplogDao;
+
+	@RequestMapping(value = "importDialogre")
+	public String form(WorkExampleExcel workExampleExcel, Model model) {
+		model.addAttribute("workExampleExcel", workExampleExcel);
+		return "modules/workexample/workExampleExcel";
+	}
+	/**
+	 * 导入Excel数据
+	 */
+	@RequiresPermissions("workexample:workExample:import")
+    @RequestMapping(value = "import")
+	//@ResponseBody
+    public String form(WorkExampleExcel workExampleExcel,@RequestParam(value = "file",required = false) MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			List<ExcelList> excelLists=workExampleExcel.getExcelList();
+			StringBuilder failureMsg = new StringBuilder();
+			//工程概况
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			WorkExample workExample=new WorkExample();
+			String str=this.workExampleImport(ei,workExample);
+			if(!"".equals(str)){
+				this.getLogEntity(workExample.getId(),
+						"",
+						"",
+						str);
+				addMessage(redirectAttributes, "导入失败:"+str);
+				return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+			}
+			//单项工程造价指标
+			String sheetName="";
+			for(int i=1;i<excelLists.size();i++){
+				ImportExcel exampleSingleEi = new ImportExcel(file, 1, i);
+				WorkExampleIndices workExampleIndices=new WorkExampleIndices();
+				workExampleIndices.setCompanyId(UserUtils.getSelectCompany().getId());
+				sheetName=exampleSingleEi.getHeaderStr();
+				workExampleIndices.setName(sheetName);
+				//List<WorkExampleIndices> exampleIndicesList = workExampleIndicesService.findByName(workExampleIndices);//指标
+				WorkExampleIndices workExampleIndices1=workExampleIndicesService.get(excelLists.get(i).getId());
+                Integer count = workExampleIndicesService.exampleIndicesCount(workExample.getId(),workExampleIndices1.getId());
+                if (count == null || count==0){
+                    workExampleIndicesService.saveExampleIndices(workExample.getId(),workExampleIndices1.getId());
+                }
+                Integer countp = workExampleIndicesService.exampleIndicesCount(workExample.getId(),workExampleIndices1.getParent().getId());
+                if (countp == null || countp==0){
+                    workExampleIndicesService.saveExampleIndices(workExample.getId(),workExampleIndices1.getParent().getId());
+                }
+                WorkExampleIndices workExampleIndicesp=workExampleIndicesService.get(workExampleIndices1.getParent().getId());
+                if(workExampleIndicesp!=null){
+                    Integer countpp = workExampleIndicesService.exampleIndicesCount(workExample.getId(),workExampleIndicesp.getParent().getId());
+                    if (countpp == null || countpp==0){
+                        workExampleIndicesService.saveExampleIndices(workExample.getId(),workExampleIndicesp.getParent().getId());
+                    }
+                }
+
+					if("1".equals(workExampleIndices1.getType())){
+						List<ExampleSingle> exampleSingList = exampleSingleEi.getDataList(ExampleSingle.class);
+						for(ExampleSingle exampleSingle : exampleSingList){
+							if(exampleSingle.getName()!=null&&!"".equals(exampleSingle.getName())){
+								workExampleIndices.setName(exampleSingle.getName());
+								workExampleIndices.setParent(workExampleIndices1);
+								List<WorkExampleIndices> indicesList = workExampleIndicesService.find(workExampleIndices);//项
+								if(indicesList!=null&&indicesList.size()==1){
+									try{
+										exampleSingle.setExampleId(workExample.getId());
+										exampleSingle.setIndexId(workExampleIndices1.getId());
+										exampleSingle.setExampleIndicesId(indicesList.get(0).getId());
+										exampleSingle.setUnit(indicesList.get(0).getItemUnit());
+										exampleSingle.setDigits(indicesList.get(0).getDecimalCount());
+										if((exampleSingle.getMoney()==null||"".equals(exampleSingle.getMoney()))
+												&&(exampleSingle.getCost()==null||"".equals(exampleSingle.getCost()))
+												&&(exampleSingle.getProportion()==null||"".equals(exampleSingle.getProportion()))){
+											String m=towFormat("0");
+											String c=towFormat("0");
+											String p=fourFormat("0");
+											exampleSingle.setMoney(m);
+											exampleSingle.setCost(c);
+											exampleSingle.setProportion(p);
+											ExampleSingle single=exampleSingleService.findSingle(exampleSingle);
+											if(single!=null){
+												exampleSingleService.save(single);//修改
+											}else{
+												exampleSingleService.save(exampleSingle);//新增
+											}
+										}else{
+											if(isDouble(exampleSingle.getMoney())
+													&&isDouble(exampleSingle.getCost())
+													&&isDouble(exampleSingle.getProportion())){
+												ExampleSingle single=exampleSingleService.findSingle(exampleSingle);
+												if(single!=null){
+													exampleSingleService.save(single);//修改
+												}else{
+													String m=towFormat(exampleSingle.getMoney());
+													String c=towFormat(exampleSingle.getCost());
+													String p=fourFormat(exampleSingle.getProportion());
+													exampleSingle.setMoney(m);
+													exampleSingle.setCost(c);
+													exampleSingle.setProportion(p);
+													exampleSingleService.save(exampleSingle);//新增
+												}
+											}else{
+												this.getLogEntity(workExample.getId(),
+														workExampleIndices1.getId(),
+														indicesList.get(0).getId(),
+														"【"+exampleSingle.getName()+"】数据异常或填写格式不正确");
+											}
+										}
+
+									}catch(ConstraintViolationException ex){
+
+									}catch (Exception ex) {
+
+									}
+								}else{
+									this.getLogEntity(workExample.getId(),
+											workExampleIndices1.getId(),
+											"",
+											"【"+exampleSingle.getName()+"】在指标项字典中不存在,或数据异常");
+								}
+							}
+
+						}
+					}else if("4".equals(workExampleIndices1.getType())){//workExampleIndices1.getName().contains("经济指标")
+					List<ExampleEconomics> economicsList = exampleSingleEi.getDataList(ExampleEconomics.class);
+					for(ExampleEconomics exampleEconomics : economicsList){
+						if(exampleEconomics.getName()!=null&&!"".equals(exampleEconomics.getName())){
+							workExampleIndices.setName(exampleEconomics.getName());
+							workExampleIndices.setParent(workExampleIndices1);
+							List<WorkExampleIndices> indicesList = workExampleIndicesService.find(workExampleIndices);//项
+							if(indicesList!=null&&indicesList.size()==1){
+								try{
+									exampleEconomics.setExampleId(workExample.getId());
+									exampleEconomics.setIndexId(workExampleIndices1.getId());
+									exampleEconomics.setExampleindicesId(indicesList.get(0).getId());
+									exampleEconomics.setUnit(indicesList.get(0).getItemUnit());
+									exampleEconomics.setDigits(indicesList.get(0).getDecimalCount());
+									if((exampleEconomics.getMoney()==null||"".equals(exampleEconomics.getMoney()))
+											&&(exampleEconomics.getCost()==null||"".equals(exampleEconomics.getCost()))
+											&&(exampleEconomics.getProportion()==null||"".equals(exampleEconomics.getProportion()))){
+										String m=towFormat("0");
+										String c=towFormat("0");
+										String p=fourFormat("0");
+										exampleEconomics.setMoney(m);
+										exampleEconomics.setCost(c);
+										exampleEconomics.setProportion(p);
+										ExampleEconomics economics=exampleEconomicsService.findEconomics(exampleEconomics);
+										if(economics!=null){
+											exampleEconomicsService.save(economics);//修改
+										}else{
+											exampleEconomicsService.save(exampleEconomics);//新增
+										}
+									}else{
+										if(isDouble(exampleEconomics.getMoney())
+												&&isDouble(exampleEconomics.getCost())
+												&&isDouble(exampleEconomics.getProportion())){
+											ExampleEconomics economics=exampleEconomicsService.findEconomics(exampleEconomics);
+											if(economics!=null){
+												exampleEconomicsService.save(economics);//修改
+											}else{
+												String m=towFormat(exampleEconomics.getMoney());
+												String c=towFormat(exampleEconomics.getCost());
+												String p=fourFormat(exampleEconomics.getProportion());
+												exampleEconomics.setMoney(m);//保留两位
+												exampleEconomics.setCost(c);
+												exampleEconomics.setProportion(p);//保留四位
+												exampleEconomicsService.save(exampleEconomics);//新增
+											}
+										}else{
+											this.getLogEntity(workExample.getId(),
+													workExampleIndices1.getId(),
+													indicesList.get(0).getId(),
+													"【"+exampleEconomics.getName()+"】数据异常或填写格式不正确");
+										}
+									}
+								}catch(ConstraintViolationException ex){
+
+								}catch (Exception ex) {
+
+								}
+							}else{//增加日志
+								this.getLogEntity(workExample.getId(),
+										workExampleIndices1.getId(),
+										"",
+										"【"+exampleEconomics.getName()+"】在指标项字典中不存在,或数据异常");
+							}
+						}
+
+					}
+				}else if("5".equals(workExampleIndices1.getType())){//workExampleIndices1.getName().contains("主要工程量指标")
+					List<ExampleProject> projectList = exampleSingleEi.getDataList(ExampleProject.class);
+					for(ExampleProject exampleProject : projectList){
+						if(exampleProject.getName()!=null&&!"".equals(exampleProject.getName())){
+							workExampleIndices.setName(exampleProject.getName());
+							workExampleIndices.setParent(workExampleIndices1);
+							List<WorkExampleIndices> indicesList = workExampleIndicesService.find(workExampleIndices);//项
+							if(indicesList!=null&&indicesList.size()==1){
+								try{
+									exampleProject.setExampleId(workExample.getId());
+									exampleProject.setIndexId(workExampleIndices1.getId());
+									exampleProject.setExampleindicesId(indicesList.get(0).getId());
+									exampleProject.setDigits(indicesList.get(0).getDecimalCount());
+									if((exampleProject.getQuota()==null||"".equals(exampleProject.getQuota()))
+											&&(exampleProject.getCount()==null||"".equals(exampleProject.getCount()))){
+										String m=towFormat("0");
+										String p=fourFormat("0");
+										exampleProject.setCount(m);
+										exampleProject.setQuota(p);
+										exampleProject.setUnit(DictUtils.getMainDictLabel(indicesList.get(0).getItemUnit(),"unit_type",""));
+										ExampleProject project=exampleProjectService.findProject(exampleProject);
+										if(project!=null){
+											exampleProjectService.save(project);//修改
+										}else{
+											exampleProjectService.save(exampleProject);//新增
+										}
+									}else{
+										if(isDouble(exampleProject.getCount())
+												&&isDouble(exampleProject.getQuota())){
+											exampleProject.setUnit(DictUtils.getMainDictLabel(indicesList.get(0).getItemUnit(),"unit_type",""));
+											ExampleProject project=exampleProjectService.findProject(exampleProject);
+											if(project!=null){
+												exampleProjectService.save(project);//修改
+											}else{
+												String m=towFormat(exampleProject.getCount());
+												String p=fourFormat(exampleProject.getQuota());
+												exampleProject.setCount(m);
+												exampleProject.setQuota(p);
+												exampleProjectService.save(exampleProject);//新增
+											}
+										}else{
+											this.getLogEntity(workExample.getId(),
+													workExampleIndices1.getId(),
+													indicesList.get(0).getId(),
+													"【"+exampleProject.getName()+"】数据异常或填写格式不正确");
+										}
+									}
+
+								}catch(ConstraintViolationException ex){
+
+								}catch (Exception ex) {
+
+								}
+							}else{
+								this.getLogEntity(workExample.getId(),
+										workExampleIndices1.getId(),
+										"",
+										"【"+exampleProject.getName()+"】在指标项字典中不存在,或数据异常");
+							}
+						}
+						}
+
+				}else if("6".equals(workExampleIndices1.getType())){//workExampleIndices1.getName().contains("主要工料价格及消耗量指标")
+					List<ExampleExpend> exampleExpendList = exampleSingleEi.getDataList(ExampleExpend.class);
+					for(ExampleExpend exampleExpend : exampleExpendList){
+						if(exampleExpend.getName()!=null&&!"".equals(exampleExpend.getName())){
+							workExampleIndices.setName(exampleExpend.getName());
+							workExampleIndices.setParent(workExampleIndices1);
+							List<WorkExampleIndices> indicesList = workExampleIndicesService.find(workExampleIndices);//项
+							if(indicesList!=null&&indicesList.size()==1){
+								try{
+									exampleExpend.setExampleId(workExample.getId());
+									exampleExpend.setIndexId(workExampleIndices1.getId());
+									exampleExpend.setExampleindicesId(indicesList.get(0).getId());
+									exampleExpend.setDigits(indicesList.get(0).getDecimalCount());
+									if((exampleExpend.getCount()==null||"".equals(exampleExpend.getCount()))
+											&&(exampleExpend.getPrice()==null||"".equals(exampleExpend.getPrice()))
+											&&(exampleExpend.getQuota()==null||"".equals(exampleExpend.getQuota()))){
+										String m=towFormat("0");
+										String c=towFormat("0");
+										String p=fourFormat("0");
+										exampleExpend.setCount(m);
+										exampleExpend.setPrice(c);
+										exampleExpend.setQuota(p);
+										exampleExpend.setUnit(DictUtils.getMainDictLabel(indicesList.get(0).getItemUnit(),"unit_type",""));
+
+										ExampleExpend expend=exampleExpendService.findExpend(exampleExpend);
+										if(expend!=null){
+											exampleExpendService.save(expend);//修改
+										}else{
+											exampleExpendService.save(exampleExpend);//新增
+										}
+									}else{
+										if(isDouble(exampleExpend.getCount())
+												&&isDouble(exampleExpend.getPrice())
+												&&isDouble(exampleExpend.getQuota())){
+											exampleExpend.setUnit(DictUtils.getMainDictLabel(indicesList.get(0).getItemUnit(),"unit_type",""));
+											ExampleExpend expend=exampleExpendService.findExpend(exampleExpend);
+											if(expend!=null){
+												exampleExpendService.save(expend);//修改
+											}else{
+												String m=towFormat(exampleExpend.getCount());
+												String c=towFormat(exampleExpend.getPrice());
+												String p=fourFormat(exampleExpend.getQuota());
+												exampleExpend.setCount(m);
+												exampleExpend.setPrice(c);
+												exampleExpend.setQuota(p);
+												exampleExpendService.save(exampleExpend);//新增
+											}
+										}else{
+											this.getLogEntity(workExample.getId(),
+													workExampleIndices1.getId(),
+													indicesList.get(0).getId(),
+													"【"+exampleExpend.getName()+"】数据异常或填写格式不正确");
+										}
+									}
+
+								}catch(ConstraintViolationException ex){
+
+								}catch (Exception ex) {
+
+								}
+
+							}else{
+								this.getLogEntity(workExample.getId(),
+										workExampleIndices1.getId(),
+										"",
+										"【"+exampleExpend.getName()+"】在指标项字典中不存在,或数据异常");
+							}
+						}
+						}
+
+				}
+
+			}
+			//List<WorkExampleIndices> workExampleIndicesList = workExampleIndicesService.findByParentId(id);
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条案例记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入案例记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入案例失败!");
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+    }
+
+
+	@RequestMapping(value = "excel")
+	@ResponseBody
+	public ResponseEntity importExcel(MultipartFile file, RedirectAttributes redirectAttributes) {
+		List<ExcelList> excelLists=new ArrayList<>();
+		ResponseEntity<ExcelList> responseEntity = new ResponseEntity<>();
+		try {
+            ImportExcel examplecount = new ImportExcel(file, 1, 0);
+            int count=examplecount.sheetCirculation();
+			String sheetName="";
+			for(int i=1;i<count;i++){
+				ImportExcel exampleSingleEi = new ImportExcel(file, 1, i);
+
+				WorkExampleIndices workExampleIndices=new WorkExampleIndices();
+				workExampleIndices.setCompanyId(UserUtils.getSelectCompany().getId());
+				sheetName=exampleSingleEi.getHeaderStr();
+				workExampleIndices.setName(sheetName);
+				List<WorkExampleIndices> workExampleIndicesList = workExampleIndicesService.findByName(workExampleIndices);
+				if(workExampleIndicesList!=null&&workExampleIndicesList.size()==1){
+					ExcelList excelList=new ExcelList();
+					excelList.setSheetName(sheetName);
+					excelList.setName(workExampleIndicesList.get(0).getName());
+					excelList.setId(workExampleIndicesList.get(0).getId());
+					excelLists.add(excelList);
+				}else{
+					ExcelList excelList=new ExcelList();
+					excelList.setSheetName(sheetName);
+					excelLists.add(excelList);
+				}
+
+			}
+		} catch (Exception e) {
+
+		}
+		responseEntity.setData(excelLists);
+		return responseEntity;
+	}
+
+    public String workExampleImport(ImportExcel ei,WorkExample example){
+		//WorkExample example=new WorkExample();
+		try {
+			example.preInsert();
+			String companyId=UserUtils.getSelectCompany().getId();
+			example.setCompanyId(companyId);
+			example.setOfficeId(UserUtils.getSelectOffice().getId());
+			example.setStatus("1");
+			if(ei.getCellValue(ei.getRow(1),1).toString()==null||"".equals(ei.getCellValue(ei.getRow(1),1).toString())){
+				return "工程名称不允许为空!";
+			}
+			if(ei.getCellValue(ei.getRow(1),3).toString()==null||"".equals(ei.getCellValue(ei.getRow(1),3).toString())){
+				return "工程类型不允许为空!";
+			}
+			if(ei.getCellValue(ei.getRow(2),1).toString()==null||"".equals(ei.getCellValue(ei.getRow(2),1).toString())){
+				return "工程地点不允许为空!";
+			}
+			if(ei.getCellValue(ei.getRow(2),3).toString()==null||"".equals(ei.getCellValue(ei.getRow(2),3).toString())){
+				return "建设规模不允许为空!";
+			}
+			example.setName(ei.getCellValue(ei.getRow(1),1).toString());
+			String type=ei.getCellValue(ei.getRow(1),3).toString().trim();
+			MainDictDetail mainDictDetail=mainDictDetailDao.getId("work_example_type",companyId,type);
+			if(mainDictDetail!=null){
+				example.setMainDictDetail(mainDictDetail);
+			}else{
+				return "工程类型在系统业务字典中不存在,请联系管理员!";
+			}
+			String address=ei.getCellValue(ei.getRow(2),1).toString().trim();
+			Area area= areaDao.findByName(address);
+			if(area!=null){
+				example.setArea(area);
+			}else{
+				return "工程地点填写不正确!";
+			}
+			example.setBuildScale(ei.getCellValue(ei.getRow(2),3).toString());
+			example.setModus(ei.getCellValue(ei.getRow(3),1).toString());
+			example.setBasicType(ei.getCellValue(ei.getRow(3),3).toString());
+			example.setScale(ei.getCellValue(ei.getRow(4),1).toString());
+			example.setSafeLevel(ei.getCellValue(ei.getRow(4),3).toString());
+			example.setStage(ei.getCellValue(ei.getRow(5),1).toString());
+			example.setInvestmentType(ei.getCellValue(ei.getRow(5),3).toString());
+			example.setValuationType(ei.getCellValue(ei.getRow(6),1).toString());
+			example.setValuationAccording(ei.getCellValue(ei.getRow(6),3).toString());
+			example.setBiddingPrice(ei.getCellValue(ei.getRow(7),1)==null?"":ei.getCellValue(ei.getRow(7),1).toString());
+			example.setTaxModel(ei.getCellValue(ei.getRow(7),3).toString());
+			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+			String date=ei.getCellValue(ei.getRow(8),1).toString();
+			if(ei.getCellValue(ei.getRow(8),1)!=null){
+				if(isDateString(ei.getCellValue(ei.getRow(8),1).toString(),"yyyy-MM-dd")){
+					example.setStartDate(df.parse(ei.getCellValue(ei.getRow(8),1).toString()));
+				}
+			}
+			if(ei.getCellValue(ei.getRow(8),3)!=null){
+				if(isDateString(ei.getCellValue(ei.getRow(8),3).toString(),"yyyy-MM-dd")){
+					example.setEndDate(df.parse(ei.getCellValue(ei.getRow(8),3).toString()));
+				}
+			}
+			example.setAbovegroundArea(ei.getCellValue(ei.getRow(9),1).toString());
+			example.setUndergroundArea(ei.getCellValue(ei.getRow(9),3).toString());
+			example.setCivilArea(ei.getCellValue(ei.getRow(10),1).toString());
+			example.setGarageArea(ei.getCellValue(ei.getRow(10),3).toString());
+			example.setAbovegroundLayer(ei.getCellValue(ei.getRow(11),1).toString());
+			example.setUndergroundLayer(ei.getCellValue(ei.getRow(11),3).toString());
+			example.setAbovegroundHeight(ei.getCellValue(ei.getRow(12),1).toString());
+			example.setUndergroundHeight(ei.getCellValue(ei.getRow(12),3).toString());
+			example.setTotalHeight(ei.getCellValue(ei.getRow(13),1).toString());
+			example.setEavesHeight(ei.getCellValue(ei.getRow(13),3).toString());
+			example.setInsideDecoration(ei.getCellValue(ei.getRow(14),1).toString());
+			example.setOutsideDecoration(ei.getCellValue(ei.getRow(14),3).toString());
+			example.setSkylightDecoration(ei.getCellValue(ei.getRow(15),1).toString());
+			example.setFloorDecoration(ei.getCellValue(ei.getRow(15),3).toString());
+			example.setDoor(ei.getCellValue(ei.getRow(16),1).toString());
+			example.setWindow(ei.getCellValue(ei.getRow(16),3).toString());
+			example.setInstruction(ei.getCellValue(ei.getRow(17),1).toString());
+			workExampleDao.insert(example);
+		} catch (Exception e) {
+            e.printStackTrace();
+			return "导入失败:请联系管理员!";
+		}
+		return "";
+	}
+
+	private static boolean isDouble(String str) {
+		if (null == str || "".equals(str)) {
+			return false;
+		}
+		Pattern pattern = Pattern.compile("^[-\\+]?[.\\d]*$");
+		return pattern.matcher(str).matches();
+	}
+
+	public static String fourFormat(String str){
+    Double d= Double.parseDouble(str);
+    DecimalFormat df = new DecimalFormat("0.0000");
+    String s = df.format(d);
+    return s;
+	}
+
+    public static String towFormat(String str){
+        Double d= Double.parseDouble(str);
+        DecimalFormat df = new DecimalFormat("0.00");
+        String s = df.format(d);
+        return s;
+    }
+  /*  public static void main(String[] args) {
+        System.out.println(format(""));
+    }*/
+	public static boolean isDateString(String datevalue, String dateFormat) {
+		try {
+			SimpleDateFormat fmt = new SimpleDateFormat(dateFormat);
+			java.util.Date dd = fmt.parse(datevalue);
+			if (datevalue.equals(fmt.format(dd))) {
+				return true;
+			} else {
+				return false;
+			}
+		} catch (Exception e) {
+			return false;
+		}
+	}
+//添加日志
+    public  void getLogEntity(String exampleId, String indexId,String termId,String reason) {
+        WorkExampleImplog workExampleImplog=new WorkExampleImplog();
+        workExampleImplog.preInsert();
+        workExampleImplog.setCompanyId(UserUtils.getSelectCompany().getId());
+        workExampleImplog.setOfficeId(UserUtils.getSelectOffice().getId());
+        workExampleImplog.setExampleId(exampleId);
+        workExampleImplog.setIndexId(indexId);
+        workExampleImplog.setTermId(termId);
+        workExampleImplog.setReason(reason);
+        workExampleImplogDao.insert(workExampleImplog);
+    }
+
+
+
+	/**
+	 * 下载导入案例数据模板
+	 */
+	/*@RequiresPermissions("workexample:workExample:import")*/
+	@RequestMapping(value = "import/template")
+	public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		String ids=request.getParameter("ids");
+		try {
+			String fileName = "案例数据导入模板.xlsx";
+			List<WorkExample> list = Lists.newArrayList();
+			ExportExcel ex=new ExportExcel(500);
+			if(ids!=null&&!"".equals(ids)){
+				String [] arr=ids.split(",");
+				for(String id:arr){
+					WorkExampleIndices workExampleIndices=workExampleIndicesService.get(id);
+					List<WorkExampleIndices> indicesList = workExampleIndicesService.findExampleIndices(id);//项
+					if("1".equals(workExampleIndices.getType())){//单项工程造价指标
+						List<String> headList=Lists.newArrayList();
+						headList.add("单位工程名称");
+						headList.add("金额(元)");
+						headList.add("单位造价(元/m2)");
+						headList.add("占造价比例(%)");
+						ex.createSheet(workExampleIndices.getName(), indicesList,headList,"1");
+					}else if("4".equals(workExampleIndices.getType())){//经济指标
+						List<String> headList=Lists.newArrayList();
+						headList.add("主要分项工程");
+						headList.add("工程造价(元)");
+						headList.add("单位造价(元/m2)");
+						headList.add("占造价比例(%)");
+						ex.createSheet(workExampleIndices.getName(), indicesList,headList,"1");
+					}else if("5".equals(workExampleIndices.getType())){//主要工程指标
+						List<String> headList=Lists.newArrayList();
+						headList.add("工料名称");
+						headList.add("单位");
+						headList.add("数量");
+						headList.add("单位指标(单位/m2)");
+						ex.createSheet(workExampleIndices.getName(), indicesList,headList,"2");
+					}else if("6".equals(workExampleIndices.getType())){//主要工料价格及消耗量指标
+						List<String> headList=Lists.newArrayList();
+						headList.add("工料名称");
+						headList.add("单位");
+						headList.add("数量");
+						headList.add("单价(元)");
+						headList.add("单位指标(单位/m2)");
+						headList.add("备注");
+						ex.createSheet(workExampleIndices.getName(), indicesList,headList,"2");
+					}
+				}
+			}
+
+			ex.setDataList(list).write(response, fileName).dispose();
+			//new ExportExcel("案例数据", WorkExample.class, 1).setDataList(list).write(response, fileName).dispose();
+			return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+	}
+}

+ 613 - 0
src/main/java/com/jeeplus/modules/workexample/web/WorkExampleController.java

@@ -0,0 +1,613 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.web;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.exampleeconomics.entity.ExampleEconomics;
+import com.jeeplus.modules.exampleeconomics.service.ExampleEconomicsService;
+import com.jeeplus.modules.exampleexpend.entity.ExampleExpend;
+import com.jeeplus.modules.exampleexpend.service.ExampleExpendService;
+import com.jeeplus.modules.exampleproject.entity.ExampleProject;
+import com.jeeplus.modules.exampleproject.service.ExampleProjectService;
+import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
+import com.jeeplus.modules.examplesingle.service.ExampleSingleService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.utils.ErrorCode;
+import com.jeeplus.modules.workexample.entity.WorkExampleIndices;
+import com.jeeplus.modules.workexample.service.WorkExampleIndicesService;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.workexample.entity.WorkExample;
+import com.jeeplus.modules.workexample.service.WorkExampleService;
+
+/**
+ * 案例Controller
+ * @author ssrh
+ * @version 2018-08-27
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workexample/workExample")
+public class WorkExampleController extends BaseController {
+
+	@Autowired
+	private WorkExampleService workExampleService;
+	@Autowired
+	private HistoryService historyService;
+	@Autowired
+	private WorkExampleIndicesService workExampleIndicesService;
+
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private ExampleSingleService exampleSingleService;
+	@Autowired
+	private ExampleProjectService exampleProjectService;
+	@Autowired
+	private ExampleExpendService exampleExpendService;
+	@Autowired
+	private ExampleEconomicsService exampleEconomicsService;
+
+	@ModelAttribute
+	public WorkExample get(@RequestParam(required=false) String id) {
+		WorkExample entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workExampleService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkExample();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 案例列表页面
+	 */
+	@RequiresPermissions("workexample:workExample:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkExample workExample, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkExample> page = workExampleService.findPage(new Page<WorkExample>(request, response), workExample); 
+		model.addAttribute("page", page);
+		return "modules/workexample/workExampleList";
+	}
+	/**
+	 * 案例列表页面
+	 */
+	@RequestMapping(value = {"listView"})
+	public String listView(WorkExample workExample, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkExample> page = workExampleService.findPage(new Page<WorkExample>(request, response), workExample);
+		model.addAttribute("page", page);
+		return "modules/workexample/workExampleListView";
+	}
+
+	/**
+	 * 查看,增加,编辑案例表单页面
+	 */
+	//@RequiresPermissions(value={"workexample:workExample:view","workexample:workExample:add","workexample:workExample:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkExample workExample, Model model) {
+		Office office = UserUtils.getSelectOffice();
+		String tabId = request.getParameter("tabId");
+		if("1".equals(tabId)){
+			model.addAttribute("workExample", workExample);
+            model.addAttribute("sign", "view");
+			return "modules/workexample/workExampleIndex";
+		}else if("3".equals(tabId)){
+			ProcessInstance processInstance = actTaskService.getProcIns(workExample.getProcessInstanceId());
+			if (processInstance!=null) {
+				Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+				Act act = new Act();
+				act.setTaskId(taskInfok.getId());
+				act.setTaskName(taskInfok.getName());
+				act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+				act.setProcDefId(taskInfok.getProcessDefinitionId());
+				act.setProcInsId(taskInfok.getProcessInstanceId());
+				act.setTask(taskInfok);
+				workExample.setAct(act);
+				//view = "workExampleModify";
+				model.addAttribute("workExample", workExample);
+                model.addAttribute("sign", "modify");
+				return "modules/workexample/workExampleIndex";
+			}
+		}
+		// 环节编号
+		String taskDefKey = workExample.getAct().getTaskDefKey();
+		if (StringUtils.isNotBlank(taskDefKey) && ("alshr".equals(taskDefKey))){
+			model.addAttribute("workExample", workExample);
+            model.addAttribute("sign", "audit");
+			return "modules/workexample/workExampleIndex";
+		}
+        model.addAttribute("workExample", workExample);
+        model.addAttribute("sign", "form");
+		return "modules/workexample/workExampleIndex";
+	}
+    @RequestMapping(value = "view")
+    public String view(WorkExample workExample, Model model) {
+        model.addAttribute("workExample", workExample);
+        return "modules/workexample/workExampleView";
+    }
+
+    @RequestMapping(value = "forms")
+    public String forms(WorkExample workExample, Model model) {
+        model.addAttribute("workExample", workExample);
+        return "modules/workexample/workExampleForm";
+    }
+
+    @RequestMapping(value = "audit")
+    public String audit(WorkExample workExample, Model model) {
+		workExample.setHome("home");
+		workExample.setAct(getByAct(workExample.getProcessInstanceId()));
+        model.addAttribute("workExample", workExample);
+        return "modules/workexample/workExampleAudit";
+    }
+    @RequestMapping(value = "modify")
+    public String modify(WorkExample workExample, Model model) {
+		workExample.setAct(getByAct(workExample.getProcessInstanceId()));
+        model.addAttribute("workExample", workExample);
+        return "modules/workexample/workExampleModify";
+    }
+	public Act getByAct(String processInstanceId){
+		Act act = new Act();
+		HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+		ProcessInstance processInstance = actTaskService.getProcIns(processInstanceId);
+		if (processInstance!=null) {
+			List<Task> taskList = actTaskService.getCurrentTaskList(processInstance);
+			if(taskList!=null && taskList.size()>1){
+				for (Task taskInfok:taskList) {
+					if (taskInfok.getAssignee().equals(UserUtils.getUser().getId())) {
+						act.setTaskId(taskInfok.getId());
+						act.setTaskName(taskInfok.getName());
+						act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+						act.setProcDefId(taskInfok.getProcessDefinitionId());
+						act.setProcInsId(taskInfok.getProcessInstanceId());
+						act.setTask(taskInfok);
+					}
+				}
+			}else {
+				Task task = actTaskService.getCurrentTaskInfo(processInstance);
+				act.setTaskId(task.getId());
+				act.setTaskName(task.getName());
+				act.setTaskDefKey(task.getTaskDefinitionKey());
+				act.setProcDefId(task.getProcessDefinitionId());
+				act.setProcInsId(task.getProcessInstanceId());
+				act.setTask(task);
+			}
+		}
+		return  act;
+	}
+	/**
+	 * 暂存
+	 */
+	@RequestMapping(value = "store")
+	public String store(WorkExample workExample,
+						Model model,
+						RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workExample)){
+			return form(workExample, model);
+		}
+		User user = workExample.getCreateBy();
+		String submitter = "";
+		if(user != null){
+			submitter = user.getId();
+		}
+		String sta = workExample.getStatus();
+		if(!UserUtils.getUser().getId().equals(submitter) && !Strings.isNullOrEmpty(submitter) && sta != null){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+		}
+		workExample.setStatus("1"); //暂存状态
+		workExample.setCompanyId(UserUtils.getSelectCompany().getId());
+		workExample.setOfficeId(UserUtils.getSelectOffice().getId());
+		if (StringUtils.isNotBlank(workExample.getProcessInstanceId()) && workExample.getProcessInstanceId().equals("NULL")){
+			workExample.setProcessInstanceId("");
+		}
+		if(!workExample.getIsNewRecord()){//编辑表单保存
+			WorkExample t = workExampleService.get(workExample.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workExample, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workExampleService.save(t);//保存
+		}else{//新增表单保存
+			workExampleService.save(workExample);//保存
+		}
+		addMessage(redirectAttributes, "保存案例成功");
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+	}
+
+	/**
+	 * 保存案例
+	 */
+	/*@RequiresPermissions(value={"workexample:workExample:add","workexample:workExample:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkExample workExample, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workExample)){
+			return form(workExample, model);
+		}
+		User user = workExample.getCreateBy();
+		String sta = workExample.getStatus();
+		if(user!=null && !UserUtils.getUser().getId().equals(user.getId()) && StringUtils.isNotBlank(user.getId())){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+		}
+		//状态设置为审核中
+		workExample.setStatus("2");
+		String processInstanceId ="";
+		if (user!=null && StringUtils.isNotBlank(user.getId()) && StringUtils.isNotBlank(sta) && "3".equals(sta)){
+			processInstanceId = workExampleService.get(workExample.getId()).getProcessInstanceId();
+		}
+		try {
+			Map<String, Object> variables = Maps.newHashMap();
+			workExample.setCompanyId(UserUtils.getSelectCompany().getId());
+			workExample.setOfficeId(UserUtils.getSelectOffice().getId());
+			String str = workExampleService.save(workExample, variables,processInstanceId);
+			if (StringUtils.isNotBlank(str)){
+				addMessage(redirectAttributes, "案例申请提交失败:"+str);
+			}else {
+				addMessage(redirectAttributes, "案例申请已经提交");
+			}
+
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "案例申请提交失败!");
+			addMessage(redirectAttributes, "系统内部错误");
+		}
+		logger.info("redirect:"+ adminPath +"/workexample/workExample/list?repage"+"-------");
+		//return "modules/workexample/workExampleList";
+		return "redirect:"+ adminPath +"/workexample/workExample/list?repage";
+
+		//redirect:/a/workexample/workExample/list?repage-------
+	}*/
+	@ResponseBody
+	@RequestMapping(value = "save")
+	@RequiresPermissions(value={"workexample:workExample:add","workexample:workExample:edit"},logical=Logical.OR)
+	public AjaxJson save(WorkExample workExample,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		//状态设置为审核中
+		workExample.setStatus("2");
+		String processInstanceId ="";
+		User user = workExample.getCreateBy();
+		String sta = workExample.getStatus();
+		String str = null;
+		if (user!=null && StringUtils.isNotBlank(user.getId()) && StringUtils.isNotBlank(sta) && "3".equals(sta)){
+			processInstanceId = workExampleService.get(workExample.getId()).getProcessInstanceId();
+		}
+		try {
+			Map<String, Object> variables = Maps.newHashMap();
+			workExample.setCompanyId(UserUtils.getSelectCompany().getId());
+			workExample.setOfficeId(UserUtils.getSelectOffice().getId());
+			str = workExampleService.save(workExample, variables,processInstanceId);
+			if (StringUtils.isNotBlank(str)){
+				j.setMsg("案例申请提交失败"+str);
+				j.put("type",false);
+			}else {
+				j.setMsg("案例申请已经提交");
+				j.put("type",true);
+				j.setSuccess(true);
+			}
+		} catch (Exception e) {
+			logger.error("送审失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("案例申请提交失败"+str);
+			j.put("type",false);
+		}
+		return j;
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "saveAudit")
+	@RequiresPermissions(value={"workexample:workExample:add","workexample:workExample:edit"},logical=Logical.OR)
+	public AjaxJson saveAudit (WorkExample workExample,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		String str = null;
+		try {
+			List<User> users = UserUtils.getByProssType(workExample.getProcessInstanceId(),1);
+			String flag = workExample.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+				j.setMsg("审批失败,审批人为空,请联系管理员!");
+				j.put("type",false);
+			}else {
+				str = workExampleService.auditSave(workExample,users);
+				addMessage(redirectAttributes, str);
+				j.setMsg(str);
+				j.put("type",true);
+				j.setSuccess(true);
+			}
+		} catch (Exception e) {
+			logger.error("审批失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("审批失败"+str);
+			j.put("type",false);
+		}
+		return j;
+	}
+
+	/*@RequestMapping(value = "saveAudit")
+	public String saveAudit(WorkExample workExample, Model model,
+							RedirectAttributes redirectAttributes) {
+		try {
+			List<User> users = UserUtils.getByProssType(workExample.getProcessInstanceId(),1);
+			String flag = workExample.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+			}else {
+				String str = workExampleService.auditSave(workExample,users);
+				addMessage(redirectAttributes, str);
+			}
+		}catch (Exception e){
+			addMessage(redirectAttributes, "审批失败");
+		}
+
+		if (StringUtils.isNotBlank(workExample.getHome()) && "home".equals(workExample.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else {
+			return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+		}
+	}*/
+	@ResponseBody
+	@RequestMapping(value = "saveAudits")
+	@RequiresPermissions(value={"workexample:workExample:add","workexample:workExample:edit"},logical=Logical.OR)
+	public AjaxJson saveAudits (WorkExample workExample,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		AjaxJson j = new AjaxJson();
+		String str = null;
+		try {
+			List<User> users = UserUtils.getByProssType(workExample.getProcessInstanceId(),1);
+			String flag = workExample.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+				j.setMsg("审批失败,审批人为空,请联系管理员!");
+				j.put("type",false);
+			}else {
+				str = workExampleService.auditSaves(workExample,users);
+				addMessage(redirectAttributes, str);
+				j.setMsg(str);
+				j.put("type",true);
+				j.setSuccess(true);
+			}
+		} catch (Exception e) {
+			logger.error("审批失败:", e);
+			j.setSuccess(false);
+			j.setErrorCode(ErrorCode.code_2004);
+			j.setMsg("审批失败"+str);
+			j.put("type",false);
+		}
+		return j;
+	}
+	/*@RequestMapping(value = "saveAudits")
+	public String saveAudits(WorkExample workExample, Model model,
+							RedirectAttributes redirectAttributes) {
+		try {
+			List<User> users = UserUtils.getByProssType(workExample.getProcessInstanceId(),1);
+			String flag = workExample.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+			}else {
+				String str = workExampleService.auditSaves(workExample,users);
+				addMessage(redirectAttributes, str);
+			}
+		}catch (Exception e){
+			addMessage(redirectAttributes, "审批失败");
+		}
+
+		if (StringUtils.isNotBlank(workExample.getHome()) && "home".equals(workExample.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else {
+			return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+		}
+	}*/
+	/**
+	 * 删除案例
+	 */
+	@RequiresPermissions("workexample:workExample:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkExample workExample, RedirectAttributes redirectAttributes) {
+		workExampleService.delete(workExample);
+		addMessage(redirectAttributes, "删除案例成功");
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+	}
+	
+	/**
+	 * 批量删除案例
+	 */
+	@RequiresPermissions("workexample:workExample:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workExampleService.delete(workExampleService.get(id));
+		}
+		addMessage(redirectAttributes, "删除案例成功");
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workexample:workExample:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkExample workExample, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "案例"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkExample> page = workExampleService.findPage(new Page<WorkExample>(request, response, -1), workExample);
+    		new ExportExcel("案例", WorkExample.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出案例记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+    }
+
+
+	
+
+	/**
+	 * 强制撤销
+	 */
+	@RequestMapping("cancelInvalidate")
+	public String cancelInvalidate(WorkExample workExample,RedirectAttributes redirectAttributes){
+		workExampleService.cancelInvalidate(workExample);
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExample/?repage";
+	}
+
+	@RequestMapping(value = "getProcessOne")
+	public String getProcessOne(WorkExample workExample,Model model) {
+		model.addAttribute("processInstanceId", workExample.getProcessInstanceId());
+		return "modules/workexample/workTrack";
+	}
+	@ResponseBody
+	@RequestMapping("checkSame")
+	public AjaxJson checkSame(WorkExample workExample){
+		AjaxJson ajaxJson = new AjaxJson();
+		//String id = null;
+		logger.info(workExample.toString());
+		if(StringUtils.isBlank(workExample.getName())){
+			ajaxJson.getBody().put("data",workExample);
+			return ajaxJson;
+		}else{
+			try {
+				if (!workExample.getIsNewRecord()) {//编辑表单保存
+					WorkExample t = workExampleService.get(workExample.getId());//从数据库取出记录的值
+					MyBeanUtils.copyBeanNotNull2Bean(workExample, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+					workExampleService.save(t);//保存
+					ajaxJson.getBody().put("data",t);
+				} else {//新增表单保存
+					workExample.setStatus("1");
+					workExample.setCompanyId(UserUtils.getSelectCompany().getId());
+					workExample.setOfficeId(UserUtils.getSelectOffice().getId());
+					//caseInfo.setUserids(getPeopleMaster());
+					workExampleService.save(workExample);//保存
+					ajaxJson.getBody().put("data",workExample);
+				}
+			}catch (Exception e) {
+				ajaxJson.getBody().put("data",workExample);
+				logger.info(e.getMessage());
+			}
+		}
+		return ajaxJson;
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "selectSingle")
+	public AjaxJson selectSingle(String indexId,String eId ,HttpServletRequest request, HttpServletResponse response, Model model) {
+		AjaxJson j = new AjaxJson();
+		List<ExampleSingle> list = Lists.newArrayList();
+		if(StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(eId)){
+			ExampleSingle exampleSingle = new ExampleSingle();
+			exampleSingle.setExampleId(eId);
+			exampleSingle.setIndexId(indexId);
+			list = exampleSingleService.findList(exampleSingle);
+		}
+		j.put("list", list);
+		return j;
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "selectProject")
+	public AjaxJson selectProject(String indexId,String eId ,HttpServletRequest request, HttpServletResponse response, Model model) {
+		AjaxJson j = new AjaxJson();
+		List<ExampleProject> list = Lists.newArrayList();
+		if(StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(eId)){
+			ExampleProject exampleProject = new ExampleProject();
+			exampleProject.setExampleId(eId);
+			exampleProject.setIndexId(indexId);
+			list = exampleProjectService.findList(exampleProject);
+		}
+		j.put("list", list);
+		return j;
+	}
+	@ResponseBody
+	@RequestMapping(value = "selectExpend")
+	public AjaxJson selectExpend(String indexId,String eId ,HttpServletRequest request, HttpServletResponse response, Model model) {
+		AjaxJson j = new AjaxJson();
+		List<ExampleExpend> list = Lists.newArrayList();
+		if(StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(eId)){
+			ExampleExpend exampleExpend = new ExampleExpend();
+			exampleExpend.setExampleId(eId);
+			exampleExpend.setIndexId(indexId);
+			list = exampleExpendService.findList(exampleExpend);
+		}
+		j.put("list", list);
+		return j;
+	}
+	@ResponseBody
+	@RequestMapping(value = "selectEconomics")
+	public AjaxJson selectEconomics(String indexId,String eId ,HttpServletRequest request, HttpServletResponse response, Model model) {
+		AjaxJson j = new AjaxJson();
+		List<ExampleEconomics> list = Lists.newArrayList();
+		if(StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(eId)){
+			ExampleEconomics exampleEconomics = new ExampleEconomics();
+			exampleEconomics.setExampleId(eId);
+			exampleEconomics.setIndexId(indexId);
+			list = exampleEconomicsService.findList(exampleEconomics);
+		}
+		j.put("list", list);
+		return j;
+	}
+	@ResponseBody
+	@RequestMapping(value = "deleteIndex")
+	public AjaxJson deleteIndex(String indexId,String exampleId ,String type,HttpServletRequest request, HttpServletResponse response, Model model) {
+		AjaxJson j = new AjaxJson();
+		try {
+			if ("1".equals(type)) {
+				if (StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(exampleId)) {
+					exampleSingleService.delteByIndexId(exampleId,indexId);
+				}
+			} else if ("4".equals(type)) {
+				if (StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(exampleId)) {
+					exampleEconomicsService.delteByIndexId(exampleId,indexId);
+				}
+			} else if ("5".equals(type)) {
+				if (StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(exampleId)) {
+					exampleProjectService.delteByIndexId(exampleId,indexId);
+				}
+			} else if ("6".equals(type)) {
+				if (StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(exampleId)) {
+					exampleExpendService.delteByIndexId(exampleId,indexId);
+				}
+			}
+			//删除树
+			if (StringUtils.isNotBlank(indexId) && StringUtils.isNotBlank(exampleId)) {
+				workExampleIndicesService.deleteExampleIndices(exampleId, indexId);
+			}
+			j.put("result",true);
+			return j;
+		}catch (Exception e){
+			j.put("result",false);
+			return j;
+		}
+	}
+}

+ 583 - 0
src/main/java/com/jeeplus/modules/workexample/web/WorkExampleIndicesController.java

@@ -0,0 +1,583 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.web;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.exampleeconomics.entity.ExampleEconomics;
+import com.jeeplus.modules.exampleeconomics.service.ExampleEconomicsService;
+import com.jeeplus.modules.exampleexpend.entity.ExampleExpend;
+import com.jeeplus.modules.exampleexpend.service.ExampleExpendService;
+import com.jeeplus.modules.exampleproject.entity.ExampleProject;
+import com.jeeplus.modules.exampleproject.service.ExampleProjectService;
+import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
+import com.jeeplus.modules.examplesingle.service.ExampleSingleService;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workexample.entity.WorkExample;
+import com.jeeplus.modules.workexample.entity.WorkExampleIndices;
+import com.jeeplus.modules.workexample.service.WorkExampleIndicesService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 指标项目字典Controller
+ * @author 杨帆
+ * @version 2018-08-27
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workexample/workExampleIndices")
+public class WorkExampleIndicesController extends BaseController {
+
+	@Autowired
+	private WorkExampleIndicesService workExampleIndicesService;
+	@Autowired
+	private ExampleSingleService exampleSingleService;
+	@Autowired
+	private ExampleProjectService exampleProjectService;
+	@Autowired
+	private ExampleExpendService exampleExpendService;
+	@Autowired
+	private ExampleEconomicsService exampleEconomicsService;
+	@ModelAttribute
+	public WorkExampleIndices get(@RequestParam(required=false) String id) {
+		WorkExampleIndices entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workExampleIndicesService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkExampleIndices();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 指标字典列表页面
+	 */
+	@RequiresPermissions("workexample:workExampleIndices:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkExampleIndices workExampleIndices, HttpServletRequest request, HttpServletResponse response, Model model) {
+		List<WorkExampleIndices> list = workExampleIndicesService.findLists(workExampleIndices);
+		if(list==null || list.size()==0){
+            list = workExampleIndicesService.findList(workExampleIndices);
+        }
+		model.addAttribute("list", list);
+		return "modules/workexample/workExampleIndicesList";
+	}
+
+	/**
+	 * 查看,增加,编辑指标字典表单页面
+	 */
+	//@RequiresPermissions(value={"workexample:workExampleIndices:view","workexample:workExampleIndices:add","workexample:workExampleIndices:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkExampleIndices workExampleIndices, Model model) {
+		if (StringUtils.isNotBlank(workExampleIndices.getView()) && workExampleIndices.getView().equals("view")){
+			model.addAttribute("edit", false);
+		}else {
+			model.addAttribute("edit", true);
+		}
+		String type = workExampleIndices.getType();
+		if (StringUtils.isNotBlank(workExampleIndices.getView()) && workExampleIndices.getView().equals("save")){
+			Integer orderNum = workExampleIndicesService.getOrderNum(workExampleIndices.getId());
+			WorkExampleIndices parent = new WorkExampleIndices(workExampleIndices.getId());
+			String parentIds = workExampleIndices.getParentIds();
+			String num = "";
+			if (orderNum==null || orderNum<1){
+				num = workExampleIndices.getOrderNum()+"01";
+			}else {
+				num = (orderNum+1)+"";
+			}
+			workExampleIndices = new WorkExampleIndices();
+			workExampleIndices.setOneItems("2");
+			workExampleIndices.setIsDisable("0");
+			workExampleIndices.setOrderNum(num);
+			workExampleIndices.setParent(parent);
+			workExampleIndices.setParentIds(parentIds+parent.getId()+",");
+			model.addAttribute("workExampleIndices", workExampleIndices);
+			if (StringUtils.isNotBlank(type) && (type.equals("2")|| type.equals("3"))){
+				//添加指标
+				return "modules/workexample/workExampleIndicesSave";
+			}else {
+				//添加项
+				return "modules/workexample/workExampleIndicesAdd";
+			}
+		}else {
+			model.addAttribute("workExampleIndices", workExampleIndices);
+			if (StringUtils.isNotBlank(type) && (type.equals("7")|| type.equals("8"))){	//修改项
+				return "modules/workexample/workExampleIndicesAdd";
+			}else {
+				if (workExampleIndices.getType().equals("4")){
+					workExampleIndices.setView("1");
+				}else if (workExampleIndices.getType().equals("5")){
+					workExampleIndices.setView("2");
+				}else {
+					workExampleIndices.setView("3");
+				}
+				//添加项
+				return "modules/workexample/workExampleIndicesSave";
+			}
+			//model.addAttribute("workExampleIndices", workExampleIndices);
+			//return "modules/workexample/workExampleIndicesForm";
+		}
+	}
+	/**
+	 * 保存指标字典
+	 */
+	//@RequiresPermissions(value={"workexample:workExampleIndices:add","workexample:workExampleIndices:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkExampleIndices workExampleIndices, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workExampleIndices)){
+			return form(workExampleIndices, model);
+		}
+		WorkExampleIndices parent = workExampleIndicesService.get(workExampleIndices.getParent().getId());
+		if (parent.getType().equals("1")){
+			workExampleIndices.setType("7");
+		}else if (parent.getType().equals("2")){
+			workExampleIndices.setType("3");
+		}else if (parent.getType().equals("3")){
+			if (workExampleIndices.getView().equals("1")){
+				workExampleIndices.setType("4");
+			}else if (workExampleIndices.getView().equals("2")){
+				workExampleIndices.setType("5");
+			}else {
+				workExampleIndices.setType("6");
+			}
+		}else if (parent.getType().equals("7")){
+			workExampleIndices.setType("8");
+		}else {
+			workExampleIndices.setType("7");
+		}
+		if(!workExampleIndices.getIsNewRecord()){//编辑表单保存
+			WorkExampleIndices t = workExampleIndicesService.get(workExampleIndices.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workExampleIndices, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workExampleIndicesService.save(t);//保存
+		}else{//新增表单保存
+			workExampleIndices.setCompanyId(UserUtils.getSelectCompany().getId());
+			workExampleIndicesService.save(workExampleIndices);//保存
+		}
+		addMessage(redirectAttributes, "保存指标字典成功");
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExampleIndices/?repage";
+	}
+	/**
+	 * 保存指标字典
+	 */
+	//@RequiresPermissions(value={"workexample:workExampleIndices:add","workexample:workExampleIndices:edit"},logical=Logical.OR)
+	@RequestMapping(value = "saveExample")
+	@ResponseBody
+	public AjaxJson saveExample(String ids, String exampleId, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		AjaxJson ajaxJson = new AjaxJson();
+		String[] idArr = ids.split(",");
+		for (String id:idArr){
+			Integer count = workExampleIndicesService.exampleIndicesCount(exampleId,id);
+			if (count == null || count==0){
+				try {
+					workExampleIndicesService.saveExampleIndices(exampleId,id);
+					List<WorkExampleIndices> workExampleIndicesList = workExampleIndicesService.findByParentId(id);
+					WorkExampleIndices exampleIndices = workExampleIndicesService.get(id);
+					if (workExampleIndicesList!=null && workExampleIndicesList.size()!=0){
+						for (WorkExampleIndices workExampleIndices:workExampleIndicesList){
+							//workExampleIndicesService.saveExampleIndices(exampleId,workExampleIndices.getId());
+							//id-指标id    workExampleIndices.getId()-項id  exampleId-项目概况id
+							if("1".equals(exampleIndices.getType())){
+								//单项工程造价指标
+								ExampleSingle exampleSingle = new ExampleSingle();
+								exampleSingle.setIndexId(id);
+								exampleSingle.setExampleId(exampleId);
+								exampleSingle.setExampleIndicesId(workExampleIndices.getId());
+								exampleSingle.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+								exampleSingle.setDigits(workExampleIndices.getDecimalCount());
+								exampleSingle.setName(workExampleIndices.getName());
+								exampleSingle.setId("");
+								exampleSingleService.save(exampleSingle);
+							}else if("4".equals(exampleIndices.getType())){
+								//经济指标
+								ExampleEconomics exampleEconomics = new ExampleEconomics();
+								exampleEconomics.setIndexId(id);
+								exampleEconomics.setExampleId(exampleId);
+								exampleEconomics.setExampleindicesId(workExampleIndices.getId());
+								exampleEconomics.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+								exampleEconomics.setDigits(workExampleIndices.getDecimalCount());
+								exampleEconomics.setName(workExampleIndices.getName());
+								exampleEconomics.setId("");
+								exampleEconomicsService.save(exampleEconomics);
+							}else if("5".equals(exampleIndices.getType())){
+								//主要工程量指标
+								ExampleProject exampleProject = new ExampleProject();
+								exampleProject.setIndexId(id);
+								exampleProject.setExampleId(exampleId);
+								exampleProject.setExampleindicesId(workExampleIndices.getId());
+								exampleProject.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+								exampleProject.setDigits(workExampleIndices.getDecimalCount());
+								exampleProject.setName(workExampleIndices.getName());
+								exampleProject.setId("");
+								exampleProjectService.save(exampleProject);
+							}else if("6".equals(exampleIndices.getType())){
+								//主要工料价格及消耗量指标
+								ExampleExpend exampleExpend = new ExampleExpend();
+								exampleExpend.setIndexId(id);
+								exampleExpend.setExampleId(exampleId);
+								exampleExpend.setExampleindicesId(workExampleIndices.getId());
+								exampleExpend.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+								exampleExpend.setDigits(workExampleIndices.getDecimalCount());
+								exampleExpend.setName(workExampleIndices.getName());
+								exampleExpend.setId("");
+								exampleExpendService.save(exampleExpend);
+							}
+						}
+					}
+				}catch (Exception e){
+					logger.info("Exception e:"+e);
+				}
+			}
+		}
+		return ajaxJson;
+	}
+
+	/**
+	 * 删除指标字典
+	 */
+	//@RequiresPermissions("workexample:workExampleIndices:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkExampleIndices workExampleIndices,String status, RedirectAttributes redirectAttributes) {
+		workExampleIndices.setIsDisable(status);
+		workExampleIndicesService.updateStatus(workExampleIndices);
+		if (status.equals("1")){
+			addMessage(redirectAttributes, "禁用项目指标成功");
+		}else{
+			addMessage(redirectAttributes, "启用项目指标成功");
+		}
+
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExampleIndices/?repage";
+	}
+	
+	/**
+	 * 批量删除指标字典
+	 */
+	//@RequiresPermissions("workexample:workExampleIndices:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workExampleIndicesService.delete(workExampleIndicesService.get(id));
+		}
+		addMessage(redirectAttributes, "删除指标字典成功");
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExampleIndices/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	//@RequiresPermissions("workexample:workExampleIndices:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkExampleIndices workExampleIndices, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "指标字典"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkExampleIndices> page = workExampleIndicesService.findPage(new Page<WorkExampleIndices>(request, response, -1), workExampleIndices);
+    		new ExportExcel("指标字典", WorkExampleIndices.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出指标字典记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExampleIndices/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	//@RequiresPermissions("workexample:workExampleIndices:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkExampleIndices> list = ei.getDataList(WorkExampleIndices.class);
+			for (WorkExampleIndices workExampleIndices : list){
+				try{
+					workExampleIndicesService.save(workExampleIndices);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条指标字典记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条指标字典记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入指标字典失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExampleIndices/?repage";
+    }
+	
+	/**
+	 * 下载导入指标字典数据模板
+	 */
+	//@RequiresPermissions("workexample:workExampleIndices:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "指标字典数据导入模板.xlsx";
+    		List<WorkExampleIndices> list = Lists.newArrayList(); 
+    		new ExportExcel("指标字典数据", WorkExampleIndices.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexample/workExampleIndices/?repage";
+    }
+
+	/**
+	 * 获取机构JSON数据。
+	 *
+	 * @param extId    排除的ID
+	 * @param type     类型(1:公司;2:部门/小组/其它:3:用户)
+	 * @param response
+	 * @return
+	 */
+	@RequiresPermissions("user")
+	@ResponseBody
+	@RequestMapping(value = "treeDataExample")
+	public List<Map<String, Object>> treeDataExample(@RequestParam(required = false) String workExampleId, @RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false) Boolean isAll, HttpServletResponse response) {
+		List<Map<String, Object>> mapList = new ArrayList<>();
+		List<WorkExampleIndices> list = new ArrayList<>();
+		WorkExampleIndices workExampleIndices = new WorkExampleIndices();
+		workExampleIndices.setParent(new WorkExampleIndices("0"));
+		workExampleIndices.setParentIds("0");
+		workExampleIndices.setName("工程名称");
+		workExampleIndices.setType("0");
+		workExampleIndices.setId("-1");
+		list.add(workExampleIndices);
+		WorkExampleIndices exampleIndices = new WorkExampleIndices();
+		exampleIndices.setParent(new WorkExampleIndices("-1"));
+		exampleIndices.setParentIds("0,");
+		exampleIndices.setName("工程概况");
+		exampleIndices.setType("0");
+		exampleIndices.setId("");
+		list.add(exampleIndices);
+		if(StringUtils.isNotBlank(workExampleId)) {
+			WorkExampleIndices workExampleIndice1 = new WorkExampleIndices();
+			workExampleIndice1.setCompanyId(UserUtils.getSelectCompany().getId());
+			workExampleIndice1.setWorkExample(new WorkExample(workExampleId));
+			workExampleIndice1.setIsDisable("0");
+			List<WorkExampleIndices> workExampleIndicesList = workExampleIndicesService.findListInfo(workExampleIndice1);
+			if (workExampleIndicesList != null && workExampleIndicesList.size() != 0) {
+				list.addAll(workExampleIndicesList);
+			}
+		}
+		for (int i = 0; i < list.size(); i++) {
+			WorkExampleIndices e = list.get(i);
+			if ((StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf("," + extId + ",") == -1))
+					) {
+				Map<String, Object> map = Maps.newHashMap();
+				map.put("id", e.getId());
+				map.put("pId", e.getParent().getId().equals("0")?"-1":e.getParent().getId());
+				map.put("pIds", e.getParentIds().replaceFirst("0,","0,-1,"));
+				map.put("name", e.getName());
+				map.put("type",e.getType());
+				if (e.getType() != null &&(Integer.parseInt(e.getType()) == 2 || Integer.parseInt(e.getType()) == 3 )){
+					map.put("isParent", true);
+				} else {
+					map.put("isParent", false);
+				}
+				mapList.add(map);
+			}
+		}
+		return mapList;
+	}
+
+	/**
+	 * 获取机构JSON数据。
+	 *
+	 * @param extId    排除的ID
+	 * @param type     类型(1:公司;2:部门/小组/其它:3:用户)
+	 * @param response
+	 * @return
+	 */
+	@RequiresPermissions("user")
+	@ResponseBody
+	@RequestMapping(value = "treeDataExampleInfo")
+	public List<Map<String, Object>> treeDataExampleInfo(@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false) Boolean isAll, HttpServletResponse response) {
+		List<Map<String, Object>> mapList = new ArrayList<>();
+		WorkExampleIndices workExampleIndice1 = new WorkExampleIndices();
+		workExampleIndice1.setCompanyId(UserUtils.getSelectCompany().getId());
+		workExampleIndice1.setView("view");
+		workExampleIndice1.setIsDisable("0");
+		List<WorkExampleIndices> list = workExampleIndicesService.findList(workExampleIndice1);
+		for (int i = 0; i < list.size(); i++) {
+			WorkExampleIndices e = list.get(i);
+			if ((StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf("," + extId + ",") == -1))
+					) {
+				Map<String, Object> map = Maps.newHashMap();
+				map.put("id", e.getId());
+				map.put("pId", e.getParent().getId());
+				map.put("pIds", e.getParentIds());
+				map.put("name", e.getName());
+				map.put("type",e.getType());
+				if (e.getType() != null &&(Integer.parseInt(e.getType()) == 2 || Integer.parseInt(e.getType()) == 3 )|| Integer.parseInt(e.getType()) == 0){
+					map.put("isParent", true);
+				} else {
+					map.put("isParent", false);
+				}
+				mapList.add(map);
+			}
+		}
+		return mapList;
+	}
+
+	/**
+	 * 获取机构JSON数据。
+	 *
+	 * @param extId    排除的ID
+	 * @param type     类型(1:公司;2:部门/小组/其它:3:用户)
+	 * @param response
+	 * @return
+	 */
+	@RequiresPermissions("user")
+	@ResponseBody
+	@RequestMapping(value = "treeDataExampleSelect")
+	public List<Map<String, Object>> treeDataExampleSelect(@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false) Boolean isAll, HttpServletResponse response) {
+		List<Map<String, Object>> mapList = new ArrayList<>();
+		List<WorkExampleIndices> list = new ArrayList<>();
+		WorkExampleIndices workExampleIndices = new WorkExampleIndices();
+		workExampleIndices.setParent(new WorkExampleIndices("0"));
+		workExampleIndices.setParentIds("0");
+		workExampleIndices.setName("工程名称");
+		workExampleIndices.setType("0");
+		workExampleIndices.setId("-1");
+		list.add(workExampleIndices);
+		WorkExampleIndices exampleIndices = new WorkExampleIndices();
+		exampleIndices.setParent(new WorkExampleIndices("-1"));
+		exampleIndices.setParentIds("0,");
+		exampleIndices.setName("工程概况");
+		exampleIndices.setType("0");
+		exampleIndices.setId("");
+		list.add(exampleIndices);
+		WorkExampleIndices workExampleIndice1 = new WorkExampleIndices();
+		workExampleIndice1.setCompanyId(UserUtils.getSelectCompany().getId());
+		workExampleIndice1.setView("view");
+		workExampleIndice1.setIsDisable("0");
+		list.addAll(workExampleIndicesService.findList(workExampleIndice1));
+		for (int i = 0; i < list.size(); i++) {
+			WorkExampleIndices e = list.get(i);
+			if ((StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf("," + extId + ",") == -1))
+					) {
+				Map<String, Object> map = Maps.newHashMap();
+				map.put("id", e.getId());
+				map.put("pId", e.getParent().getId().equals("0")?"-1":e.getParent().getId());
+				map.put("name", e.getName());
+				map.put("pIds", e.getParentIds().replaceFirst("0,","0,-1,"));
+				map.put("type",e.getType());
+				if (e.getType() != null &&(Integer.parseInt(e.getType()) == 2 || Integer.parseInt(e.getType()) == 3 )){
+					map.put("isParent", true);
+				} else {
+					map.put("isParent", false);
+				}
+				mapList.add(map);
+			}
+		}
+		return mapList;
+	}
+
+	@RequestMapping(value = "gridSelectIndices")
+	public String gridSelectIndices(WorkExampleIndices workExampleIndices,String url,String indexId, HttpServletRequest request, HttpServletResponse response, Model model){
+		List<WorkExampleIndices> list =new ArrayList<>();
+		if(StringUtils.isNotBlank(indexId)){
+			workExampleIndices.setId(indexId);
+		}
+		Page<WorkExampleIndices> page = workExampleIndicesService.findPageByParentId(new Page<WorkExampleIndices>(request, response),  workExampleIndices);
+		model.addAttribute("workExampleIndices", workExampleIndices);
+		model.addAttribute("url", url);
+		model.addAttribute("indexId", indexId);
+		model.addAttribute("page", page);
+		return  "modules/sys/gridSelectSingle";
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "saveIndices")
+	public AjaxJson saveIndices(String indexId,String exampleId ,String ids,HttpServletRequest request, HttpServletResponse response, Model model) {
+		String[] idArr = ids.split(",");
+		//筛选
+		AjaxJson j = new AjaxJson();
+		WorkExampleIndices exampleIndices = workExampleIndicesService.get(indexId);
+		List list = Lists.newArrayList();
+		for (String id:idArr){
+			if(StringUtils.isNotBlank(id)){
+				if("1".equals(exampleIndices.getType())){
+					//单项工程造价指标
+					WorkExampleIndices workExampleIndices = workExampleIndicesService.get(id);
+					ExampleSingle exampleSingle = new ExampleSingle();
+					exampleSingle.setIndexId(indexId);
+					exampleSingle.setExampleId(exampleId);
+					exampleSingle.setExampleIndicesId(id);
+					exampleSingle.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+					exampleSingle.setDigits(workExampleIndices.getDecimalCount());
+					exampleSingle.setName(workExampleIndices.getName());
+					list.add(exampleSingle);
+				}else if("4".equals(exampleIndices.getType())){
+					//经济指标
+					WorkExampleIndices workExampleIndices = workExampleIndicesService.get(id);
+					ExampleEconomics exampleEconomics = new ExampleEconomics();
+					exampleEconomics.setIndexId(indexId);
+					exampleEconomics.setExampleId(exampleId);
+					exampleEconomics.setExampleindicesId(id);
+					exampleEconomics.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+					exampleEconomics.setDigits(workExampleIndices.getDecimalCount());
+					exampleEconomics.setName(workExampleIndices.getName());
+					list.add(exampleEconomics);
+				}else if("5".equals(exampleIndices.getType())){
+					//主要工程量指标
+					WorkExampleIndices workExampleIndices = workExampleIndicesService.get(id);
+					ExampleProject exampleProject = new ExampleProject();
+					exampleProject.setIndexId(indexId);
+					exampleProject.setExampleId(exampleId);
+					exampleProject.setExampleindicesId(id);
+					exampleProject.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+					exampleProject.setDigits(workExampleIndices.getDecimalCount());
+					exampleProject.setName(workExampleIndices.getName());
+					list.add(exampleProject);
+				}else if("6".equals(exampleIndices.getType())){
+					//主要工料价格及消耗量指标
+					WorkExampleIndices workExampleIndices = workExampleIndicesService.get(id);
+					ExampleExpend exampleExpend = new ExampleExpend();
+					exampleExpend.setIndexId(indexId);
+					exampleExpend.setExampleId(exampleId);
+					exampleExpend.setExampleindicesId(id);
+					exampleExpend.setUnit(DictUtils.getMainDictLabel(workExampleIndices.getItemUnit(),"unit_type",""));//unit_type     getMainDictList
+					exampleExpend.setDigits(workExampleIndices.getDecimalCount());
+					exampleExpend.setName(workExampleIndices.getName());
+					list.add(exampleExpend);
+				}
+			}
+		}
+		j.put("list", list);
+		j.put("indexId",indexId);
+		return j;
+	}
+}

+ 208 - 0
src/main/java/com/jeeplus/modules/workexample/web/WorkExampleInfoController.java

@@ -0,0 +1,208 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.web;
+
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.exampleeconomics.entity.ExampleEconomics;
+import com.jeeplus.modules.exampleeconomics.service.ExampleEconomicsService;
+import com.jeeplus.modules.exampleexpend.entity.ExampleExpend;
+import com.jeeplus.modules.exampleexpend.service.ExampleExpendService;
+import com.jeeplus.modules.exampleproject.entity.ExampleProject;
+import com.jeeplus.modules.exampleproject.service.ExampleProjectService;
+import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
+import com.jeeplus.modules.examplesingle.service.ExampleSingleService;
+import com.jeeplus.modules.sys.entity.MainDictDetail;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.service.MainDictDetailService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workexample.entity.WorkExample;
+import com.jeeplus.modules.workexample.entity.WorkExampleIndices;
+import com.jeeplus.modules.workexample.service.WorkExampleIndicesService;
+import com.jeeplus.modules.workexample.service.WorkExampleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 案例Controller
+ * @author ssrh
+ * @version 2018-08-27
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workexample/workExample")
+public class WorkExampleInfoController extends BaseController {
+
+	@Autowired
+	private WorkExampleService workExampleService;
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private MainDictDetailService mainDictDetailService;
+	@Autowired
+	private ExampleSingleService exampleSingleService;
+	@Autowired
+	private ExampleProjectService exampleProjectService;
+	@Autowired
+	private ExampleExpendService exampleExpendService;
+	@Autowired
+	private ExampleEconomicsService exampleEconomicsService;
+	@Autowired
+	private WorkExampleIndicesService workExampleIndicesService;
+	@ModelAttribute
+	public WorkExample get(@RequestParam(required=false) String id) {
+		WorkExample entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workExampleService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkExample();
+		}
+		return entity;
+	}
+
+	/**
+	 * 查看,增加,编辑指标字典表单页面
+	 */
+	@RequestMapping(value = "example")
+	public String example(WorkExample workExample, Model model) {
+        WorkExample example = new WorkExample();
+        example.setAddress(workExample.getAddress());
+        example.setExampleType(StringUtils.isBlank(workExample.getExampleType())?"1":workExample.getExampleType());
+        example.setDictId(workExample.getDictId());
+		example.setExampleTypeName(workExample.getExampleTypeName());
+		example.setArea(workExample.getArea());
+        String exampleType = workExample.getExampleType();
+        String type = "0";
+        if (StringUtils.isNotBlank(exampleType)){
+			WorkExampleIndices workExampleIndices = workExampleIndicesService.get(exampleType);
+			if (workExampleIndices!=null && StringUtils.isNotBlank(workExampleIndices.getType())){
+				type = workExampleIndices.getType();
+			}
+		}else {
+			example.setExampleTypeName("工程概况");
+			example.setExampleType("");
+		}
+        Office company = UserUtils.getSelectCompany();
+        if ("1".equals(type)){
+			List<ExampleSingle> exampleSingleList = new ArrayList<>();
+			if (StringUtils.isNotBlank(workExample.getDictId())){
+				exampleSingleList = exampleSingleService.getCount(company.getId(),workExample.getArea().getId(),workExample.getDictId(),exampleType);
+				if (exampleSingleList!=null && exampleSingleList.size()!=0) {
+					workExample.setCompanyId(company.getId());
+					BigDecimal sum = workExampleService.getSumBuildScale(workExample);
+					ExampleSingle exampleSingleTotal=new ExampleSingle();
+					exampleSingleTotal.setName("合计");
+					BigDecimal sumsTotal = new BigDecimal("0.00");
+					for (ExampleSingle exampleSingle : exampleSingleList) {
+						sumsTotal = sumsTotal.add(exampleSingle.getSums());
+					}
+					for (ExampleSingle exampleSingle : exampleSingleList) {
+						BigDecimal proportion = exampleSingle.getSums().divide(sumsTotal, 2, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100));
+						exampleSingle.setProportion(proportion.toString());
+						if (exampleSingle.getAvgs() != null && exampleSingle.getAvgs().compareTo(BigDecimal.ZERO) == 1) {
+							exampleSingle.setAvgs(exampleSingle.getSums().divide(exampleSingle.getAvgs(), 2, BigDecimal.ROUND_HALF_EVEN));
+						}
+					}
+					exampleSingleTotal.setSums(sumsTotal);
+					exampleSingleTotal.setAvgs(sumsTotal.divide(sum, 2, BigDecimal.ROUND_HALF_EVEN));
+					exampleSingleList.add(exampleSingleTotal);
+				}
+            }
+			model.addAttribute("workExample", example);
+			model.addAttribute("exampleSingleList", exampleSingleList);
+            return "modules/workexample/workExampleSingle";
+        }else if("4".equals(type)){
+			List<ExampleEconomics> exampleEconomicsList = new ArrayList<>();
+			if (StringUtils.isNotBlank(workExample.getDictId())){
+				exampleEconomicsList = exampleEconomicsService.getCount(company.getId(),workExample.getArea().getId(),workExample.getDictId(),exampleType);
+				if (exampleEconomicsList!=null && exampleEconomicsList.size()!=0) {
+					workExample.setCompanyId(company.getId());
+					BigDecimal sum = workExampleService.getSumBuildScale(workExample);
+					ExampleEconomics exampleEconomicsTotal=new ExampleEconomics();
+					exampleEconomicsTotal.setName("合计");
+					BigDecimal sumsTotal = new BigDecimal("0.00");
+					for (ExampleEconomics exampleEconomics : exampleEconomicsList) {
+						sumsTotal = sumsTotal.add(exampleEconomics.getSums());
+					}
+					for (ExampleEconomics exampleEconomics : exampleEconomicsList) {
+						BigDecimal proportion = exampleEconomics.getSums().divide(sumsTotal, 2, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100));
+						exampleEconomics.setProportion(proportion.toString());
+						if (exampleEconomics.getAvgs() != null && exampleEconomics.getAvgs().compareTo(BigDecimal.ZERO) == 1) {
+							exampleEconomics.setAvgs(exampleEconomics.getSums().divide(exampleEconomics.getAvgs(), 2, BigDecimal.ROUND_HALF_EVEN));
+						}
+					}
+					exampleEconomicsTotal.setSums(sumsTotal);
+					exampleEconomicsTotal.setAvgs(sumsTotal.divide(sum, 2, BigDecimal.ROUND_HALF_EVEN));
+					exampleEconomicsList.add(exampleEconomicsTotal);
+				}
+			}
+			model.addAttribute("workExample", example);
+			model.addAttribute("exampleEconomicsList", exampleEconomicsList);
+			return "modules/workexample/workExampleEconomics";
+		}else if("5".equals(type)){
+			List<ExampleProject> exampleProjectList = new ArrayList<>();
+			if (StringUtils.isNotBlank(workExample.getDictId())){
+				exampleProjectList = exampleProjectService.getCount(company.getId(),workExample.getArea().getId(),workExample.getDictId(),exampleType);
+				if (exampleProjectList!=null && exampleProjectList.size()!=0) {
+					workExample.setCompanyId(company.getId());
+					for (ExampleProject exampleProject : exampleProjectList) {
+						if (exampleProject.getAvgs() != null && exampleProject.getAvgs().compareTo(BigDecimal.ZERO) == 1) {
+							BigDecimal proportion = exampleProject.getSums().divide(exampleProject.getAvgs(), 2, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100));
+							exampleProject.setAvgs(proportion);
+						}
+					}
+				}
+			}
+			model.addAttribute("workExample", example);
+			model.addAttribute("exampleProjectList", exampleProjectList);
+			return "modules/workexample/workExampleWork";
+		}else if("6".equals(type)){
+			List<ExampleExpend> exampleExpendList = new ArrayList<>();
+			if (StringUtils.isNotBlank(workExample.getDictId())){
+				exampleExpendList = exampleExpendService.getCount(company.getId(),workExample.getArea().getId(),workExample.getDictId(),exampleType);
+				if (exampleExpendList!=null && exampleExpendList.size()!=0) {
+					workExample.setCompanyId(company.getId());
+					for (ExampleExpend exampleExpend : exampleExpendList) {
+						if (exampleExpend.getAvgs() != null && exampleExpend.getAvgs().compareTo(BigDecimal.ZERO) == 1) {
+							BigDecimal proportion = exampleExpend.getSums().divide(exampleExpend.getAvgs(), 2, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100));
+							exampleExpend.setAvgs(proportion);
+						}
+					}
+				}
+			}
+			model.addAttribute("workExample", example);
+			model.addAttribute("exampleExpendList", exampleExpendList);
+			return "modules/workexample/workExampleConsumption";
+		}else {
+	    	if (StringUtils.isNotBlank(workExample.getDictId())){
+				workExample.setCompanyId(company.getId());
+				example = workExampleService.getByTypes(workExample);
+				MainDictDetail mainDictDetail = mainDictDetailService.get(workExample.getDictId());
+				example.setWorkType(mainDictDetail!=null?mainDictDetail.getDetailName():"");
+			}
+			example.setExampleTypeName("工程概况");
+	    	if(StringUtils.isBlank(example.getDictId())){
+				example.setDictId(workExample.getDictId());
+			}
+			if(workExample.getArea()== null || StringUtils.isNotBlank(workExample.getArea().getId())){
+				example.setArea(workExample.getArea());
+			}
+            model.addAttribute("workExample", example);
+            return "modules/workexample/workExampleSituation";
+		}
+	}
+
+}

+ 97 - 0
src/main/java/com/jeeplus/modules/workexample/web/WorkExamplesController.java

@@ -0,0 +1,97 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexample.web;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.exampleeconomics.entity.ExampleEconomics;
+import com.jeeplus.modules.exampleeconomics.service.ExampleEconomicsService;
+import com.jeeplus.modules.exampleexpend.entity.ExampleExpend;
+import com.jeeplus.modules.exampleexpend.service.ExampleExpendService;
+import com.jeeplus.modules.exampleproject.entity.ExampleProject;
+import com.jeeplus.modules.exampleproject.service.ExampleProjectService;
+import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
+import com.jeeplus.modules.examplesingle.service.ExampleSingleService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workexample.entity.WorkExample;
+import com.jeeplus.modules.workexample.service.WorkExampleService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 案例Controller
+ * @author ssrh
+ * @version 2018-08-27
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workexample/workExamples")
+public class WorkExamplesController extends BaseController {
+
+	@Autowired
+	private WorkExampleService workExampleService;
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private ExampleSingleService exampleSingleService;
+	@Autowired
+	private ExampleProjectService exampleProjectService;
+	@Autowired
+	private ExampleExpendService exampleExpendService;
+	@Autowired
+	private ExampleEconomicsService exampleEconomicsService;
+
+	@ModelAttribute
+	public WorkExample get(@RequestParam(required=false) String id) {
+		WorkExample entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workExampleService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkExample();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 案例列表页面
+	 */
+	@RequiresPermissions("workexample:workExample:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkExample workExample, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkExample> page = workExampleService.findPage(new Page<WorkExample>(request, response), workExample); 
+		model.addAttribute("page", page);
+		return "modules/workexample/workExampleLists";
+	}
+
+}

+ 19 - 0
src/main/java/com/jeeplus/modules/workexampleimplog/dao/WorkExampleImplogDao.java

@@ -0,0 +1,19 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexampleimplog.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workexampleimplog.entity.WorkExampleImplog;
+
+/**
+ * 案例导入日志DAO接口
+ * @author ssrh
+ * @version 2018-09-03
+ */
+@MyBatisDao
+public interface WorkExampleImplogDao extends CrudDao<WorkExampleImplog> {
+
+	
+}

+ 151 - 0
src/main/java/com/jeeplus/modules/workexampleimplog/entity/WorkExampleImplog.java

@@ -0,0 +1,151 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexampleimplog.entity;
+
+import java.util.Date;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 案例导入日志Entity
+ * @author ssrh
+ * @version 2018-09-03
+ */
+public class WorkExampleImplog extends DataEntity<WorkExampleImplog> {
+	
+	private static final long serialVersionUID = 1L;
+	private String userName;
+	private String companyId;		// 公司
+	private String officeId;		// 部门
+	private String exampleId;		// 概况Id
+	private String indexId;		// 指标
+	private String termId;		// 项
+	private String reason;		// 失败原因
+	private String flat;		// 状态
+	private String exampleName;		// 概况Id
+	private String indexName;		// 指标
+	private String termName;		// 项
+	private Date beginCreateDate;		// 开始 创建时间
+	private Date endCreateDate;		// 结束 创建时间
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+	public String getExampleName() {
+		return exampleName;
+	}
+
+	public void setExampleName(String exampleName) {
+		this.exampleName = exampleName;
+	}
+
+	public String getIndexName() {
+		return indexName;
+	}
+
+	public void setIndexName(String indexName) {
+		this.indexName = indexName;
+	}
+
+	public String getTermName() {
+		return termName;
+	}
+
+	public void setTermName(String termName) {
+		this.termName = termName;
+	}
+
+	
+	public WorkExampleImplog() {
+		super();
+	}
+
+	public WorkExampleImplog(String id){
+		super(id);
+	}
+
+	@ExcelField(title="公司", align=2, sort=7)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="部门", align=2, sort=8)
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+	
+	@ExcelField(title="概况Id", align=2, sort=9)
+	public String getExampleId() {
+		return exampleId;
+	}
+
+	public void setExampleId(String exampleId) {
+		this.exampleId = exampleId;
+	}
+	
+	@ExcelField(title="指标", align=2, sort=10)
+	public String getIndexId() {
+		return indexId;
+	}
+
+	public void setIndexId(String indexId) {
+		this.indexId = indexId;
+	}
+	
+	@ExcelField(title="项", align=2, sort=11)
+	public String getTermId() {
+		return termId;
+	}
+
+	public void setTermId(String termId) {
+		this.termId = termId;
+	}
+	
+	@ExcelField(title="失败原因", align=2, sort=12)
+	public String getReason() {
+		return reason;
+	}
+
+	public void setReason(String reason) {
+		this.reason = reason;
+	}
+	
+	@ExcelField(title="状态", align=2, sort=13)
+	public String getFlat() {
+		return flat;
+	}
+
+	public void setFlat(String flat) {
+		this.flat = flat;
+	}
+	
+	public Date getBeginCreateDate() {
+		return beginCreateDate;
+	}
+
+	public void setBeginCreateDate(Date beginCreateDate) {
+		this.beginCreateDate = beginCreateDate;
+	}
+	
+	public Date getEndCreateDate() {
+		return endCreateDate;
+	}
+
+	public void setEndCreateDate(Date endCreateDate) {
+		this.endCreateDate = endCreateDate;
+	}
+		
+}

+ 50 - 0
src/main/java/com/jeeplus/modules/workexampleimplog/service/WorkExampleImplogService.java

@@ -0,0 +1,50 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexampleimplog.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workexampleimplog.entity.WorkExampleImplog;
+import com.jeeplus.modules.workexampleimplog.dao.WorkExampleImplogDao;
+
+/**
+ * 案例导入日志Service
+ * @author ssrh
+ * @version 2018-09-03
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkExampleImplogService extends CrudService<WorkExampleImplogDao, WorkExampleImplog> {
+
+	public WorkExampleImplog get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkExampleImplog> findList(WorkExampleImplog workExampleImplog) {
+		return super.findList(workExampleImplog);
+	}
+	
+	public Page<WorkExampleImplog> findPage(Page<WorkExampleImplog> page, WorkExampleImplog workExampleImplog) {
+		return super.findPage(page, workExampleImplog);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkExampleImplog workExampleImplog) {
+		super.save(workExampleImplog);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkExampleImplog workExampleImplog) {
+		super.delete(workExampleImplog);
+	}
+	
+	
+	
+	
+}

+ 198 - 0
src/main/java/com/jeeplus/modules/workexampleimplog/web/WorkExampleImplogController.java

@@ -0,0 +1,198 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexampleimplog.web;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.workexampleimplog.entity.WorkExampleImplog;
+import com.jeeplus.modules.workexampleimplog.service.WorkExampleImplogService;
+
+/**
+ * 案例导入日志Controller
+ * @author ssrh
+ * @version 2018-09-03
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workexampleimplog/workExampleImplog")
+public class WorkExampleImplogController extends BaseController {
+
+	@Autowired
+	private WorkExampleImplogService workExampleImplogService;
+	
+	@ModelAttribute
+	public WorkExampleImplog get(@RequestParam(required=false) String id) {
+		WorkExampleImplog entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workExampleImplogService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkExampleImplog();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 案例导入日志列表页面
+	 */
+	/*@RequiresPermissions("workexampleimplog:workExampleImplog:list")*/
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkExampleImplog workExampleImplog, HttpServletRequest request, HttpServletResponse response, Model model) {
+		workExampleImplog.setCompanyId(UserUtils.getSelectCompany().getId());
+		Page<WorkExampleImplog> page = workExampleImplogService.findPage(new Page<WorkExampleImplog>(request, response), workExampleImplog); 
+		model.addAttribute("page", page);
+		return "modules/workexampleimplog/workExampleImplogList";
+	}
+
+	/**
+	 * 查看,增加,编辑案例导入日志表单页面
+	 */
+	@RequiresPermissions(value={"workexampleimplog:workExampleImplog:view","workexampleimplog:workExampleImplog:add","workexampleimplog:workExampleImplog:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkExampleImplog workExampleImplog, Model model) {
+		model.addAttribute("workExampleImplog", workExampleImplog);
+		return "modules/workexampleimplog/workExampleImplogForm";
+	}
+
+	/**
+	 * 保存案例导入日志
+	 */
+	@RequiresPermissions(value={"workexampleimplog:workExampleImplog:add","workexampleimplog:workExampleImplog:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkExampleImplog workExampleImplog, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workExampleImplog)){
+			return form(workExampleImplog, model);
+		}
+		if(!workExampleImplog.getIsNewRecord()){//编辑表单保存
+			WorkExampleImplog t = workExampleImplogService.get(workExampleImplog.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workExampleImplog, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workExampleImplogService.save(t);//保存
+		}else{//新增表单保存
+			workExampleImplogService.save(workExampleImplog);//保存
+		}
+		addMessage(redirectAttributes, "保存案例导入日志成功");
+		return "redirect:"+Global.getAdminPath()+"/workexampleimplog/workExampleImplog/?repage";
+	}
+	
+	/**
+	 * 删除案例导入日志
+	 */
+	@RequiresPermissions("workexampleimplog:workExampleImplog:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkExampleImplog workExampleImplog, RedirectAttributes redirectAttributes) {
+		workExampleImplogService.delete(workExampleImplog);
+		addMessage(redirectAttributes, "删除案例导入日志成功");
+		return "redirect:"+Global.getAdminPath()+"/workexampleimplog/workExampleImplog/?repage";
+	}
+	
+	/**
+	 * 批量删除案例导入日志
+	 */
+	@RequiresPermissions("workexampleimplog:workExampleImplog:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workExampleImplogService.delete(workExampleImplogService.get(id));
+		}
+		addMessage(redirectAttributes, "删除案例导入日志成功");
+		return "redirect:"+Global.getAdminPath()+"/workexampleimplog/workExampleImplog/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workexampleimplog:workExampleImplog:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkExampleImplog workExampleImplog, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "案例导入日志"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkExampleImplog> page = workExampleImplogService.findPage(new Page<WorkExampleImplog>(request, response, -1), workExampleImplog);
+    		new ExportExcel("案例导入日志", WorkExampleImplog.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出案例导入日志记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexampleimplog/workExampleImplog/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workexampleimplog:workExampleImplog:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkExampleImplog> list = ei.getDataList(WorkExampleImplog.class);
+			for (WorkExampleImplog workExampleImplog : list){
+				try{
+					workExampleImplogService.save(workExampleImplog);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条案例导入日志记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条案例导入日志记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入案例导入日志失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexampleimplog/workExampleImplog/?repage";
+    }
+	
+	/**
+	 * 下载导入案例导入日志数据模板
+	 */
+	@RequiresPermissions("workexampleimplog:workExampleImplog:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "案例导入日志数据导入模板.xlsx";
+    		List<WorkExampleImplog> list = Lists.newArrayList(); 
+    		new ExportExcel("案例导入日志数据", WorkExampleImplog.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexampleimplog/workExampleImplog/?repage";
+    }
+	
+	
+	
+
+}

+ 21 - 0
src/main/java/com/jeeplus/modules/workexplore/dao/WorkExploreDao.java

@@ -0,0 +1,21 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexplore.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workexplore.entity.WorkExplore;
+
+/**
+ * 现场踏勘记录DAO接口
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@MyBatisDao
+public interface WorkExploreDao extends CrudDao<WorkExplore> {
+
+    int deleteByProId(WorkExplore workExplore);
+
+    WorkExplore findListByProId(WorkExplore workExplore);
+}

+ 37 - 0
src/main/java/com/jeeplus/modules/workexplore/entity/WorkExplore.java

@@ -0,0 +1,37 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexplore.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 现场踏勘记录Entity
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+public class WorkExplore extends DataEntity<WorkExplore> {
+	
+	private static final long serialVersionUID = 1L;
+	private String projectId;		// 项目编号
+	
+	public WorkExplore() {
+		super();
+	}
+
+	public WorkExplore(String id){
+		super(id);
+	}
+
+	@ExcelField(title="项目编号", align=2, sort=7)
+	public String getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+	
+}

+ 55 - 0
src/main/java/com/jeeplus/modules/workexplore/service/WorkExploreService.java

@@ -0,0 +1,55 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexplore.service;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workexplore.dao.WorkExploreDao;
+import com.jeeplus.modules.workexplore.entity.WorkExplore;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 现场踏勘记录Service
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkExploreService extends CrudService<WorkExploreDao, WorkExplore> {
+
+	@Autowired
+	private WorkExploreDao workExploreDao;
+
+	public WorkExplore get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkExplore> findList(WorkExplore workExplore) {
+		return super.findList(workExplore);
+	}
+	
+	public Page<WorkExplore> findPage(Page<WorkExplore> page, WorkExplore workExplore) {
+		return super.findPage(page, workExplore);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkExplore workExplore) {
+		super.save(workExplore);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkExplore workExplore) {
+		super.delete(workExplore);
+	}
+
+
+	public WorkExplore findListByProId(WorkExplore workExplore){
+		return workExploreDao.findListByProId(workExplore);
+	}
+	
+}

+ 202 - 0
src/main/java/com/jeeplus/modules/workexplore/web/WorkExploreController.java

@@ -0,0 +1,202 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workexplore.web;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.workexplore.entity.WorkExplore;
+import com.jeeplus.modules.workexplore.service.WorkExploreService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.List;
+
+/**
+ * 现场踏勘记录Controller
+ * @author 马鹏波
+ * @version 2018-06-05
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workexplore/workExplore")
+public class WorkExploreController extends BaseController {
+
+	@Autowired
+	private WorkExploreService workExploreService;
+	
+	@ModelAttribute
+	public WorkExplore get(@RequestParam(required=false) String id) {
+		WorkExplore entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workExploreService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkExplore();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 现场踏勘记录列表页面
+	 */
+//	@RequiresPermissions("workexplore:workExplore:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkExplore workExplore, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkExplore> page = workExploreService.findPage(new Page<WorkExplore>(request, response), workExplore); 
+		model.addAttribute("page", page);
+		return "modules/workexplore/workExploreList";
+	}
+
+	/**
+	 * 查看,增加,编辑现场踏勘记录表单页面
+	 */
+//	@RequiresPermissions(value={"workexplore:workExplore:view","workexplore:workExplore:add","workexplore:workExplore:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkExplore workExplore,HttpServletRequest request, Model model) {
+		String view = request.getParameter("view");
+		if("view".equals(view)){
+			view = "modules/workexplore/workExploreFormView";
+		}else{
+			view = "modules/workexplore/workExploreForm";
+		}
+		if(!Strings.isNullOrEmpty(workExplore.getProjectId())){
+			workExplore = workExploreService.findListByProId(workExplore);
+		}
+		model.addAttribute("workExplore", workExplore);
+		return view;
+	}
+
+	/**
+	 * 保存现场踏勘记录
+	 */
+//	@RequiresPermissions(value={"workexplore:workExplore:add","workexplore:workExplore:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkExplore workExplore, HttpServletRequest request,Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workExplore)){
+			return form(workExplore,request, model);
+		}
+		if(!workExplore.getIsNewRecord()){//编辑表单保存
+			WorkExplore t = workExploreService.get(workExplore.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workExplore, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workExploreService.save(t);//保存
+		}else{//新增表单保存
+			workExploreService.save(workExplore);//保存
+		}
+		addMessage(redirectAttributes, "保存现场踏勘记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workexplore/workExplore/?repage";
+	}
+	
+	/**
+	 * 删除现场踏勘记录
+	 */
+//	@RequiresPermissions("workexplore:workExplore:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkExplore workExplore, RedirectAttributes redirectAttributes) {
+		workExploreService.delete(workExplore);
+		addMessage(redirectAttributes, "删除现场踏勘记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workexplore/workExplore/?repage";
+	}
+	
+	/**
+	 * 批量删除现场踏勘记录
+	 */
+//	@RequiresPermissions("workexplore:workExplore:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workExploreService.delete(workExploreService.get(id));
+		}
+		addMessage(redirectAttributes, "删除现场踏勘记录成功");
+		return "redirect:"+Global.getAdminPath()+"/workexplore/workExplore/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+//	@RequiresPermissions("workexplore:workExplore:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkExplore workExplore, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "现场踏勘记录"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkExplore> page = workExploreService.findPage(new Page<WorkExplore>(request, response, -1), workExplore);
+    		new ExportExcel("现场踏勘记录", WorkExplore.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出现场踏勘记录记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexplore/workExplore/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+//	@RequiresPermissions("workexplore:workExplore:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkExplore> list = ei.getDataList(WorkExplore.class);
+			for (WorkExplore workExplore : list){
+				try{
+					workExploreService.save(workExplore);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条现场踏勘记录记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条现场踏勘记录记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入现场踏勘记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexplore/workExplore/?repage";
+    }
+	
+	/**
+	 * 下载导入现场踏勘记录数据模板
+	 */
+//	@RequiresPermissions("workexplore:workExplore:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "现场踏勘记录数据导入模板.xlsx";
+    		List<WorkExplore> list = Lists.newArrayList(); 
+    		new ExportExcel("现场踏勘记录数据", WorkExplore.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workexplore/workExplore/?repage";
+    }
+	
+	
+	
+
+}

+ 42 - 0
src/main/java/com/jeeplus/modules/workfield/dao/WorkFieldDao.java

@@ -0,0 +1,42 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfield.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfield.entity.WorkField;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 外勤申请DAO接口
+ * @author ssrh
+ * @version 2018-09-06
+ */
+@MyBatisDao
+public interface WorkFieldDao extends CrudDao<WorkField> {
+
+    /**
+     * 更新流程实例ID
+     * @return
+     */
+    public int updateProcessInstanceId(WorkField workField);
+
+    /**
+     * 根据流程实例ID获取
+     * @param processInstanceId
+     * @return
+     */
+    public WorkField getByProcessInstanceId(String processInstanceId);
+
+    /**
+     * 根据时间和档案id查询数据
+     * @param staffId,time
+     * @return
+     */
+    public WorkField getByStaffIdAndTime(@Param("staffId")String staffId, @Param("time")String time);
+
+    List<WorkField> findListValidateTime(String staffId);
+}

+ 240 - 0
src/main/java/com/jeeplus/modules/workfield/entity/WorkField.java

@@ -0,0 +1,240 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfield.entity;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.modules.sys.entity.Office;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+/**
+ * 外勤申请Entity
+ * @author ssrh
+ * @version 2018-09-06
+ */
+public class WorkField extends ActEntity<WorkField> {
+	//外勤zzsqliuokjyhg94yuhbqasdfiiii750904(通知79 附件75 编码29 assignmentType21)
+	private static final long serialVersionUID = 1L;
+	public static final String SERIAL_BIZCODE = "29";
+	private String processInstanceId;		// 流程号
+	private String officeId;	// 部门
+	private String companyId;		// 公司
+	private String num;		// 加班编号
+	private String name;		// 姓名
+	private Date startDate;		// 开始日期
+	private String startType;		// 类型1
+	private Date endDate;		// 结束日期
+	private String endType;		// 类型2
+	private String reason;		// 外勤事由
+	private WorkStaffBasicInfo workStaffBasicInfo;		// 档案
+	private String status;		// 状态
+	private String days;		// 外勤天数
+	private String home;
+	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
+
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public WorkField() {
+		super();
+	}
+
+	public WorkField(String id){
+		super(id);
+	}
+
+	@ExcelField(title="流程号", align=2, sort=7)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+
+	@ExcelField(title="公司", align=2, sort=9)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="加班编号", align=2, sort=10)
+	public String getNum() {
+		return num;
+	}
+
+	public void setNum(String num) {
+		this.num = num;
+	}
+	
+	@ExcelField(title="姓名", align=2, sort=11)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="开始日期", align=2, sort=12)
+	public Date getStartDate() {
+		return startDate;
+	}
+
+	public void setStartDate(Date startDate) {
+		this.startDate = startDate;
+	}
+	
+	@ExcelField(title="类型1", align=2, sort=13)
+	public String getStartType() {
+		return startType;
+	}
+
+	public void setStartType(String startType) {
+		this.startType = startType;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="结束日期", align=2, sort=14)
+	public Date getEndDate() {
+		return endDate;
+	}
+
+	public void setEndDate(Date endDate) {
+		this.endDate = endDate;
+	}
+	
+	@ExcelField(title="类型2", align=2, sort=15)
+	public String getEndType() {
+		return endType;
+	}
+
+	public void setEndType(String endType) {
+		this.endType = endType;
+	}
+	
+	@ExcelField(title="外勤事由", align=2, sort=16)
+	public String getReason() {
+		return reason;
+	}
+
+	public void setReason(String reason) {
+		this.reason = reason;
+	}
+
+	public WorkStaffBasicInfo getWorkStaffBasicInfo() {
+		return workStaffBasicInfo;
+	}
+
+	public void setWorkStaffBasicInfo(WorkStaffBasicInfo workStaffBasicInfo) {
+		this.workStaffBasicInfo = workStaffBasicInfo;
+	}
+
+	public String getHome() {
+		return home;
+	}
+
+	public void setHome(String home) {
+		this.home = home;
+	}
+
+	public List<WorkClientAttachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<WorkClientAttachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	@ExcelField(title="状态", align=2, sort=18)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+	@ExcelField(title="外勤天数", align=2, sort=19)
+	public String getDays() {
+		return days;
+	}
+
+	public void setDays(String days) {
+		this.days = days;
+	}
+	
+}

+ 750 - 0
src/main/java/com/jeeplus/modules/workfield/service/WorkFieldService.java

@@ -0,0 +1,750 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfield.service;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.leaveapply.service.LeaveApplyService;
+import com.jeeplus.modules.serialnum.service.SerialNumTplService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workout.service.WorkOutService;
+import com.jeeplus.modules.workovertime.dao.WorkOvertimeDao;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import com.jeeplus.modules.workstaff.dao.WorkStaffAchivesDao;
+import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
+import org.activiti.engine.ActivitiObjectNotFoundException;
+import org.activiti.engine.IdentityService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workfield.entity.WorkField;
+import com.jeeplus.modules.workfield.dao.WorkFieldDao;
+
+/**
+ * 外勤申请Service
+ * @author ssrh
+ * @version 2018-09-06
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkFieldService extends CrudService<WorkFieldDao, WorkField> {
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private SerialNumTplService serialNumTplService;
+
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private WorkActivityProcessDao workActivityProcessDao;
+	@Autowired
+	private WorkStaffAchivesDao workStaffAchivesDao;
+	@Autowired
+	private LeaveApplyService leaveApplyService;
+	@Autowired
+	@Lazy
+	private WorkOutService workOutService;
+
+	@Autowired
+	private WorkFieldDao workFieldDao;
+	@Autowired
+	private WorkClientAttachmentDao workClientAttachmentDao;
+	public WorkField get(String id) {
+		WorkField workField = super.get(id);
+		if(workField!=null){
+			//附件
+			WorkClientAttachment workClientAttachment = new WorkClientAttachment();
+			workClientAttachment.setAttachmentId(id);
+			workClientAttachment.setAttachmentFlag("75");
+			workField.setWorkAttachments(workClientAttachmentDao.findList(workClientAttachment));
+		}
+		return workField;
+	}
+
+	public WorkField getByStaffIdAndTime(String staffId, String time) {
+		WorkField workField = dao.getByStaffIdAndTime(staffId, time);
+		return workField;
+	}
+
+	public List<WorkField> findList(WorkField workField) {
+		return super.findList(workField);
+	}
+	
+	public Page<WorkField> findPage(Page<WorkField> page, WorkField workField) {
+		workField.getSqlMap().put("dsf", dataScopeFilter(workField.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_FIELD.getValue()));
+		workField.setPage(page);
+		page.setList(findList(workField));
+		return page;
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkField workField) {
+		super.save(workField);
+		updateInfo(workField);
+	}
+
+	@Transactional(readOnly = false)
+	public void updateInfo(WorkField workField) {
+		//附件信息
+		for (WorkClientAttachment workClientAttachment : workField.getWorkAttachments()) {
+			if (workClientAttachment.getId() == null) {
+				continue;
+			}
+			if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())) {
+				workClientAttachment.setAttachmentId(workField.getId());
+				workClientAttachment.setAttachmentFlag("75");
+				workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
+				if (StringUtils.isBlank(workClientAttachment.getId()) || "null".equals(workClientAttachment.getId())) {
+					workClientAttachment.preInsert();
+					workClientAttachmentDao.insert(workClientAttachment);
+				} else {
+					workClientAttachment.preUpdate();
+					workClientAttachmentDao.update(workClientAttachment);
+				}
+			} else {
+				workClientAttachmentDao.delete(workClientAttachment);
+			}
+		}
+	}
+
+	//时间验证
+	@Transactional(readOnly = false)
+	public String validateTime(Date startTime, String startType, Date endTime, String endType){
+		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
+		WorkStaffBasicInfo workStaffBasicInfo=leaveApplyService.getBasicInfo();
+		List<WorkField> leaveDetails=workFieldDao.findListValidateTime(workStaffBasicInfo.getId());
+		double start=Integer.parseInt(sdf1.format(startTime));
+		double end=Integer.parseInt(sdf1.format(endTime));
+		if("2".equals(startType)){
+			start=start+0.5;
+		}
+		if("2".equals(endType)){
+			end=end+0.5;
+		}
+		for(int i=0;i<leaveDetails.size();i++){
+			WorkField detail=leaveDetails.get(i);
+			Date stateTime1 = detail.getStartDate();
+			double start1=Integer.parseInt(sdf1.format(stateTime1));
+			Date realEndTime1 = detail.getEndDate();
+			double realEnd1=Integer.parseInt(sdf1.format(realEndTime1));
+			String startType1 = detail.getStartType();
+			String realEndType1 = detail.getEndType();
+			if("2".equals(startType1)){
+				start1=start1+0.5;
+			}
+			if("2".equals(realEndType1)){
+				realEnd1=realEnd1+0.5;
+			}
+			if((start>=start1&&start<=realEnd1)||(end>=start1&&end<=realEnd1)
+					||(start1>=start&&start1<=end)||(realEnd1>=start&&realEnd1<=end)){
+				return  "外勤时间存在重叠情况!";
+			}
+		}
+		return "";
+	}
+	/**
+	 * 提交存储
+	 * @param
+	 * @param variables
+	 */
+	@Transactional(readOnly = false)
+	public String save(WorkField workField, Map<String, Object> variables, String processInstanceId) {
+		//时间校验
+		String sign1 = leaveApplyService.validateTime(workField.getStartDate(),workField.getStartType(),workField.getEndDate(),workField.getEndType());
+		if(StringUtils.isNotBlank(sign1)){
+			updateInfo(workField);
+			if("2".equals(workField.getStatus())){
+				workField.setStatus("1");
+			}
+			super.save(workField);
+			return sign1;
+		}else{
+			String sign2 = workOutService.validateTime(workField.getStartDate(),workField.getStartType(),workField.getEndDate(),workField.getEndType());
+			if(StringUtils.isNotBlank(sign2)){
+				updateInfo(workField);
+				if("2".equals(workField.getStatus())){
+					workField.setStatus("1");
+				}
+				super.save(workField);
+				return sign2;
+			}else{
+				String sign3 = this.validateTime(workField.getStartDate(),workField.getStartType(),workField.getEndDate(),workField.getEndType());
+				if(StringUtils.isNotBlank(sign3)){
+					updateInfo(workField);
+					if("2".equals(workField.getStatus())){
+						workField.setStatus("1");
+					}
+					super.save(workField);
+					return sign3;
+				}
+			}
+		}
+		User user = UserUtils.getUser();
+		if (StringUtils.isBlank(workField.getNum())) {
+			workField.setNum(serialNumTplService.genSerialNum(user.getCompany(), workField.SERIAL_BIZCODE));
+		}
+		super.save(workField);
+		Office office = officeService.get(workField.getOfficeId());
+		String str =  "外勤申请编号:"+workField.getNum()+",外勤事由:"+workField.getReason()+",所属部门:"+office.getName();
+		String title = "外勤申请人:"+user.getName();
+		updateInfo(workField);
+		// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(user.getId());
+		// 启动流程
+		String businessKey = workField.getId().toString();
+		WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("zzsqliuokjyhg94yuhbqasdfiiii750904", office);
+		// 启动流程
+		String processType = workActivityMenu.getProcessType();
+		StringBuffer buffer = new StringBuffer();
+		Activity activity = new Activity();
+		WorkProjectNotify workProjectNotify = UtilNotify
+				.saveNotify(workField.getId(),
+						null,
+						workField.getCompanyId(),
+						title,
+						str,
+						"79",
+						"0",
+						"待审批",
+						""
+				);
+		List<User> users = new ArrayList<>();
+		List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"21",workField.getCreateBy());
+		if (StringUtils.isNotBlank(workActivityMenu.getId())) {
+			workProjectNotify.setNotifyRole("");
+			workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+			List<Activity> activities = workActivityMenu.getActivities();
+			for (Activity a : activities) {
+				String encount = a.getEncount();
+				String enlist = a.getEnlist();
+				if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
+					List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"21",workField.getCreateBy());
+					if (enusers.size()==0){
+						workField.setStatus("1");
+						super.save(workField);
+						return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
+					}
+					variables.put(enlist, enusers);
+					variables.put(encount, enusers.size());
+				}
+				if (a.getDelFlag().equals("0") && a.getCount() == 1) {
+					activity = a;
+				}
+			}
+			buffer.append(activity.getRole().getEnname());
+			if (activity != null && StringUtils.isNotBlank(activity.getId())) {
+				//角色审批
+				if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
+					users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"21",workField.getCreateBy());
+				}
+				//人员审批
+				if (StringUtils.isNotBlank(activity.getUser().getId())) {
+					users.add(activity.getUser());
+				}
+			}
+			workProjectNotify.setId("");
+		} else {
+			variables.put("bmzrList", bmzrs);
+			if (bmzrs.size()==0 ){
+				workField.setStatus("1");
+				super.save(workField);
+			}
+			if (bmzrs.size()==0){
+				return "流程审批人不能为空,角色部门负责人下无用户,请联系管理员!";
+			}
+			variables.put("bmzrcount",bmzrs.size());
+			processType = "workfield";
+			users.addAll(bmzrs);
+		}
+		for (User u : users){
+			workProjectNotify.setUser(u);
+			workProjectNotify.setId("");
+			workProjectNotify.setNotifyRole("部门负责人审批");
+			workProjectNotifyService
+					.save(workProjectNotify);
+			Map<String,Object> extras = new HashMap<>();
+			extras.put("type","7002");
+			extras.put("id",workProjectNotify.getId());
+			extras.put("procDefKey","79");
+			UserUtils.pushInfoToApp(title,str,extras,u.getId());
+			UserUtils.pushIm(u.getId(),str);
+		}
+		variables.put("type", processType);
+		variables.put("busId", businessKey);
+		variables.put("title", "审批单:" + workField.getNum());//设置标题;
+
+		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+		workField.setProcessInstance(processInstance);
+		if (StringUtils.isNotBlank(processInstanceId)) {
+			workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+			workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+			workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
+		}
+		// 更新流程实例ID
+		workField.setProcessInstanceId(processInstance.getId());
+		workFieldDao.updateProcessInstanceId(workField);
+		List<Activity> list = workActivityMenu.getActivities();
+		if (list != null && list.size() != 0) {
+			workActivityProcessService.saveList(list, processInstance.getId());
+		} else {
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessKey("workfield");
+			workActivityProcess.setCount(1);
+			workActivityProcess.setProcessInstanceId(processInstance.getId());
+			workActivityProcess.setIsApproval("0");
+			workActivityProcessService.save(workActivityProcess);
+			workActivityProcessService.insertAuditsByType(bmzrs,processInstance.getId(),1,1);
+		}
+		logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
+				ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
+		return "";
+	}
+	@Transactional(readOnly = false)
+	public void delete(WorkField workField) {
+		super.delete(workField);
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workField.getId());
+		List<User> users = workProjectNotifyService.readByNotifyId(notify);
+		if (users!=null && users.size()!=0){
+			for (User user:users){
+				UserUtils.pushMeIm(user.getId());
+			}
+		}
+	}
+
+	/**
+	 * 审核流程
+	 * @param
+	 */
+	@Transactional(readOnly = false)
+	public String auditSave(WorkField workField,List<User> auditUsers) {
+		String userName = UserUtils.get(workField.getCreateBy().getId()).getName();
+		Office office = officeService.get(workField.getOfficeId());
+		String title = "外勤申请人:"+userName;
+		String str  =  "外勤申请编号:"+workField.getNum()+",外勤事由:"+workField.getReason()+",所属部门:"+office.getName();
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workField.getAct().getTaskDefKey();
+		if (!"modifyApply".equals(taskDefKey)) {
+			actTaskService.claim(workField.getAct().getTaskId(), UserUtils.getUser().getId());
+		}else{
+			//时间校验
+			String sign1 = leaveApplyService.validateTime(workField.getStartDate(),workField.getStartType(),workField.getEndDate(),workField.getEndType());
+			if(StringUtils.isNotBlank(sign1)){
+				return sign1;
+			}else{
+				String sign2 = workOutService.validateTime(workField.getStartDate(),workField.getStartType(),workField.getEndDate(),workField.getEndType());
+				if(StringUtils.isNotBlank(sign2)){
+					return sign2;
+				}else{
+					String sign3 = this.validateTime(workField.getStartDate(),workField.getStartType(),workField.getEndDate(),workField.getEndType());
+					if(StringUtils.isNotBlank(sign3)){
+						return sign3;
+					}
+				}
+			}
+			workField.getAct().setFlag("yes");
+			updateInfo(workField);
+		}
+		String comment = "";
+		if (workField.getStatus().equals("4")){
+			comment = ("yes".equals(workField.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+		}else {
+			comment = ("yes".equals(workField.getAct().getFlag())?"[同意] ":"[驳回] ")+workField.getAct().getComment();
+		}
+		//yes 的时候状态为审核通过 否则为未通过
+		//1 审核中 2 未通过
+		workField.setStatus(("yes".equals(workField.getAct().getFlag()) ? "2" : "4"));
+		Map<String, Object> vars = Maps.newHashMap();
+		//业务逻辑对应的条件表达式
+		String exp = "";
+		String taskCount = "";
+		String notifyRole = "";
+		int key = 0;
+		String enname = "";
+		List<Activity> activitieList = activityService.getByProcessInstanceId(workField.getProcessInstanceId());
+		WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+		if (activitieList != null && activitieList.size() != 0) {
+			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+			workActivityMenu.setActivities(activitieList);
+		}
+
+		WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+		WorkActivityProcess selectProcess = new WorkActivityProcess();
+		selectProcess.setProcessInstanceId(workField.getProcessInstanceId());
+		List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+		List<Activity> activities = workActivityMenu.getActivities();
+		if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workfield")) {
+			key = 1;
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
+					taskCount = activityProcess.getCount()+"";
+					workActivityProcess = activityProcess;
+					if (!workActivityProcess.getIsApproval().equals("0")) {
+						workActivityProcess.setId("");
+					}
+					exp = "pass";
+					if (!"yes".equals(workField.getAct().getFlag())) {
+						workField.setStatus("4");
+						workActivityProcess.setIsApproval("2");
+						String returnBack = "-1";
+						for (Activity activity : activities) {
+							if (activity.getCount() == activityProcess.getCount()) {
+								returnBack = activity.getReturnBack();
+								notifyRole = activity.getName();
+								break;
+							}
+						}
+						if (returnBack.equals("0")) {
+							workActivityProcess.setId("");
+						}
+
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+				}else if(taskDefKey.equals("modifyApply")){
+					notifyRole = "调整申请";
+					taskCount = "0";
+					exp = "pass";
+					workActivityProcess.setId("");
+					workActivityProcess.setCount(0);
+					if (!"yes".equals(workField.getAct().getFlag())) {
+						workField.setStatus("3");
+						workActivityProcess.setIsApproval("2");
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+					break;
+				}
+			}
+		} else {
+			workActivityMenu.setProcessType("workfield");
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				String count = activityProcess.getCount() + "";
+				workActivityProcess = activityProcess;
+				if (!workActivityProcess.getIsApproval().equals("0")) {
+					workActivityProcess.setId("");
+				}
+				// 审核环节
+				if ("bmzr".equals(taskDefKey) && count.contains("1")) {
+					taskCount = "1";
+					exp = "pass";
+					if ("yes".equals(workField.getAct().getFlag())) {
+						notifyRole = "审批通过";
+						workActivityProcess.setIsApproval("1");
+					} else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				} else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+					taskCount = "0";
+					notifyRole = "部门负责人审批";
+					exp = "pass";
+					workActivityProcess.setCount(0);
+					enname = "bmzr";
+					if (!"yes".equals(workField.getAct().getFlag())) {
+						workField.setStatus("3");
+					}
+					break;
+				} else if ("apply_end".equals(taskDefKey)) {
+				}
+
+			}
+		}
+		// 设置意见
+		workField.getAct().setComment(("yes".equals(workField.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workField.getAct().getComment());
+		workField.preUpdate();
+		// 提交流程任务
+		vars.put(exp, "yes".equals(workField.getAct().getFlag()) ? true : false);
+		vars.put("passs", true);
+		workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workField.getProcessInstanceId(),taskDefKey,"modifyApply",workField.getAct().getFlag(),comment, activities);
+		// 提交流程任务
+		actTaskService.complete(workField.getAct().getTaskId(), workField.getAct().getProcInsId(), workField.getAct().getComment(), vars);
+		boolean state = actTaskService.isProcessEnd(workField.getAct().getProcInsId());
+		List<User> users = new ArrayList<>();
+		List<User> userList = new ArrayList<>();
+		if (!state) {
+			users.add(workField.getCreateBy());
+			if ("yes".equals(workField.getAct().getFlag())) {
+				workField.setStatus("5");
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workField.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				workProjectNotifyService
+						.save(UtilNotify
+								.saveNotify(workField.getId(),
+										workField.getCreateBy(),
+										workField.getCompanyId(),
+										title,
+										str,
+										"79",
+										"0",
+										"待通知",
+										notifyRole));
+
+			} else {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workField.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				if (StringUtils.isNotBlank(workField.getStatus()) && !workField.getStatus().equals("3")){
+					workField.setStatus("4");
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workField.getId(),
+											workField.getCreateBy(),
+											workField.getCompanyId(),
+											title,
+											str,
+											"79",
+											"0",
+											"待通知",
+											notifyRole));
+				}
+			}
+			workActivityProcessService.deleteProcessIdAuditUsers(workField.getProcessInstanceId());
+		} else {
+			if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workfield")) {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workField.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				//users.addAll(userList);
+				WorkProjectNotify workProjectNotify = UtilNotify
+						.saveNotify(workField.getId(),
+								new User(),
+								workField.getCompanyId(),
+								title,
+								str,
+								"79",
+								"0",
+								"待审批",
+								notifyRole);
+				List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+						activities,
+						workProjectNotify,
+						taskDefKey,
+						workField.getAct().getFlag(),
+						taskCount,
+						workField.getCreateBy(),
+						workField.getOfficeId(),
+						"21");
+				for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
+					users.add(workProjectNotify1.getUser());
+					workProjectNotify1.setId("");
+					workProjectNotify1.setIsNewRecord(false);
+					workProjectNotifyService
+							.save(workProjectNotify1);
+					if (!"modifyApply".equals(taskDefKey)){
+						Map<String,Object> extras = new HashMap<>();
+						extras.put("type","7002");
+						extras.put("id",workProjectNotify.getId());
+						extras.put("procDefKey","79");
+						UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
+
+					}
+				}
+
+			} else {
+				if (!"yes".equals(workField.getAct().getFlag())) {
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workField.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					//users.addAll(userList);
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workField.getId(),
+											workField.getCreateBy(),
+											workField.getCompanyId(),
+											title,
+											str,
+											"79",
+											"0",
+											"重新申请",
+											notifyRole));
+					users.add( workField.getCreateBy());
+				} else {
+					if (StringUtils.isNotBlank(enname)) {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workField.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						//users.addAll(userList1);
+						WorkProjectNotify workProjectNotify = UtilNotify
+								.saveNotify(workField.getId(),
+										new User(),
+										workField.getCompanyId(),
+										title,
+										str,
+										"79",
+										"0",
+										"待审批",
+										notifyRole);
+						users.addAll(auditUsers);
+						for (User user1:auditUsers){
+							workProjectNotify.setId("");
+							workProjectNotify.setUser(user1);
+							workProjectNotify.setIsNewRecord(false);
+							workProjectNotifyService
+									.save(workProjectNotify);
+							if (!"modifyApply".equals(taskDefKey)){
+								Map<String,Object> extras = new HashMap<>();
+								extras.put("type","7002");
+								extras.put("id",workProjectNotify.getId());
+								extras.put("procDefKey","79");
+								UserUtils.pushInfoToApp(title,str,extras,user1.getId());
+
+							}
+						}
+					}else {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workField.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						users.addAll(userList);
+						users.add(workField.getCreateBy());
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workField.getId(),
+												workField.getCreateBy(),
+												workField.getCompanyId(),
+												title,
+												str,
+												"79",
+												"0",
+												"重新申请",
+												notifyRole));
+					}
+				}
+			}
+		}
+		if (users!=null && users.size()!=0) {
+			for (User u : users) {
+				UserUtils.pushIm(u.getId(),str);
+			}
+		}
+		if (userList!=null && userList.size()!=0) {
+			for (User u : userList) {
+				UserUtils.pushMeIm(u.getId());
+			}
+		}
+
+		workFieldDao.update(workField);
+		return "保存审核意见成功!";
+	}
+
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public WorkField getByProcessInstanceId(String processInstanceId) {
+		WorkField workField = workFieldDao.getByProcessInstanceId(processInstanceId);
+		return workField;
+	}
+
+	/**
+	 * 强制撤销
+	 * @param
+	 */
+	@Transactional(readOnly = false)
+	public void cancelInvalidate(WorkField workField) {
+		String invalidateProcessInstanceId = workField.getProcessInstanceId();
+		try {
+			//将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
+			WorkActivityProcess process = new WorkActivityProcess();
+			process.setProcessInstanceId(workField.getProcessInstanceId());
+			process.setIsApproval("0");
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(workField.getProcessInstanceId());
+			List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
+			WorkProjectNotify notify = new WorkProjectNotify();
+			notify.setNotifyId(workField.getId());
+			List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+			if (userList!=null && userList.size()!=0) {
+				for (User u : userList) {
+					User user = UserUtils.get(u.getId());
+					/*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(u.getId());
+					for (WebSocket toUserConn : toUserConns) {
+						String message = "{\"to\":\""+u.getId()+"\"," +
+								"\"msg\":\"审批信息 归档申请人:"+ user.getName()+",归档编号:"+workContractRecord.getRecordNum()+" 强制撤销!\"," +
+								"\"useType\":\"sys\"}";
+						ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+					}*/
+					UserUtils.pushIm(u.getId(),"外勤申请人:"+ user.getName()+",外勤申请编号:"+workField.getNum()+" 强制撤销!");
+
+				}
+			}
+			if(processList!=null && processList.size()>0){
+				for (int i =0;i<processList.size();i++) {
+					WorkActivityProcess p = processList.get(i);
+					if(StringUtils.isNotBlank(p.getIsApproval()) && "0".equals(p.getIsApproval())){
+						p.setDelFlag("1");
+						p.setIsApproval("-1");
+						workActivityProcessDao.updateDelFlagAndIsApproval(p);
+					}
+				}
+				WorkActivityProcess pro = new WorkActivityProcess();
+				pro.setId("");
+				pro.preInsert();
+				pro.setDelFlag("0");
+				pro.setRemarks("[强制撤销]");
+				pro.setProcessKey(processList.get(0).getProcessKey());
+				pro.setIsApproval("1");
+				pro.setProcessInstanceId(processList.get(0).getProcessInstanceId());
+				pro.setCount(0);
+				workActivityProcessDao.insert(pro);
+			}
+
+			//结束该流程,设为"撤销"状态
+			actTaskService.endProcessInstance(invalidateProcessInstanceId,"外勤申请-强制撤销");
+			workField.setStatus("3");
+			workField.preUpdate();
+			workFieldDao.update(workField);
+
+		}catch (ActivitiObjectNotFoundException e){
+			System.err.println("撤销异常,因为这个流程已不存在!");
+			e.printStackTrace();
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 367 - 0
src/main/java/com/jeeplus/modules/workfield/web/WorkFieldController.java

@@ -0,0 +1,367 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfield.web;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.sysmtree.service.SysMtreeService;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
+import com.jeeplus.modules.workstaff.service.WorkStaffBasicInfoService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.workfield.entity.WorkField;
+import com.jeeplus.modules.workfield.service.WorkFieldService;
+
+/**
+ * 外勤申请Controller
+ * @author ssrh
+ * @version 2018-09-06
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workfield/workField")
+public class WorkFieldController extends BaseController {
+
+
+	@Autowired
+	protected RuntimeService runtimeService;
+	@Autowired
+	private WorkStaffBasicInfoService workStaffBasicInfoService;
+	@Autowired
+	protected TaskService taskService;
+
+	@Autowired
+	private ActTaskService actTaskService;
+
+	@Autowired
+	private HttpServletRequest request;
+
+	@Autowired
+	private SysMtreeService sysMtreeService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private WorkFieldService workFieldService;
+
+	@ModelAttribute
+	public WorkField get(@RequestParam(required=false) String id) {
+		WorkField entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workFieldService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkField();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 外勤申请列表页面
+	 */
+	@RequiresPermissions("workfield:workField:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkField workField, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkField> page = workFieldService.findPage(new Page<WorkField>(request, response), workField); 
+		model.addAttribute("page", page);
+		return "modules/workfield/workFieldList";
+	}
+
+	/**
+	 * 查看,增加,编辑外勤申请表单页面
+	 */
+	//@RequiresPermissions(value={"workfield:workField:view","workfield:workField:add","workfield:workField:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkField workField, Model model) {
+		String view = "workFieldForm";
+		Office office = UserUtils.getSelectOffice();
+		String tabId = request.getParameter("tabId");
+		if("1".equals(tabId)){
+			view = "workFieldView";
+		}else if("3".equals(tabId)){
+			ProcessInstance processInstance = actTaskService.getProcIns(workField.getProcessInstanceId());
+			if (processInstance!=null) {
+				Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+				Act act = new Act();
+				act.setTaskId(taskInfok.getId());
+				act.setTaskName(taskInfok.getName());
+				act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+				act.setProcDefId(taskInfok.getProcessDefinitionId());
+				act.setProcInsId(taskInfok.getProcessInstanceId());
+				act.setTask(taskInfok);
+				workField.setAct(act);
+				view = "workFieldModify";
+			}
+		}
+		// 环节编号
+		String taskDefKey = workField.getAct().getTaskDefKey();
+		if (StringUtils.isNotBlank(taskDefKey) && ("bmzr".equals(taskDefKey))){
+			view = "workFieldAudit";
+		}
+		if(StringUtils.isBlank(workField.getId())){
+			workField.setName(UserUtils.getUser().getName());
+			WorkStaffBasicInfo workStaffBasicInfo = new WorkStaffBasicInfo();
+			workStaffBasicInfo.setUserId(UserUtils.getUser().getId());
+			workStaffBasicInfo.setOffice(UserUtils.getSelectOffice());
+			workStaffBasicInfo = workStaffBasicInfoService.getByUserOffice(workStaffBasicInfo);
+			workField.setWorkStaffBasicInfo(workStaffBasicInfo);
+			workField.setCreateDate(new Date());
+		}
+		model.addAttribute("workField", workField);
+		return "modules/workfield/"+view;
+	}
+
+	/**
+	 * 暂存
+	 */
+	@RequestMapping(value = "store")
+	public String store(WorkField workField,
+						Model model,
+						RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workField)){
+			return form(workField, model);
+		}
+		User user = workField.getCreateBy();
+		String submitter = "";
+		if(user != null){
+			submitter = user.getId();
+		}
+		String sta = workField.getStatus();
+		if(!UserUtils.getUser().getId().equals(submitter) && !Strings.isNullOrEmpty(submitter) && sta != null){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+		}
+		workField.setStatus("1"); //暂存状态
+		workField.setCompanyId(UserUtils.getSelectCompany().getId());
+		workField.setOfficeId(UserUtils.getSelectOffice().getId());
+		if (StringUtils.isNotBlank(workField.getProcessInstanceId()) && workField.getProcessInstanceId().equals("NULL")){
+			workField.setProcessInstanceId("");
+		}
+		if(!workField.getIsNewRecord()){//编辑表单保存
+			WorkField t = workFieldService.get(workField.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workField, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workFieldService.save(t);//保存
+		}else{//新增表单保存
+			workFieldService.save(workField);//保存
+		}
+		addMessage(redirectAttributes, "保存外勤申请成功");
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+	}
+	/**
+	 * 保存外勤申请
+	 */
+	@RequiresPermissions(value={"workfield:workField:add","workfield:workField:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkField workField, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workField)){
+			return form(workField, model);
+		}
+		User user = workField.getCreateBy();
+		String sta = workField.getStatus();
+		if(user!=null && !UserUtils.getUser().getId().equals(user.getId()) && StringUtils.isNotBlank(user.getId())){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+		}
+		//状态设置为审核中
+		workField.setStatus("2");
+		String processInstanceId ="";
+		if (user!=null && StringUtils.isNotBlank(user.getId()) && StringUtils.isNotBlank(sta) && "3".equals(sta)){
+			processInstanceId = workFieldService.get(workField.getId()).getProcessInstanceId();
+		}
+		try {
+			Map<String, Object> variables = Maps.newHashMap();
+			workField.setCompanyId(UserUtils.getSelectCompany().getId());
+			workField.setOfficeId(UserUtils.getSelectOffice().getId());
+			String str = workFieldService.save(workField, variables,processInstanceId);
+			if (StringUtils.isNotBlank(str)){
+				addMessage(redirectAttributes, "外勤申请提交失败:"+str);
+			}else {
+				addMessage(redirectAttributes, "外勤申请已经提交");
+			}
+
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "外勤申请提交失败!");
+			addMessage(redirectAttributes, "系统内部错误");
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+	}
+
+	/**
+	 * 工单执行(完成任务)
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "saveAudit")
+	public String saveAudit(WorkField workField, Model model,
+							RedirectAttributes redirectAttributes) {
+		try {
+			List<User> users = UserUtils.getByProssType(workField.getProcessInstanceId(),1);
+			String flag = workField.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+			}else {
+				String str = workFieldService.auditSave(workField,users);
+				addMessage(redirectAttributes, str);
+			}
+		}catch (Exception e){
+			addMessage(redirectAttributes, "审批失败");
+		}
+
+		if (StringUtils.isNotBlank(workField.getHome()) && "home".equals(workField.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else {
+			return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+		}
+	}
+	/**
+	 * 删除外勤申请
+	 */
+	@RequiresPermissions("workfield:workField:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkField workField, RedirectAttributes redirectAttributes) {
+		workFieldService.delete(workField);
+		addMessage(redirectAttributes, "删除外勤申请成功");
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+	}
+	
+	/**
+	 * 批量删除外勤申请
+	 */
+	@RequiresPermissions("workfield:workField:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workFieldService.delete(workFieldService.get(id));
+		}
+		addMessage(redirectAttributes, "删除外勤申请成功");
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workfield:workField:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkField workField, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "外勤申请"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkField> page = workFieldService.findPage(new Page<WorkField>(request, response, -1), workField);
+    		new ExportExcel("外勤申请", WorkField.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出外勤申请记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workfield:workField:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkField> list = ei.getDataList(WorkField.class);
+			for (WorkField workField : list){
+				try{
+					workFieldService.save(workField);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条外勤申请记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条外勤申请记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入外勤申请失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+    }
+	
+	/**
+	 * 下载导入外勤申请数据模板
+	 */
+	@RequiresPermissions("workfield:workField:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "外勤申请数据导入模板.xlsx";
+    		List<WorkField> list = Lists.newArrayList(); 
+    		new ExportExcel("外勤申请数据", WorkField.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+    }
+
+	/**
+	 * 强制撤销
+	 */
+	@RequestMapping("cancelInvalidate")
+	public String cancelInvalidate(WorkField workField,RedirectAttributes redirectAttributes){
+		workFieldService.cancelInvalidate(workField);
+		return "redirect:"+Global.getAdminPath()+"/workfield/workField/?repage";
+	}
+	/**
+	 * 读取单个实体流程
+	 * @return
+	 */
+	@RequestMapping(value = "getProcessOne")
+	public String getProcessOne(WorkField workField,Model model) {
+		model.addAttribute("processInstanceId", workField.getProcessInstanceId());
+		return "modules/workfield/workTrack";
+	}
+
+
+
+}

+ 31 - 0
src/main/java/com/jeeplus/modules/workfullconstructsheet/dao/WorkFullConstructsheetDao.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullconstructsheet.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullconstructsheet.entity.WorkFullConstructsheet;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+
+import java.util.List;
+
+/**
+ * 施工联系单DAO接口
+ * @author fgy
+ * @version 2017-11-06
+ */
+@MyBatisDao
+public interface WorkFullConstructsheetDao extends CrudDao<WorkFullConstructsheet> {
+
+
+    List<WorkFullManage> getListOfWorkFullManage(WorkFullManage workFullManage);
+
+    void updateProcessInstanceId(WorkFullConstructsheet workFullConstructsheet);
+
+    void updateStatus(WorkFullConstructsheet workFullConstructsheet);
+
+    List<WorkFullConstructsheet> findList(WorkFullConstructsheet workFullConstructsheet);
+
+    WorkFullConstructsheet getByProcessInstanceId(String processInstanceId);
+}

+ 248 - 0
src/main/java/com/jeeplus/modules/workfullconstructsheet/entity/WorkFullConstructsheet.java

@@ -0,0 +1,248 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullconstructsheet.entity;
+
+
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 施工联系单Entity
+ * @author fgy
+ * @version 2017-11-06
+ */
+public class WorkFullConstructsheet extends ActEntity<WorkFullConstructsheet> {
+	
+	private static final long serialVersionUID = 1L;
+	private String workFullManageId;		// 项目id
+	private WorkFullManage workFullManage;  //项目
+	private String processInstanceId;		// 实例流程id
+	private Boolean processEnded;            //流程是否走到了结束状态(结束:false,未结束:true)
+	private String status;		// 审核状态(0暂存,1审核中,2已通过,3未通过,4已撤销)
+	private String companyId;		// 企业id
+	private String officeId;
+	private String constructsheetTopic;		// 联系单主题
+	private String constructsheetNumber;		// 联系单编号
+	private String projectNumber;		// 项目编号
+	private String constructSection;		// 施工标段
+	private String costIncreaseDecrease;		// 是否产生费用增减(0否,1是)
+	private String proprietorComment;		// 业主处理意见
+	private String changeContext;		// 变更原因及主要内容
+	private String name ;               //用来传递一些数据,无实义
+	private Workattachment workattachment ; //附件
+	private List<Workattachment> workAttachments;
+
+
+	private Task task ;              //任务
+	private Map<String,Object> variables ; //
+	private ProcessInstance processInstance ;
+	private HistoricProcessInstance historicProcessInstance;
+	private ProcessDefinition processDefinition;
+
+	public WorkFullConstructsheet() {
+		super();
+	}
+
+	public WorkFullConstructsheet(String id){
+		super(id);
+	}
+
+	@ExcelField(title="项目id", align=2, sort=1)
+	public String getWorkFullManageId() {
+		return workFullManageId;
+	}
+
+	public void setWorkFullManageId(String workFullManageId) {
+		this.workFullManageId = workFullManageId;
+	}
+	
+	@ExcelField(title="实例流程id", align=2, sort=2)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+	
+	@ExcelField(title="审核状态", dictType="work_full_constructsheet_status", align=2, sort=3)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+	@ExcelField(title="企业id", align=2, sort=4)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="联系单主题", align=2, sort=5)
+	public String getConstructsheetTopic() {
+		return constructsheetTopic;
+	}
+
+	public void setConstructsheetTopic(String constructsheetTopic) {
+		this.constructsheetTopic = constructsheetTopic;
+	}
+	
+	@ExcelField(title="联系单编号", align=2, sort=6)
+	public String getConstructsheetNumber() {
+		return constructsheetNumber;
+	}
+
+	public void setConstructsheetNumber(String constructsheetNumber) {
+		this.constructsheetNumber = constructsheetNumber;
+	}
+	
+	@ExcelField(title="项目编号", align=2, sort=7)
+	public String getProjectNumber() {
+		return projectNumber;
+	}
+
+	public void setProjectNumber(String projectNumber) {
+		this.projectNumber = projectNumber;
+	}
+	
+	@ExcelField(title="施工标段", align=2, sort=8)
+	public String getConstructSection() {
+		return constructSection;
+	}
+
+	public void setConstructSection(String constructSection) {
+		this.constructSection = constructSection;
+	}
+	
+	@ExcelField(title="是否产生费用增减", dictType="cost_increase_decrease", align=2, sort=9)
+	public String getCostIncreaseDecrease() {
+		return costIncreaseDecrease;
+	}
+
+	public void setCostIncreaseDecrease(String costIncreaseDecrease) {
+		this.costIncreaseDecrease = costIncreaseDecrease;
+	}
+	
+	@ExcelField(title="业主处理意见", align=2, sort=10)
+	public String getProprietorComment() {
+		return proprietorComment;
+	}
+
+	public void setProprietorComment(String proprietorComment) {
+		this.proprietorComment = proprietorComment;
+	}
+	
+	@ExcelField(title="变更原因及主要内容", align=2, sort=11)
+	public String getChangeContext() {
+		return changeContext;
+	}
+
+	public void setChangeContext(String changeContext) {
+		this.changeContext = changeContext;
+	}
+
+	public WorkFullManage getWorkFullManage() {
+		return workFullManage;
+	}
+
+	public void setWorkFullManage(WorkFullManage workFullManage) {
+		this.workFullManage = workFullManage;
+	}
+
+	public Workattachment getWorkattachment() {
+		return workattachment;
+	}
+
+	public void setWorkattachment(Workattachment workattachment) {
+		this.workattachment = workattachment;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+
+
+	public List<Workattachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<Workattachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	public Boolean getProcessEnded() {
+		return processEnded;
+	}
+
+	public void setProcessEnded(Boolean processEnded) {
+		this.processEnded = processEnded;
+	}
+}

+ 667 - 0
src/main/java/com/jeeplus/modules/workfullconstructsheet/service/WorkFullConstructsheetService.java

@@ -0,0 +1,667 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullconstructsheet.service;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workfullconstructsheet.dao.WorkFullConstructsheetDao;
+import com.jeeplus.modules.workfullconstructsheet.entity.WorkFullConstructsheet;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullManageDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.service.WorkFullManageService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import org.activiti.engine.ActivitiObjectNotFoundException;
+import org.activiti.engine.IdentityService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 施工联系单Service
+ * @author fgy
+ * @version 2017-11-06
+ */
+@SuppressWarnings("all")
+@Service
+@Transactional(readOnly = true)
+public class WorkFullConstructsheetService extends CrudService<WorkFullConstructsheetDao, WorkFullConstructsheet> {
+
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private WorkFullConstructsheetDao workFullConstructsheetDao;
+	@Autowired
+	private WorkFullManageService workFullManageService;
+	@Autowired
+	private WorkattachmentService workattachmentService;
+	@Autowired
+	private WorkFullManageDao workFullManageDao;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private OfficeService officeService;
+
+	private Lock lock = new ReentrantLock();
+
+	public WorkFullConstructsheet get(String id) {
+
+		WorkFullConstructsheet workFullConstructsheet = super.get(id);
+		if(workFullConstructsheet != null){
+			WorkFullManage workFullManage = workFullManageService.get(workFullConstructsheet.getWorkFullManageId());
+			if(workFullManage != null){
+				workFullConstructsheet.setWorkFullManage(workFullManage);
+				workFullConstructsheet.setWorkFullManageId(workFullManage.getId());
+			}
+
+			List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(workFullConstructsheet.getId(),"47");
+			if(attachmentList!=null && attachmentList.size()>0){
+				for (int i = 0; i < attachmentList.size(); i++) {
+					Workattachment attachment = attachmentList.get(i);
+					if(attachment != null){
+						attachment.setAttachmentUser(UserUtils.get(attachment.getAttachmentUser()).getName());
+					}
+				}
+				workFullConstructsheet.setWorkAttachments(attachmentList);
+			}
+			//流程结束state=false,未结束state=true
+			boolean state = true;
+			if(StringUtils.isNotBlank(workFullConstructsheet.getProcessInstanceId())){
+				state = actTaskService.isProcessEnd(workFullConstructsheet.getProcessInstanceId());
+			}else{
+				//如果是项目负责人,不用审核,没有流程实例
+				state = false;
+			}
+			workFullConstructsheet.setProcessEnded(state);
+		}
+
+		return workFullConstructsheet ;
+	}
+	
+	public List<WorkFullConstructsheet> findList(WorkFullConstructsheet workFullConstructsheet) {
+		return super.findList(workFullConstructsheet);
+	}
+	
+	public Page<WorkFullConstructsheet> findPage(Page<WorkFullConstructsheet> page, WorkFullConstructsheet workFullConstructsheet) {
+		workFullConstructsheet.setPage(page);
+		page.setList(findListBelongtoWorkfullmanage(workFullConstructsheet));
+		return page;
+	}
+
+	private List<WorkFullConstructsheet> findListBelongtoWorkfullmanage(WorkFullConstructsheet workFullConstructsheet) {
+		if(StringUtils.isBlank(workFullConstructsheet.getWorkFullManageId())){
+			return null ;
+		}
+		List<WorkFullConstructsheet> constructsheetListList = workFullConstructsheetDao.findList(workFullConstructsheet);
+		if(constructsheetListList != null && constructsheetListList.size()>0){
+			for(WorkFullConstructsheet constructsheet : constructsheetListList){
+				WorkFullManage workFullManage = workFullManageService.get(constructsheet.getWorkFullManageId());
+				constructsheet.setWorkFullManage(workFullManage);
+				constructsheet.setWorkFullManageId(workFullManage.getId());
+
+				//流程结束state=false,未结束state=true
+				boolean state = true;
+				if(StringUtils.isNotBlank(constructsheet.getProcessInstanceId())){
+					state = actTaskService.isProcessEnd(constructsheet.getProcessInstanceId());
+				}else{
+					//如果是项目负责人,不用审核,没有流程实例
+					state = false;
+				}
+				constructsheet.setProcessEnded(state);
+
+			}
+		}
+		return constructsheetListList;
+	}
+
+	@Transactional(readOnly = false)
+	public WorkFullConstructsheet save(WorkFullConstructsheet workFullConstructsheet, String workFullManageId, String submit) {
+		//(0暂存,1审核中,2已通过,3未通过、4已撤销)
+		String id = workFullConstructsheet.getId();
+		//提交、暂存、重新申请,执行保存,撤销不执行保存
+		if("submit".equals(submit) || "toStore".equals(submit)|| "reapply".equals(submit)){
+			if(StringUtils.isBlank(workFullConstructsheet.getId())){
+				workFullConstructsheet.setStatus("0");
+			}
+			workFullConstructsheet.setWorkFullManageId(workFullManageId);
+			workFullConstructsheet.setCompanyId(UserUtils.getSelectCompany().getId());
+			workFullConstructsheet.setOfficeId(UserUtils.getSelectOffice().getId());
+			super.save(workFullConstructsheet);
+			//uploadFile(attachment_file,workFullConstructsheet,"47");
+			if(StringUtils.isBlank(id)){
+				List<Workattachment> workattachmentList = workFullConstructsheet.getWorkAttachments();
+				if(workattachmentList!=null && workattachmentList.size()>0){
+					for (int i = 0; i < workattachmentList.size(); i++) {
+						Workattachment w = workattachmentList.get(i);
+						if (StringUtils.isNotBlank(w.getUrl()) && !w.getUrl().equals("null")) {
+							w.setCompanyId(workFullConstructsheet.getCompanyId());
+							w.setAttachmentUser(UserUtils.getUser().getId());
+							w.setAttachmentId(workFullConstructsheet.getId());
+							w.setId("");
+							workattachmentService.save(w);
+						}
+					}
+				}
+			}
+		}
+
+		//新添加数据:先保存,后启动流程;暂存数据:只保存,不启动流程;
+		//重新申请:先保存数据,后执行审核;撤销:不保存,但是执行审核
+		if("submit".equals(submit)){
+			Map<String,Object> variables = new HashMap<String,Object>();
+			startProcess(workFullConstructsheet,variables);
+		}else if("reapply".equals(submit) || "repeal".equals(submit)){
+			auditSave(workFullConstructsheet);
+		}
+		return workFullConstructsheet;
+	}
+	@Transactional(readOnly = false)
+	private void startProcess(WorkFullConstructsheet workFullConstructsheet, Map<String, Object> variables) {
+		System.err.print("==========审核流程开始=========");
+		//用来设置启动流程的人员的id,引擎会自动把人员的id保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(workFullConstructsheet.getCurrentUser().getId());
+		WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("db2322f3c5db4648b2306b8089a8529b", officeService.get(workFullConstructsheet.getOfficeId()));
+		//启动流程
+		String businessKey = workFullConstructsheet.getId().toString();
+		String processType = workActivityMenu.getProcessType();
+		StringBuffer buffer1 = new StringBuffer();
+		Activity activity = new Activity();
+		if(StringUtils.isNotBlank(workActivityMenu.getId())){
+			workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+			List<Activity> activities = workActivityMenu.getActivities();
+			for (Activity a:activities){
+				if (a.getDelFlag().equals("0") && a.getCount() == 1){
+					activity = a;
+					break;
+				}
+			}
+			buffer1.append(activity.getRole().getEnname());
+			variables.put("type", workActivityMenu.getProcessType());
+		}else{
+			processType= ActUtils.PD_WORKFULLCONSTRUCTSHEET[0];
+			variables.put("type", processType);
+			Role role = UserUtils.getSelectRole().get(0);
+			buffer1 = DateUtils.getByEnnme(role.getEnname());
+			buffer1.append("bmzr");
+			variables.put("bmzr", buffer1.toString());
+		}
+		variables.put("businessId",businessKey);
+		variables.put("title",workFullConstructsheet.getConstructsheetTopic());
+
+		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType,businessKey,variables);
+		workFullConstructsheet.setProcessInstance(processInstance);
+		workFullConstructsheet.setProcessInstanceId(processInstance.getId());
+		workFullConstructsheetDao.updateProcessInstanceId(workFullConstructsheet);
+
+		workFullConstructsheet.setStatus("1");
+		updateStatus(workFullConstructsheet);
+
+		List<Activity> list= workActivityMenu.getActivities();
+		if (list!=null && list.size()!=0){
+			workActivityProcessService.saveList(list,processInstance.getId());
+		}else {
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessKey(processType);
+			workActivityProcess.setCount(1);
+			workActivityProcess.setProcessInstanceId(processInstance.getId());
+			workActivityProcess.setIsApproval("0");
+			workActivityProcess.setActivity(new Activity("86bba2f2095b43899311e8abdc623f44"));
+			workActivityProcessService.save(workActivityProcess);
+		}
+
+		//发起通知给审批人
+		WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+		workProjectNotify.setTitle("您有新的施工联系单待审批");
+		workProjectNotify.setNotifyId(workFullConstructsheet.getId());
+		workProjectNotify.setCompanyId(workFullConstructsheet.getCompanyId());
+		workProjectNotify.setContent("审批任务-施工联系单");
+		workProjectNotify.setRemarks("待审批");
+		workProjectNotify.setType("10");
+		workProjectNotify.setStatus("0");
+		workProjectNotify.setNotifyRole("");
+		workProjectNotify.setUser(new User(""));
+
+		if(workActivityMenu!=null&&StringUtils.isNotBlank(workActivityMenu.getId())&&StringUtils.isNotBlank(activity.getId())){
+			//角色审批
+			if(StringUtils.isNotBlank(activity.getRole().getEnname())){
+				workProjectNotify.setNotifyRole(buffer1.toString());
+			}
+			//人员审批
+			if(StringUtils.isNotBlank(activity.getUser().getId())){
+				workProjectNotify.setUser(new User(activity.getUser().getId()));
+			}
+		}else {
+			workProjectNotify.setNotifyRole(buffer1.toString());
+		}
+		workProjectNotifyService.save(workProjectNotify);
+	}
+	@Transactional(readOnly = false)
+	private void updateStatus(WorkFullConstructsheet workFullConstructsheet) {
+		workFullConstructsheetDao.updateStatus(workFullConstructsheet);
+	}
+
+	@Transactional(readOnly = false)
+	private void uploadFile(MultipartFile file, WorkFullConstructsheet workFullConstructsheet, String attachmentFlag) {
+		if(file!=null && !file.isEmpty() && file.getSize()>0){
+			//后一次上传前先删除前一次上传的文件
+			delFile(workFullConstructsheet,attachmentFlag);
+
+			OSSClientUtil ossClientUtil = new OSSClientUtil();
+			String fileName = file.getOriginalFilename();
+			String fileType = fileName.substring(fileName.lastIndexOf(".")+1);
+			String url = ossClientUtil.uploadFile2OSS(file,"workFullConstructsheet");
+			Workattachment workattachment = new Workattachment();
+			workattachment.setUrl(url);
+			workattachment.setType(fileType);
+			workattachment.setAttachmentName(fileName);
+			workattachment.setAttachmentUser(UserUtils.getUser().getId());
+			workattachment.setAttachmentId(workFullConstructsheet.getId());
+			workattachment.setAttachmentFlag(attachmentFlag);
+			workattachmentService.save(workattachment);
+		}
+
+	}
+	@Transactional(readOnly = false)
+	public void delFile(WorkFullConstructsheet workFullConstructsheet, String attachmentFlag) {
+		Workattachment workattachment = workattachmentService.get(workFullConstructsheet.getRemarks());
+		if(workattachment != null){
+			doDelFile(workattachment);
+		}
+	}
+	@Transactional(readOnly = false)
+	private void doDelFile(Workattachment workattachment) {
+		workattachmentService.deleteFileFromAliyun(workattachment,workattachment==null?"":workattachment.getUrl());
+		workattachmentService.delete(workattachment);
+
+	}
+
+	@Transactional(readOnly = false)
+	public void delete(WorkFullConstructsheet workFullConstructsheet) {
+		delFile(workFullConstructsheet,"47");
+		super.delete(workFullConstructsheet);
+		//逻辑删除相关的通知记录
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workFullConstructsheet.getId());
+		workProjectNotifyService.modifyDelflag(notify);
+	}
+
+	public Page<WorkFullManage> findListOfWorkFullManage(Page<WorkFullManage> page, WorkFullManage workFullManage) {
+		if (StringUtils.isNotBlank(workFullManage.getTotalFullIds())){
+			workFullManage.setTotalFullIds(","+workFullManage.getTotalFullIds()+",");
+		}
+		workFullManage.getSqlMap().put("dsf", dataScopeFilterOR(workFullManage.getCurrentUser(), "o", "u","s", MenuStatusEnum.END.getValue()));
+		workFullManage.setPage(page);
+		List<WorkFullManage> list = Lists.newArrayList();
+		workFullManage.setIsTotal("1");
+		List<WorkFullManage> totals = getListOfWorkFullManage(workFullManage);
+		List<WorkFullManage> workFullManages = new ArrayList<>();
+		for (WorkFullManage fullManage:totals){
+			WorkFullManage wfm = new WorkFullManage();
+			wfm.setTotalFullId(fullManage.getId());
+			List<WorkFullManage> workEngineeringProjectLists = getListOfWorkFullManage(wfm);
+			if (workEngineeringProjectLists!=null && workEngineeringProjectLists.size()!=0){
+				workFullManages.addAll(workEngineeringProjectLists);
+			}
+		}
+		workFullManages.addAll(totals);
+		WorkFullManageService.sortList(list,workFullManages,"0",true);
+		//WorkFullManageService.sortList(list,getListOfWorkFullManage(workFullManage),"0",true);
+		page.setList(list);
+		return page ;
+	}
+
+	private List<WorkFullManage> getListOfWorkFullManage(WorkFullManage workFullManage) {
+		List<WorkFullManage> workFullManageList = workFullConstructsheetDao.getListOfWorkFullManage(workFullManage);
+		if (workFullManageList != null && workFullManageList.size()>0){
+			for(WorkFullManage w : workFullManageList){
+				String hostMasterIds = w.getHostMaster();
+				StringBuilder hostMasterName = new StringBuilder();
+				String[] idArray = hostMasterIds.split(",");
+				if(idArray != null && idArray.length>0){
+					for(int i =0 ;i<idArray.length;i++){
+						if(StringUtils.isNotBlank(idArray[i])){
+							User u = UserUtils.get(idArray[i]);
+							hostMasterName.append(",").append(u.getName());
+						}
+					}
+				}
+				if(hostMasterName.length()>1){
+					w.setHostMasterName(hostMasterName.substring(1));
+				}
+			}
+		}
+		return workFullManageList ;
+	}
+
+	public WorkFullConstructsheet getByProcessInstanceId(String processInstanceId) {
+		return workFullConstructsheetDao.getByProcessInstanceId(processInstanceId);
+	}
+	//部门负责人审核或创建人重申、撤销(0暂存,1审核中,2通过,3未通过,4已撤销)
+	@Transactional(readOnly = false)
+	public String auditSave(WorkFullConstructsheet workFullConstructsheet) {
+		try {
+			String userId = UserUtils.getUser().getId();
+			actTaskService.claim(workFullConstructsheet.getAct().getTaskId(), userId);
+			// 设置意见
+			String comment = "";
+			if(workFullConstructsheet.getStatus().equals("3")){//如果是被驳回状态
+				comment = ("yes".equals(workFullConstructsheet.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+			}else{
+				comment = ("yes".equals(workFullConstructsheet.getAct().getFlag())?"[同意] ":"[驳回] ")+workFullConstructsheet.getAct().getComment();
+			}
+			workFullConstructsheet.getAct().setComment(comment);
+			workFullConstructsheet.setStatus("1");
+
+			System.err.println("comment======"+workFullConstructsheet.getAct().getComment());
+			WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+			workProjectNotify.setNotifyId(workFullConstructsheet.getId());
+			workProjectNotifyService.readByNotifyId(workProjectNotify);
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workFullConstructsheet.getAct().getTaskDefKey();
+			System.err.println("taskDefKey======"+taskDefKey);
+			//业务逻辑对应的条件表达式
+			String exp = "";
+
+			//WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("db2322f3c5db4648b2306b8089a8529b",officeService.get(workFullConstructsheet.getOfficeId()));
+			List<Activity> activitieList = activityService.getByProcessInstanceId(workFullConstructsheet.getProcessInstanceId());
+			WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+			if (activitieList!=null && activitieList.size()!=0){
+				workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+				workActivityMenu.setActivities(activitieList);
+			}
+
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			WorkActivityProcess selectedProcess = new WorkActivityProcess();
+			selectedProcess.setProcessInstanceId(workFullConstructsheet.getProcessInstanceId());
+			List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectedProcess);
+
+			boolean isCustomProcess = StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals(ActUtils.PD_WORKFULLCONSTRUCTSHEET[0]);
+
+			String taskCount = "";
+			int key = 0;
+
+			List<Activity> activities = workActivityMenu.getActivities();
+			if (isCustomProcess) {
+				key = 1;
+				for (int i =0;i<workActivityProcesses.size();i++){
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = taskDefKey.replace("task","").replace("audit","");
+
+					if(taskDefKey.contains("audit") && (activityProcess.getCount()+"").contains(count)){
+						taskCount = count ;
+						exp = "pass";
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						if (!"yes".equals(workFullConstructsheet.getAct().getFlag())) {
+							workFullConstructsheet.setStatus("4");
+							workActivityProcess.setIsApproval("2");
+						}else {
+							workFullConstructsheet.setStatus("1");
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("施工联系单:重新申请");
+							workProjectNotify.setRemarks("重新申请");
+						}
+					}
+					else if ((activityProcess.getCount()+"").contains(count)){
+						taskCount = count ;
+
+						workActivityProcess = activityProcess;
+						workActivityProcess.setRemarks(comment);
+
+						if (!activityProcess.getIsApproval().equals("0")){
+							workActivityProcess.setId("");
+						}
+						exp = "pass";
+						if (!"yes".equals(workFullConstructsheet.getAct().getFlag())) {
+							workFullConstructsheet.setStatus("3");
+							workActivityProcess.setIsApproval("2");
+							workProjectNotify.setTitle("您的施工联系单申请被驳回!");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullConstructsheet.getCreateBy());
+							String returnBack = "-1";
+							for (Activity activity:activities){
+								if(activity.getCount()==Integer.parseInt(count)){
+									returnBack = activity.getReturnBack();
+									break;
+								}
+							}
+							if (returnBack.equals("0")) {
+								workActivityProcess.setId("");
+							}
+						}else {
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("施工联系单:待审批");
+						}
+					}
+				}
+			}else {
+				workActivityMenu.setId(workActivityProcesses.get(0).getId());
+				workActivityMenu.setProcessType(ActUtils.PD_WORKFULLCONSTRUCTSHEET[0]);
+				for (int i = 0; i < workActivityProcesses.size(); i++) {
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = activityProcess.getCount() + "";
+
+					if(! activityProcess.getIsApproval().equals("0")){
+						workActivityProcess.setId("");
+					}
+					taskCount = "1" ; // 默认流程只有一个审批环节
+
+					// 部门负责人审批
+					if ("audit".equals(taskDefKey)  && count.equals("1")){
+						workActivityProcess.setCount(1); //默认流程里部门负责人是第一个环节
+						exp = "pass";
+						if("yes".equals(workFullConstructsheet.getAct().getFlag())){
+							workActivityProcess.setIsApproval("1");
+							workFullConstructsheet.setStatus("2");
+							workProjectNotify.setTitle("您的施工联系单申请已通过");
+							workProjectNotify.setRemarks("待通知");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullConstructsheet.getCreateBy());
+						}else{
+							workActivityProcess.setIsApproval("2");
+
+							workFullConstructsheet.setStatus("3");//驳回
+							workProjectNotify.setRemarks("重新申请");
+							workProjectNotify.setTitle("施工联系单申请被驳回!");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullConstructsheet.getCreateBy());
+						}
+					}
+					//重申|撤销
+					else if("reapply".equals(taskDefKey) && count.equals("0")){
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						exp="pass";
+						if("yes".equals(workFullConstructsheet.getAct().getFlag())){//重新申请
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("施工联系单重新申请!");
+							Role role = UserUtils.getSelectRole().get(0);
+							StringBuffer buffer = DateUtils.getByEnnme(role.getEnname());
+							buffer.append("bmzr");
+							workProjectNotify.setNotifyRole(buffer.toString());//给部门负责人再次发送通知
+							workProjectNotify.setUser(new User(""));//如果是重新申请,就不给创建人发通知,只给部门负责人发通知
+							workProjectNotify.setRemarks("待审批");
+							workFullConstructsheet.setStatus("1");
+						}else{
+							workActivityProcess.setIsApproval("2");
+							workFullConstructsheet.setStatus("4");//撤销
+						}
+						break;
+					}
+					// 未知环节
+				}
+			}
+
+			//更新自定义的流程追踪数据
+			String defaultReapply = "reapply"; //默认流程中的重新申请任务标识
+			workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workFullConstructsheet.getProcessInstanceId(),taskDefKey,defaultReapply,workFullConstructsheet.getAct().getFlag(),comment, activities);
+
+
+			// 设置意见
+			workFullConstructsheet.getAct().setComment(comment);
+			workFullConstructsheet.preUpdate();
+
+			// 提交流程任务
+			Map<String, Object> vars = Maps.newHashMap();
+			vars.put(exp, "yes".equals(workFullConstructsheet.getAct().getFlag()) ?true : false );
+			System.err.println("vars======"+vars.toString());
+			// 提交流程任务
+			actTaskService.complete(workFullConstructsheet.getAct().getTaskId(), workFullConstructsheet.getAct().getProcInsId(), workFullConstructsheet.getAct().getComment(), vars);
+			boolean state = actTaskService.isProcessEnd(workFullConstructsheet.getAct().getProcInsId());
+			if (!state){
+				if(isCustomProcess){
+					if("yes".equals(workFullConstructsheet.getAct().getFlag())){
+						workFullConstructsheet.setStatus("2");
+					}else{
+						if(! "3".equals(workFullConstructsheet.getStatus()))
+							workFullConstructsheet.setStatus("4");
+					}
+				}
+
+				//终审之后,发送通知给创建人
+				if("2".equals(workFullConstructsheet.getStatus())){
+					workProjectNotify.setTitle("您的施工联系单申请已通过");
+				}
+				if("3".equals(workFullConstructsheet.getStatus())){
+					workProjectNotify.setTitle("您的施工联系单申请被驳回");
+				}
+				workProjectNotify.setRemarks("待通知");//用于在通知页面做查看操作,这一步必须
+				workProjectNotify.setNotifyRole("");
+				workProjectNotify.setUser(workFullConstructsheet.getCreateBy());
+			}else{
+				if (isCustomProcess) {
+					String count = taskDefKey.replace("audit","").replace("task","");
+					Activity activity = new Activity();
+
+					if (taskDefKey.contains("audit")) {
+						if (activities.size() == 1 || count.equals("1")){
+							activity = activities.get(0);
+						}else if (activities.size()==Integer.parseInt(count)){
+							activity = activities.get(activities.size()-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}else {
+							activity = activities.get(Integer.parseInt(count)-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}
+					}
+
+					else if(!"yes".equals(workFullConstructsheet.getAct().getFlag())){
+
+						workProjectNotify.setRemarks("重新申请");
+						activity = new Activity();
+					}
+
+					else {
+
+						activity = activities.get(Integer.parseInt(count));
+						workProjectNotify.setRemarks("待审批");
+					}
+
+					if(StringUtils.isNotBlank(activity.getId())){
+						workProjectNotify.setUser(activity.getUser());
+						workProjectNotify.setNotifyRole(activity.getRole().getEnname());
+					}
+				}
+				else{
+
+				}
+			}
+
+			workProjectNotify.setCompanyId(workFullConstructsheet.getCompanyId());
+			workProjectNotify.setContent(workFullConstructsheet.getAct().getComment());
+			workProjectNotify.setType("10");
+			workProjectNotify.setStatus("0");
+			//创建人如果做了撤销操作,无需发送通知
+			if (!workFullConstructsheet.getStatus().equals("4")) {
+				workProjectNotifyService.save(workProjectNotify);
+			}
+			//更新施工联系单审核状态
+			workFullConstructsheetDao.updateStatus(workFullConstructsheet);
+
+			System.err.println("施工联系单审核正常");
+			return "审核执行成功";
+			//如果是撤销操作,更改与此相关的所有通知的已读状态,不再显示
+			//如果是同意或驳回操作:将前面发给审批人的所有通知变更为已读;
+			//如果是重新申请操作:将前面发给申请人的所有通知变更为已读;
+			//如果是同意操作,发送审批通过的通知给申请人;申请人在阅读完成后,变更已读状态;
+//			WorkProjectNotify notify = new WorkProjectNotify();
+//			notify.setNotifyId(workFullConstructsheet.getId());
+//			if("4".equals(workFullConstructsheet.getStatus())){
+//				workProjectNotifyService.readByNotifyId(notify);
+//			}
+//			else if("2".equals(workFullConstructsheet.getStatus()) ||"3".equals(workFullConstructsheet.getStatus())){
+//				String roleEnname = DateUtils.getByEnnme(UserUtils.getSelectRole().getEnname())+"bmzr";
+//				notify.setNotifyRole(roleEnname);
+//				workProjectNotifyService.readByNotifyIdAndNotifyRole(notify);
+//			}else if("1".equals(workFullConstructsheet.getStatus())){
+//				notify.setUser(workFullConstructsheet.getCreateBy());
+//				workProjectNotifyService.readByNotifyIdAndNotifyUser(notify);
+//			}
+
+		}catch (ActivitiObjectNotFoundException e){
+			e.printStackTrace();
+			System.err.println("施工联系单--重复审批");
+			logger.error("ActivitiObjectNotFoundException -- "+e);
+			return "流程已审批,不能重新审批!";
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			System.err.println("施工联系单审核异常");
+			logger.error("Exception e:"+e);
+			return "审核执行失败!!";
+		}
+	}
+
+
+}

+ 504 - 0
src/main/java/com/jeeplus/modules/workfullconstructsheet/web/WorkFullConstructsheetController.java

@@ -0,0 +1,504 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullconstructsheet.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workfullconstructsheet.entity.WorkFullConstructsheet;
+import com.jeeplus.modules.workfullconstructsheet.service.WorkFullConstructsheetService;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.service.WorkFullManageService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 施工联系单Controller
+ * @author fgy
+ * @version 2017-11-06
+ */
+@SuppressWarnings("all")
+@Controller
+@RequestMapping(value = "${adminPath}/workfullconstructsheet/workFullConstructsheet")
+public class WorkFullConstructsheetController extends BaseController {
+
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkFullConstructsheetService workFullConstructsheetService;
+	@Autowired
+	private WorkFullManageService workFullManageService;
+	@Autowired
+	private ActivityService activityService;
+
+	@ModelAttribute
+	public WorkFullConstructsheet get(@RequestParam(required=false) String id) {
+		WorkFullConstructsheet entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workFullConstructsheetService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkFullConstructsheet();
+		}
+		return entity;
+	}
+	/**
+	 *  待添加施工联系单的项目列表
+	 */
+	@RequestMapping("workfullmanageList")
+	public String workfullmanageList(WorkFullManage workFullManage, HttpServletRequest request, HttpServletResponse response, Model model){
+		String userId = UserUtils.getUser().getId();
+		if(!UserUtils.getSelectRoleInfo()){
+			workFullManage.setQueryCon(userId);
+		}
+
+		Page<WorkFullManage> page = workFullConstructsheetService.findListOfWorkFullManage(new Page<WorkFullManage>(request, response), workFullManage);
+		model.addAttribute("page", page);
+		return "modules/workfullconstructsheet/workfullmanageList";
+	}
+
+	/**
+	 * 施工联系单列表页面
+	 */
+	@RequiresPermissions("workfullconstructsheet:workFullConstructsheet:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkFullConstructsheet workFullConstructsheet, HttpServletRequest request, HttpServletResponse response, Model model) {
+		String workFullManageId = request.getParameter("workFullManageId");
+
+		if(StringUtils.isNotBlank(workFullManageId)){
+			workFullConstructsheet.setWorkFullManageId(workFullManageId);
+		}
+		Page<WorkFullConstructsheet> page = workFullConstructsheetService.findPage(new Page<WorkFullConstructsheet>(request, response), workFullConstructsheet);
+		model.addAttribute("page", page);
+		model.addAttribute("workFullManage",workFullManageService.get(workFullManageId));
+		model.addAttribute("workFullManageId",workFullManageId);
+		return "modules/workfullconstructsheet/workFullConstructsheetList";
+	}
+
+	/**
+	 * 查看,增加,编辑施工联系单表单页面
+	 */
+	@RequiresPermissions(value={"workfullconstructsheet:workFullConstructsheet:view","workfullconstructsheet:workFullConstructsheet:add","workfullconstructsheet:workFullConstructsheet:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkFullConstructsheet workFullConstructsheet, Model model , HttpServletRequest request) {
+		String dialog = request.getParameter("dialog");
+		String workFullManageId = request.getParameter("workFullManageId");
+		String listpage = request.getParameter("listpage");
+		if(StringUtils.isBlank(workFullManageId)){
+			workFullManageId = workFullConstructsheet.getWorkFullManageId();
+		}
+		if(StringUtils.isNotBlank(workFullManageId)){
+			WorkFullManage workFullManage = workFullManageService.get(workFullManageId);
+			model.addAttribute("workFullManage",workFullManage);
+		}
+		model.addAttribute("workFullConstructsheet", workFullConstructsheet);
+		model.addAttribute("listpage",listpage);
+
+		if(workFullConstructsheet.getAct()!=null && StringUtils.isNotBlank(workFullConstructsheet.getAct().getTaskId())){
+			String taskId = workFullConstructsheet.getAct().getTaskId();
+			return "modules/workfullconstructsheet/workFullConstructsheetAudit";
+		}
+
+		if("add".equals(dialog) || "edit".equals(dialog)){
+			return "modules/workfullconstructsheet/workFullConstructsheetForm";
+		}
+		if("view".equals(dialog)){
+			return "modules/workfullconstructsheet/workFullConstructsheetView";
+		}
+
+		return "modules/workfullconstructsheet/workFullConstructsheetForm";
+	}
+
+	/**
+	 * 保存施工联系单
+	 */
+	@RequiresPermissions(value={"workfullconstructsheet:workFullConstructsheet:add","workfullconstructsheet:workFullConstructsheet:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkFullConstructsheet workFullConstructsheet, Model model,HttpServletRequest request,HttpServletResponse response,
+					   RedirectAttributes redirectAttributes,@RequestParam(value = "listpage",required = false)String listpage) throws Exception{
+		//新添加(submit提交,toStore暂存),被驳回(reapply重新申请,repeal撤销)
+		String submit = request.getParameter("submit");
+		String workFullManageId = request.getParameter("workFullManageId");
+		if (!beanValidator(model, workFullConstructsheet)){
+			return form(workFullConstructsheet, model,request);
+		}
+		if(!workFullConstructsheet.getIsNewRecord()){//编辑表单保存
+			WorkFullConstructsheet t = workFullConstructsheetService.get(workFullConstructsheet.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workFullConstructsheet, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+
+			//被驳回状态
+			if (StringUtils.isNotBlank(t.getStatus()) &&t.getStatus().equals("3")){
+				ProcessInstance processInstance = actTaskService.getProcIns(t.getProcessInstanceId());
+				if (processInstance!=null) {
+					Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+					Act act = new Act();
+					act.setTaskId(taskInfok.getId());
+					act.setTaskName(taskInfok.getName());
+					act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+					act.setProcDefId(taskInfok.getProcessDefinitionId());
+					act.setProcInsId(taskInfok.getProcessInstanceId());
+					act.setTask(taskInfok);
+					if("reapply".equals(submit)){act.setFlag("yes");}//重新申请
+					if("repeal".equals(submit)){act.setFlag("no");}//撤销
+					t.setAct(act);
+				}
+			}
+			workFullConstructsheetService.save(t,workFullManageId,submit);//保存
+			if("reapply".equals(submit)){
+				addMessage(redirectAttributes,"重新申请施工联系单,并发往部门负责人审核");
+			} else if("repeal".equals(submit)){
+				addMessage(redirectAttributes,"已撤销施工联系单");
+			}
+			return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/?repage";
+		}else{//新增表单保存
+			workFullConstructsheet = workFullConstructsheetService.save(workFullConstructsheet,workFullManageId,submit);//保存
+			if("submit".equals(submit)){
+				String message = StringUtils.isNoneBlank(workFullConstructsheet.getId())?"保存施工联系单成功,并发往部门负责人审核":"监理联系单添加失败";
+				addMessage(redirectAttributes,message);
+			}else if("toStore".equals(submit)){
+				String message = StringUtils.isNoneBlank(workFullConstructsheet.getId())?"已暂存施工联系单":"暂存施工联系单失败";
+				addMessage(redirectAttributes,message);
+			}
+			//主页面添加操作后刷新主页面,弹窗页面添加操作后刷新弹窗页面
+			if(StringUtils.isNotBlank(listpage)&&listpage.equals("workfullmanageList")){
+				return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/"+listpage;
+			}
+			return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/?repage";
+		}
+	}
+	/**
+	 * 流程追踪
+	 */
+	@RequiresPermissions("workfullconstructsheet:workFullConstructsheet:view")
+	@RequestMapping("getProcess")
+	public String getProcess(WorkFullConstructsheet workFullConstructsheet, Model model){
+
+		model.addAttribute("processInstanceId",workFullConstructsheet.getProcessInstanceId());
+		return "modules/workfullconstructsheet/workFullConstructsheetTask";
+	}
+	/**
+	 * 待办任务
+	 */
+	@RequestMapping("auditTodo")
+	public String auditTodo(Act act , Model model , HttpServletRequest request, HttpServletResponse response){
+		act.setProcDefKey("workFullConstructsheet");
+		List<Act> actList = new ArrayList<>();
+		actList.addAll(actTaskService.todoList(act));
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+
+		List<Activity> activities = activityService.groupByActivityMenu("db2322f3c5db4648b2306b8089a8529b",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			actList.addAll(actTaskService.todoList(act));
+		}
+		List<WorkFullConstructsheet> constructsheetList = new ArrayList<>();
+		Role role = UserUtils.getSelectRole().get(0);
+		String officeId = "";
+		if(role.getDataScope().equals("4")){
+			User user = UserUtils.getUser();
+			officeId = user.getOffice().getId();
+		}
+		for(Act a : actList){
+			//重新申请和撤销不在代办和历史任务列表展示
+			if("audit".equals(a.getTask().getTaskDefinitionKey())||(! "reapply".equals(a.getTask().getTaskDefinitionKey()) && !a.getTask().getTaskDefinitionKey().contains("audit"))){
+				WorkFullConstructsheet workFullConstructsheet = workFullConstructsheetService.getByProcessInstanceId(a.getProcInsId());
+				if(workFullConstructsheet != null){
+					workFullConstructsheet = workFullConstructsheetService.get(workFullConstructsheet.getId());
+				}
+				if(workFullConstructsheet != null && workFullConstructsheet.getCompanyId().equals(companyId)){
+					User createBy = UserUtils.get(workFullConstructsheet.getCreateBy().getId());
+					if (StringUtils.isNotBlank(officeId)) {
+						if (officeId.equals(createBy.getOffice().getId())) {
+							if(a.getVars().getMap().get("applyUserId") != null){
+								User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+								if(user != null){
+									a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+								}
+							}
+							workFullConstructsheet.setAct(a);
+							if(workFullConstructsheet.getWorkFullManage()!=null && workFullConstructsheet.getWorkFullManage().getId()!=null){
+								WorkFullManage workFullManage = workFullManageService.get(workFullConstructsheet.getWorkFullManage().getId());
+								workFullConstructsheet.setWorkFullManage(workFullManage);
+							}
+							if(StringUtils.isNotBlank(workFullConstructsheet.getId())){
+								workFullConstructsheet.setName(officeService.get(companyId).getName());
+							}
+							constructsheetList.add(workFullConstructsheet);
+						}
+					}else {
+						if(a.getVars().getMap().get("applyUserId") != null){
+							User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+							if(user != null){
+								a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+							}
+						}
+						workFullConstructsheet.setAct(a);
+						if(workFullConstructsheet.getWorkFullManage()!=null && workFullConstructsheet.getWorkFullManage().getId()!=null){
+							WorkFullManage workFullManage = workFullManageService.get(workFullConstructsheet.getWorkFullManage().getId());
+							workFullConstructsheet.setWorkFullManage(workFullManage);
+						}
+						if(StringUtils.isNotBlank(workFullConstructsheet.getId())){
+							workFullConstructsheet.setName(officeService.get(companyId).getName());
+						}
+						constructsheetList.add(workFullConstructsheet);
+					}
+				}
+			}
+		}
+
+		model.addAttribute("list", constructsheetList);
+		return "modules/workfullconstructsheet/workFullConstructsheetAuditTodo";
+	}
+	/**
+	 *  打开审核框
+	 */
+	@RequestMapping("applyOnWorkFullConstructsheet")
+	public String applyOnWorkFullConstructsheet(Act act){
+		// 获取流程XML上的表单KEY
+		String formKey = "/workfullconstructsheet/workFullConstructsheet/form";
+		//logger.info("------formKeys:"+formKeys);
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+		}
+		return "redirect:" + ActUtils.getFormUrl(formKey, act);
+	}
+
+	/**
+	 * 部门负责人审核
+	 */
+	@RequestMapping("saveAudit")
+	public String saveAudit(WorkFullConstructsheet workFullConstructsheet, Map<String, Object> vars, Model model, RedirectAttributes redirectAttributes) {
+		/*if (StringUtils.isBlank(workFullConstructsheet.getAct().getComment())){
+			addMessage(model, "请填写审核意见。");
+			return form(workFullConstructsheet, model,null);
+		}*/
+		String message = workFullConstructsheetService.auditSave(workFullConstructsheet);
+		addMessage(redirectAttributes, message);
+		return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/?repage";
+	}
+	/**
+	 *  已办任务
+	 */
+	@RequestMapping("auditHistory")
+	public String auditHistory(Act act , Model model,HttpServletRequest request,HttpServletResponse response){
+		act.setProcDefKey("workFullConstructsheet");
+		List<Act> list = actTaskService.historicList(act);
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+
+		List<Activity> activities = activityService.groupByActivityMenu("db2322f3c5db4648b2306b8089a8529b",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			list.addAll(actTaskService.historicList(act));
+		}
+
+		List<WorkFullConstructsheet> constructsheetList = new ArrayList<WorkFullConstructsheet>();
+		Role role = UserUtils.getSelectRole().get(0);
+		String officeId = "";
+		if(role.getDataScope().equals("4")){
+			User user = UserUtils.getUser();
+			officeId = user.getOffice().getId();
+		}
+		for (Act a : list) {
+			//重新申请和撤销不展示在代办和历史任务列表里
+			if(! "reapply".equals(a.getHistTask().getTaskDefinitionKey())){
+				WorkFullConstructsheet workFullConstructsheet = workFullConstructsheetService.getByProcessInstanceId(a.getHistTask().getProcessInstanceId());
+				if(workFullConstructsheet != null){
+					workFullConstructsheet = workFullConstructsheetService.get(workFullConstructsheet.getId());
+				}
+				if (workFullConstructsheet != null && workFullConstructsheet.getCompanyId().equals(companyId)) {
+					User createBy = UserUtils.get(workFullConstructsheet.getCreateBy().getId());
+					if (StringUtils.isNotBlank(officeId)) {
+						if (officeId.equals(createBy.getOffice().getId())) {
+							if (a.getVars().getMap().get("applyUserId")!=null){
+								a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+							}
+							workFullConstructsheet.setAct(a);
+							if(workFullConstructsheet.getWorkFullManage()!=null && workFullConstructsheet.getWorkFullManage().getId()!=null){
+								WorkFullManage workFullManage = workFullManageService.get(workFullConstructsheet.getWorkFullManage().getId());
+								workFullConstructsheet.setWorkFullManage(workFullManage);
+							}
+							if (StringUtils.isNotBlank(workFullConstructsheet.getId())){
+								workFullConstructsheet.setName(officeService.get(companyId).getName());
+							}
+							constructsheetList.add(workFullConstructsheet);
+						}
+					}else {
+						if (a.getVars().getMap().get("applyUserId")!=null){
+							a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+						}
+						workFullConstructsheet.setAct(a);
+						if(workFullConstructsheet.getWorkFullManage()!=null && workFullConstructsheet.getWorkFullManage().getId()!=null){
+							WorkFullManage workFullManage = workFullManageService.get(workFullConstructsheet.getWorkFullManage().getId());
+							workFullConstructsheet.setWorkFullManage(workFullManage);
+						}
+						if (StringUtils.isNotBlank(workFullConstructsheet.getId())){
+							workFullConstructsheet.setName(officeService.get(companyId).getName());
+						}
+						constructsheetList.add(workFullConstructsheet);
+					}
+				}
+			}
+		}
+
+		model.addAttribute("list", constructsheetList);
+		return "modules/workfullconstructsheet/workFullConstructsheetAuditHistory";
+	}
+
+	/**
+	 * 删除施工联系单
+	 */
+	@RequiresPermissions("workfullconstructsheet:workFullConstructsheet:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkFullConstructsheet workFullConstructsheet, HttpServletRequest request,HttpServletResponse response,Model model) {
+		workFullConstructsheetService.delete(workFullConstructsheet);
+		WorkFullConstructsheet w = new WorkFullConstructsheet();
+		w.setWorkFullManageId(workFullConstructsheet.getWorkFullManageId());
+		model.addAttribute("workFullConstructsheet",w);
+		model.addAttribute("message","删除施工联系单成功");
+		return list(w,request,response,model);
+	}
+	/**
+	 *  删除附件
+	 */
+	@ResponseBody
+	@RequestMapping("delFile")
+	public AjaxJson delFile(WorkFullConstructsheet workFullConstructsheet , HttpServletRequest request, Model model){
+//		String attachmentFlag = request.getParameter("attachmentFlag");
+//		workFullConstructsheetService.delFile(workFullConstructsheet,attachmentFlag);
+//		workFullConstructsheet = workFullConstructsheetService.get(workFullConstructsheet.getId());
+//		model.addAttribute("workFullConstructsheet",workFullConstructsheet);
+//		return form(workFullConstructsheet,model,request);
+		String workFullDesignchangeId = request.getParameter("id");
+		String attaId = request.getParameter("attaId");
+		String attachmentUrl = request.getParameter("attachmentUrl");
+		workFullConstructsheet.setRemarks(attaId);
+		workFullConstructsheetService.delFile(workFullConstructsheet,attachmentUrl);
+		AjaxJson ajaxJson = new AjaxJson();
+		ajaxJson.put("attachmentUrl",attachmentUrl);
+		return ajaxJson;
+	}
+	
+//	/**
+//	 * 批量删除施工联系单(目前没做)
+//	 */
+//	@RequiresPermissions("workfullconstructsheet:workFullConstructsheet:del")
+//	@RequestMapping(value = "deleteAll")
+//	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+//		String idArray[] =ids.split(",");
+//		for(String id : idArray){
+//			workFullConstructsheetService.delete(workFullConstructsheetService.get(id));
+//		}
+//		addMessage(redirectAttributes, "删除施工联系单成功");
+//		return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/?repage";
+//	}
+//
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workfullconstructsheet:workFullConstructsheet:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkFullConstructsheet workFullConstructsheet, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "施工联系单"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkFullConstructsheet> page = workFullConstructsheetService.findPage(new Page<WorkFullConstructsheet>(request, response, -1), workFullConstructsheet);
+    		new ExportExcel("施工联系单", WorkFullConstructsheet.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出施工联系单记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workfullconstructsheet:workFullConstructsheet:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkFullConstructsheet> list = ei.getDataList(WorkFullConstructsheet.class);
+			for (WorkFullConstructsheet workFullConstructsheet : list){
+				try{
+					workFullConstructsheetService.save(workFullConstructsheet);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条施工联系单记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条施工联系单记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入施工联系单失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/?repage";
+    }
+	
+	/**
+	 * 下载导入施工联系单数据模板
+	 */
+	@RequiresPermissions("workfullconstructsheet:workFullConstructsheet:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "施工联系单数据导入模板.xlsx";
+    		List<WorkFullConstructsheet> list = Lists.newArrayList(); 
+    		new ExportExcel("施工联系单数据", WorkFullConstructsheet.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullconstructsheet/workFullConstructsheet/?repage";
+    }
+
+}

+ 31 - 0
src/main/java/com/jeeplus/modules/workfulldesignchange/dao/WorkFullDesignchangeDao.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfulldesignchange.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfulldesignchange.entity.WorkFullDesignchange;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+
+import java.util.List;
+
+/**
+ * 设计变更DAO接口
+ * @author fgy
+ * @version 2017-11-03
+ */
+@MyBatisDao
+public interface WorkFullDesignchangeDao extends CrudDao<WorkFullDesignchange> {
+
+
+    List<WorkFullManage> getListOfWorkFullManage(WorkFullManage workFullManage);
+
+    List<WorkFullDesignchange> findList(WorkFullDesignchange workFullDesignchange);
+
+    int updateProcessInstanceId(WorkFullDesignchange workFullDesignchange);
+
+    void updateStatus(WorkFullDesignchange workFullDesignchange);
+
+    WorkFullDesignchange getByProcessInstanceId(String processInstanceId);
+}

+ 258 - 0
src/main/java/com/jeeplus/modules/workfulldesignchange/entity/WorkFullDesignchange.java

@@ -0,0 +1,258 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfulldesignchange.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 设计变更Entity
+ * @author fgy
+ * @version 2017-11-03
+ */
+public class WorkFullDesignchange extends ActEntity<WorkFullDesignchange> {
+	
+	private static final long serialVersionUID = 1L;
+	private String workFullManageId;		// 项目id
+	private WorkFullManage workFullManage;  //项目
+	private String processInstanceId;		// 流程实例id
+	private Boolean processEnded;            //流程是否走到了结束状态(结束:false,未结束:true)
+	private String status;		// 审核状态(0暂存,1审核中,2已通过,3未通过,4已撤销)
+	private String companyId;		// 企业id
+	private String officeId;
+	private String unitProjectName;		// 单位工程名称
+	private String changeNumber;		// 变更编号
+	private String projectNumber;		// 项目编号
+	private String constructSection;		// 施工标段
+	private String changeSource;		// 变更来源
+	private Date changeTime;		// 变更时间
+	private String performer;		// 执行单位
+	private String costVariation;		// 是否涉及造价变更(0否,1是)
+	private String changeContext;		// 变更原因及主要内容
+	private String name ;               //仅用在某些数据传递,无实义
+	private List<Workattachment> workAttachments ;// 附件
+
+	private Task task ;              //任务
+	private Map<String,Object> variables ; //
+	private ProcessInstance processInstance ;
+	private HistoricProcessInstance historicProcessInstance;
+	private ProcessDefinition processDefinition;
+
+	public WorkFullDesignchange() {
+		super();
+	}
+
+	public WorkFullDesignchange(String id){
+		super(id);
+	}
+
+	@ExcelField(title="项目id", align=2, sort=1)
+	public String getWorkFullManageId() {
+		return workFullManageId;
+	}
+
+	public void setWorkFullManageId(String workFullManageId) {
+		this.workFullManageId = workFullManageId;
+	}
+	
+	@ExcelField(title="流程实例id", align=2, sort=2)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+	
+	@ExcelField(title="审核状态", dictType="work_full_designchange_status", align=2, sort=3)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+	@ExcelField(title="企业id", align=2, sort=4)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="单位工程名称", align=2, sort=5)
+	public String getUnitProjectName() {
+		return unitProjectName;
+	}
+
+	public void setUnitProjectName(String unitProjectName) {
+		this.unitProjectName = unitProjectName;
+	}
+	
+	@ExcelField(title="变更编号", align=2, sort=6)
+	public String getChangeNumber() {
+		return changeNumber;
+	}
+
+	public void setChangeNumber(String changeNumber) {
+		this.changeNumber = changeNumber;
+	}
+	
+	@ExcelField(title="项目编号", align=2, sort=7)
+	public String getProjectNumber() {
+		return projectNumber;
+	}
+
+	public void setProjectNumber(String projectNumber) {
+		this.projectNumber = projectNumber;
+	}
+	
+	@ExcelField(title="施工标段", align=2, sort=8)
+	public String getConstructSection() {
+		return constructSection;
+	}
+
+	public void setConstructSection(String constructSection) {
+		this.constructSection = constructSection;
+	}
+	
+	@ExcelField(title="变更来源", align=2, sort=9)
+	public String getChangeSource() {
+		return changeSource;
+	}
+
+	public void setChangeSource(String changeSource) {
+		this.changeSource = changeSource;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="变更时间", align=2, sort=10)
+	public Date getChangeTime() {
+		return changeTime;
+	}
+
+	public void setChangeTime(Date changeTime) {
+		this.changeTime = changeTime;
+	}
+	
+	@ExcelField(title="执行单位", align=2, sort=11)
+	public String getPerformer() {
+		return performer;
+	}
+
+	public void setPerformer(String performer) {
+		this.performer = performer;
+	}
+	
+	@ExcelField(title="是否涉及造价变更(0否,1是)", align=2, sort=12)
+	public String getCostVariation() {
+		return costVariation;
+	}
+
+	public void setCostVariation(String costVariation) {
+		this.costVariation = costVariation;
+	}
+	
+	@ExcelField(title="变更原因及主要内容", align=2, sort=13)
+	public String getChangeContext() {
+		return changeContext;
+	}
+
+	public void setChangeContext(String changeContext) {
+		this.changeContext = changeContext;
+	}
+
+	public WorkFullManage getWorkFullManage() {
+		return workFullManage;
+	}
+
+	public void setWorkFullManage(WorkFullManage workFullManage) {
+		this.workFullManage = workFullManage;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+
+	public List<Workattachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<Workattachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	public Boolean getProcessEnded() {
+		return processEnded;
+	}
+
+	public void setProcessEnded(Boolean processEnded) {
+		this.processEnded = processEnded;
+	}
+}

+ 664 - 0
src/main/java/com/jeeplus/modules/workfulldesignchange/service/WorkFullDesignchangeService.java

@@ -0,0 +1,664 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfulldesignchange.service;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workfulldesignchange.dao.WorkFullDesignchangeDao;
+import com.jeeplus.modules.workfulldesignchange.entity.WorkFullDesignchange;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullManageDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.service.WorkFullManageService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import org.activiti.engine.ActivitiObjectNotFoundException;
+import org.activiti.engine.IdentityService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 设计变更Service
+ * @author fgy
+ * @version 2017-11-03
+ */
+@SuppressWarnings("all")
+@Service
+@Transactional(readOnly = true)
+public class WorkFullDesignchangeService extends CrudService<WorkFullDesignchangeDao, WorkFullDesignchange> {
+
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private WorkattachmentService workattachmentService;
+	@Autowired
+	private WorkFullManageService workFullManageService;
+	@Autowired
+	private WorkFullDesignchangeDao workFullDesignchangeDao;
+	@Autowired
+	private WorkFullManageDao workFullManageDao;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private OfficeService officeService;
+	private Lock lock = new ReentrantLock();
+
+
+	public WorkFullDesignchange get(String id) {
+		WorkFullDesignchange workFullDesignchange = super.get(id);
+		if(workFullDesignchange != null){
+			WorkFullManage workFullManage = workFullManageService.get(workFullDesignchange.getWorkFullManageId());
+			if(workFullManage != null){
+				workFullDesignchange.setWorkFullManage(workFullManage);
+				workFullDesignchange.setWorkFullManageId(workFullManage.getId());
+			}
+
+			List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(workFullDesignchange.getId(),"46");
+			if(attachmentList != null && attachmentList.size()>0){
+				for (int i = 0; i < attachmentList.size(); i++) {
+					Workattachment attachment = attachmentList.get(i);
+					attachment.setAttachmentUser(UserUtils.get(attachment.getAttachmentUser()).getName());
+				}
+				workFullDesignchange.setWorkAttachments(attachmentList);
+			}
+
+			//流程结束state=false,未结束state=true
+			boolean state = true;
+			if(StringUtils.isNotBlank(workFullDesignchange.getProcessInstanceId())){
+				state = actTaskService.isProcessEnd(workFullDesignchange.getProcessInstanceId());
+			}else{
+				//如果是项目负责人,不用审核,没有流程实例
+				state = false;
+			}
+			workFullDesignchange.setProcessEnded(state);
+		}
+
+		return workFullDesignchange ;
+
+	}
+	
+	public List<WorkFullDesignchange> findList(WorkFullDesignchange workFullDesignchange) {
+		return super.findList(workFullDesignchange);
+	}
+	
+	public Page<WorkFullDesignchange> findPage(Page<WorkFullDesignchange> page, WorkFullDesignchange workFullDesignchange) {
+		workFullDesignchange.setPage(page);
+		page.setList(findListBelongtoWorkfullmanage(workFullDesignchange));
+		return page;
+	}
+
+	public List<WorkFullDesignchange> findListBelongtoWorkfullmanage(WorkFullDesignchange workFullDesignchange) {
+		if(StringUtils.isBlank(workFullDesignchange.getWorkFullManageId())){
+			return null ;
+		}
+		List<WorkFullDesignchange> designList = workFullDesignchangeDao.findList(workFullDesignchange);
+		if(designList != null && designList.size()>0){
+			for(WorkFullDesignchange design : designList){
+				WorkFullManage workFullManage = workFullManageService.get(design.getWorkFullManageId());
+				design.setWorkFullManage(workFullManage);
+				design.setWorkFullManageId(workFullManage.getId());
+
+				//流程结束state=false,未结束state=true
+				boolean state = true;
+				if(StringUtils.isNotBlank(design.getProcessInstanceId())){
+					state = actTaskService.isProcessEnd(design.getProcessInstanceId());
+				}else{
+					//如果是项目负责人,不用审核,没有流程实例
+					state = false;
+				}
+				design.setProcessEnded(state);
+
+			}
+		}
+		return designList;
+	}
+
+	@Transactional(readOnly = false)
+	public WorkFullDesignchange save(WorkFullDesignchange workFullDesignchange, String workFullManageId, String submit) {
+		//(0暂存,1审核中,2已通过,3未通过、4已撤销)
+		String id = workFullDesignchange.getId();
+		//提交、暂存、重新申请,执行保存,撤销不执行保存
+		if("submit".equals(submit) || "toStore".equals(submit)|| "reapply".equals(submit)){
+			if(StringUtils.isBlank(workFullDesignchange.getId())){
+				workFullDesignchange.setStatus("0");
+			}
+			workFullDesignchange.setWorkFullManageId(workFullManageId);
+			workFullDesignchange.setCompanyId(UserUtils.getSelectCompany().getId());
+			workFullDesignchange.setOfficeId(UserUtils.getSelectOffice().getId());
+			super.save(workFullDesignchange);
+
+			if(StringUtils.isBlank(id)){
+				List<Workattachment> workAttachments = workFullDesignchange.getWorkAttachments();
+				if(workAttachments!=null && workAttachments.size()>0){
+					for (int i = 0; i < workAttachments.size(); i++) {
+						Workattachment w = workAttachments.get(i);
+						if (StringUtils.isNotBlank(w.getUrl()) && !w.getUrl().equals("null")) {
+							w.setCompanyId(workFullDesignchange.getCompanyId());
+							w.setAttachmentId(workFullDesignchange.getId());
+							w.setAttachmentUser(UserUtils.getUser().getId());
+							w.setId("");
+							workattachmentService.save(w);
+						}
+					}
+				}
+			}
+		}
+
+		//新添加数据:先保存,后启动流程;暂存数据:只保存,不启动流程;
+		//重新申请:先保存数据,后执行审核;撤销:不保存,但是执行审核
+		if("submit".equals(submit)){
+			Map<String,Object> variables = new HashMap<String,Object>();
+			startProcess(workFullDesignchange,variables);
+		}else if("reapply".equals(submit) || "repeal".equals(submit)){
+			auditSave(workFullDesignchange);
+		}
+		return workFullDesignchange;
+	}
+	@Transactional(readOnly = false)
+	public void uploadFile(MultipartFile file, WorkFullDesignchange workFullDesignchange, String attachmentFlag) {
+		if(file!=null && !file.isEmpty() && file.getSize()>0){
+			//后一次上传前先删除前一次上传的文件
+			delFile(workFullDesignchange,attachmentFlag);
+
+			OSSClientUtil ossClientUtil = new OSSClientUtil();
+			String fileName = file.getOriginalFilename();
+			String fileType = fileName.substring(fileName.lastIndexOf(".")+1);
+			String url = ossClientUtil.uploadFile2OSS(file,"workFullDesignchange");
+			Workattachment workattachment = new Workattachment();
+			workattachment.setUrl(url);
+			workattachment.setType(fileType);
+			workattachment.setAttachmentName(fileName);
+			workattachment.setAttachmentUser(UserUtils.getUser().getId());
+			workattachment.setAttachmentId(workFullDesignchange.getId());
+			workattachment.setAttachmentFlag(attachmentFlag);
+			workattachmentService.save(workattachment);
+		}
+	}
+
+	@Transactional(readOnly = false)
+	public void delFile(WorkFullDesignchange workFullDesignchange, String attachmentFlag) {
+
+		Workattachment workattachment = workattachmentService.get(workFullDesignchange.getRemarks());
+		if(workattachment != null){
+			doDelFile(workattachment);
+		}
+	}
+	@Transactional(readOnly = false)
+	public void doDelFile(Workattachment workattachment) {
+		workattachmentService.deleteFileFromAliyun(workattachment,workattachment==null?"":workattachment.getUrl());
+		workattachmentService.delete(workattachment);
+	}
+	@Transactional(readOnly = false)
+	public void startProcess(WorkFullDesignchange workFullDesignchange, Map<String, Object> variables) {
+		System.err.print("==========审核流程开始=========");
+		//用来设置启动流程的人员的id,引擎会自动把人员的id保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(workFullDesignchange.getCurrentUser().getId());
+		WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("c2660a7b49e14a70b411ed36535662d4",officeService.get(workFullDesignchange.getOfficeId()));
+		//启动流程
+		String businessKey = workFullDesignchange.getId().toString();
+		String processType = workActivityMenu.getProcessType();
+		StringBuffer buffer1 = new StringBuffer();
+		Activity activity = new Activity();
+		if(StringUtils.isNotBlank(workActivityMenu.getId())){
+			workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+			List<Activity> activities = workActivityMenu.getActivities();
+			for (Activity a:activities){
+				if (a.getDelFlag().equals("0") && a.getCount() == 1){
+					activity = a;
+					break;
+				}
+			}
+			buffer1.append(activity.getRole().getEnname());
+			variables.put("type", workActivityMenu.getProcessType());
+		}else{
+			processType= ActUtils.PD_WORKFULLDESIGNCHANGE[0];
+			variables.put("type", processType);
+			Role role = UserUtils.getSelectRole().get(0);
+			buffer1 = DateUtils.getByEnnme(role.getEnname());
+			buffer1.append("bmzr");
+			variables.put("bmzr", buffer1.toString());
+		}
+		variables.put("businessId",businessKey);
+		variables.put("title",workFullDesignchange.getRemarks());
+
+		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType,businessKey,variables);
+		workFullDesignchange.setProcessInstance(processInstance);
+		workFullDesignchange.setProcessInstanceId(processInstance.getId());
+		workFullDesignchangeDao.updateProcessInstanceId(workFullDesignchange);
+
+		workFullDesignchange.setStatus("1");
+		updateStatus(workFullDesignchange);
+
+		List<Activity> list= workActivityMenu.getActivities();
+		if (list!=null && list.size()!=0){
+			workActivityProcessService.saveList(list,processInstance.getId());
+		}else {
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessKey(processType);
+			workActivityProcess.setCount(1);
+			workActivityProcess.setProcessInstanceId(processInstance.getId());
+			workActivityProcess.setIsApproval("0");
+			workActivityProcess.setActivity(new Activity("f8628ba6301d4674becc8a846636b7de"));
+			workActivityProcessService.save(workActivityProcess);
+		}
+
+		//发起通知给审批人
+		WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+		workProjectNotify.setTitle("您有新的设计变更待审批");
+		workProjectNotify.setNotifyId(workFullDesignchange.getId());
+		workProjectNotify.setCompanyId(workFullDesignchange.getCompanyId());
+		workProjectNotify.setContent("审批任务-设计变更");
+		workProjectNotify.setRemarks("待审批");
+		workProjectNotify.setType("9");
+		workProjectNotify.setStatus("0");
+		workProjectNotify.setNotifyRole("");
+		workProjectNotify.setUser(new User(""));
+
+		if(workActivityMenu!=null&&StringUtils.isNotBlank(workActivityMenu.getId())&&StringUtils.isNotBlank(activity.getId())){
+			//角色审批
+			if(StringUtils.isNotBlank(activity.getRole().getEnname())){
+				workProjectNotify.setNotifyRole(buffer1.toString());
+			}
+			//人员审批
+			if(StringUtils.isNotBlank(activity.getUser().getId())){
+				workProjectNotify.setUser(new User(activity.getUser().getId()));
+			}
+		}else {
+			workProjectNotify.setNotifyRole(buffer1.toString());
+		}
+		workProjectNotifyService.save(workProjectNotify);
+	}
+	@Transactional(readOnly = false)
+	private void updateStatus(WorkFullDesignchange workFullDesignchange) {
+		workFullDesignchangeDao.updateStatus(workFullDesignchange);
+	}
+
+	@Transactional(readOnly = false)
+	public void delete(WorkFullDesignchange workFullDesignchange) {
+		delFile(workFullDesignchange,"46");
+		super.delete(workFullDesignchange);
+		//逻辑删除相关的通知记录
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workFullDesignchange.getId());
+		workProjectNotifyService.modifyDelflag(notify);
+	}
+
+
+	public Page<WorkFullManage> findListOfWorkFullManage(Page<WorkFullManage> page, WorkFullManage workFullManage) {
+		if (StringUtils.isNotBlank(workFullManage.getTotalFullIds())){
+			workFullManage.setTotalFullIds(","+workFullManage.getTotalFullIds()+",");
+		}
+		workFullManage.getSqlMap().put("dsf", dataScopeFilterOR(workFullManage.getCurrentUser(), "o", "u","s", MenuStatusEnum.END.getValue()));
+		workFullManage.setPage(page);
+		List<WorkFullManage> list = Lists.newArrayList();
+		workFullManage.setIsTotal("1");
+		List<WorkFullManage> totals = getListOfWorkFullManage(workFullManage);
+		List<WorkFullManage> workFullManages = new ArrayList<>();
+		for (WorkFullManage fullManage:totals){
+			WorkFullManage wfm = new WorkFullManage();
+			wfm.setTotalFullId(fullManage.getId());
+			List<WorkFullManage> workEngineeringProjectLists = getListOfWorkFullManage(wfm);
+			if (workEngineeringProjectLists!=null && workEngineeringProjectLists.size()!=0){
+				workFullManages.addAll(workEngineeringProjectLists);
+			}
+		}
+		workFullManages.addAll(totals);
+		WorkFullManageService.sortList(list,workFullManages,"0",true);
+		//WorkFullManageService.sortList(list,getListOfWorkFullManage(workFullManage),"0",true);
+		page.setList(list);
+		return page ;
+	}
+
+
+	public List<WorkFullManage> getListOfWorkFullManage(WorkFullManage workFullManage) {
+		List<WorkFullManage> workFullManageList = workFullDesignchangeDao.getListOfWorkFullManage(workFullManage);
+		if (workFullManageList != null && workFullManageList.size()>0){
+			for(WorkFullManage w : workFullManageList){
+				String hostMasterIds = w.getHostMaster();
+				StringBuilder hostMasterName = new StringBuilder();
+				String[] idArray = hostMasterIds.split(",");
+				if(idArray != null && idArray.length>0){
+					for(int i =0 ;i<idArray.length;i++){
+						if(StringUtils.isNotBlank(idArray[i])){
+							User u = UserUtils.get(idArray[i]);
+							hostMasterName.append(",").append(u.getName());
+						}
+					}
+				}
+				if(hostMasterName.length()>1){
+					w.setHostMasterName(hostMasterName.substring(1));
+				}
+			}
+		}
+		return workFullManageList ;
+	}
+
+	public WorkFullDesignchange getByProcessInstanceId(String processInstanceId) {
+		return workFullDesignchangeDao.getByProcessInstanceId(processInstanceId);
+	}
+	//部门负责人审核或创建人重申、撤销(0暂存,1审核中,2通过,3未通过,4已撤销)
+	@Transactional(readOnly = false)
+	public String auditSave(WorkFullDesignchange workFullDesignchange) {
+		try {
+			String userId = UserUtils.getUser().getId();
+			actTaskService.claim(workFullDesignchange.getAct().getTaskId(), userId);
+			// 设置意见
+			String comment = "";
+			if(workFullDesignchange.getStatus().equals("3")){//如果是被驳回状态
+				comment = ("yes".equals(workFullDesignchange.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+			}else{
+				comment = ("yes".equals(workFullDesignchange.getAct().getFlag())?"[同意] ":"[驳回] ")+workFullDesignchange.getAct().getComment();
+			}
+			workFullDesignchange.getAct().setComment(comment);
+			workFullDesignchange.setStatus("1");
+
+			System.err.println("comment======"+workFullDesignchange.getAct().getComment());
+			WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+			workProjectNotify.setNotifyId(workFullDesignchange.getId());
+			workProjectNotifyService.readByNotifyId(workProjectNotify);
+
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workFullDesignchange.getAct().getTaskDefKey();
+			System.err.println("taskDefKey======"+taskDefKey);
+			//业务逻辑对应的条件表达式
+			String exp = "";
+
+			//WorkActivityMenu workActivityMenu2 = workActivityMenuService.findByParentAndOffice("c2660a7b49e14a70b411ed36535662d4",officeService.get(workFullDesignchange.getOfficeId()));
+			List<Activity> activitieList = activityService.getByProcessInstanceId(workFullDesignchange.getProcessInstanceId());
+			WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+			if (activitieList!=null && activitieList.size()!=0){
+				workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+				workActivityMenu.setActivities(activitieList);
+			}
+
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			WorkActivityProcess selectedProcess = new WorkActivityProcess();
+			selectedProcess.setProcessInstanceId(workFullDesignchange.getProcessInstanceId());
+			List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectedProcess);
+
+			//是自定义流程
+			boolean isCustomProcess = StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals(ActUtils.PD_WORKFULLDESIGNCHANGE[0]);
+
+			String taskCount = "";
+			int key = 0;
+
+			List<Activity> activities = workActivityMenu.getActivities();
+			if (isCustomProcess) {
+				key = 1 ;
+				for (int i =0;i<workActivityProcesses.size();i++){
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = taskDefKey.replace("task","").replace("audit","");
+
+					if(taskDefKey.contains("audit") && (activityProcess.getCount()+"").contains(count)){
+						taskCount = count ;
+						exp = "pass";
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						if (!"yes".equals(workFullDesignchange.getAct().getFlag())) {
+							workFullDesignchange.setStatus("4");
+							workActivityProcess.setIsApproval("2");
+						}else {
+							workFullDesignchange.setStatus("1");
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("设计变更:重新申请");
+							workProjectNotify.setRemarks("重新申请");
+						}
+					}
+					else if ((activityProcess.getCount()+"").contains(count)){
+						taskCount = count ;
+						workActivityProcess = activityProcess;
+						workActivityProcess.setRemarks(comment);
+
+						if (!activityProcess.getIsApproval().equals("0")){
+							workActivityProcess.setId("");
+						}
+						exp = "pass";
+						if (!"yes".equals(workFullDesignchange.getAct().getFlag())) {
+							workFullDesignchange.setStatus("3");
+							workActivityProcess.setIsApproval("2");
+							workProjectNotify.setTitle("您的设计变更审请被驳回!");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullDesignchange.getCreateBy());
+
+							String returnBack = "-1";
+							for (Activity activity:activities){
+								if(activity.getCount()==Integer.parseInt(count)){
+									returnBack = activity.getReturnBack();
+									break;
+								}
+							}
+							if (returnBack.equals("0")) {
+								workActivityProcess.setId("");
+							}
+						}else {
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("设计变更:待审批!");
+						}
+					}
+				}
+			}else {
+				workActivityMenu.setId(workActivityProcesses.get(0).getId());
+				workActivityMenu.setProcessType(ActUtils.PD_WORKFULLDESIGNCHANGE[0]);
+				for (int i = 0; i < workActivityProcesses.size(); i++) {
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = activityProcess.getCount() + "";
+
+					if(! activityProcess.getIsApproval().equals("0")){
+						workActivityProcess.setId("");
+					}
+					taskCount = "1" ; // 默认流程只有一个审批环节
+
+					if ("audit".equals(taskDefKey) && count.equals("1")){
+						workActivityProcess.setCount(1); //默认流程里部门负责人是第一个环节
+						exp = "pass";
+						if("yes".equals(workFullDesignchange.getAct().getFlag())){
+							workActivityProcess.setIsApproval("1");
+							workFullDesignchange.setStatus("2");
+							workProjectNotify.setTitle("您的设计变更申请已通过");
+							workProjectNotify.setRemarks("待通知");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullDesignchange.getCreateBy());
+						}else{
+							workActivityProcess.setIsApproval("2");
+
+							workFullDesignchange.setStatus("3");
+							workProjectNotify.setRemarks("重新申请");
+							workProjectNotify.setTitle("设计变更申请被驳回!");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullDesignchange.getCreateBy());
+						}
+					}else if("reapply".equals(taskDefKey)){
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						exp="pass";
+						if("yes".equals(workFullDesignchange.getAct().getFlag())){//重新申请
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("设计变更重新申请!");
+							Role role = UserUtils.getSelectRole().get(0);
+							StringBuffer buffer = DateUtils.getByEnnme(role.getEnname());
+							buffer.append("bmzr");
+							workProjectNotify.setNotifyRole(buffer.toString());//给部门负责人再次发送通知
+							workProjectNotify.setUser(new User(""));//如果是重新申请,就不给创建人发通知,只给部门负责人发通知
+							workProjectNotify.setRemarks("待审批");
+							workFullDesignchange.setStatus("1");
+						}else{
+							workActivityProcess.setIsApproval("2");
+							workFullDesignchange.setStatus("4");
+						}
+						break;
+					}
+					// 未知环节
+				}
+			}
+
+			//更新自定义的流程追踪数据
+			String defaultReapply = "reapply"; //默认流程中的重新申请任务标识
+			workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workFullDesignchange.getProcessInstanceId(),taskDefKey,defaultReapply,workFullDesignchange.getAct().getFlag(),comment, activities);
+
+
+			// 设置意见
+			workFullDesignchange.getAct().setComment(comment);
+			workFullDesignchange.preUpdate();
+
+			// 提交流程任务
+			Map<String, Object> vars = Maps.newHashMap();
+			vars.put(exp, "yes".equals(workFullDesignchange.getAct().getFlag()) ?true : false );
+			System.err.println("vars======"+vars.toString());
+			// 提交流程任务
+			actTaskService.complete(workFullDesignchange.getAct().getTaskId(), workFullDesignchange.getAct().getProcInsId(), workFullDesignchange.getAct().getComment(), vars);
+			boolean state = actTaskService.isProcessEnd(workFullDesignchange.getAct().getProcInsId());
+			if (!state){
+
+				if(isCustomProcess){
+					if("yes".equals(workFullDesignchange.getAct().getFlag())){
+						workFullDesignchange.setStatus("2");
+					}else{
+						if(! "3".equals(workFullDesignchange.getStatus()))
+							workFullDesignchange.setStatus("4");
+					}
+				}
+
+				if("2".equals(workFullDesignchange.getStatus())){
+					workProjectNotify.setTitle("您的设计变更申请已通过");
+				}
+				if("3".equals(workFullDesignchange.getStatus())){
+					workProjectNotify.setTitle("您的设计变更申请被驳回");
+				}
+				workProjectNotify.setRemarks("待通知");
+				workProjectNotify.setNotifyRole("");
+				workProjectNotify.setUser(workFullDesignchange.getCreateBy());
+			}else{
+				if (isCustomProcess) {
+					String count = taskDefKey.replace("audit","").replace("task","");
+					Activity activity = new Activity();
+
+					if (taskDefKey.contains("audit")) {
+						if (activities.size() == 1 || count.equals("1")){
+							activity = activities.get(0);
+						}else if (activities.size()==Integer.parseInt(count)){
+							activity = activities.get(activities.size()-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}else {
+							activity = activities.get(Integer.parseInt(count)-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}
+					}
+
+					else if(!"yes".equals(workFullDesignchange.getAct().getFlag())){
+
+						workProjectNotify.setRemarks("重新申请");
+						activity = new Activity();
+					}
+
+					else {
+						activity = activities.get(Integer.parseInt(count));
+						workProjectNotify.setRemarks("待审批");
+					}
+
+					if(StringUtils.isNotBlank(activity.getId())){
+						workProjectNotify.setUser(activity.getUser());
+						workProjectNotify.setNotifyRole(activity.getRole().getEnname());
+					}
+				}
+				else{
+
+				}
+			}
+
+			workProjectNotify.setCompanyId(workFullDesignchange.getCompanyId());
+			workProjectNotify.setContent(workFullDesignchange.getAct().getComment());
+			workProjectNotify.setType("9");
+			workProjectNotify.setStatus("0");
+			//创建人如果做了撤销操作,无需发送通知
+			if (!workFullDesignchange.getStatus().equals("4")) {
+				workProjectNotifyService.save(workProjectNotify);
+			}
+			//更新设计变更审核状态
+			workFullDesignchangeDao.updateStatus(workFullDesignchange);
+
+			System.err.println("设计变更审批正常");
+			return "审核执行成功";
+			//如果是撤销操作,更改与此相关的所有通知的已读状态,不再显示
+			//如果是同意或驳回操作:将前面发给审批人的所有通知变更为已读;
+			//如果是重新申请操作:将前面发给申请人的所有通知变更为已读;
+			//如果是同意操作,发送审批通过的通知给申请人;申请人在阅读完成后,变更已读状态;
+//			WorkProjectNotify notify = new WorkProjectNotify();
+//			notify.setNotifyId(workFullDesignchange.getId());
+//			if("4".equals(workFullDesignchange.getStatus())){
+//				workProjectNotifyService.readByNotifyId(notify);
+//			}
+//			else if("2".equals(workFullDesignchange.getStatus()) ||"3".equals(workFullDesignchange.getStatus())){
+//				String roleEnname = DateUtils.getByEnnme(UserUtils.getSelectRole().getEnname())+"bmzr";
+//				notify.setNotifyRole(roleEnname);
+//				workProjectNotifyService.readByNotifyIdAndNotifyRole(notify);
+//			}else if("1".equals(workFullDesignchange.getStatus())){
+//				notify.setUser(workFullDesignchange.getCreateBy());
+//				workProjectNotifyService.readByNotifyIdAndNotifyUser(notify);
+//			}
+
+		}catch (ActivitiObjectNotFoundException e){
+			e.printStackTrace();
+			System.err.println("设计变更--重复审批");
+			logger.error("ActivitiObjectNotFoundException -- "+e);
+			return "流程已审批,不能重新审批!";
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			System.err.println("设计变更审批异常");
+			logger.error("Exception e:"+e);
+			return "审核执行失败!!";
+		}
+	}
+
+}

+ 512 - 0
src/main/java/com/jeeplus/modules/workfulldesignchange/web/WorkFullDesignchangeController.java

@@ -0,0 +1,512 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfulldesignchange.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workfulldesignchange.entity.WorkFullDesignchange;
+import com.jeeplus.modules.workfulldesignchange.service.WorkFullDesignchangeService;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.service.WorkFullManageService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 设计变更Controller
+ * @author fgy
+ * @version 2017-11-03
+ */
+@SuppressWarnings("all")
+@Controller
+@RequestMapping(value = "${adminPath}/workfulldesignchange/workFullDesignchange")
+public class WorkFullDesignchangeController extends BaseController {
+
+	@Autowired
+	private WorkFullManageService workFullManageService;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkFullDesignchangeService workFullDesignchangeService;
+	@Autowired
+	private ActivityService activityService;
+
+	@ModelAttribute
+	public WorkFullDesignchange get(@RequestParam(required=false) String id) {
+		WorkFullDesignchange entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workFullDesignchangeService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkFullDesignchange();
+		}
+		return entity;
+	}
+	/**
+	 *  待添加设计变更的项目列表
+	 */
+	@RequestMapping("workfullmanageList")
+	public String workfullmanageList(WorkFullManage workFullManage,HttpServletRequest request,HttpServletResponse response,Model model){
+		String userId = UserUtils.getUser().getId();
+		if(!UserUtils.getSelectRoleInfo()){
+			workFullManage.setQueryCon(userId);
+		}
+
+		Page<WorkFullManage> page = workFullDesignchangeService.findListOfWorkFullManage(new Page<WorkFullManage>(request, response), workFullManage);
+		model.addAttribute("page", page);
+		return "modules/workfulldesignchange/workfullmanageList";
+	}
+
+	 /**
+	 * 设计变更列表页面
+	 */
+	@RequiresPermissions("workfulldesignchange:workFullDesignchange:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkFullDesignchange workFullDesignchange, HttpServletRequest request, HttpServletResponse response, Model model) {
+		String workFullManageId = request.getParameter("workFullManageId");
+
+		if(StringUtils.isNotBlank(workFullManageId)){
+			workFullDesignchange.setWorkFullManageId(workFullManageId);
+		}
+		Page<WorkFullDesignchange> page = workFullDesignchangeService.findPage(new Page<WorkFullDesignchange>(request, response), workFullDesignchange);
+		model.addAttribute("page", page);
+		model.addAttribute("workFullManage",workFullManageService.get(workFullManageId));
+		model.addAttribute("workFullManageId",workFullManageId);
+
+		return "modules/workfulldesignchange/workFullDesignchangeList";
+	}
+
+	/**
+	 * 查看,增加,编辑设计变更表单页面
+	 */
+	@RequiresPermissions(value={"workfulldesignchange:workFullDesignchange:view","workfulldesignchange:workFullDesignchange:add","workfulldesignchange:workFullDesignchange:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkFullDesignchange workFullDesignchange, Model model,HttpServletRequest request) {
+		String dialog = request.getParameter("dialog");
+		String workFullManageId = request.getParameter("workFullManageId");
+		String listpage = request.getParameter("listpage");
+		if(StringUtils.isBlank(workFullManageId)){
+			workFullManageId = workFullDesignchange.getWorkFullManageId();
+		}
+		if(StringUtils.isNotBlank(workFullManageId)){
+			WorkFullManage workFullManage = workFullManageService.get(workFullManageId);
+			model.addAttribute("workFullManage",workFullManage);
+		}
+		model.addAttribute("workFullDesignchange", workFullDesignchange);
+		model.addAttribute("listpage",listpage);
+
+		if(workFullDesignchange.getAct()!=null && StringUtils.isNotBlank(workFullDesignchange.getAct().getTaskId())){
+			String taskId = workFullDesignchange.getAct().getTaskId();
+			return "modules/workfulldesignchange/workFullDesignchangeAudit";
+		}
+
+		if("add".equals(dialog) || "edit".equals(dialog)){
+			return "modules/workfulldesignchange/workFullDesignchangeForm";
+		}
+		if("view".equals(dialog)){
+			return "modules/workfulldesignchange/workFullDesignchangeView";
+		}
+		return "modules/workfulldesignchange/workFullDesignchangeForm";
+	}
+
+	/**
+	 * 保存设计变更
+	 */
+	@RequiresPermissions(value={"workfulldesignchange:workFullDesignchange:add","workfulldesignchange:workFullDesignchange:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkFullDesignchange workFullDesignchange,HttpServletRequest request,@RequestParam(value = "listpage",required = false)String listpage,
+					   Model model,RedirectAttributes redirectAttributes) throws Exception{
+		//新添加(submit提交,toStore暂存),被驳回(reapply重新申请,repeal撤销)
+		String submit = request.getParameter("submit");
+		String workFullManageId = request.getParameter("workFullManageId");
+		if (!beanValidator(model, workFullDesignchange)){
+			return form(workFullDesignchange, model,request);
+		}
+		if(!workFullDesignchange.getIsNewRecord()){//编辑表单保存
+			WorkFullDesignchange t = workFullDesignchangeService.get(workFullDesignchange.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workFullDesignchange, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+
+			//被驳回状态
+			if (StringUtils.isNotBlank(t.getStatus()) &&t.getStatus().equals("3")){
+				ProcessInstance processInstance = actTaskService.getProcIns(t.getProcessInstanceId());
+				if (processInstance!=null) {
+					Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+					Act act = new Act();
+					act.setTaskId(taskInfok.getId());
+					act.setTaskName(taskInfok.getName());
+					act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+					act.setProcDefId(taskInfok.getProcessDefinitionId());
+					act.setProcInsId(taskInfok.getProcessInstanceId());
+					act.setTask(taskInfok);
+					if("reapply".equals(submit)){act.setFlag("yes");}//重新申请
+					if("repeal".equals(submit)){act.setFlag("no");}//撤销
+					t.setAct(act);
+				}
+			}
+			workFullDesignchangeService.save(t,workFullManageId,submit);//保存
+			if("reapply".equals(submit)){
+				addMessage(redirectAttributes,"重新申请设计变更,并发往部门负责人审核");
+			} else if("repeal".equals(submit)){
+				addMessage(redirectAttributes,"已撤销设计变更");
+			}
+			return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/?repage";
+		}else{//新增表单保存
+			workFullDesignchange = workFullDesignchangeService.save(workFullDesignchange,workFullManageId,submit);//保存
+			if("submit".equals(submit)){
+				String message = StringUtils.isNoneBlank(workFullDesignchange.getId())?"保存设计变更成功,并发往部门负责人审核":"监理联系单添加失败";
+				addMessage(redirectAttributes,message);
+			}else if("toStore".equals(submit)){
+				String message = StringUtils.isNoneBlank(workFullDesignchange.getId())?"已暂存设计变更":"暂存设计变更失败";
+				addMessage(redirectAttributes,message);
+			}
+			//主页面添加操作后刷新主页面,弹窗页面添加操作后刷新弹窗页面
+			if(StringUtils.isNotBlank(listpage)&&listpage.equals("workfullmanageList")){
+				return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/"+listpage;
+			}
+			return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/?repage";
+		}
+	}
+	/**
+	 * 流程追踪
+	 */
+	@RequiresPermissions("workfulldesignchange:workFullDesignchange:view")
+	@RequestMapping("getProcess")
+	public String getProcess(WorkFullDesignchange workFullDesignchange, Model model){
+
+		model.addAttribute("processInstanceId",workFullDesignchange.getProcessInstanceId());
+		return "modules/workfulldesignchange/workFullDesignchangeTask";
+	}
+	/**
+	 * 待办任务
+	 */
+	@RequestMapping("auditTodo")
+	public String auditTodo(Act act , Model model , HttpServletRequest request, HttpServletResponse response){
+		act.setProcDefKey("workFullDesignchange");
+		List<Act> actList = new ArrayList<>();
+		actList.addAll(actTaskService.todoList(act));
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+
+		List<Activity> activities = activityService.groupByActivityMenu("c2660a7b49e14a70b411ed36535662d4",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			actList.addAll(actTaskService.todoList(act));
+		}
+
+		List<WorkFullDesignchange> designList = new ArrayList<>();
+		Role role = UserUtils.getSelectRole().get(0);
+		String officeId = "";
+		if(role.getDataScope().equals("4")){
+			User user = UserUtils.getUser();
+			officeId = user.getOffice().getId();
+		}
+
+		for(Act a : actList){
+			//重新申请和撤销不在代办和历史任务列表展示
+			if("audit".equals(a.getTask().getTaskDefinitionKey())||(! "reapply".equals(a.getTask().getTaskDefinitionKey()) && !a.getTask().getTaskDefinitionKey().contains("audit"))){
+				WorkFullDesignchange workFullDesignchange = workFullDesignchangeService.getByProcessInstanceId(a.getProcInsId());
+				if(workFullDesignchange != null){
+					workFullDesignchange = workFullDesignchangeService.get(workFullDesignchange.getId());
+				}
+				if(workFullDesignchange != null && workFullDesignchange.getCompanyId().equals(companyId)){
+					User createBy = UserUtils.get(workFullDesignchange.getCreateBy().getId());
+					if (StringUtils.isNotBlank(officeId)) {
+						if (officeId.equals(createBy.getOffice().getId())) {
+							if(a.getVars().getMap().get("applyUserId") != null){
+								User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+								if(user != null){
+									a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+								}
+							}
+							workFullDesignchange.setAct(a);
+							if(workFullDesignchange.getWorkFullManage()!=null && workFullDesignchange.getWorkFullManage().getId()!=null){
+								WorkFullManage workFullManage = workFullManageService.get(workFullDesignchange.getWorkFullManage().getId());
+								workFullDesignchange.setWorkFullManage(workFullManage);
+							}
+							if(StringUtils.isNotBlank(workFullDesignchange.getId())){
+								workFullDesignchange.setName(officeService.get(companyId).getName());
+							}
+							designList.add(workFullDesignchange);
+						}
+					}else{
+						if(a.getVars().getMap().get("applyUserId") != null){
+							User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+							if(user != null){
+								a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+							}
+						}
+						workFullDesignchange.setAct(a);
+						if(workFullDesignchange.getWorkFullManage()!=null && workFullDesignchange.getWorkFullManage().getId()!=null){
+							WorkFullManage workFullManage = workFullManageService.get(workFullDesignchange.getWorkFullManage().getId());
+							workFullDesignchange.setWorkFullManage(workFullManage);
+						}
+						if(StringUtils.isNotBlank(workFullDesignchange.getId())){
+							workFullDesignchange.setName(officeService.get(companyId).getName());
+						}
+						designList.add(workFullDesignchange);
+					}
+				}
+			}
+		}
+
+		model.addAttribute("list", designList);
+		return "modules/workfulldesignchange/workFullDesignchangeAuditTodo";
+
+	}
+	/**
+	 *  打开审核框
+	 */
+	@RequestMapping("applyOnWorkFullDesignchange")
+	public String applyOnWorkFullDesignchange(Act act){
+		// 获取流程XML上的表单KEY
+		String formKey = "/workfulldesignchange/workFullDesignchange/form";
+		//logger.info("------formKeys:"+formKeys);
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+		}
+		return "redirect:" + ActUtils.getFormUrl(formKey, act);
+	}
+	/**
+	 * 部门负责人审核
+	 */
+	@RequestMapping("saveAudit")
+	public String saveAudit(WorkFullDesignchange workFullDesignchange, Map<String, Object> vars, Model model, RedirectAttributes redirectAttributes) {
+		/*if (StringUtils.isBlank(workFullDesignchange.getAct().getComment())){
+			addMessage(model, "请填写审核意见。");
+			return form(workFullDesignchange, model,null);
+		}*/
+		String message = workFullDesignchangeService.auditSave(workFullDesignchange);
+		addMessage(redirectAttributes, message);
+		return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/?repage";
+	}
+	/**
+	 *  已办任务
+	 */
+	@RequestMapping("auditHistory")
+	public String auditHistory(Act act , Model model,HttpServletRequest request,HttpServletResponse response){
+		act.setProcDefKey("workFullDesignchange");
+		List<Act> list = actTaskService.historicList(act);
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+
+		List<Activity> activities = activityService.groupByActivityMenu("c2660a7b49e14a70b411ed36535662d4",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			list.addAll(actTaskService.historicList(act));
+		}
+
+		List<WorkFullDesignchange> meetingList = new ArrayList<WorkFullDesignchange>();
+		Role role = UserUtils.getSelectRole().get(0);
+		String officeId = "";
+		if(role.getDataScope().equals("4")){
+			User user = UserUtils.getUser();
+			officeId = user.getOffice().getId();
+		}
+
+		for (Act a : list) {
+			//重新申请和撤销不展示在代办和历史任务列表里
+			if(! "reapply".equals(a.getHistTask().getTaskDefinitionKey())){
+				WorkFullDesignchange workFullDesignchange = workFullDesignchangeService.getByProcessInstanceId(a.getHistTask().getProcessInstanceId());
+				if(workFullDesignchange != null){
+					workFullDesignchange = workFullDesignchangeService.get(workFullDesignchange.getId());
+				}
+				if (workFullDesignchange != null && workFullDesignchange.getCompanyId().equals(companyId)) {
+					User createBy = UserUtils.get(workFullDesignchange.getCreateBy().getId());
+					if (StringUtils.isNotBlank(officeId)) {
+						if (officeId.equals(createBy.getOffice().getId())) {
+							if (a.getVars().getMap().get("applyUserId")!=null){
+								a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+							}
+							workFullDesignchange.setAct(a);
+							if(workFullDesignchange.getWorkFullManage()!=null && workFullDesignchange.getWorkFullManage().getId()!=null){
+								WorkFullManage workFullManage = workFullManageService.get(workFullDesignchange.getWorkFullManage().getId());
+								workFullDesignchange.setWorkFullManage(workFullManage);
+							}
+							if (StringUtils.isNotBlank(workFullDesignchange.getId())){
+								workFullDesignchange.setName(officeService.get(companyId).getName());
+							}
+							meetingList.add(workFullDesignchange);
+						}
+					}else{
+						if (a.getVars().getMap().get("applyUserId")!=null){
+							a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+						}
+						workFullDesignchange.setAct(a);
+						if(workFullDesignchange.getWorkFullManage()!=null && workFullDesignchange.getWorkFullManage().getId()!=null){
+							WorkFullManage workFullManage = workFullManageService.get(workFullDesignchange.getWorkFullManage().getId());
+							workFullDesignchange.setWorkFullManage(workFullManage);
+						}
+						if (StringUtils.isNotBlank(workFullDesignchange.getId())){
+							workFullDesignchange.setName(officeService.get(companyId).getName());
+						}
+						meetingList.add(workFullDesignchange);
+					}
+				}
+			}
+		}
+
+		model.addAttribute("list", meetingList);
+		return "modules/workfulldesignchange/workFullDesignchangeAuditHistory";
+	}
+	/**
+	 * 删除设计变更
+	 */
+	@RequiresPermissions("workfulldesignchange:workFullDesignchange:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkFullDesignchange workFullDesignchange, HttpServletRequest request,HttpServletResponse response,Model model) {
+		workFullDesignchangeService.delete(workFullDesignchange);
+		WorkFullDesignchange w = new WorkFullDesignchange();
+		w.setWorkFullManageId(workFullDesignchange.getWorkFullManageId());
+		model.addAttribute("workFullDesignchange",w);
+		model.addAttribute("message","删除设计变更成功");
+		return list(w,request,response,model);
+	}
+	/**
+	 *  删除附件
+	 */
+	@ResponseBody
+	@RequestMapping("delFile")
+	public AjaxJson delFile(WorkFullDesignchange workFullDesignchange , HttpServletRequest request, Model model){
+//		String attachmentFlag = request.getParameter("attachmentFlag");
+//		String wtId = request.getParameter("wtId");
+//		workFullDesignchange.setRemarks(wtId);
+//		workFullDesignchangeService.delFile(workFullDesignchange,attachmentFlag);
+//		workFullDesignchange = workFullDesignchangeService.get(workFullDesignchange.getId());
+//		model.addAttribute("workFullDesignchange",workFullDesignchange);
+//		return form(workFullDesignchange,model,request);
+		String workFullDesignchangeId = request.getParameter("id");
+		String attaId = request.getParameter("attaId");
+		String attachmentUrl = request.getParameter("attachmentUrl");
+		workFullDesignchange.setRemarks(attaId);
+		workFullDesignchangeService.delFile(workFullDesignchange,attachmentUrl);
+		AjaxJson ajaxJson = new AjaxJson();
+		ajaxJson.put("attachmentUrl",attachmentUrl);
+		return ajaxJson;
+	}
+
+
+	/**
+	 * 批量删除设计变更(目前没做)
+	 */
+//	@RequiresPermissions("workfulldesignchange:workFullDesignchange:del")
+//	@RequestMapping(value = "deleteAll")
+//	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+//		String idArray[] =ids.split(",");
+//		for(String id : idArray){
+//			workFullDesignchangeService.delete(workFullDesignchangeService.get(id));
+//		}
+//		addMessage(redirectAttributes, "删除设计变更成功");
+//		return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/?repage";
+//	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workfulldesignchange:workFullDesignchange:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkFullDesignchange workFullDesignchange, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "设计变更"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkFullDesignchange> page = workFullDesignchangeService.findPage(new Page<WorkFullDesignchange>(request, response, -1), workFullDesignchange);
+    		new ExportExcel("设计变更", WorkFullDesignchange.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出设计变更记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workfulldesignchange:workFullDesignchange:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkFullDesignchange> list = ei.getDataList(WorkFullDesignchange.class);
+			for (WorkFullDesignchange workFullDesignchange : list){
+				try{
+					workFullDesignchangeService.save(workFullDesignchange);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条设计变更记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条设计变更记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入设计变更失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/?repage";
+    }
+	
+	/**
+	 * 下载导入设计变更数据模板
+	 */
+	@RequiresPermissions("workfulldesignchange:workFullDesignchange:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "设计变更数据导入模板.xlsx";
+    		List<WorkFullDesignchange> list = Lists.newArrayList(); 
+    		new ExportExcel("设计变更数据", WorkFullDesignchange.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfulldesignchange/workFullDesignchange/?repage";
+    }
+	
+	
+	
+
+}

+ 37 - 0
src/main/java/com/jeeplus/modules/workfullexecute/dao/WorkFullExecuteDao.java

@@ -0,0 +1,37 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullexecute.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullexecute.entity.WorkFullExecute;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 项目实施DAO接口
+ * @author fgy
+ * @version 2017-10-27
+ */
+@MyBatisDao
+public interface WorkFullExecuteDao extends CrudDao<WorkFullExecute> {
+
+
+    List<WorkFullManage> getListOfWorkFullManage(WorkFullManage workFullManage);
+
+    List<WorkFullExecute> findListBelongtoWorkfullmanage(WorkFullExecute workFullExecute);
+
+    List<WorkFullExecute> findList(WorkFullExecute workFullExecute);
+
+    void updateStatus(WorkFullExecute workFullExecute);
+
+    int updateProcessInstanceId(WorkFullExecute workFullExecute);
+
+    WorkFullExecute getByProcessInstanceId(String processInstanceId);
+
+    //项目实施完成后更新项目状态
+    void updateStatusOfWorkFullManage(Map<String, Object> map);
+}

+ 259 - 0
src/main/java/com/jeeplus/modules/workfullexecute/entity/WorkFullExecute.java

@@ -0,0 +1,259 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullexecute.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 项目实施Entity
+ * @author fgy
+ * @version 2017-10-27
+ */
+public class WorkFullExecute extends ActEntity<WorkFullExecute> {
+	
+	private static final long serialVersionUID = 1L;
+	private String fileName;		// 文件名
+	private String fileType;		// 文件类型(1地勘报告、2施工图、3图审报告、4会审纪要、5投标书、6甲供材料、7设备台账、8工程联系函、9建议、10合同管理台账、11造价咨询专题会议纪要、12造价咨询工作报告、13其他)
+	private String fileTypeDeclare;		// 文件类型说明
+	private Date startTime;		// 编制开始日期
+	private Date endTime;		// 编制完成日期
+	private WorkFullManage workFullManage;		// 项目
+	private String workFullManageId ;           //项目id
+	private String processInstanceId;		// 实例流程id
+	private Boolean processEnded;            //流程是否走到了结束状态(结束:false,未结束:true)
+	private String companyId;		// 公司id
+	private String officeId;
+	private String status ;         //审核状态(0暂存、1审核中、2已通过、3未通过,4已撤销)
+	private List<Workattachment> executeFile;       //实施文件 work_attachment中attachment_flag = 2
+	private Workattachment exeFile;
+	private List<Workattachment> manuscriptFile;   //工作底稿  work_attachment中attachment_flag = 3
+	private String name ;     //仅用作一些数据的传递,无实义
+	private List<Workattachment> manuscriptList = new ArrayList<>();  //工作底稿
+	private List<Workattachment> workAttachments;
+	// 流程任务
+	private Task task;
+	//
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public WorkFullExecute() {
+		super();
+	}
+
+	public WorkFullExecute(String id){
+		super(id);
+	}
+
+	@ExcelField(title="文件名", align=2, sort=1)
+	public String getFileName() {
+		return fileName;
+	}
+
+	public void setFileName(String fileName) {
+		this.fileName = fileName;
+	}
+	
+	@ExcelField(title="文件类型(1地勘报告、2施工图、3图审报告、4会审纪要、5投标书、6甲供材料、7设备台账、8工程联系函、9建议、10合同管理台账、11造价咨询专题会议纪要、12造价咨询工作报告、13其他)", dictType="work_full_execute_fileType", align=2, sort=2)
+	public String getFileType() {
+		return fileType;
+	}
+
+	public void setFileType(String fileType) {
+		this.fileType = fileType;
+	}
+	
+	@ExcelField(title="文件类型说明", align=2, sort=3)
+	public String getFileTypeDeclare() {
+		return fileTypeDeclare;
+	}
+
+	public void setFileTypeDeclare(String fileTypeDeclare) {
+		this.fileTypeDeclare = fileTypeDeclare;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="编制开始日期", align=2, sort=4)
+	public Date getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="编制完成日期", align=2, sort=5)
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+	
+	@ExcelField(title="项目id", align=2, sort=6)
+	public WorkFullManage getWorkFullManage() {
+		return workFullManage;
+	}
+
+	public void setWorkFullManage(WorkFullManage workFullManage) {
+		this.workFullManage = workFullManage;
+	}
+	
+	@ExcelField(title="实例流程id", align=2, sort=7)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+	
+	@ExcelField(title="公司id", align=2, sort=8)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	public List<Workattachment> getManuscriptList() {
+		return manuscriptList;
+	}
+
+	public void setManuscriptList(List<Workattachment> manuscriptList) {
+		this.manuscriptList = manuscriptList;
+	}
+
+	public String getWorkFullManageId() {
+		return workFullManageId;
+	}
+
+	public void setWorkFullManageId(String workFullManageId) {
+		this.workFullManageId = workFullManageId;
+	}
+
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+
+	public List<Workattachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<Workattachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	public List<Workattachment> getExecuteFile() {
+		return executeFile;
+	}
+
+	public void setExecuteFile(List<Workattachment> executeFile) {
+		this.executeFile = executeFile;
+	}
+
+	public List<Workattachment> getManuscriptFile() {
+		return manuscriptFile;
+	}
+
+	public void setManuscriptFile(List<Workattachment> manuscriptFile) {
+		this.manuscriptFile = manuscriptFile;
+	}
+
+	public Workattachment getExeFile() {
+		return exeFile;
+	}
+
+	public void setExeFile(Workattachment exeFile) {
+		this.exeFile = exeFile;
+	}
+
+	public Boolean getProcessEnded() {
+		return processEnded;
+	}
+
+	public void setProcessEnded(Boolean processEnded) {
+		this.processEnded = processEnded;
+	}
+}

+ 767 - 0
src/main/java/com/jeeplus/modules/workfullexecute/service/WorkFullExecuteService.java

@@ -0,0 +1,767 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullexecute.service;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workfullexecute.dao.WorkFullExecuteDao;
+import com.jeeplus.modules.workfullexecute.entity.WorkFullExecute;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullManageDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.service.WorkFullManageService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import org.activiti.engine.ActivitiObjectNotFoundException;
+import org.activiti.engine.IdentityService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 项目实施Service
+ * @author fgy
+ * @version 2017-10-27
+ */
+@SuppressWarnings("all")
+@Service
+@Transactional(readOnly = true)
+public class WorkFullExecuteService extends CrudService<WorkFullExecuteDao, WorkFullExecute> {
+
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private WorkFullManageService workFullManageService ;
+	@Autowired
+	private WorkFullExecuteDao workFullExecuteDao;
+	@Autowired
+	private WorkattachmentService workattachmentService;
+	@Autowired
+	private WorkFullManageDao workFullManageDao;
+	@Autowired
+	private OfficeService officeService;
+	private Lock lock = new ReentrantLock();
+
+	public WorkFullExecute get(String id) {
+		WorkFullExecute workFullExecute = super.get(id);
+		if(workFullExecute != null){
+			WorkFullManage workFullManage = workFullManageService.get(workFullExecute.getWorkFullManageId());
+			if(workFullManage != null){
+				workFullExecute.setWorkFullManage(workFullManage);
+				workFullExecute.setWorkFullManageId(workFullManage.getId());
+			}
+			List<Workattachment> executeFileList = workattachmentService.getListByAttachmentIdAndFlag(workFullExecute.getId(),"2");
+			if(executeFileList!=null && executeFileList.size()>0){
+				for (int i = 0; i < executeFileList.size(); i++) {
+					Workattachment executeFile = executeFileList.get(i);
+					if(executeFile != null){
+						executeFile.setAttachmentUser(UserUtils.get(executeFile.getAttachmentUser()).getName());
+					}
+				}
+				workFullExecute.setExecuteFile(executeFileList);
+			}
+			List<Workattachment> manuscriptFileList = workattachmentService.getListByAttachmentIdAndFlag(workFullExecute.getId(),"3");
+			if(manuscriptFileList!=null && manuscriptFileList.size()>0){
+				for (int i = 0; i < manuscriptFileList.size(); i++) {
+					Workattachment manuscriptFile = manuscriptFileList.get(i);
+					if(manuscriptFile != null){
+						manuscriptFile.setAttachmentUser(UserUtils.get(manuscriptFile.getAttachmentUser()).getName());
+					}
+				}
+				workFullExecute.setManuscriptFile(manuscriptFileList);
+			}
+
+			//流程结束state=false,未结束state=true
+			boolean state = true;
+			if(StringUtils.isNotBlank(workFullExecute.getProcessInstanceId())){
+				state = actTaskService.isProcessEnd(workFullExecute.getProcessInstanceId());
+			}else{
+				//如果是项目负责人,不用审核,没有流程实例
+				state = false;
+			}
+			workFullExecute.setProcessEnded(state);
+
+		}
+		return workFullExecute ;
+	}
+	
+	public List<WorkFullExecute> findList(WorkFullExecute workFullExecute) {
+		return super.findList(workFullExecute);
+	}
+	
+	public Page<WorkFullExecute> findPage(Page<WorkFullExecute> page, WorkFullExecute workFullExecute) {
+		workFullExecute.setPage(page);
+		page.setList(findListBelongtoWorkfullmanage(workFullExecute));
+		return page;
+	}
+
+	//一个项目有多个项目实施文件
+	private List<WorkFullExecute> findListBelongtoWorkfullmanage(WorkFullExecute workFullExecute) {
+		if(StringUtils.isBlank(workFullExecute.getWorkFullManageId())){
+			return new ArrayList<>();
+		}
+		List<WorkFullExecute> executeList = workFullExecuteDao.findList(workFullExecute);
+		if(executeList != null && executeList.size()>0){
+			for(int i=0 ; i< executeList.size();i++){
+				WorkFullExecute execute = executeList.get(i);
+
+				//流程结束state=false,未结束state=true
+				boolean state = true;
+				if(StringUtils.isNotBlank(execute.getProcessInstanceId())){
+					state = actTaskService.isProcessEnd(execute.getProcessInstanceId());
+				}else{
+					//如果是项目负责人,不用审核,没有流程实例
+					state = false;
+				}
+				execute.setProcessEnded(state);
+
+				List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(execute.getId(),"2");
+				if(attachmentList != null && attachmentList.size()>0){
+					for (int j = 0; j < attachmentList.size(); j++) {
+						Workattachment attachment = attachmentList.get(j);
+						if(StringUtils.isNotBlank(attachment.getAttachmentUser())){
+							attachment.setAttachmentUser(UserUtils.get(attachment.getAttachmentUser()).getName());
+						}
+					}
+					// TODO 现在限制一条实施记录里面有多个实施文件,万一保留了多个,就不好不好跟列表对应,暂时取第一个文件;
+					execute.setExeFile(attachmentList.get(0));
+				}
+			}
+		}
+
+		return executeList;
+	}
+
+	@Transactional(readOnly = false)
+	public WorkFullExecute save(WorkFullExecute workFullExecute, String workFullManageId , String submit ,HttpServletRequest request) {
+		//(0暂存,1审核中,2已通过,3未通过、4已撤销)
+
+		String id = workFullExecute.getId();
+		//提交、重新申请,执行保存,撤销不执行保存
+		if("submit".equals(submit) ||  "reapply".equals(submit)){
+			//先保存项目实施信息
+			if(StringUtils.isBlank(workFullExecute.getId())){
+				workFullExecute.setStatus("0");
+
+				//如果是项目负责人,直接"通过"
+				if(workFullManageService.get(workFullManageId).getHostMaster().contains(UserUtils.getUser().getId())){
+					workFullExecute.setStatus("2");
+				}
+			}
+			workFullExecute.setWorkFullManageId(workFullManageId);
+			workFullExecute.setCompanyId(UserUtils.getSelectCompany().getId());
+			workFullExecute.setOfficeId(UserUtils.getSelectOffice().getId());
+			super.save(workFullExecute);
+
+			if(StringUtils.isBlank(id)){
+				List<Workattachment> workAttachments = workFullExecute.getWorkAttachments();
+				if(workAttachments!=null && workAttachments.size()>0){
+					for (int i = 0; i < workAttachments.size(); i++) {
+						Workattachment w = workAttachments.get(i);
+						if (StringUtils.isNotBlank(w.getUrl()) && !w.getUrl().equals("null")) {
+							w.setAttachmentUser(UserUtils.getUser().getId());
+							w.setAttachmentId(workFullExecute.getId());
+							w.setCompanyId(workFullExecute.getCompanyId());
+							w.setId("");
+							//实施文件只有一个,底稿可以多个
+							if("2".equals(w.getAttachmentFlag())){
+								delFile(workFullExecute,w.getAttachmentFlag());
+							}
+
+							workattachmentService.save(w);
+						}
+					}
+				}
+			}
+
+//			//再上传项目实施文件(2)和底稿(3)
+//			MultiValueMap<String, MultipartFile> multiFileMap = request.getMultiFileMap();
+//			List<MultipartFile> execute_file = multiFileMap.get("execute_file");
+//			if(execute_file!=null&&execute_file.size()>0){
+//				for(int i=0;i<execute_file.size();i++){
+//					MultipartFile multipartFile = execute_file.get(0);
+//					if(multipartFile!=null && !multipartFile.isEmpty()&& multipartFile.getSize()>0){
+//						uploadFile(multipartFile,workFullExecute,"2");
+//					}
+//				}
+//			}
+//			List<MultipartFile> manuscript_file = multiFileMap.get("manuscript_file");
+//			if(manuscript_file!=null&&manuscript_file.size()>0){
+//				for(int i=0;i<manuscript_file.size();i++){
+//					MultipartFile multipartFile = manuscript_file.get(0);
+//					if(multipartFile!=null && !multipartFile.isEmpty()&&multipartFile.getSize()>0){
+//						uploadFile(multipartFile,workFullExecute,"3");
+//					}
+//				}
+//			}
+
+			//如果是项目负责人,不用审核
+			if(workFullManageService.get(workFullManageId).getHostMaster().contains(UserUtils.getUser().getId())){
+				return workFullExecute;
+			}
+
+		}
+
+		///新添加数据:先保存,后启动流程;
+		//重新申请:先保存数据,后执行审核;撤销:不保存,但是执行审核
+		if("submit".equals(submit)){
+			Map<String,Object> variables = new HashMap<String,Object>();
+			startProcess(workFullExecute,variables);
+		}else if("reapply".equals(submit) || "repeal".equals(submit)){
+			auditSave(workFullExecute);
+		}
+		return workFullExecute;
+	}
+
+	@Transactional(readOnly = false)
+	public void startProcess(WorkFullExecute workFullExecute, Map<String, Object> variables) {
+
+		//用来设置启动流程的人员的id,引擎会自动把人员的id保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(workFullExecute.getCurrentUser().getId());
+		WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("190aeda1d370481ab80387a71080f93c",officeService.get(workFullExecute.getOfficeId()));
+		//启动流程
+		String businessKey = workFullExecute.getId().toString();
+		String processType = workActivityMenu.getProcessType();
+		StringBuffer buffer1 = new StringBuffer();
+		Activity activity = new Activity();
+		if(StringUtils.isNotBlank(workActivityMenu.getId())){
+			workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+			List<Activity> activities = workActivityMenu.getActivities();
+			for (Activity a:activities){
+				//审批任务的第一个人(角色)
+				if (a.getDelFlag().equals("0") && a.getCount() == 1){
+					activity = a;
+					break;
+				}
+			}
+			buffer1.append(activity.getRole().getEnname());
+			variables.put("type", workActivityMenu.getProcessType());
+		}else{
+			processType= ActUtils.PD_WORKFULLEXECUTE[0];
+			variables.put("type", "workFullExecute");
+			Role role = UserUtils.getSelectRole().get(0);
+			buffer1 = DateUtils.getByEnnme(role.getEnname());
+			buffer1.append("bmzr");
+			variables.put("bmzr", buffer1.toString());
+		}
+
+		variables.put("businessId",businessKey);
+		variables.put("title",workFullExecute.getRemarks());
+
+		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType,businessKey,variables);
+		workFullExecute.setProcessInstance(processInstance);
+		workFullExecute.setProcessInstanceId(processInstance.getId());
+		workFullExecuteDao.updateProcessInstanceId(workFullExecute);
+
+		workFullExecute.setStatus("1");
+		updateStatus(workFullExecute);
+
+		List<Activity> list= workActivityMenu.getActivities();
+		if (list!=null && list.size()!=0){
+			workActivityProcessService.saveList(list,processInstance.getId());
+		}else {
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessKey(processType);
+			workActivityProcess.setCount(1);
+			workActivityProcess.setProcessInstanceId(processInstance.getId());
+			workActivityProcess.setIsApproval("0");
+			workActivityProcess.setActivity(new Activity("c2fd325dab4d47618fa858e5a5334b86"));
+			workActivityProcessService.save(workActivityProcess);
+		}
+
+		//发起通知给审批角色或人员
+		WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+		workProjectNotify.setTitle("您有新的项目实施待审批");
+		workProjectNotify.setNotifyId(workFullExecute.getId());
+		workProjectNotify.setCompanyId(workFullExecute.getCompanyId());
+		workProjectNotify.setContent("审批任务-项目实施申请");
+		workProjectNotify.setRemarks("待审批");
+		workProjectNotify.setType("7");
+		workProjectNotify.setStatus("0");
+		workProjectNotify.setNotifyRole("");
+		workProjectNotify.setUser(new User(""));
+
+		if(workActivityMenu!=null&&StringUtils.isNotBlank(workActivityMenu.getId())&&StringUtils.isNotBlank(activity.getId())){
+			//角色审批
+			if(StringUtils.isNotBlank(activity.getRole().getEnname())){
+				workProjectNotify.setNotifyRole(buffer1.toString());
+			}
+			//人员审批
+			if(StringUtils.isNotBlank(activity.getUser().getId())){
+				workProjectNotify.setUser(new User(activity.getUser().getId()));
+			}
+		}else {
+			workProjectNotify.setNotifyRole(buffer1.toString());
+		}
+		workProjectNotifyService.save(workProjectNotify);
+	}
+
+	@Transactional(readOnly = false)
+	private void updateStatus(WorkFullExecute workFullExecute) {
+		workFullExecuteDao.updateStatus(workFullExecute);
+	}
+
+	@Transactional(readOnly = false)
+	private void uploadFile(MultipartFile file, WorkFullExecute workFullExecute,String attachmentFlag) {
+		if(file!=null && !file.isEmpty() && file.getSize()>0){
+
+			//后一次上传前先删除前一次上传的文件
+			delFile(workFullExecute,attachmentFlag);
+
+			OSSClientUtil ossClientUtil = new OSSClientUtil();
+			String fileName = file.getOriginalFilename();
+			String fileType = fileName.substring(fileName.lastIndexOf(".")+1);
+			String url = ossClientUtil.uploadFile2OSS(file,"workFullExecute");
+			Workattachment workattachment = new Workattachment();
+			workattachment.setUrl(url);
+			workattachment.setType(fileType);
+			workattachment.setAttachmentName(fileName);
+			workattachment.setAttachmentUser(UserUtils.getUser().getId());
+			workattachment.setAttachmentId(workFullExecute.getId());
+			workattachment.setAttachmentFlag(attachmentFlag);
+			workattachmentService.save(workattachment);
+		}
+	}
+
+	@Transactional(readOnly = false)
+	public void delete(WorkFullExecute workFullExecute) {
+		delFile(workFullExecute,"2");
+		delFile(workFullExecute,"3");
+		super.delete(workFullExecute);
+		//逻辑删除相关的通知记录
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workFullExecute.getId());
+		workProjectNotifyService.modifyDelflag(notify);
+	}
+
+	//查询待实施项目列表
+    public Page<WorkFullManage> findListOfWorkFullManage(Page<WorkFullManage> page, WorkFullManage workFullManage) {
+		if (StringUtils.isNotBlank(workFullManage.getTotalFullIds())){
+			workFullManage.setTotalFullIds(","+workFullManage.getTotalFullIds()+",");
+		}
+		workFullManage.getSqlMap().put("dsf", dataScopeFilterOR(workFullManage.getCurrentUser(), "o", "u","s", MenuStatusEnum.END.getValue()));
+		workFullManage.setPage(page);
+		workFullManage.setIsTotal("1");
+		List<WorkFullManage> list = Lists.newArrayList();
+		List<WorkFullManage> totals = getListOfWorkFullManage(workFullManage);
+		List<WorkFullManage> workFullManages = new ArrayList<>();
+		for (WorkFullManage fullManage:totals){
+			WorkFullManage wfm = new WorkFullManage();
+			wfm.setTotalFullId(fullManage.getId());
+			List<WorkFullManage> workEngineeringProjectLists = getListOfWorkFullManage(wfm);
+			if (workEngineeringProjectLists!=null && workEngineeringProjectLists.size()!=0){
+				workFullManages.addAll(workEngineeringProjectLists);
+			}
+		}
+		workFullManages.addAll(totals);
+		WorkFullManageService.sortList(list,workFullManages,"0",true);
+		/*List<WorkFullManage> list = Lists.newArrayList();
+		WorkFullManageService.sortList(list,getListOfWorkFullManage(workFullManage),"0",true);*/
+		page.setList(list);
+		return page ;
+    }
+
+	private List<WorkFullManage> getListOfWorkFullManage(WorkFullManage workFullManage) {
+		List<WorkFullManage> workFullManageList = workFullExecuteDao.getListOfWorkFullManage(workFullManage);
+		if (workFullManageList != null && workFullManageList.size()>0){
+			for(WorkFullManage w : workFullManageList){
+				String hostMasterIds = w.getHostMaster();
+				StringBuilder hostMasterName = new StringBuilder();
+				String[] idArray = hostMasterIds.split(",");
+				if(idArray != null && idArray.length>0){
+					for(int i =0 ;i<idArray.length;i++){
+						if(StringUtils.isNotBlank(idArray[i])){
+							User u = UserUtils.get(idArray[i]);
+							hostMasterName.append(",").append(u.getName());
+						}
+					}
+				}
+				if(hostMasterName.length()>1){
+					w.setHostMasterName(hostMasterName.substring(1));
+				}
+			}
+		}
+		return workFullManageList ;
+	}
+	//获取流程信息
+	public WorkFullExecute getByProcessInstanceId(String processInstanceId) {
+		return workFullExecuteDao.getByProcessInstanceId(processInstanceId);
+	}
+
+	//执行审核操作(0暂存,1审核中,2通过,3未通过,4撤销)
+	@Transactional(readOnly = false)
+	public String auditSave(WorkFullExecute workFullExecute) {
+		try {
+			String userId = UserUtils.getUser().getId();
+			actTaskService.claim(workFullExecute.getAct().getTaskId(), userId);
+			// 设置意见
+			String comment = "";
+			if(workFullExecute.getStatus().equals("3")){//如果是被驳回状态
+				comment = ("yes".equals(workFullExecute.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+			}else{
+				comment = ("yes".equals(workFullExecute.getAct().getFlag())?"[同意] ":"[驳回] ")+workFullExecute.getAct().getComment();
+			}
+			workFullExecute.getAct().setComment(comment);
+			workFullExecute.setStatus("1");
+
+			System.err.println("comment======"+workFullExecute.getAct().getComment());
+			WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+			workProjectNotify.setNotifyId(workFullExecute.getId());
+			workProjectNotifyService.readByNotifyId(workProjectNotify);//每执行一步审核操作,都把已发出的通知变更为"已读"
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workFullExecute.getAct().getTaskDefKey();
+			System.err.println("taskDefKey======"+taskDefKey);
+			//业务逻辑对应的条件表达式
+			String exp = "";
+
+			//WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("190aeda1d370481ab80387a71080f93c", officeService.get(workFullExecute.getOfficeId()));
+			List<Activity> activitieList = activityService.getByProcessInstanceId(workFullExecute.getProcessInstanceId());
+			WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+			if (activitieList!=null && activitieList.size()!=0){
+				workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+				workActivityMenu.setActivities(activitieList);
+			}
+
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			WorkActivityProcess selectedProcess = new WorkActivityProcess();
+			selectedProcess.setProcessInstanceId(workFullExecute.getProcessInstanceId());
+			List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectedProcess);
+
+			//是自定义流程
+			boolean isCustomProcess = StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals(ActUtils.PD_WORKFULLEXECUTE[0]);
+
+			String taskCount = "";
+			int key = 0;
+
+			List<Activity> activities = workActivityMenu.getActivities();
+			if (isCustomProcess) {
+				key = 1;
+				for (int i =0;i<workActivityProcesses.size();i++){
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = taskDefKey.replace("task","").replace("audit","");
+
+					//重申|撤销 (audit1,2,3... = yes|no)
+					if(taskDefKey.contains("audit") && (activityProcess.getCount()+"").contains(count)){
+						taskCount = count ;
+						exp = "pass";
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						if (!"yes".equals(workFullExecute.getAct().getFlag())) {
+							workActivityProcess.setIsApproval("2");
+							workFullExecute.setStatus("4");//撤销
+						}else {
+							workActivityProcess.setIsApproval("1");
+							workFullExecute.setStatus("1");//重申
+							workProjectNotify.setTitle("项目实施:重新申请");
+							workProjectNotify.setRemarks("重新申请");//用于在通知页面做审核操作,这一步必须
+							//对通知的人(角色)的设定在 提交任务里完成
+						}
+					}
+					//中间审批环节
+					else if ((activityProcess.getCount()+"").contains(count)){
+						taskCount = count ;
+						workActivityProcess = activityProcess;
+						workActivityProcess.setRemarks(comment);
+
+						if (!workActivityProcess.getIsApproval().equals("0")){
+							workActivityProcess.setId("");
+						}
+						exp = "pass";
+						if (!"yes".equals(workFullExecute.getAct().getFlag())) {
+							workActivityProcess.setIsApproval("2");
+							workFullExecute.setStatus("3");
+							workProjectNotify.setTitle("您的项目实施申请被驳回!");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullExecute.getCreateBy());
+							String returnBack = "-1";
+							for (Activity activity:activities){
+								if(activity.getCount()==Integer.parseInt(count)){
+									returnBack = activity.getReturnBack();
+									break;
+								}
+							}
+							if (returnBack.equals("0")) {
+								workActivityProcess.setId("");
+							}
+						}else {
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("项目实施:待审批");
+							//对通知的人(角色)的设定在 提交任务里完成
+						}
+					}
+				}
+			}else {
+				workActivityMenu.setId(workActivityProcesses.get(0).getId());
+				workActivityMenu.setProcessType(ActUtils.PD_WORKFULLEXECUTE[0]);
+				for (int i = 0; i < workActivityProcesses.size(); i++) {
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = activityProcess.getCount() + "";
+
+					if(! activityProcess.getIsApproval().equals("0")){
+						workActivityProcess.setId("");
+					}
+					taskCount = "1" ; // 默认流程只有一个审批环节
+
+					// 部门负责人审核
+					if ("audit".equals(taskDefKey) && count.equals("1")){
+						workActivityProcess.setCount(1); //默认流程里部门负责人是第一个环节
+						exp = "pass";
+						if("yes".equals(workFullExecute.getAct().getFlag())){
+							workActivityProcess.setIsApproval("1");
+							workFullExecute.setStatus("2");
+							workProjectNotify.setTitle("您的项目实施申请已通过");
+							workProjectNotify.setRemarks("待通知");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullExecute.getCreateBy());
+						}else{
+							workActivityProcess.setIsApproval("2");
+
+							workFullExecute.setStatus("3");//驳回
+							//跳转页面的所需,这里只能填"重新申请"
+							workProjectNotify.setRemarks("重新申请");
+							workProjectNotify.setTitle("项目实施申请被驳回!");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullExecute.getCreateBy());
+						}
+					}
+					//重申|撤销
+					else if("reapply".equals(taskDefKey) && count.equals("0")){
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						exp="pass";
+						if("yes".equals(workFullExecute.getAct().getFlag())){//重新申请
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("项目实施重新申请!");
+							Role role = UserUtils.getSelectRole().get(0);
+							StringBuffer buffer = DateUtils.getByEnnme(role.getEnname());
+							buffer.append("bmzr");
+							workProjectNotify.setNotifyRole(buffer.toString());//给部门负责人再次发送通知
+							workProjectNotify.setUser(new User(""));//如果是重新申请,就不给创建人发通知,只给部门负责人发通知
+							workProjectNotify.setRemarks("待审批");
+							workFullExecute.setStatus("1");
+						}else{
+							workActivityProcess.setIsApproval("2");
+							workFullExecute.setStatus("4");//撤销
+						}
+						break;
+					}
+					// 未知环节
+				}
+			}
+
+
+			//更新自定义的流程追踪数据
+			String defaultReapply = "reapply"; //默认流程中的重新申请任务标识
+			workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workFullExecute.getProcessInstanceId(),taskDefKey,defaultReapply,workFullExecute.getAct().getFlag(),comment, activities);
+
+			// 设置意见
+			workFullExecute.getAct().setComment(comment);
+			workFullExecute.preUpdate();
+
+			// 提交流程任务
+			Map<String, Object> vars = Maps.newHashMap();
+			vars.put(exp, "yes".equals(workFullExecute.getAct().getFlag()) ?true : false );
+			System.out.println("vars======"+vars.toString());
+			// 提交流程任务
+			actTaskService.complete(workFullExecute.getAct().getTaskId(), workFullExecute.getAct().getProcInsId(), workFullExecute.getAct().getComment(), vars);
+			boolean state = actTaskService.isProcessEnd(workFullExecute.getAct().getProcInsId());
+			//state=false流程结束,state=true流程未结束
+			if (!state){
+				//A:对于默认流程,流程结束时,审批状态已经设定
+
+				//B:对于自定义流程,在中间环节,只能确定一个驳回状态=3,通过状态和撤销状态需要在这里设置
+				//终审结束,①可能是"同意=2",②可能是"驳回=3"(选择了"不可撤销"),③可能是"撤销=4"
+				if(isCustomProcess){
+					if("yes".equals(workFullExecute.getAct().getFlag())){
+						workFullExecute.setStatus("2");
+					}else{
+						if(! "3".equals(workFullExecute.getStatus()))
+							workFullExecute.setStatus("4");
+					}
+				}
+
+				//终审之后,发送通知给创建人
+				if("2".equals(workFullExecute.getStatus())){
+					workProjectNotify.setTitle("您的项目实施申请已通过");
+				}
+				if("3".equals(workFullExecute.getStatus())){
+					workProjectNotify.setTitle("您的项目实施申请被驳回");
+				}
+				workProjectNotify.setRemarks("待通知");//用于在通知页面做查看操作,这一步必须
+				workProjectNotify.setNotifyRole("");
+				workProjectNotify.setUser(workFullExecute.getCreateBy());
+			}else{
+				//尚未到终审,
+				//workProjectNotify.setRemarks("待审批");//用于在通知页面做审核操作,这一步必须
+				//如果是自定义流程,则需要先知道下一步(可能是撤销到某一步)的执行人(角色)是谁
+				if (isCustomProcess) {
+					String count = taskDefKey.replace("audit","").replace("task","");
+					Activity activity = new Activity();
+					////撤销到某一步
+					if (taskDefKey.contains("audit")) {
+						if (activities.size() == 1 || count.equals("1")){
+							activity = activities.get(0);
+						}else if (activities.size()==Integer.parseInt(count)){
+							activity = activities.get(activities.size()-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}else {
+							activity = activities.get(Integer.parseInt(count)-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}
+					}
+					//中间步骤驳回
+					else if(!"yes".equals(workFullExecute.getAct().getFlag())){
+						//驳回之后,创建人可以发起重申|撤销;将通知消息归类到审批列表,这一步必须
+						//对通知的人(创建人)的设定在前面已完成
+						workProjectNotify.setRemarks("重新申请");
+						activity = new Activity();//驳回后需将id置空
+					}
+					//中间某步骤同意
+					else {
+						//得到下一步要执行的activity
+						activity = activities.get(Integer.parseInt(count));
+						workProjectNotify.setRemarks("待审批");
+					}
+					//发送审批消息给下一步的人(角色)
+					if(StringUtils.isNotBlank(activity.getId())){//在驳回时不走这一步,判断id为必须
+						workProjectNotify.setUser(activity.getUser());
+						workProjectNotify.setNotifyRole(activity.getRole().getEnname());
+					}
+				}
+				//如果是默认流程,
+				else{
+					//下一步的执行人(角色)已在前面设置
+				}
+			}
+
+			workProjectNotify.setCompanyId(workFullExecute.getCompanyId());
+			workProjectNotify.setContent(workFullExecute.getAct().getComment());
+			workProjectNotify.setType("7");
+			workProjectNotify.setStatus("0");
+			//创建人如果做了撤销操作,无需发送通知
+			if (!workFullExecute.getStatus().equals("4")) {
+				workProjectNotifyService.save(workProjectNotify);
+			}
+			//更新审核状态
+			workFullExecuteDao.updateStatus(workFullExecute);
+
+			System.err.println("项目实施--审核步骤正常");
+
+			return "审核执行成功";
+
+		}catch (ActivitiObjectNotFoundException e){
+			e.printStackTrace();
+			System.err.println("项目实施--重复审批");
+			logger.error("ActivitiObjectNotFoundException -- "+e);
+			return "流程已审批,不能重新审批!";
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			System.err.println("项目实施--审核步骤异常");
+			logger.error("Exception e:"+e);
+			return "审核执行失败!!";
+		}
+	}
+	@Transactional(readOnly = false)
+	public int updateWorkFullManageStatus(WorkFullExecute workFullExecute) {
+		List<WorkFullExecute> workFullExecuteList = findListBelongtoWorkfullmanage(workFullExecute);
+		int flag = 0 ;
+		if(workFullExecuteList != null && workFullExecuteList.size()>0){
+			for(WorkFullExecute w : workFullExecuteList){
+				if(StringUtils.isNotBlank(w.getProcessInstanceId())){
+					String processInstanceId = w.getProcessInstanceId();
+					ProcessInstance processInstance = actTaskService.getProcIns(processInstanceId);
+					if(processInstance!=null){
+						flag++;
+						break;
+					}
+				}
+			}
+		}
+		if(flag==0){
+			updateStatusOfWorkFullManage(workFullExecute.getWorkFullManageId());
+		}
+		return flag;
+	}
+	@Transactional(readOnly = false)
+	private void updateStatusOfWorkFullManage(String workFullManageId) {
+		String updateBy = "";
+		User user = UserUtils.getUser();
+		if(StringUtils.isNotBlank(user.getId())){
+			updateBy = user.getId();
+		}
+		Date updateDate = new Date();
+		Map<String,Object> map = new HashMap<>();
+		map.put("updateBy",updateBy);
+		map.put("updateDate",updateDate);
+		map.put("id",workFullManageId);
+		map.put("fullProjectStatus","4");
+		workFullExecuteDao.updateStatusOfWorkFullManage(map);
+	}
+
+
+	//删除实施文件或底稿
+	@Transactional(readOnly = false)
+	public void delFile(WorkFullExecute workFullExecute, String attachmentFlag) {
+		Workattachment workattachment = workattachmentService.get(workFullExecute.getRemarks());
+		if(workattachment != null){
+			doDelFile(workattachment);
+		}
+	}
+	@Transactional(readOnly = false)
+	public void doDelFile(Workattachment workattachment){
+		workattachmentService.deleteFileFromAliyun(workattachment,workattachment==null?"":workattachment.getUrl());
+		workattachmentService.delete(workattachment);
+	}
+
+}

+ 555 - 0
src/main/java/com/jeeplus/modules/workfullexecute/web/WorkFullExecuteController.java

@@ -0,0 +1,555 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullexecute.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workfullexecute.entity.WorkFullExecute;
+import com.jeeplus.modules.workfullexecute.service.WorkFullExecuteService;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.service.WorkFullManageService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 项目实施Controller
+ * @author fgy
+ * @version 2017-10-27
+ */
+@SuppressWarnings("all")
+@Controller
+@RequestMapping(value = "${adminPath}/workfullexecute/workFullExecute")
+public class WorkFullExecuteController extends BaseController {
+
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkFullExecuteService workFullExecuteService;
+	@Autowired
+	private WorkFullManageService workFullManageService;
+	@Autowired
+	private ActivityService activityService;
+
+	@ModelAttribute
+	public WorkFullExecute get(@RequestParam(required=false) String id) {
+		WorkFullExecute entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workFullExecuteService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkFullExecute();
+		}
+		return entity;
+	}
+
+	/**
+	 * 待实施项目的列表
+	 */
+	@RequiresPermissions("workfullexecute:workFullExecute:workfullmanageList")
+	@RequestMapping("/workfullmanageList")
+	public String workfullmanageList(WorkFullManage workFullManage ,HttpServletRequest request, HttpServletResponse response,Model model){
+		String userId = UserUtils.getUser().getId();
+		//仅是普通员工
+		if(!UserUtils.getSelectRoleInfo()){
+			workFullManage.setQueryCon(userId);
+		}
+
+		Page<WorkFullManage> page = workFullExecuteService.findListOfWorkFullManage(new Page<WorkFullManage>(request, response), workFullManage);
+		model.addAttribute("page", page);
+		return "modules/workfullexecute/workfullmanageList";
+	}
+	/**
+	 * 项目实施记录列表页面
+	 */
+	@RequiresPermissions("workfullexecute:workFullExecute:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkFullExecute workFullExecute, HttpServletRequest request, HttpServletResponse response, Model model) {
+		String workFullManageId = request.getParameter("workFullManageId");
+
+		if(StringUtils.isNotBlank(workFullManageId)){
+			workFullExecute.setWorkFullManageId(workFullManageId);
+		}
+		Page<WorkFullExecute> page = workFullExecuteService.findPage(new Page<WorkFullExecute>(request, response), workFullExecute);
+		model.addAttribute("page", page);
+		model.addAttribute("workFullManage",workFullManageService.get(workFullManageId));
+
+		if(page.getList()!=null && page.getList().size()==0){
+			model.addAttribute("closeable","3");//无项目实施记录
+		}else{
+			WorkFullManage m = workFullManageService.getSimpleWorkFullManage(workFullManageId);
+			if(Integer.parseInt(m.getFullProjectStatus())>=4){
+				model.addAttribute("closeable","2");//实施阶段已过
+			}else {
+				Role role = UserUtils.getSelectRole().get(0);
+				if(role.getDataScope().equals("4")){
+					model.addAttribute("closeable","1");//部门负责人可关闭
+				}else{
+					model.addAttribute("closeable","0");//非部门负责人不可关闭
+				}
+			}
+		}
+		model.addAttribute("workFullManageId",workFullManageId);
+		return "modules/workfullexecute/workFullExecuteList";
+	}
+
+	/**
+	 * 项目实施列表,仅查看---全过程监控
+	 */
+	@RequestMapping("list4monitor")
+	public String list4monitor(WorkFullExecute workFullExecute, HttpServletRequest request, HttpServletResponse response, Model model) {
+		String workFullManageId = request.getParameter("workFullManageId");
+
+		//workFullManageId = request.getSession().getAttribute("workFullManageId").toString();
+
+		if(StringUtils.isNotBlank(workFullManageId)){
+			workFullExecute.setWorkFullManageId(workFullManageId);
+		}
+		Page<WorkFullExecute> page = workFullExecuteService.findPage(new Page<WorkFullExecute>(request, response), workFullExecute);
+		model.addAttribute("page", page);
+		return "modules/workfullexecute/list4monitor";
+	}
+
+	/**
+	 * 查看,增加,编辑项目实施记录表单页面
+	 */
+	@RequiresPermissions(value={"workfullexecute:workFullExecute:view","workfullexecute:workFullExecute:add","workfullexecute:workFullExecute:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkFullExecute workFullExecute, Model model,HttpServletRequest request) {
+		String dialog = request.getParameter("dialog");
+		String workFullManageId = request.getParameter("workFullManageId");
+		String listpage = request.getParameter("listpage");
+		if(StringUtils.isBlank(workFullManageId)){
+			workFullManageId = workFullExecute.getWorkFullManageId();
+		}
+		if(StringUtils.isNotBlank(workFullManageId)){
+			WorkFullManage workFullManage = workFullManageService.get(workFullManageId);
+			model.addAttribute("workFullManage",workFullManage);
+		}
+		model.addAttribute("workFullExecute", workFullExecute);
+		model.addAttribute("listpage",listpage);
+
+		if(workFullExecute.getAct()!=null && StringUtils.isNotBlank(workFullExecute.getAct().getTaskId())){
+			String taskId = workFullExecute.getAct().getTaskId();
+			return "modules/workfullexecute/workFullExecuteAudit";
+		}
+
+		if("add".equals(dialog) || "edit".equals(dialog)){
+			return "modules/workfullexecute/workFullExecuteForm";
+		}
+		if("view".equals(dialog)){
+			return "modules/workfullexecute/workFullExecuteView";
+		}
+		return "modules/workfullexecute/workFullExecuteForm";
+	}
+
+	/**
+	 * 保存项目实施记录
+	 */
+	@RequiresPermissions(value={"workfullexecute:workFullExecute:add","workfullexecute:workFullExecute:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkFullExecute workFullExecute, Model model,HttpServletRequest request,
+					   @RequestParam(value = "listpage",required = false)String listpage,RedirectAttributes redirectAttributes) throws Exception{
+		//被驳回(reapply重新申请,repeal撤销)
+		String submit = request.getParameter("submit");
+		String workFullManageId = request.getParameter("workFullManageId");
+		if (!beanValidator(model, workFullExecute)){
+			return form(workFullExecute, model,null);
+		}
+		if(!workFullExecute.getIsNewRecord()){//编辑表单保存
+			WorkFullExecute t = workFullExecuteService.get(workFullExecute.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workFullExecute, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+
+			//被驳回状态
+			if (StringUtils.isNotBlank(t.getStatus()) &&t.getStatus().equals("3")){
+				ProcessInstance processInstance = actTaskService.getProcIns(t.getProcessInstanceId());
+				if (processInstance!=null) {
+					Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+					Act act = new Act();
+					act.setTaskId(taskInfok.getId());
+					act.setTaskName(taskInfok.getName());
+					act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+					act.setProcDefId(taskInfok.getProcessDefinitionId());
+					act.setProcInsId(taskInfok.getProcessInstanceId());
+					act.setTask(taskInfok);
+					if("reapply".equals(submit)){act.setFlag("yes");}//重新申请
+					if("repeal".equals(submit)){act.setFlag("no");}//撤销
+					t.setAct(act);
+				}
+			}
+			workFullExecuteService.save(t,workFullManageId,submit,request);//保存
+			if("reapply".equals(submit)){
+				addMessage(redirectAttributes,"重新申请项目实施,并发往部门负责人审核");
+			} else if("repeal".equals(submit)){
+				addMessage(redirectAttributes,"已撤销该项目实施");
+			}
+			return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+		}else{//新增表单保存
+			workFullExecute = workFullExecuteService.save(workFullExecute,workFullManageId,submit,request);//保存
+			String result = StringUtils.isNoneBlank(workFullExecute.getId())?"添加项目实施成功":"项目实施添加失败";
+			addMessage(redirectAttributes, result);
+			if(StringUtils.isNotBlank(listpage)&&listpage.equals("workfullmanageList")){
+				return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/"+listpage;
+			}
+			return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+		}
+	}
+
+	/**
+	 * 流程追踪
+	 */
+	@RequestMapping("getProcess")
+	public String getProcess(WorkFullExecute workFullExecute, Model model){
+
+		model.addAttribute("processInstanceId",workFullExecute.getProcessInstanceId());
+		return "modules/workfullexecute/workFullExecuteTask";
+	}
+	/**
+	 * 待办任务
+	 */
+	@RequestMapping("auditTodo")
+	public String auditTodo(Act act , Model model ,HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes){
+		act.setProcDefKey("workFullExecute");
+		List<Act> actList = new ArrayList<>();
+		actList.addAll(actTaskService.todoList(act));
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+
+		List<Activity> activities = activityService.groupByActivityMenu("190aeda1d370481ab80387a71080f93c",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			actList.addAll(actTaskService.todoList(act));
+		}
+
+		List<WorkFullExecute> executesList = new ArrayList<>();
+		Role role = UserUtils.getSelectRole().get(0);
+		String officeId = "";
+		if(role.getDataScope().equals("4")){
+			User user = UserUtils.getUser();
+			officeId = user.getOffice().getId();
+		}
+
+		for(Act a : actList){
+			//重新申请和撤销不在代办和历史任务列表展示
+			if("audit".equals(a.getTask().getTaskDefinitionKey())||(! "reapply".equals(a.getTask().getTaskDefinitionKey()) && !a.getTask().getTaskDefinitionKey().contains("audit"))){
+				WorkFullExecute workFullExecute = workFullExecuteService.getByProcessInstanceId(a.getProcInsId());
+				if(workFullExecute != null){
+					workFullExecute = workFullExecuteService.get(workFullExecute.getId());
+				}
+				if(workFullExecute != null && workFullExecute.getCompanyId().equals(companyId)){
+					User createBy = UserUtils.get(workFullExecute.getCreateBy().getId());
+					if (StringUtils.isNotBlank(officeId)) {
+						if (officeId.equals(createBy.getOffice().getId())) {
+							if (a.getVars().getMap().get("applyUserId") != null) {
+								User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+								if (user != null) {
+									a.getVars().getMap().put("applyUserId", UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+								}
+							}
+							workFullExecute.setAct(a);
+							if (workFullExecute.getWorkFullManage() != null && workFullExecute.getWorkFullManage().getId() != null) {
+								WorkFullManage workFullManage = workFullManageService.get(workFullExecute.getWorkFullManage().getId());
+								workFullExecute.setWorkFullManage(workFullManage);
+							}
+							if (StringUtils.isNotBlank(workFullExecute.getId())) {
+								workFullExecute.setName(officeService.get(companyId).getName());
+							}
+							executesList.add(workFullExecute);
+						}
+					}else{
+						if(a.getVars().getMap().get("applyUserId") != null){
+							User user = UserUtils.get(a.getVars().getMap().get("applyUserId").toString());
+							if(user != null){
+								a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+							}
+						}
+						workFullExecute.setAct(a);
+						if(workFullExecute.getWorkFullManage()!=null && workFullExecute.getWorkFullManage().getId()!=null){
+							WorkFullManage workFullManage = workFullManageService.get(workFullExecute.getWorkFullManage().getId());
+							workFullExecute.setWorkFullManage(workFullManage);
+						}
+						if(StringUtils.isNotBlank(workFullExecute.getId())){
+							workFullExecute.setName(officeService.get(companyId).getName());
+						}
+						executesList.add(workFullExecute);
+					}
+				}
+			}
+		}
+
+		model.addAttribute("list", executesList);
+		return "modules/workfullexecute/workFullExecuteAuditTodo";
+
+	}
+
+	/**
+	 * 已办任务
+	 */
+	@RequestMapping("auditHistory")
+	public String auditHistory(Act act , Model model,HttpServletRequest request,HttpServletResponse response){
+		act.setProcDefKey("workFullExecute");
+		List<Act> list = actTaskService.historicList(act);
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+
+		List<Activity> activities = activityService.groupByActivityMenu("190aeda1d370481ab80387a71080f93c",companyId);
+		for (Activity activity:activities){
+			act.setProcDefKey(activity.getProcessKey());
+			list.addAll(actTaskService.historicList(act));
+		}
+
+		List<WorkFullExecute> workFullExecuteList = new ArrayList<WorkFullExecute>();
+		Role role = UserUtils.getSelectRole().get(0);
+		String officeId = "";
+		if(role.getDataScope().equals("4")){
+			User user = UserUtils.getUser();
+			officeId = user.getOffice().getId();
+		}
+		for (Act a : list) {
+			//重新申请和撤销不展示在代办和历史任务列表里
+			if(! "reapply".equals(a.getHistTask().getTaskDefinitionKey())){
+				WorkFullExecute workFullExecute = workFullExecuteService.getByProcessInstanceId(a.getHistTask().getProcessInstanceId());
+				if(workFullExecute != null){
+					workFullExecute = workFullExecuteService.get(workFullExecute.getId());
+				}
+				if (workFullExecute != null && workFullExecute.getCompanyId().equals(companyId)) {
+					User createBy = UserUtils.get(workFullExecute.getCreateBy().getId());
+					if (StringUtils.isNotBlank(officeId)) {
+						if (officeId.equals(createBy.getOffice().getId())) {
+							if (a.getVars().getMap().get("applyUserId")!=null){
+								a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+							}
+							workFullExecute.setAct(a);
+							if(workFullExecute.getWorkFullManage()!=null && workFullExecute.getWorkFullManage().getId()!=null){
+								WorkFullManage workFullManage = workFullManageService.get(workFullExecute.getWorkFullManage().getId());
+								workFullExecute.setWorkFullManage(workFullManage);
+							}
+							if (StringUtils.isNotBlank(workFullExecute.getId())){
+								workFullExecute.setName(officeService.get(companyId).getName());
+							}
+							workFullExecuteList.add(workFullExecute);
+						}
+					}else {
+						if (a.getVars().getMap().get("applyUserId")!=null){
+							a.getVars().getMap().put("applyUserId",UserUtils.get(a.getVars().getMap().get("applyUserId").toString()).getName());
+						}
+						workFullExecute.setAct(a);
+						if(workFullExecute.getWorkFullManage()!=null && workFullExecute.getWorkFullManage().getId()!=null){
+							WorkFullManage workFullManage = workFullManageService.get(workFullExecute.getWorkFullManage().getId());
+							workFullExecute.setWorkFullManage(workFullManage);
+						}
+						if (StringUtils.isNotBlank(workFullExecute.getId())){
+							workFullExecute.setName(officeService.get(companyId).getName());
+						}
+						workFullExecuteList.add(workFullExecute);
+					}
+				}
+			}
+		}
+		model.addAttribute("list", workFullExecuteList);
+		return "modules/workfullexecute/workFullExecuteAuditHistory";
+
+	}
+
+	/**
+	 * 打开审核框
+	 */
+	@RequestMapping("applyOnWorkFullExecute")
+	public String applyOnWorkFullExecute(Act act){
+		// 获取流程XML上的表单KEY
+		String formKey = "/workfullexecute/workFullExecute/form";
+		//logger.info("------formKeys:"+formKeys);
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+		}
+		return "redirect:" + ActUtils.getFormUrl(formKey, act);
+	}
+
+	/**
+	 * 部门负责人审核
+	 */
+	@RequestMapping("saveAudit")
+	public String saveAudit(WorkFullExecute workFullExecute, Map<String, Object> vars, Model model, RedirectAttributes redirectAttributes) {
+		/*if (StringUtils.isBlank(workFullExecute.getAct().getComment())){
+			addMessage(model, "请填写审核意见。");
+			return form(workFullExecute, model,null);
+		}*/
+		String message = workFullExecuteService.auditSave(workFullExecute);
+		addMessage(redirectAttributes, message);
+		return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+	}
+	/**
+	 * 删除项目实施记录
+	 */
+	@RequiresPermissions("workfullexecute:workFullExecute:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkFullExecute workFullExecute, HttpServletRequest request, HttpServletResponse response, Model model) {
+		workFullExecuteService.delete(workFullExecute);
+		WorkFullExecute w = new WorkFullExecute();
+		w.setWorkFullManageId(workFullExecute.getWorkFullManageId());
+		model.addAttribute("workFullExecute",w);
+		model.addAttribute("message","删除项目实施成功");
+		return list(w,request,response,model);
+	}
+	/**
+	 *  删除附件(实施文件或底稿)
+	 */
+	@ResponseBody
+	@RequestMapping("delFile")
+	public AjaxJson delFile(WorkFullExecute workFullExecute , HttpServletRequest request, HttpServletResponse response,Model model){
+//		String attachmentFlag = request.getParameter("attachmentFlag");
+//		workFullExecuteService.delFile(workFullExecute,attachmentFlag);
+//		workFullExecute = workFullExecuteService.get(workFullExecute.getId());
+//		model.addAttribute("workFullExecute",workFullExecute);
+//		return form(workFullExecute,model,request);
+		String workFullDesignchangeId = request.getParameter("id");
+		String attaId = request.getParameter("attaId");
+		String attachmentUrl = request.getParameter("attachmentUrl");
+		workFullExecute.setRemarks(attaId);
+		workFullExecuteService.delFile(workFullExecute,attachmentUrl);
+		AjaxJson ajaxJson = new AjaxJson();
+		ajaxJson.put("attachmentUrl",attachmentUrl);
+		return ajaxJson;
+	}
+	//结束项目实施,由部门负责人操作
+	@RequestMapping("closeWorkFullExecute")
+	public String closeWorkFullExecute(@RequestParam("workFullManageId") String workFullManageId,RedirectAttributes redirectAttributes,Model model){
+		WorkFullExecute workFullExecute = new WorkFullExecute();
+		if(StringUtils.isNotBlank(workFullManageId)){
+			workFullExecute.setWorkFullManageId(workFullManageId);
+			int flag = workFullExecuteService.updateWorkFullManageStatus(workFullExecute);
+			if(flag == 0){
+				addMessage(redirectAttributes,"关闭项目实施成功!");
+			}else{
+				addMessage(redirectAttributes,"项目实施列表中有些未完成审批,请等待全部流程完成,再次尝试此操作");
+				//return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/auditTodo";
+			}
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+	}
+
+	/**
+	 * 批量删除项目实施记录 (暂时不做批量删除操作,该方法没有写完整)
+	 */
+//	@RequiresPermissions("workfullexecute:workFullExecute:del")
+//	@RequestMapping(value = "deleteAll")
+//	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+//		String idArray[] =ids.split(",");
+//		for(String id : idArray){
+//			workFullExecuteService.delete(workFullExecuteService.get(id));
+//		}
+//		addMessage(redirectAttributes, "删除项目实施记录成功");
+//		return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+//	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workfullexecute:workFullExecute:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkFullExecute workFullExecute, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "项目实施记录"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkFullExecute> page = workFullExecuteService.findPage(new Page<WorkFullExecute>(request, response, -1), workFullExecute);
+    		new ExportExcel("项目实施记录", WorkFullExecute.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出项目实施记录记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workfullexecute:workFullExecute:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkFullExecute> list = ei.getDataList(WorkFullExecute.class);
+			for (WorkFullExecute workFullExecute : list){
+				try{
+					workFullExecuteService.save(workFullExecute);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条项目实施记录记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条项目实施记录记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入项目实施记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+    }
+	
+	/**
+	 * 下载导入项目实施记录数据模板
+	 */
+	@RequiresPermissions("workfullexecute:workFullExecute:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "项目实施记录数据导入模板.xlsx";
+    		List<WorkFullExecute> list = Lists.newArrayList(); 
+    		new ExportExcel("项目实施记录数据", WorkFullExecute.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullexecute/workFullExecute/?repage";
+    }
+	
+	
+	
+
+}

+ 18 - 0
src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullConstructDao.java

@@ -0,0 +1,18 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullConstruct;
+
+/**
+ * 施工监理设计单位联系人DAO接口
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@MyBatisDao
+public interface WorkFullConstructDao extends CrudDao<WorkFullConstruct> {
+
+}

+ 18 - 0
src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullDesignDao.java

@@ -0,0 +1,18 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullDesign;
+
+/**
+ * 施工监理设计单位联系人DAO接口
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@MyBatisDao
+public interface WorkFullDesignDao extends CrudDao<WorkFullDesign> {
+
+}

+ 53 - 0
src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullManageDao.java

@@ -0,0 +1,53 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workproject.entity.WorkProject;
+
+import java.util.List;
+
+/**
+ * 全过程管理DAO接口
+ * @author mapengbo
+ * @version 2017-10-24
+ */
+@MyBatisDao
+public interface WorkFullManageDao extends CrudDao<WorkFullManage> {
+
+    /**
+     * 主办负责人
+     * @return
+     */
+	public int insertHostMaster(WorkFullManage workFullManage);
+
+    /**
+     * 协办负责人
+     * @param workFullManage
+     * @return
+     */
+	public int insertFollowMaster(WorkFullManage workFullManage);
+
+    /**
+     * 主办成员
+     * @param workFullManage
+     * @return
+     */
+	public int insertHostMember(WorkFullManage workFullManage);
+
+    /**
+     * 协办成员
+     * @param workFullManage
+     * @return
+     */
+	public int insertFollowMember(WorkFullManage workFullManage);
+    //根据总项目外键获取
+    public WorkFullManage getByPId(WorkProject workProject);
+
+    public List<WorkFullManage> findListByprojectt(WorkFullManage workFullManage);
+
+    public List<WorkFullManage> findByList(WorkFullManage workFullManage);
+}

+ 56 - 0
src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullPayDao.java

@@ -0,0 +1,56 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullPay;
+
+/**
+ * 工程计量支付DAO接口
+ * @author mapengbo
+ * @version 2017-11-03
+ */
+@MyBatisDao
+public interface WorkFullPayDao extends CrudDao<WorkFullPay> {
+
+    /**
+     * 查询记录数
+     * @return
+     */
+	public int queryCount(WorkFullPay workFullPay);
+
+    /**
+     * 查询累计支付金额
+     * @return
+     */
+	public String querySum(WorkFullPay workFullPay);
+
+    /**
+     * 更新流程实例ID
+     * @return
+     */
+    public int updateProcessInstanceId(WorkFullPay workFullPay);
+
+    /**
+     * 根据流程实例ID获取WorkReimbursement
+     * @param processInstanceId
+     * @return
+     */
+    public WorkFullPay getByProcessInstanceId(String processInstanceId);
+
+    /**
+     * 获取第一条记录
+     * @param workFullPay
+     * @return
+     */
+    public WorkFullPay getFirstRecord(WorkFullPay workFullPay);
+
+    /**
+     * 查询是否存在状态不为已通过的数据
+     * @param workFullPay
+     * @return
+     */
+    public int getStatusNotFour(WorkFullPay workFullPay);
+}

+ 40 - 0
src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullRecordDao.java

@@ -0,0 +1,40 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullRecord;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 全过程管理项目归档DAO接口
+ * @author mapengbo
+ * @version 2017-11-01
+ */
+@MyBatisDao
+public interface WorkFullRecordDao extends CrudDao<WorkFullRecord> {
+
+    /**
+     * 更新流程实例ID
+     * @return
+     */
+    public int updateProcessInstanceId(WorkFullRecord workFullRecord);
+
+    /**
+     * 根据流程实例ID获取WorkReimbursement
+     * @param processInstanceId
+     * @return
+     */
+    public WorkFullRecord getByProcessInstanceId(String processInstanceId);
+
+    /**
+     * 查询文件管理员
+     * @return
+     */
+    public HashMap<Object,Object> queryWjgly(Map<Object,Object> map);
+
+}

+ 18 - 0
src/main/java/com/jeeplus/modules/workfullmanage/dao/WorkFullSurveyDao.java

@@ -0,0 +1,18 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullSurvey;
+
+/**
+ * 施工监理设计单位联系人DAO接口
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@MyBatisDao
+public interface WorkFullSurveyDao extends CrudDao<WorkFullSurvey> {
+
+}

+ 57 - 0
src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullConstruct.java

@@ -0,0 +1,57 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 施工单位联系人Entity
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+public class WorkFullConstruct extends DataEntity<WorkFullConstruct> {
+
+	private static final long serialVersionUID = 1L;
+	private String unitName;		// 单位名称
+	private String unitLinkMan;		// 联系人姓名
+	private String linkPhone;		// 联系方式
+
+	public WorkFullConstruct() {
+		super();
+	}
+
+	public WorkFullConstruct(String id){
+		super(id);
+	}
+
+	@ExcelField(title="联系人姓名", align=2, sort=1)
+	public String getUnitName() {
+		return unitName;
+	}
+
+	public void setUnitName(String unitName) {
+		this.unitName = unitName;
+	}
+	
+	@ExcelField(title="职务", align=2, sort=2)
+	public String getUnitLinkMan() {
+		return unitLinkMan;
+	}
+
+	public void setUnitLinkMan(String unitLinkMan) {
+		this.unitLinkMan = unitLinkMan;
+	}
+	
+	@ExcelField(title="QQ", align=2, sort=3)
+	public String getLinkPhone() {
+		return linkPhone;
+	}
+
+	public void setLinkPhone(String linkPhone) {
+		this.linkPhone = linkPhone;
+	}
+	
+}

+ 57 - 0
src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullDesign.java

@@ -0,0 +1,57 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 设计单位联系人Entity
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+public class WorkFullDesign extends DataEntity<WorkFullDesign> {
+	
+	private static final long serialVersionUID = 1L;
+	private String unitName;		// 单位名称
+	private String unitLinkMan;		// 联系人
+	private String linkPhone;		// 联系电话
+
+	public WorkFullDesign() {
+		super();
+	}
+
+	public WorkFullDesign(String id){
+		super(id);
+	}
+
+	@ExcelField(title="联系人姓名", align=2, sort=1)
+	public String getUnitName() {
+		return unitName;
+	}
+
+	public void setUnitName(String unitName) {
+		this.unitName = unitName;
+	}
+	
+	@ExcelField(title="职务", align=2, sort=2)
+	public String getUnitLinkMan() {
+		return unitLinkMan;
+	}
+
+	public void setUnitLinkMan(String unitLinkMan) {
+		this.unitLinkMan = unitLinkMan;
+	}
+	
+	@ExcelField(title="QQ", align=2, sort=3)
+	public String getLinkPhone() {
+		return linkPhone;
+	}
+
+	public void setLinkPhone(String linkPhone) {
+		this.linkPhone = linkPhone;
+	}
+
+}

+ 795 - 0
src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullManage.java

@@ -0,0 +1,795 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.entity;
+
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.Collections3;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workproject.entity.WorkProject;
+import com.jeeplus.modules.workprojectcompletion.entity.WorkProjectCompletionInfo;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 全过程管理Entity
+ * @author mapengbo
+ * @version 2017-10-24
+ */
+public class WorkFullManage extends DataEntity<WorkFullManage> {
+	
+	private static final long serialVersionUID = 1L;
+	private String contractId;		// 合同编号
+	private String fullProjectNumber;		// 项目编号
+	private String fullProjectSource;		// 项目来源
+	private String fullProjectName;		// 项目名称
+	private String fullIndustryType;		// 行业分类
+	private String fullStructureType;		// 结构类型
+	private String fullInvestMoney;		// 投资金额
+	private String clientId;		// 委托方
+	private String buildId;		// 建设方s
+	private String fullProjectType;		// 项目分类
+//	private String fullProjectAddress;		// 工程所在地
+	private String fullProjectProperty;		// 工程性质
+	private String fullProjectScale;		// 工程规模
+	private String fullCountUnit;		// 计量单位
+	private String fullProjectFeature;		// 项目特性
+	private Office hostCompany;		// 主办公司及部门
+	private Office followCompany;		// 协办公司及部门
+	private Date talkStartTime;		// 洽谈开始时间
+	private Date talkEndTime;		// 洽谈结束时间
+	private String askPayMode;		// 咨询费用支付方式
+	private String standardExplain;		// 标准说明
+	private String fixedPrice;		// 固定价
+	private String clientRequire;		// 业主要求
+	private String hostMaster;	//主办负责人编号
+	private String hostMasterName;	//主办负责人名称
+	private String followMaster;	//协办负责人编号
+	private String followMasterName;	//协办负责人名称
+	private String hostMember;		//主办项目成员编号
+	private String hostMemberName;	//主办项目成员名称
+	private String followMember;	//协办项目成员编号
+	private String followMemberName; //协办项目成员
+	private String ciName; //委托方名称
+	private String fullProjectStatus; //项目状态
+	private WorkFullConstruct constructId; //施工单位编号
+	private WorkFullSurvey surveyId;  //监理单位编号
+	private WorkFullDesign designId; //设计单位编号
+	private WorkContractInfo workContractInfo; //合同信息
+	private WorkClientInfo workClientInfo;
+	private WorkClientInfo workBuildInfo;
+	private String queryCon; //查询条件
+	private String companyId; //公司编号
+	private String officeId;
+	private String workVisaCount;//签证单数量
+	private String workAskCheckPriceCount;//询价与核价数量
+	private String query2;
+	private WorkProject workProject;//总项目外键
+	private Area area;		// 地区Id
+	private WorkProjectCompletionInfo workProjectCompletion;
+	private String masterId;
+	private String contractName;
+	private String ext;
+	private String isTotal;
+	private String totalFullName;
+	private String psort;//行业大分类
+	private String ssort; //行业详细分类
+	private String totalFullId; //父节点
+	private String totalFullNumber;
+	private String totalFullIds; //所有父节点
+	private String commonFlag; //标识同一个总合同
+	private String isTotalName; //标识当前项目级别
+	private Integer sort = 30;
+	private String projectId;
+	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
+
+	public List<WorkClientAttachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<WorkClientAttachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	private WorkFullRecord workFullRecord; //项目归档实体类
+
+	public WorkProject getWorkProject() {
+		return workProject;
+	}
+
+	public void setWorkProject(WorkProject workProject) {
+		this.workProject = workProject;
+	}
+
+	//附件列表
+//	private List<WorkClientAttachment> workClientAttachmentList = Lists.newArrayList();
+	// 主办公司负责人
+	private List<User> hostMasterList = new ArrayList<User>();
+	// 协办公司负责人
+	private List<User> followMasterList = new ArrayList<>();
+	// 主办公司项目成员
+	private List<User> hostMemberList = new ArrayList<>();
+	// 协办公司项目成员
+	private List<User> followMemberList = new ArrayList<>();
+	public WorkFullManage() {
+		super();
+	}
+
+	public String getPsort() {
+		return psort;
+	}
+
+	public void setPsort(String psort) {
+		this.psort = psort;
+	}
+
+	public String getSsort() {
+		return ssort;
+	}
+
+	public void setSsort(String ssort) {
+		this.ssort = ssort;
+	}
+
+	public WorkFullManage(String id){
+		super(id);
+	}
+
+	public String getWorkAskCheckPriceCount() {
+		return workAskCheckPriceCount;
+	}
+
+	public void setWorkAskCheckPriceCount(String workAskCheckPriceCount) {
+		this.workAskCheckPriceCount = workAskCheckPriceCount;
+	}
+
+	public String getWorkVisaCount() {
+		return workVisaCount;
+	}
+
+	public void setWorkVisaCount(String workVisaCount) {
+		this.workVisaCount = workVisaCount;
+	}
+
+	public String getExt() {
+		return ext;
+	}
+
+	public void setExt(String ext) {
+		this.ext = ext;
+	}
+
+	public String getContractName() {
+		return contractName;
+	}
+
+	public void setContractName(String contractName) {
+		this.contractName = contractName;
+	}
+
+	@ExcelField(title="合同编号", align=2, sort=7)
+	public String getContractId() {
+		return contractId;
+	}
+
+	public void setContractId(String contractId) {
+		this.contractId = contractId;
+	}
+	
+	@ExcelField(title="项目编号", align=2, sort=8)
+	public String getFullProjectNumber() {
+		return fullProjectNumber;
+	}
+
+	public void setFullProjectNumber(String fullProjectNumber) {
+		this.fullProjectNumber = fullProjectNumber;
+	}
+	
+	@ExcelField(title="项目来源", align=2, sort=9)
+	public String getFullProjectSource() {
+		return fullProjectSource;
+	}
+
+	public void setFullProjectSource(String fullProjectSource) {
+		this.fullProjectSource = fullProjectSource;
+	}
+	
+	@ExcelField(title="项目名称", align=2, sort=10)
+	public String getFullProjectName() {
+		return fullProjectName;
+	}
+
+	public void setFullProjectName(String fullProjectName) {
+		this.fullProjectName = fullProjectName;
+	}
+	
+	@ExcelField(title="行业分类", dictType="full_industry_type", align=2, sort=11)
+	public String getFullIndustryType() {
+		return fullIndustryType;
+	}
+
+	public void setFullIndustryType(String fullIndustryType) {
+		this.fullIndustryType = fullIndustryType;
+	}
+	
+	@ExcelField(title="结构类型", dictType="full_structure_type", align=2, sort=12)
+	public String getFullStructureType() {
+		return fullStructureType;
+	}
+
+	public void setFullStructureType(String fullStructureType) {
+		this.fullStructureType = fullStructureType;
+	}
+	
+	@ExcelField(title="投资金额", align=2, sort=13)
+	public String getFullInvestMoney() {
+		return fullInvestMoney;
+	}
+
+	public void setFullInvestMoney(String fullInvestMoney) {
+		this.fullInvestMoney = fullInvestMoney;
+	}
+	
+	@ExcelField(title="委托方", align=2, sort=14)
+	public String getClientId() {
+		return clientId;
+	}
+
+	public void setClientId(String clientId) {
+		this.clientId = clientId;
+	}
+	
+	@ExcelField(title="建设方", align=2, sort=15)
+	public String getBuildId() {
+		return buildId;
+	}
+
+	public void setBuildId(String buildId) {
+		this.buildId = buildId;
+	}
+	
+	@ExcelField(title="项目分类", align=2, sort=16)
+	public String getFullProjectType() {
+		return fullProjectType;
+	}
+
+	public void setFullProjectType(String fullProjectType) {
+		this.fullProjectType = fullProjectType;
+	}
+	
+//	@ExcelField(title="工程所在地", align=2, sort=17)
+//	public String getFullProjectAddress() {
+//		return fullProjectAddress;
+//	}
+//
+//	public void setFullProjectAddress(String fullProjectAddress) {
+//		this.fullProjectAddress = fullProjectAddress;
+//	}
+	
+	@ExcelField(title="工程性质", align=2, sort=18)
+	public String getFullProjectProperty() {
+		return fullProjectProperty;
+	}
+
+	public void setFullProjectProperty(String fullProjectProperty) {
+		this.fullProjectProperty = fullProjectProperty;
+	}
+	
+	@ExcelField(title="工程规模", align=2, sort=19)
+	public String getFullProjectScale() {
+		return fullProjectScale;
+	}
+
+	public void setFullProjectScale(String fullProjectScale) {
+		this.fullProjectScale = fullProjectScale;
+	}
+	
+	@ExcelField(title="计量单位", dictType="full_count_unit", align=2, sort=20)
+	public String getFullCountUnit() {
+		return fullCountUnit;
+	}
+
+	public void setFullCountUnit(String fullCountUnit) {
+		this.fullCountUnit = fullCountUnit;
+	}
+	
+	@ExcelField(title="项目特性", align=2, sort=21)
+	public String getFullProjectFeature() {
+		return fullProjectFeature;
+	}
+
+	public void setFullProjectFeature(String fullProjectFeature) {
+		this.fullProjectFeature = fullProjectFeature;
+	}
+
+	public Office getHostCompany() {
+		return hostCompany;
+	}
+
+	public void setHostCompany(Office hostCompany) {
+		this.hostCompany = hostCompany;
+	}
+
+	public Office getFollowCompany() {
+		return followCompany;
+	}
+
+	public void setFollowCompany(Office followCompany) {
+		this.followCompany = followCompany;
+	}
+
+	public List<User> getHostMasterList() {
+		return hostMasterList;
+	}
+
+	public void setHostMasterList(List<User> hostMasterList) {
+		this.hostMasterList = hostMasterList;
+	}
+
+	public List<User> getFollowMasterList() {
+		return followMasterList;
+	}
+
+	public void setFollowMasterList(List<User> followMasterList) {
+		this.followMasterList = followMasterList;
+	}
+
+	public List<User> getHostMemberList() {
+		return hostMemberList;
+	}
+
+	public void setHostMemberList(List<User> hostMemberList) {
+		this.hostMemberList = hostMemberList;
+	}
+
+	public List<User> getFollowMemberList() {
+		return followMemberList;
+	}
+
+	public void setFollowMemberList(List<User> followMemberList) {
+		this.followMemberList = followMemberList;
+	}
+
+	@ExcelField(title="洽谈开始时间", align=2, sort=28)
+	public Date getTalkStartTime() {
+		return talkStartTime;
+	}
+
+	public void setTalkStartTime(Date talkStartTime) {
+		this.talkStartTime = talkStartTime;
+	}
+	
+	@ExcelField(title="洽谈结束时间", align=2, sort=29)
+	public Date getTalkEndTime() {
+		return talkEndTime;
+	}
+
+	public void setTalkEndTime(Date talkEndTime) {
+		this.talkEndTime = talkEndTime;
+	}
+	
+	@ExcelField(title="咨询费用支付方式", dictType="ask_pay_mode", align=2, sort=30)
+	public String getAskPayMode() {
+		return askPayMode;
+	}
+
+	public void setAskPayMode(String askPayMode) {
+		this.askPayMode = askPayMode;
+	}
+	
+	@ExcelField(title="标准说明", align=2, sort=31)
+	public String getStandardExplain() {
+		return standardExplain;
+	}
+
+	public void setStandardExplain(String standardExplain) {
+		this.standardExplain = standardExplain;
+	}
+	
+	@ExcelField(title="固定价", align=2, sort=32)
+	public String getFixedPrice() {
+		return fixedPrice;
+	}
+
+	public void setFixedPrice(String fixedPrice) {
+		this.fixedPrice = fixedPrice;
+	}
+	
+	@ExcelField(title="业主要求", align=2, sort=33)
+	public String getClientRequire() {
+		return clientRequire;
+	}
+
+	public void setClientRequire(String clientRequire) {
+		this.clientRequire = clientRequire;
+	}
+
+	public WorkFullConstruct getConstructId() {
+		return constructId;
+	}
+
+	public void setConstructId(WorkFullConstruct constructId) {
+		this.constructId = constructId;
+	}
+
+	public WorkFullSurvey getSurveyId() {
+		return surveyId;
+	}
+
+	public void setSurveyId(WorkFullSurvey surveyId) {
+		this.surveyId = surveyId;
+	}
+
+	public WorkFullDesign getDesignId() {
+		return designId;
+	}
+
+	public void setDesignId(WorkFullDesign designId) {
+		this.designId = designId;
+	}
+
+	public String getHostMaster() {
+		return hostMaster;
+	}
+
+	public void setHostMaster(String hostMaster) {
+		this.hostMaster = hostMaster;
+	}
+
+	public String getFollowMaster() {
+		return followMaster;
+	}
+
+	public void setFollowMaster(String followMaster) {
+		this.followMaster = followMaster;
+	}
+
+	public String getHostMember() {
+		return hostMember;
+	}
+
+	public void setHostMember(String hostMember) {
+		this.hostMember = hostMember;
+	}
+
+	public String getFollowMember() {
+		return followMember;
+	}
+
+	public void setFollowMember(String followMember) {
+		this.followMember = followMember;
+	}
+
+	public WorkContractInfo getWorkContractInfo() {
+		return workContractInfo;
+	}
+
+	public void setWorkContractInfo(WorkContractInfo workContractInfo) {
+		this.workContractInfo = workContractInfo;
+	}
+
+	public String getHostMasterName() {
+		return hostMasterName;
+	}
+
+	public void setHostMasterName(String hostMasterName) {
+		this.hostMasterName = hostMasterName;
+	}
+
+	public String getFollowMasterName() {
+		return followMasterName;
+	}
+
+	public void setFollowMasterName(String followMasterName) {
+		this.followMasterName = followMasterName;
+	}
+
+	public String getHostMemberName() {
+		return hostMemberName;
+	}
+
+	public void setHostMemberName(String hostMemberName) {
+		this.hostMemberName = hostMemberName;
+	}
+
+	public String getFollowMemberName() {
+		return followMemberName;
+	}
+
+	public void setFollowMemberName(String followMemberName) {
+		this.followMemberName = followMemberName;
+	}
+
+	public WorkClientInfo getWorkClientInfo() {
+		return workClientInfo;
+	}
+
+	public void setWorkClientInfo(WorkClientInfo workClientInfo) {
+		this.workClientInfo = workClientInfo;
+	}
+
+	public WorkClientInfo getWorkBuildInfo() {
+		return workBuildInfo;
+	}
+
+	public void setWorkBuildInfo(WorkClientInfo workBuildInfo) {
+		this.workBuildInfo = workBuildInfo;
+	}
+
+	public String getCiName() {
+		return ciName;
+	}
+
+	public void setCiName(String ciName) {
+		this.ciName = ciName;
+	}
+
+	public String getFullProjectStatus() {
+		return fullProjectStatus;
+	}
+
+	public void setFullProjectStatus(String fullProjectStatus) {
+		this.fullProjectStatus = fullProjectStatus;
+	}
+
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	@ExcelField(title="主办公司项目负责人", align=2, sort=13)
+	public String getHostMasterIds() {
+		return Collections3.extractToString(hostMasterList, "id", ",") ;
+	}
+
+	public void setHostMasterIds(String hostMaster) {
+		this.hostMasterList = Lists.newArrayList();
+		for (String id : StringUtils.split(hostMaster, ",")){
+			this.hostMasterList.add(new User(id));
+		}
+	}
+
+	public String getQueryCon() {
+		return queryCon;
+	}
+
+	public void setQueryCon(String queryCon) {
+		this.queryCon = queryCon;
+	}
+
+	public String getQuery2() {
+		return query2;
+	}
+
+	public void setQuery2(String query2) {
+		this.query2 = query2;
+	}
+
+//	public List<WorkClientAttachment> getWorkClientAttachmentList() {
+//		return workClientAttachmentList;
+//	}
+//
+//	public void setWorkClientAttachmentList(List<WorkClientAttachment> workClientAttachmentList) {
+//		this.workClientAttachmentList = workClientAttachmentList;
+//	}
+
+	public WorkFullRecord getWorkFullRecord() {
+		return workFullRecord;
+	}
+
+	public void setWorkFullRecord(WorkFullRecord workFullRecord) {
+		this.workFullRecord = workFullRecord;
+	}
+
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+
+	/**
+	 * 主办公司项目负责人
+	 * @return
+	 */
+	public String getHostMasterNames() {
+		return Collections3.extractToString(hostMasterList, "name", ",") ;
+	}
+	/**
+	 * 主办公司项目负责人
+	 * @return
+	 */
+	public void setHostMasterNames(String hostMaster) {
+		// 什么也不做
+	}
+
+	@ExcelField(title="协办公司项目负责人", align=2, sort=13)
+	public String getFollowMasterIds() {
+		return Collections3.extractToString(followMasterList, "id", ",") ;
+	}
+
+	public void setFollowMasterIds(String followMaster) {
+		this.followMasterList = Lists.newArrayList();
+		for (String id : StringUtils.split(followMaster, ",")){
+			this.followMasterList.add(new User(id));
+		}
+	}
+	/**
+	 * 协办公司项目负责人
+	 * @return
+	 */
+	public String getFollowMasterNames() {
+		return Collections3.extractToString(followMasterList, "name", ",") ;
+	}
+	/**
+	 * 协办公司项目负责人
+	 * @return
+	 */
+	public void setFollowMasterNames(String followMaster) {
+		// 什么也不做
+	}
+
+	@ExcelField(title="主办公司项目成员", align=2, sort=13)
+	public String getHostMemberIds() {
+		return Collections3.extractToString(hostMemberList, "id", ",") ;
+	}
+
+	public void setHostMemberIds(String hostMember) {
+		this.hostMemberList = Lists.newArrayList();
+		for (String id : StringUtils.split(hostMember, ",")){
+			this.hostMemberList.add(new User(id));
+		}
+	}
+	/**
+	 * 主办公司项目负责人
+	 * @return
+	 */
+	public String getHostMemberNames() {
+		return Collections3.extractToString(hostMemberList, "name", ",") ;
+	}
+	/**
+	 * 主办公司项目负责人
+	 * @return
+	 */
+	public void setHostMemberNames(String hostMember) {
+		// 什么也不做
+	}
+
+
+	@ExcelField(title="协办公司项目成员", align=2, sort=13)
+	public String getFollowMemberIds() {
+		return Collections3.extractToString(followMemberList, "id", ",") ;
+	}
+
+	public void setFollowMemberIds(String followMember) {
+		this.followMemberList = Lists.newArrayList();
+		for (String id : StringUtils.split(followMember, ",")){
+			this.followMemberList.add(new User(id));
+		}
+	}
+	/**
+	 * 主办公司项目负责人
+	 * @return
+	 */
+	public String getFollowMemberNames() {
+		return Collections3.extractToString(followMemberList, "name", ",") ;
+	}
+	/**
+	 * 主办公司项目负责人
+	 * @return
+	 */
+	public void setFollowMemberNames(String followMember) {
+		// 什么也不做
+	}
+
+	public Area getArea() {
+		return area;
+	}
+
+	public void setArea(Area area) {
+		this.area = area;
+	}
+
+	public WorkProjectCompletionInfo getWorkProjectCompletion() {
+		return workProjectCompletion;
+	}
+
+	public void setWorkProjectCompletion(WorkProjectCompletionInfo workProjectCompletion) {
+		this.workProjectCompletion = workProjectCompletion;
+	}
+
+	public String getMasterId() {
+		return masterId;
+	}
+
+	public void setMasterId(String masterId) {
+		this.masterId = masterId;
+	}
+
+	public String getIsTotal() {
+		return isTotal;
+	}
+
+	public void setIsTotal(String isTotal) {
+		this.isTotal = isTotal;
+	}
+
+	public String getTotalFullName() {
+		return totalFullName;
+	}
+
+	public void setTotalFullName(String totalFullName) {
+		this.totalFullName = totalFullName;
+	}
+
+	public String getTotalFullId() {
+		return totalFullId;
+	}
+
+	public void setTotalFullId(String totalFullId) {
+		this.totalFullId = totalFullId;
+	}
+
+	public String getTotalFullNumber() {
+		return totalFullNumber;
+	}
+
+	public void setTotalFullNumber(String totalFullNumber) {
+		this.totalFullNumber = totalFullNumber;
+	}
+
+	public String getTotalFullIds() {
+		return totalFullIds;
+	}
+
+	public void setTotalFullIds(String totalFullIds) {
+		this.totalFullIds = totalFullIds;
+	}
+
+	public String getCommonFlag() {
+		return commonFlag;
+	}
+
+	public void setCommonFlag(String commonFlag) {
+		this.commonFlag = commonFlag;
+	}
+
+	public String getIsTotalName() {
+		return isTotalName;
+	}
+
+	public void setIsTotalName(String isTotalName) {
+		this.isTotalName = isTotalName;
+	}
+
+	public Integer getSort() {
+		return sort;
+	}
+
+	public void setSort(Integer sort) {
+		this.sort = sort;
+	}
+
+	public String getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+}

+ 227 - 0
src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullPay.java

@@ -0,0 +1,227 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.entity;
+
+
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+/**
+ * 工程计量支付Entity
+ * @author mapengbo
+ * @version 2017-11-03
+ */
+public class WorkFullPay extends ActEntity<WorkFullPay> {
+	
+	private static final long serialVersionUID = 1L;
+	private String applyUnit;		// 申请单位
+	private String payContent;		// 付款内容
+	private String constructionTender;		// 施工标段
+	private String thisApplyMoney;		// 本次申请金额
+	private String arrangeMoney;		// 合同金额
+	private String arrangePayMoney;		// 合同最高支付金额
+	private String confirmPayMoney;		// 核定支付金额
+	private String totalPayMoney;		// 累计付款金额
+	private String completeEngeerValue;		// 完成工程产值
+	private String completePerPay;		// 完成比例付款
+	private String completeProcess;		// 完成进度
+	private String processInstanceId;		// 流程编号
+	private Boolean processEnded;            //流程是否走到了结束状态(结束:false,未结束:true)
+	private String fullPayStatus;		// 1,暂存 2,审核中 3,未通过 4,已通过
+	private String workFullManageId; //项目id
+	private String countFlag; //次数区分
+	// 流程任务
+	private Task task;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public WorkFullPay() {
+		super();
+	}
+
+	public WorkFullPay(String id){
+		super(id);
+	}
+
+	@ExcelField(title="申请单位", align=2, sort=7)
+	public String getApplyUnit() {
+		return applyUnit;
+	}
+
+	public void setApplyUnit(String applyUnit) {
+		this.applyUnit = applyUnit;
+	}
+	
+	@ExcelField(title="付款内容", align=2, sort=8)
+	public String getPayContent() {
+		return payContent;
+	}
+
+	public void setPayContent(String payContent) {
+		this.payContent = payContent;
+	}
+	
+	@ExcelField(title="施工标段", align=2, sort=9)
+	public String getConstructionTender() {
+		return constructionTender;
+	}
+
+	public void setConstructionTender(String constructionTender) {
+		this.constructionTender = constructionTender;
+	}
+	
+	@ExcelField(title="本次申请金额", align=2, sort=10)
+	public String getThisApplyMoney() {
+		return thisApplyMoney;
+	}
+
+	public void setThisApplyMoney(String thisApplyMoney) {
+		this.thisApplyMoney = thisApplyMoney;
+	}
+	
+	@ExcelField(title="合同金额", align=2, sort=11)
+	public String getArrangeMoney() {
+		return arrangeMoney;
+	}
+
+	public void setArrangeMoney(String arrangeMoney) {
+		this.arrangeMoney = arrangeMoney;
+	}
+	
+	@ExcelField(title="合同最高支付金额", align=2, sort=12)
+	public String getArrangePayMoney() {
+		return arrangePayMoney;
+	}
+
+	public void setArrangePayMoney(String arrangePayMoney) {
+		this.arrangePayMoney = arrangePayMoney;
+	}
+	
+	@ExcelField(title="核定支付金额", align=2, sort=13)
+	public String getConfirmPayMoney() {
+		return confirmPayMoney;
+	}
+
+	public void setConfirmPayMoney(String confirmPayMoney) {
+		this.confirmPayMoney = confirmPayMoney;
+	}
+	
+	@ExcelField(title="累计付款金额", align=2, sort=14)
+	public String getTotalPayMoney() {
+		return totalPayMoney;
+	}
+
+	public void setTotalPayMoney(String totalPayMoney) {
+		this.totalPayMoney = totalPayMoney;
+	}
+	
+	@ExcelField(title="完成工程产值", align=2, sort=15)
+	public String getCompleteEngeerValue() {
+		return completeEngeerValue;
+	}
+
+	public void setCompleteEngeerValue(String completeEngeerValue) {
+		this.completeEngeerValue = completeEngeerValue;
+	}
+	
+	@ExcelField(title="完成比例付款", align=2, sort=16)
+	public String getCompletePerPay() {
+		return completePerPay;
+	}
+
+	public void setCompletePerPay(String completePerPay) {
+		this.completePerPay = completePerPay;
+	}
+	
+	@ExcelField(title="完成进度", align=2, sort=17)
+	public String getCompleteProcess() {
+		return completeProcess;
+	}
+
+	public void setCompleteProcess(String completeProcess) {
+		this.completeProcess = completeProcess;
+	}
+	
+	@ExcelField(title="流程编号", align=2, sort=18)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+	
+	@ExcelField(title="1,暂存 2,审核中 3,未通过 4,已通过", dictType="full_pay_status", align=2, sort=19)
+	public String getFullPayStatus() {
+		return fullPayStatus;
+	}
+
+	public void setFullPayStatus(String fullPayStatus) {
+		this.fullPayStatus = fullPayStatus;
+	}
+
+	public String getWorkFullManageId() {
+		return workFullManageId;
+	}
+
+	public void setWorkFullManageId(String workFullManageId) {
+		this.workFullManageId = workFullManageId;
+	}
+
+	public String getCountFlag() {
+		return countFlag;
+	}
+
+	public void setCountFlag(String countFlag) {
+		this.countFlag = countFlag;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public Boolean getProcessEnded() {
+		return processEnded;
+	}
+
+	public void setProcessEnded(Boolean processEnded) {
+		this.processEnded = processEnded;
+	}
+}

+ 413 - 0
src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullRecord.java

@@ -0,0 +1,413 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.workbidingproject.entity.WorkBidingProject;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workengineeringproject.entity.WorkEngineeringProject;
+import com.jeeplus.modules.workproject.entity.WorkProject;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 项目归档Entity
+ * @author mapengbo
+ * @version 2017-11-01
+ */
+public class WorkFullRecord extends ActEntity<WorkFullRecord> {
+	
+	private static final long serialVersionUID = 1L;
+	private String recordName;		// 案卷名称
+	private String recordNumber;		// 案卷编号
+	private String backRecordNumber;		// 归档号
+	private String recordLibNumber;		// 所属卷库
+	private String backRecordYear;		// 归卷年代
+	private Office backRecordDept;		// 归卷部门
+	private String compleOrganization;		// 编制机构
+	private String retentionPeriod;		// 保管期限
+	private Date startTime;		// 开始日期
+	private Date endTime;		// 结束日期
+	private String recordSecretLevel;		// 案卷密级
+	private String fondsNumber;		// 全宗号
+	private String listsNumber;		// 目录号
+	private String recordProNumber;		// 档案馆号
+	private String strongboxNumber;		// 保险箱号
+	private String microNumber;		// 缩微号
+	private String ekkoBstypOne;		// 凭证编号开始
+	private String ekkoBstypTwo;		// 凭证编号结尾
+	private String reportNumber;		// 报告号
+	private String pageNumber;		// 页数
+	private String manageUser;		// 管理员
+	private String ekkoType;		// 凭证类别
+	private WorkFullManage workFullManage; //项目登记的信息
+	private WorkEngineeringProject workEngineeringProject; //项目登记的信息
+	private WorkContractInfo workContractInfo; //项目登记的信息
+	private WorkBidingProject workBidingProject;  //招标项目信息
+	private WorkProject workProject;//总项目
+	private String companyId; //公司编号
+	private String officeId; //公司编号
+	private String backRecordStatus; //归档状态
+	private String processInstanceId; //流程id
+	private String type;
+	private String manageId; //管理员编号
+	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
+
+	public List<WorkClientAttachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<WorkClientAttachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	public WorkProject getWorkProject() {
+		return workProject;
+	}
+
+	public void setWorkProject(WorkProject workProject) {
+		this.workProject = workProject;
+	}
+
+	public WorkBidingProject getWorkBidingProject() {
+		return workBidingProject;
+	}
+
+	public void setWorkBidingProject(WorkBidingProject workBidingProject) {
+		this.workBidingProject = workBidingProject;
+	}
+
+	// 流程任务
+	private Task task;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public WorkFullRecord() {
+		super();
+	}
+
+	public WorkFullRecord(String id){
+		super(id);
+	}
+
+	@ExcelField(title="案卷名称", align=2, sort=7)
+	public String getRecordName() {
+		return recordName;
+	}
+
+	public void setRecordName(String recordName) {
+		this.recordName = recordName;
+	}
+	
+	@ExcelField(title="案卷编号", align=2, sort=8)
+	public String getRecordNumber() {
+		return recordNumber;
+	}
+
+	public void setRecordNumber(String recordNumber) {
+		this.recordNumber = recordNumber;
+	}
+	
+	@ExcelField(title="归档号", align=2, sort=9)
+	public String getBackRecordNumber() {
+		return backRecordNumber;
+	}
+
+	public void setBackRecordNumber(String backRecordNumber) {
+		this.backRecordNumber = backRecordNumber;
+	}
+	
+	@ExcelField(title="所属卷库", dictType="record_lib_number", align=2, sort=10)
+	public String getRecordLibNumber() {
+		return recordLibNumber;
+	}
+
+	public void setRecordLibNumber(String recordLibNumber) {
+		this.recordLibNumber = recordLibNumber;
+	}
+	
+	@ExcelField(title="归卷年代", align=2, sort=11)
+	public String getBackRecordYear() {
+		return backRecordYear;
+	}
+
+	public void setBackRecordYear(String backRecordYear) {
+		this.backRecordYear = backRecordYear;
+	}
+
+
+
+	@ExcelField(title="归卷部门", fieldType=Office.class, value="backRecordDept.name", align=2, sort=12)
+	public Office getBackRecordDept() {
+		return backRecordDept;
+	}
+
+	public void setBackRecordDept(Office backRecordDept) {
+		this.backRecordDept = backRecordDept;
+	}
+	
+	@ExcelField(title="编制机构", align=2, sort=13)
+	public String getCompleOrganization() {
+		return compleOrganization;
+	}
+
+	public void setCompleOrganization(String compleOrganization) {
+		this.compleOrganization = compleOrganization;
+	}
+	
+	@ExcelField(title="保管期限", dictType="retention_period", align=2, sort=14)
+	public String getRetentionPeriod() {
+		return retentionPeriod;
+	}
+
+	public void setRetentionPeriod(String retentionPeriod) {
+		this.retentionPeriod = retentionPeriod;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="开始日期", align=2, sort=15)
+	public Date getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="结束日期", align=2, sort=16)
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+	
+	@ExcelField(title="案卷密级", dictType="record_secret_level", align=2, sort=17)
+	public String getRecordSecretLevel() {
+		return recordSecretLevel;
+	}
+
+	public void setRecordSecretLevel(String recordSecretLevel) {
+		this.recordSecretLevel = recordSecretLevel;
+	}
+	
+	@ExcelField(title="全宗号", align=2, sort=18)
+	public String getFondsNumber() {
+		return fondsNumber;
+	}
+
+	public void setFondsNumber(String fondsNumber) {
+		this.fondsNumber = fondsNumber;
+	}
+	
+	@ExcelField(title="目录号", align=2, sort=19)
+	public String getListsNumber() {
+		return listsNumber;
+	}
+
+	public void setListsNumber(String listsNumber) {
+		this.listsNumber = listsNumber;
+	}
+	
+	@ExcelField(title="档案馆号", align=2, sort=20)
+	public String getRecordProNumber() {
+		return recordProNumber;
+	}
+
+	public void setRecordProNumber(String recordProNumber) {
+		this.recordProNumber = recordProNumber;
+	}
+	
+	@ExcelField(title="保险箱号", align=2, sort=21)
+	public String getStrongboxNumber() {
+		return strongboxNumber;
+	}
+
+	public void setStrongboxNumber(String strongboxNumber) {
+		this.strongboxNumber = strongboxNumber;
+	}
+	
+	@ExcelField(title="缩微号", align=2, sort=22)
+	public String getMicroNumber() {
+		return microNumber;
+	}
+
+	public void setMicroNumber(String microNumber) {
+		this.microNumber = microNumber;
+	}
+	
+	@ExcelField(title="凭证编号开始", align=2, sort=23)
+	public String getEkkoBstypOne() {
+		return ekkoBstypOne;
+	}
+
+	public void setEkkoBstypOne(String ekkoBstypOne) {
+		this.ekkoBstypOne = ekkoBstypOne;
+	}
+	
+	@ExcelField(title="凭证编号结尾", align=2, sort=24)
+	public String getEkkoBstypTwo() {
+		return ekkoBstypTwo;
+	}
+
+	public void setEkkoBstypTwo(String ekkoBstypTwo) {
+		this.ekkoBstypTwo = ekkoBstypTwo;
+	}
+	
+	@ExcelField(title="报告号", align=2, sort=25)
+	public String getReportNumber() {
+		return reportNumber;
+	}
+
+	public void setReportNumber(String reportNumber) {
+		this.reportNumber = reportNumber;
+	}
+	
+	@ExcelField(title="页数", align=2, sort=26)
+	public String getPageNumber() {
+		return pageNumber;
+	}
+
+	public void setPageNumber(String pageNumber) {
+		this.pageNumber = pageNumber;
+	}
+	
+	@ExcelField(title="管理员", align=2, sort=27)
+	public String getManageUser() {
+		return manageUser;
+	}
+
+	public void setManageUser(String manageUser) {
+		this.manageUser = manageUser;
+	}
+	
+	@ExcelField(title="凭证类别", dictType="ekko_type", align=2, sort=28)
+	public String getEkkoType() {
+		return ekkoType;
+	}
+
+	public void setEkkoType(String ekkoType) {
+		this.ekkoType = ekkoType;
+	}
+
+	public String getManageId() {
+		return manageId;
+	}
+
+	public void setManageId(String manageId) {
+		this.manageId = manageId;
+	}
+
+	public WorkFullManage getWorkFullManage() {
+		return workFullManage;
+	}
+
+	public void setWorkFullManage(WorkFullManage workFullManage) {
+		this.workFullManage = workFullManage;
+	}
+
+	public WorkEngineeringProject getWorkEngineeringProject() {
+		return workEngineeringProject;
+	}
+
+	public void setWorkEngineeringProject(WorkEngineeringProject workEngineeringProject) {
+		this.workEngineeringProject = workEngineeringProject;
+	}
+
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	public String getBackRecordStatus() {
+		return backRecordStatus;
+	}
+
+	public void setBackRecordStatus(String backRecordStatus) {
+		this.backRecordStatus = backRecordStatus;
+	}
+
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public WorkContractInfo getWorkContractInfo() {
+		return workContractInfo;
+	}
+
+	public void setWorkContractInfo(WorkContractInfo workContractInfo) {
+		this.workContractInfo = workContractInfo;
+	}
+
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+}

+ 57 - 0
src/main/java/com/jeeplus/modules/workfullmanage/entity/WorkFullSurvey.java

@@ -0,0 +1,57 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+/**
+ * 监理单位联系人Entity
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+public class WorkFullSurvey extends DataEntity<WorkFullSurvey> {
+
+	private static final long serialVersionUID = 1L;
+	private String unitName;		// 单位名称
+	private String unitLinkMan;		// 联系人
+	private String linkPhone;		// 联系电话
+
+	public WorkFullSurvey() {
+		super();
+	}
+
+	public WorkFullSurvey(String id){
+		super(id);
+	}
+
+	@ExcelField(title="联系人姓名", align=2, sort=1)
+	public String getUnitName() {
+		return unitName;
+	}
+
+	public void setUnitName(String unitName) {
+		this.unitName = unitName;
+	}
+	
+	@ExcelField(title="职务", align=2, sort=2)
+	public String getUnitLinkMan() {
+		return unitLinkMan;
+	}
+
+	public void setUnitLinkMan(String unitLinkMan) {
+		this.unitLinkMan = unitLinkMan;
+	}
+	
+	@ExcelField(title="QQ", align=2, sort=3)
+	public String getLinkPhone() {
+		return linkPhone;
+	}
+
+	public void setLinkPhone(String linkPhone) {
+		this.linkPhone = linkPhone;
+	}
+
+}

+ 49 - 0
src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullConstructService.java

@@ -0,0 +1,49 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.service;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullConstructDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullConstruct;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 施工单位联系人Service
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkFullConstructService extends CrudService<WorkFullConstructDao, WorkFullConstruct> {
+
+	public WorkFullConstruct get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkFullConstruct> findList(WorkFullConstruct workFullConstruct) {
+		return super.findList(workFullConstruct);
+	}
+	
+	public Page<WorkFullConstruct> findPage(Page<WorkFullConstruct> page, WorkFullConstruct workFullConstruct) {
+		return super.findPage(page, workFullConstruct);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkFullConstruct workFullConstruct) {
+		super.save(workFullConstruct);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkFullConstruct workFullConstruct) {
+		super.delete(workFullConstruct);
+	}
+	
+	
+	
+	
+}

+ 49 - 0
src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullDesignService.java

@@ -0,0 +1,49 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.service;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullDesignDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullDesign;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 设计联系人Service
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkFullDesignService extends CrudService<WorkFullDesignDao, WorkFullDesign> {
+
+	public WorkFullDesign get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkFullDesign> findList(WorkFullDesign workFullDesign) {
+		return super.findList(workFullDesign);
+	}
+	
+	public Page<WorkFullDesign> findPage(Page<WorkFullDesign> page, WorkFullDesign workFullDesign) {
+		return super.findPage(page, workFullDesign);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkFullDesign workFullDesign) {
+		super.save(workFullDesign);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkFullDesign workFullDesign) {
+		super.delete(workFullDesign);
+	}
+	
+	
+	
+	
+}

+ 468 - 0
src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullManageService.java

@@ -0,0 +1,468 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.service;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.mapper.JsonMapper;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.sys.dao.AreaDao;
+import com.jeeplus.modules.sys.dao.RoleDao;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientLinkmanDao;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
+import com.jeeplus.modules.workclientinfo.service.WorkClientInfoService;
+import com.jeeplus.modules.workcontractinfo.dao.WorkContractAnnexDao;
+import com.jeeplus.modules.workcontractinfo.dao.WorkContractInfoDao;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workfullexecute.dao.WorkFullExecuteDao;
+import com.jeeplus.modules.workfullexecute.entity.WorkFullExecute;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullConstructDao;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullDesignDao;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullManageDao;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullSurveyDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workproject.entity.WorkProject;
+import com.jeeplus.modules.workreimbursement.utils.VarStr;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 全过程管理Service
+ * @author mapengbo
+ * @version 2017-10-24
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkFullManageService extends CrudService<WorkFullManageDao, WorkFullManage> {
+
+
+	@Autowired
+	private WorkFullManageDao workFullManageDao;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private WorkContractInfoDao workContractInfoDao;
+	@Autowired
+	private WorkFullConstructDao workFullConstructDao;
+	@Autowired
+	private WorkFullSurveyDao workFullSurveyDao;
+	@Autowired
+	private WorkFullDesignDao workFullDesignDao;
+	@Autowired
+	private WorkClientInfoService workClientInfoService;
+	@Autowired
+	private WorkClientAttachmentDao workClientAttachmentDao;
+	@Autowired
+	private WorkFullExecuteDao workFullExecuteDao;
+	@Autowired
+	private WorkContractAnnexDao workContractAnnexDao;
+	@Autowired
+	private RoleDao roleDao;
+	@Autowired
+	private WorkClientLinkmanDao workClientLinkmanDao;
+	@Autowired
+	private AreaDao areaDao;
+
+	public WorkFullManage getSimpleWorkFullManage(String id){
+		return super.get(id);
+	}
+	public WorkFullManage getByPId(WorkProject workProject){
+		return workFullManageDao.getByPId(workProject);
+	}
+	public WorkFullManage getWF(String id){
+		WorkFullManage workFullManage = super.get(id);
+		if(workFullManage != null){
+			WorkClientInfo workClientInfo = workClientInfoService.get(workFullManage.getClientId());
+			workClientInfo.setCreditRank(DictUtils.getDictLabel(workClientInfo.getCreditRank(),"credit_rank",workClientInfo.getCreditRank()));
+			workFullManage.setWorkClientInfo(workClientInfo);
+			WorkFullManage wf = workFullManageDao.get(workFullManage.getTotalFullId());
+			if(wf != null){
+				workFullManage.setTotalFullName(wf.getTotalFullName());
+			}
+		}
+		return workFullManage;
+	}
+	public WorkFullManage get(String id) {
+		if(StringUtils.isBlank(id)){
+			return new WorkFullManage();
+		}
+		WorkFullManage workFullManage = super.get(id);
+		if(workFullManage==null){
+			return new WorkFullManage();
+		}
+		//获取附件信息
+		WorkClientAttachment workClientAttachment = new WorkClientAttachment();
+		workClientAttachment.setAttachmentId(id);
+		workClientAttachment.setAttachmentFlag(VarStr.attachmentFlag[2]);
+		workFullManage.setWorkAttachments(workClientAttachmentDao.findList(workClientAttachment));
+		//公司信息
+		workFullManage.setHostCompany(officeService.get(workFullManage.getHostCompany()));
+		workFullManage.setFollowCompany(officeService.get(workFullManage.getFollowCompany()));
+		//合同信息
+		WorkContractInfo contract = workContractInfoDao.findUniqueByProperty("contract_num", workFullManage.getContractId());
+		if(contract != null){
+			WorkContractInfo workContractInfo = workContractInfoDao.get(contract.getId());
+//			workContractInfo.setWorkContractAnnexList(workContractAnnexDao.findList(new WorkContractAnnex(workContractInfo)));
+			workFullManage.setWorkContractInfo(workContractInfo);
+		}
+		if(workFullManage.getConstructId() != null){
+			workFullManage.setConstructId(workFullConstructDao.get(workFullManage.getConstructId().getId()));
+		}
+		if(workFullManage.getDesignId() != null){
+			workFullManage.setDesignId(workFullDesignDao.get(workFullManage.getDesignId().getId()));
+		}
+		if(workFullManage.getSurveyId() != null){
+			workFullManage.setSurveyId(workFullSurveyDao.get(workFullManage.getSurveyId().getId()));
+		}
+		//委托方信息
+		WorkClientInfo workClientInfo = workClientInfoService.get(workFullManage.getClientId());
+		if(workClientInfo != null){
+			workClientInfo.setCreditRank(DictUtils.getDictLabel(workClientInfo.getCreditRank(),"credit_rank",workClientInfo.getCreditRank()));
+			List<WorkClientLinkman>  workClientLinkmanList = workClientLinkmanDao.findByClientId(workClientInfo.getId());
+			if(workClientLinkmanList!=null && workClientLinkmanList.size()>0){
+				workClientInfo.setWorkClientLinkman(workClientLinkmanList.get(0));
+			}
+			workFullManage.setWorkClientInfo(workClientInfo);
+		}
+		//建设方信息
+		WorkClientInfo workBuildInfo = workClientInfoService.get(workFullManage.getBuildId());
+		if(workBuildInfo != null){
+			workBuildInfo.setCreditRank(DictUtils.getDictLabel(workBuildInfo.getCreditRank(),"credit_rank",workClientInfo.getCreditRank()));
+			workFullManage.setWorkBuildInfo(workBuildInfo);
+		}
+		if(!Strings.isNullOrEmpty(workFullManage.getHostMaster())){
+			String[] split = workFullManage.getHostMaster().split(",");
+			String hostMasterName = getPeople(split);
+			workFullManage.setHostMasterName(hostMasterName);
+		}
+
+		if(!Strings.isNullOrEmpty(workFullManage.getFollowMaster())){
+			String[] split1 = workFullManage.getFollowMaster().split(",");
+			String followMasterName = getPeople(split1);
+			workFullManage.setFollowMasterName(followMasterName);
+		}
+		if(!Strings.isNullOrEmpty(workFullManage.getHostMember())){
+			String[] split2 = workFullManage.getHostMember().split(",");
+			String hostMemberName = getPeople(split2);
+			workFullManage.setHostMemberName(hostMemberName);
+		}
+		if(!Strings.isNullOrEmpty(workFullManage.getFollowMember())){
+			String[] split3 = workFullManage.getFollowMember().split(",");
+			String followMemberName = getPeople(split3);
+			workFullManage.setFollowMemberName(followMemberName);
+		}
+		return workFullManage;
+	}
+
+	public List<WorkFullManage> findList(WorkFullManage workFullManage) {
+		return super.findList(workFullManage);
+	}
+
+		public Page<WorkFullManage> findPage(Page<WorkFullManage> page, WorkFullManage workFullManage) {
+		if (StringUtils.isNotBlank(workFullManage.getTotalFullIds())){
+			workFullManage.setTotalFullIds(","+workFullManage.getTotalFullIds()+",");
+		}
+		workFullManage.setOfficeId(UserUtils.getSelectOffice().getId());
+		workFullManage.getSqlMap().put("dsf", dataScopeFilterOR(workFullManage.getCurrentUser(), "o", "u","s", MenuStatusEnum.END.getValue()));
+		workFullManage.setPage(page);
+		workFullManage.setIsTotal("1");
+		List<WorkFullManage> list = Lists.newArrayList();
+		List<WorkFullManage> totals = dao.findList(workFullManage);
+		List<WorkFullManage> workFullManages = new ArrayList<>();
+		for (WorkFullManage fullManage:totals){
+			WorkFullManage wfm = new WorkFullManage();
+			wfm.setTotalFullId(fullManage.getId());
+			List<WorkFullManage> workEngineeringProjectLists = dao.findList(wfm);
+			if (workEngineeringProjectLists!=null && workEngineeringProjectLists.size()!=0){
+				workFullManages.addAll(workEngineeringProjectLists);
+			}
+		}
+		workFullManages.addAll(totals);
+		sortList(list,workFullManages,"0",true);
+		page.setList(list);
+		return page;
+	}
+
+	public static void sortList(List<WorkFullManage> list, List<WorkFullManage> sourcelist, String parentId, boolean cascade){
+		for (int i=0; i<sourcelist.size(); i++){
+			WorkFullManage e = sourcelist.get(i);
+			if (e.getTotalFullId()!=null && e.getTotalFullId().equals(parentId)){
+				list.add(e);
+				if (cascade){
+					// 判断是否还有子节点, 有则继续获取子节点
+					for (int j=0; j<sourcelist.size(); j++){
+						WorkFullManage child = sourcelist.get(j);
+						if (child.getTotalFullId()!=null && child.getTotalFullId().equals(e.getId())){
+							sortList(list, sourcelist, e.getId(), true);
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+
+	@Transactional(readOnly = false)
+	public void save(WorkFullManage workFullManage) {
+		Area area = workFullManage.getArea();
+		area = areaDao.get(area.getId());
+		workFullManage.setArea(area);
+//		// 主办公司负责人
+//		List<User> hostMasterList = new ArrayList<User>();
+//		// 协办公司负责人
+//		List<User> followMasterList = new ArrayList<>();
+//		// 主办公司项目成员
+//		List<User> hostMemberList = new ArrayList<>();
+//		// 协办公司项目成员
+//		List<User> followMemberList = new ArrayList<>();
+//
+//		String hostMasters = dealPeople(workFullManage.getHostMasterList(), hostMasterList);
+//		String followMasters = dealPeople(workFullManage.getFollowMasterList(), followMasterList);
+//		String hostMembers = dealPeople(workFullManage.getHostMemberList(), hostMemberList,hostMasters);
+//		String followMembers = dealPeople(workFullManage.getFollowMemberList(), followMemberList,followMasters);
+//		workFullManage.setHostMaster(hostMasters);
+//		workFullManage.setHostMember(hostMembers);
+//		workFullManage.setFollowMaster(followMasters);
+//		workFullManage.setFollowMember(followMembers);
+
+//		workFullManage.setHostMasterList(hostMasterList);
+//		workFullManage.setFollowMasterList(followMasterList);
+//		workFullManage.setHostMemberList(hostMemberList);
+//		workFullManage.setFollowMemberList(followMemberList);
+//		if(hostMasterList.size() > 0){
+//			workFullManageDao.insertHostMaster(workFullManage);
+//		}
+//		if(followMasterList.size() > 0){
+//			workFullManageDao.insertFollowMaster(workFullManage);
+//		}
+//		if(hostMemberList.size() > 0){
+//			workFullManageDao.insertHostMember(workFullManage);
+//		}
+//		if(followMemberList.size() > 0){
+//			workFullManageDao.insertFollowMember(workFullManage);
+//		}
+		super.save(workFullManage);
+		//附件信息
+		for (WorkClientAttachment workClientAttachment : workFullManage.getWorkAttachments()){
+			if (workClientAttachment.getId() == null){
+				continue;
+			}
+			if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())){
+				workClientAttachment.setAttachmentId(workFullManage.getId());
+				workClientAttachment.setAttachmentFlag(VarStr.attachmentFlag[2]);
+				workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
+				workClientAttachment.setCompanyId(UserUtils.getSelectCompany().getId());
+				if (StringUtils.isBlank(workClientAttachment.getId()) || "null".equals(workClientAttachment.getId())){
+					workClientAttachment.preInsert();
+					workClientAttachmentDao.insert(workClientAttachment);
+				}else{
+					workClientAttachment.preUpdate();
+					workClientAttachmentDao.update(workClientAttachment);
+				}
+			}else{
+				workClientAttachmentDao.delete(workClientAttachment);
+			}
+		}
+	}
+
+	@Transactional(readOnly = false)
+	public void delete(WorkFullManage workFullManage) {
+		super.delete(workFullManage);
+	}
+
+	/**
+	 * 查询附件列表
+	 * @param workClientAttachment
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public List<WorkClientAttachment> findList(WorkClientAttachment workClientAttachment){
+		return workClientAttachmentDao.findList(workClientAttachment);
+	}
+	/**
+	 * 删除附件
+	 * @param workClientAttachment
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public int deleteAttach(WorkClientAttachment workClientAttachment){
+		return workClientAttachmentDao.delete(workClientAttachment);
+	}
+
+	/**
+	 * 修改项目状态
+	 * @param workFullManage
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public int updStatusById(WorkFullManage workFullManage){
+		return workFullManageDao.update(workFullManage);
+	}
+
+	/**
+	 * 查询施工阶段的所有文件
+	 * @return
+	 */
+	public List<WorkClientAttachment> queryEngeerFile(String companyId,String workFullManageId){
+		WorkFullExecute workFullExecute = new WorkFullExecute();
+		workFullExecute.setCompanyId(companyId);
+		workFullExecute.setWorkFullManageId(workFullManageId);
+		List<WorkFullExecute> list = workFullExecuteDao.findList(workFullExecute);
+		List<WorkClientAttachment> li = new ArrayList<WorkClientAttachment>();
+		for (WorkFullExecute worke : list) {
+			WorkClientAttachment workClientAttachment = new WorkClientAttachment();
+			workClientAttachment.setAttachmentId(worke.getId());
+			workClientAttachment.setAttachmentFlag("2");
+			List<WorkClientAttachment> workList = workClientAttachmentDao.findList(workClientAttachment);
+			li.addAll(workList);
+		}
+		return li;
+	}
+
+	/**
+	 * 处理人员
+	 * @param list
+	 * @param reList
+	 * @return
+	 */
+	public String dealPeople(List<User> list,List<User> reList){
+		String member = "";
+		for (int i = 0; i < list.size(); i++) {
+			User user = list.get(i);
+			if (user.getId() == null) {
+				continue;
+			}
+			reList.add(user);
+			if(i + 1 == list.size()){
+				member += user.getId();
+			}else {
+				member += user.getId()+",";
+			}
+		}
+		return member;
+	}
+	/**
+	 * 处理人员 去掉成员中的项目负责人
+	 * @param list
+	 * @param reList
+	 * @return
+	 */
+	public String dealPeople(List<User> list,List<User> reList,String reMember){
+		String member = "";
+		for (int i = 0; i < list.size(); i++) {
+			User user = list.get(i);
+			if (user.getId() == null || reMember.contains(user.getId())) {
+				continue;
+			}
+			reList.add(user);
+			if(i + 1 == list.size()){
+				member += user.getId();
+			}else {
+				member += user.getId()+",";
+			}
+		}
+		return member;
+	}
+
+	/**
+	 * 处理人员,返回人员名称
+	 * @return
+	 */
+	public String getPeople(String[] split){
+		if(split.length == 0){
+			return "";
+		}
+		String name = "";
+		for (int i = 0; i < split.length; i++) {
+			if(i == split.length -1){
+				name += UserUtils.get(split[i]).getName();
+			}else{
+				name += UserUtils.get(split[i]).getName()+",";
+			}
+		}
+		return name;
+	}
+
+	/**
+	 * 获取所有涉及人员的部门负责人
+	 * @param split
+	 * @return
+	 */
+	public String getPeopleMaster(String[] split){
+		if(split.length == 0){
+			return "";
+		}
+		String masterId = "";
+		for (int i = 0; i < split.length; i++) {
+			User user = UserUtils.get(split[i]);
+			Map<Object,Object> map = new HashMap<>();
+			map.put("ename","bmzr");
+			map.put("companyId",user.getCompany().getId());
+			map.put("officeId",user.getOffice().getId());
+			if(i == split.length -1){
+				masterId += roleDao.queryMasterByEnameAndOfficeId(map);
+			}else{
+				masterId += roleDao.queryMasterByEnameAndOfficeId(map) + ",";
+			}
+		}
+		return masterId;
+	}
+
+	public Page<WorkFullManage> findPageByproject(Page<WorkFullManage> page, WorkFullManage workFullManage) {
+		workFullManage.setPage(page);
+		page.setList(dao.findListByprojectt(workFullManage));
+		return page;
+	}
+
+	public List<WorkFullManage> findByList(WorkFullManage workFullManage) {
+		return dao.findByList(workFullManage);
+	}
+
+
+    public String parseList2Json(WorkClientInfo workClientInfo) {
+		if(workClientInfo == null){
+			return "";
+		}
+		List<WorkClientLinkman> list = workClientInfo.getWorkClientLinkmanList();
+		List<Map<Object,Object>> resultList = Lists.newArrayList();
+		String creditRank = DictUtils.getDictLabel(workClientInfo.getCreditRank(),"credit_rank","");
+		if(list.size() > 0) {
+			for (int i = 0; i < list.size(); i++) {
+				HashMap<Object, Object> map = Maps.newHashMap();
+				map.put("linkmanName", list == null ? "" : list.get(i).getName());
+				map.put("linkmanOffice", list == null ? "" : list.get(i).getOffice());
+				map.put("linkmanPosition", list == null ? "" : list.get(i).getPosition());
+				map.put("QQ", list == null ? "" : list.get(i).getQq());
+				map.put("linkmanPhone", list == null ? "" : list.get(i).getLinkPhone());
+				map.put("linkmanMobile", list == null ? "" : list.get(i).getLinkMobile());
+				map.put("linkmanEmail", list == null ? "" : list.get(i).getEmail());
+				map.put("clientName", workClientInfo.getName()==null ? "" :workClientInfo.getName());
+				map.put("clientId", workClientInfo.getId() ==null?"":workClientInfo.getId());
+				map.put("creditRank",creditRank);
+				resultList.add(map);
+			}
+		}
+		String resultJsonStr = JsonMapper.toJsonString(resultList);
+		return resultJsonStr;
+    }
+}

+ 616 - 0
src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullPayService.java

@@ -0,0 +1,616 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.service;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.act.utils.ProcessDefCache;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullManageDao;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullPayDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullPay;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import org.activiti.engine.*;
+import org.activiti.engine.history.HistoricTaskInstance;
+import org.activiti.engine.history.HistoricTaskInstanceQuery;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 工程计量支付Service
+ * @author mapengbo
+ * @version 2017-11-03
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkFullPayService extends CrudService<WorkFullPayDao, WorkFullPay> {
+
+	@Autowired
+	private WorkFullPayDao workFullPayDao;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	protected TaskService taskService;
+	@Autowired
+	protected HistoryService historyService;
+	@Autowired
+	protected RepositoryService repositoryService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkFullManageDao workFullManageDao;
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private OfficeService officeService;
+
+	public WorkFullPay get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkFullPay> findList(WorkFullPay workFullPay) {
+		return super.findList(workFullPay);
+	}
+	
+	public Page<WorkFullPay> findPage(Page<WorkFullPay> page, WorkFullPay workFullPay) {
+		page = super.findPage(page,workFullPay);
+		List<WorkFullPay> list = page.getList();
+		if(list!=null && list.size()>0){
+			for (int i = 0; i < list.size(); i++) {
+				WorkFullPay pay = list.get(i);
+
+				//流程结束state=false,未结束state=true
+				boolean state = true;
+				if(StringUtils.isNotBlank(pay.getProcessInstanceId())){
+					state = actTaskService.isProcessEnd(pay.getProcessInstanceId());
+				}else{
+					state = false;
+				}
+				pay.setProcessEnded(state);
+			}
+		}
+		return page;
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkFullPay workFullPay,Map<String, Object> variables) {
+		super.save(workFullPay);
+		// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(UserUtils.getUser().getId());
+
+		String workFullManageId2 = workFullPay.getWorkFullManageId();
+		String officeId = workFullManageDao.get(workFullManageId2).getOfficeId();
+		WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("f5f37f9906374d5abbf57c95dfa28869",officeService.get(officeId));
+		// 启动流程
+		String businessKey = workFullPay.getId().toString();
+		String processType = workActivityMenu.getProcessType();
+		StringBuffer buffer1 = new StringBuffer();
+		Activity activity = new Activity();
+		if(StringUtils.isNotBlank(workActivityMenu.getId())){
+			workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+			List<Activity> activities = workActivityMenu.getActivities();
+			for (Activity a:activities){
+				//审批任务的第一个人(角色)
+				if (a.getDelFlag().equals("0") && a.getCount() == 1){
+					activity = a;
+					break;
+				}
+			}
+			buffer1.append(activity.getRole().getEnname());
+			variables.put("type", workActivityMenu.getProcessType());
+		}else{
+			processType = ActUtils.PD_WORKFULLPAY[0];
+			variables.put("type", processType);
+		}
+
+		variables.put("busId", businessKey);
+		variables.put("title", "审批单:"+workFullPay.getApplyUnit());//设置标题;
+		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+		workFullPay.setProcessInstance(processInstance);
+		// 更新流程实例ID
+		workFullPay.setProcessInstanceId(processInstance.getId());
+		workFullPayDao.updateProcessInstanceId(workFullPay);
+
+		List<Activity> list= workActivityMenu.getActivities();
+		if (list!=null && list.size()!=0){
+			workActivityProcessService.saveList(list,processInstance.getId());
+		}else {
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessKey(processType);
+			workActivityProcess.setCount(1);
+			workActivityProcess.setProcessInstanceId(processInstance.getId());
+			workActivityProcess.setIsApproval("0");
+			workActivityProcess.setActivity(new Activity("cde385ec18734780b3870f6a54e1b53e"));
+			workActivityProcessService.save(workActivityProcess);
+		}
+
+		if(workActivityMenu!=null&&StringUtils.isNotBlank(workActivityMenu.getId())&&StringUtils.isNotBlank(activity.getId())){
+			WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+			workProjectNotify.setTitle("工程计量支付申请,请审批!");
+			workProjectNotify.setNotifyId(workFullPay.getId());
+			String workFullManageId = workFullPay.getWorkFullManageId();
+			workProjectNotify.setCompanyId(workFullManageDao.get(workFullManageId).getCompanyId());
+			workProjectNotify.setContent(UserUtils.get(workFullPay.getCreateBy().getId()).getName()+"发起了工程计量支付申请,请审批!");
+			workProjectNotify.setRemarks("待审批");
+			workProjectNotify.setType("14");
+			workProjectNotify.setStatus("0");
+			workProjectNotify.setNotifyRole("");
+			workProjectNotify.setUser(new User(""));
+
+			//角色审批
+			if(StringUtils.isNotBlank(activity.getRole().getEnname())){
+				workProjectNotify.setNotifyRole(buffer1.toString());
+			}
+			//人员审批
+			if(StringUtils.isNotBlank(activity.getUser().getId())){
+				workProjectNotify.setUser(new User(activity.getUser().getId()));
+			}
+			workProjectNotifyService.save(workProjectNotify);
+		}else {
+			String workFullManageId = workFullPay.getWorkFullManageId();
+			workProjectNotifyService.save(UtilNotify.saveNotify(workFullPay.getId(),
+					null,
+					workFullManageDao.get(workFullManageId).getCompanyId(),
+					"工程计量支付申请,请审批",
+					UserUtils.get(workFullPay.getCreateBy().getId()).getName()+"工程计量支付申请,请审批!",
+					"14",
+					"0",
+					"待审批",
+					variables.get("SSRHbmzr").toString()
+			));
+		}
+
+
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkFullPay workFullPay) {
+		super.delete(workFullPay);
+	}
+
+	/**
+	 * 查询记录数
+	 * @return
+	 */
+	public String queryCount(WorkFullPay workFullPay){
+		return workFullPayDao.queryCount(workFullPay)+"";
+	}
+
+	/**
+	 * 查询累计支付金额
+	 * @return
+	 */
+	public String querySum(WorkFullPay workFullPay){
+		return workFullPayDao.querySum(workFullPay);
+	}
+
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public WorkFullPay getByProcessInstanceId(String processInstanceId) {
+		WorkFullPay workFullPay = workFullPayDao.getByProcessInstanceId(processInstanceId);
+		return workFullPay;
+	}
+
+	/**
+	 * 获取已办任务
+	 * @return
+	 */
+	public List<WorkFullPay> historicList(Act act){
+		String userId = UserUtils.getUser().getId();
+		HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().finished().taskAssignee(userId);
+		// 设置查询条件
+		if (StringUtils.isNotBlank(act.getProcDefKey())){
+			query.processDefinitionKey(act.getProcDefKey());
+		}
+		if (act.getBeginDate() != null){
+			query.taskCompletedAfter(act.getBeginDate());
+		}
+		if (act.getEndDate() != null){
+			query.taskCompletedBefore(act.getEndDate());
+		}
+		List<HistoricTaskInstance> list = query.list();
+		List<WorkFullPay> list1 = new ArrayList<>();
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+		for (HistoricTaskInstance histTask : list) {
+			WorkFullPay workFullPay = this.getByProcessInstanceId(histTask.getProcessInstanceId());
+			if (workFullPay != null ){
+				WorkFullManage workFullManage = workFullManageDao.get(workFullPay.getWorkFullManageId());
+				if(workFullManage.getCompanyId().equals(companyId)){
+					workFullPay.setCreateBy(UserUtils.get(workFullPay.getCreateBy().getId()));
+					historyService.getHistoricIdentityLinksForProcessInstance(histTask.getProcessInstanceId());
+					act.setHistTask(histTask);
+					act.setVars(histTask.getProcessVariables());
+					act.setProcDef(ProcessDefCache.get(histTask.getProcessDefinitionId()));
+					act.setStatus("finish");
+					workFullPay.setAct(act);
+					list1.add(workFullPay);
+				}
+			}
+		}
+		return list1;
+	}
+
+	/**
+	 * 审核流程
+	 */
+	@Transactional(readOnly = false)
+	public String auditSave(WorkFullPay workFullPay, String status[]) {
+		try{
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workFullPay.getAct().getTaskDefKey();
+			if(!"modifyApply".equals(taskDefKey)){
+				actTaskService.claim(workFullPay.getAct().getTaskId(), UserUtils.getUser().getId());
+			}
+
+			//业务逻辑对应的条件表达式
+			String exp = "";
+			String str = "";
+			String notifyRole = "";
+			User user = null;
+			String comment = ("yes".equals(workFullPay.getAct().getFlag())?"[同意] ":"[驳回] ")+workFullPay.getAct().getComment();
+			//WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("f5f37f9906374d5abbf57c95dfa28869",UserUtils.getSelectOffice());
+			List<Activity> activitieList = activityService.getByProcessInstanceId(workFullPay.getProcessInstanceId());
+			WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+			if (activitieList!=null && activitieList.size()!=0){
+				workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+				workActivityMenu.setActivities(activitieList);
+			}
+
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			WorkActivityProcess selectedProcess = new WorkActivityProcess();
+			selectedProcess.setProcessInstanceId(workFullPay.getProcessInstanceId());
+			List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectedProcess);
+
+			workFullPay.setFullPayStatus("2");
+			//是自定义流程
+			boolean isCustomProcess = StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals(ActUtils.PD_WORKFULLPAY[0]);
+			String taskCount = "";
+			int key = 0;
+			WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+			workProjectNotify.setNotifyId(workFullPay.getId());
+			workProjectNotifyService.readByNotifyId(workProjectNotify);//每执行一步审核操作,都把已发出的通知变更为"已读"
+			List<Activity> activities = workActivityMenu.getActivities();
+			// 1 暂存 2 审核中 3 未通过 4 已通过 5已撤销
+			if (isCustomProcess) {
+				key = 1;
+
+				for (int i =0;i<workActivityProcesses.size();i++){
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = taskDefKey.replace("task","").replace("audit","");
+					taskCount = count;
+					//重申|撤销
+					if(taskDefKey.contains("audit") && (activityProcess.getCount()+"").contains(count)){
+						exp = "pass";
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						if (!"yes".equals(workFullPay.getAct().getFlag())) {
+							workFullPay.setFullPayStatus("5");//撤销
+							workActivityProcess.setIsApproval("2");
+						}else {
+							workFullPay.setFullPayStatus("2");//重申
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("工程计量支付:重新申请");
+							workProjectNotify.setRemarks("待审批");
+						}
+						break;
+					}
+					else if ((activityProcess.getCount()+"").contains(count)){
+						taskCount = count;
+						workActivityProcess = activityProcess;
+						workActivityProcess.setRemarks(comment);
+
+						if (!workActivityProcess.getIsApproval().equals("0")){
+							workActivityProcess.setId("");
+						}
+						exp = "pass";
+						if (!"yes".equals(workFullPay.getAct().getFlag())) {
+							workFullPay.setFullPayStatus("3");
+							workActivityProcess.setIsApproval("2");
+							workProjectNotify.setTitle("您的工程计量支付申请被驳回!");
+							workProjectNotify.setNotifyRole("");
+							workProjectNotify.setUser(workFullPay.getCreateBy());
+							String returnBack = "-1";
+							for (Activity activity:activities){
+								if(activity.getCount()==Integer.parseInt(count)){
+									returnBack = activity.getReturnBack();
+									break;
+								}
+							}
+							if (returnBack.equals("0")) {
+								workActivityProcess.setId("");
+							}
+						}else {
+							workActivityProcess.setIsApproval("1");
+							workProjectNotify.setTitle("工程计量支付:待审批");
+							//对通知的人(角色)的设定在 提交任务里完成
+						}
+					}
+				}
+			}else {
+
+				workActivityMenu.setId(workActivityProcesses.get(0).getId());
+				workActivityMenu.setProcessType(ActUtils.PD_WORKFULLPAY[0]);
+
+				Role role = UserUtils.getSelectRole().get(0);
+				StringBuffer buffer = DateUtils.getByEnnme(role.getEnname());
+
+				for (int i = 0; i < workActivityProcesses.size(); i++) {
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = activityProcess.getCount() + "";
+
+					// 部门负责人审核
+					if ("deptLeaderAudit".equals(taskDefKey) && count.contains("1")){
+						workActivityProcess = activityProcess;
+						taskCount = "1";
+						workActivityProcess.setProcessInstanceId(workFullPay.getProcessInstanceId());
+						workActivityProcess.setProcessKey(ActUtils.PD_WORKFULLPAY[0]);
+						workActivityProcess.setRemarks(comment);
+
+						workFullPay.setFullPayStatus(("yes".equals(workFullPay.getAct().getFlag())?status[3]:status[2]));
+
+						exp = "deptLeaderPass";
+						user = workFullPay.getCreateBy();
+						if("yes".equals(workFullPay.getAct().getFlag())){
+							workActivityProcess.setIsApproval("1");
+							str = "工程计量支付:待审批!";
+						}else{
+							workActivityProcess.setIsApproval("2");
+							str = "工程计量支付:被驳回!";
+						}
+					}
+					else if ("modifyApply".equals(taskDefKey) && count.contains("0")){
+						taskCount = "1";
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+
+						exp = "modifyApply";
+						if ("yes".equals(workFullPay.getAct().getFlag())){
+							workActivityProcess.setIsApproval("1");
+							//给部门负责人
+							notifyRole = buffer.append("bmzr").toString();
+							workFullPay.setFullPayStatus(status[1]);
+							str = "工程计量支付:待审批!";
+						}else{
+							workActivityProcess.setIsApproval("2");
+							workFullPay.setFullPayStatus(status[4]);
+						}
+						break;
+					}
+					else if ("apply_end".equals(taskDefKey)){
+					}
+					// 未知环节
+
+				}
+			}
+
+			workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workFullPay.getProcessInstanceId(),taskDefKey,"modifyApply",workFullPay.getAct().getFlag(),comment, activities);
+
+			// 设置意见
+			workFullPay.getAct().setComment(comment);
+			workFullPay.preUpdate();
+
+			// 设置意见
+			//workFullPay.getAct().setComment(("yes".equals(workFullPay.getAct().getFlag())?"[同意] ":"[驳回] ")+workFullPay.getAct().getComment());
+			// 提交流程任务
+			Map<String, Object> vars = Maps.newHashMap();
+			vars.put(exp, "yes".equals(workFullPay.getAct().getFlag())? true : false);
+			// 提交流程任务
+			actTaskService.complete(workFullPay.getAct().getTaskId(), workFullPay.getAct().getProcInsId(), workFullPay.getAct().getComment(), vars);
+			workFullPayDao.update(workFullPay);
+			boolean state = actTaskService.isProcessEnd(workFullPay.getAct().getProcInsId());
+			WorkFullManage workFullManage = workFullManageDao.get(workFullPay.getWorkFullManageId());
+			if(!state) {
+
+				if(isCustomProcess){
+					if("yes".equals(workFullPay.getAct().getFlag())){
+						workFullPay.setFullPayStatus("4");
+						workProjectNotify.setTitle("您的工程计量支付审核:已通过");
+					}else{
+						if(! "3".equals(workFullPay.getFullPayStatus())) {
+							workFullPay.setFullPayStatus("5");
+						}else {
+							workProjectNotify.setTitle("您的工程计量支付审核:未通过");
+						}
+					}
+					workProjectNotify.setRemarks("待通知");
+					workProjectNotify.setUser(workFullPay.getCreateBy());
+					workProjectNotify.setCompanyId(workFullManage.getCompanyId());
+					workProjectNotify.setContent(workFullPay.getAct().getComment());
+					workProjectNotify.setType("14");
+					workProjectNotify.setStatus("0");
+					//创建人如果做了撤销操作,无需发送通知
+					if (!workFullPay.getFullPayStatus().equals("5")) {
+						workProjectNotifyService.save(workProjectNotify);
+					}
+
+				}else{
+
+					//str = "yes".equals(workFullPay.getAct().getFlag())?"您的工程计量支付审核:已通过":"您的工程计量支付审核:未通过";
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workFullPay.getId());
+					workProjectNotifyService.readByNotifyId(notify);
+					if("yes".equals(workFullPay.getAct().getFlag())){
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workFullPay.getId(),
+												workFullPay.getCreateBy(),
+												workFullManage.getCompanyId(),
+												"您的工程计量支付审核:已通过",
+												workFullPay.getAct().getComment(),
+												"14",
+												"0",
+												"待通知",
+												""));
+					}else {
+						if ("3".equals(workFullPay.getFullPayStatus())){
+							workProjectNotifyService
+									.save(UtilNotify
+											.saveNotify(workFullPay.getId(),
+													workFullPay.getCreateBy(),
+													workFullManage.getCompanyId(),
+													"您的工程计量支付审核:未通过",
+													workFullPay.getAct().getComment(),
+													"14",
+													"0",
+													"待通知",
+													""));
+						}
+					}
+				}
+
+			}else{
+
+				if (isCustomProcess) {
+					String count = taskDefKey.replace("audit","").replace("task","");
+					Activity activity = new Activity();
+					////撤销到某一步
+					if (taskDefKey.contains("audit")) {
+						if (activities.size() == 1 || count.equals("1")){
+							activity = activities.get(0);
+						}else if (activities.size()==Integer.parseInt(count)){
+							activity = activities.get(activities.size()-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}else {
+							activity = activities.get(Integer.parseInt(count)-1);
+							String returnBack = activity.getReturnBack();
+							if (returnBack.equals("1")){
+								activity = activities.get(Integer.parseInt(count)-2);
+							}else if (returnBack.equals("2")){
+								activity = activities.get(0);
+							}
+						}
+					}
+					//中间步骤驳回
+					else if(!"yes".equals(workFullPay.getAct().getFlag())){
+						//驳回之后,创建人可以发起重申|撤销;将通知消息归类到审批列表,这一步必须
+						//对通知的人(创建人)的设定在前面已完成
+						workProjectNotify.setRemarks("重新申请");
+						activity = new Activity();//驳回后将id置空
+					}
+					//中间某步骤同意
+					else {
+						//得到下一步要执行的activity
+						activity = activities.get(Integer.parseInt(count));
+						workProjectNotify.setRemarks("待审批");
+					}
+					//发送审批消息给下一步的人(角色)
+					if(StringUtils.isNotBlank(activity.getId())){//在驳回时不走这一步,判断id必须
+						workProjectNotify.setUser(activity.getUser());
+						workProjectNotify.setNotifyRole(activity.getRole().getEnname());
+					}
+
+					workProjectNotify.setCompanyId(workFullManage.getCompanyId());
+					workProjectNotify.setContent(workFullPay.getAct().getComment());
+					workProjectNotify.setType("14");
+					workProjectNotify.setStatus("0");
+					//创建人如果做了撤销操作,无需发送通知
+					if (!workFullPay.getFullPayStatus().equals("5")) {
+						workProjectNotifyService.save(workProjectNotify);
+					}
+				}
+				//如果是默认流程,
+				else{
+					//下一步的执行人(角色)已在前面设置
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workFullPay.getId());
+					workProjectNotifyService.readByNotifyId(notify);
+					if (!"yes".equals(workFullPay.getAct().getFlag())){
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workFullPay.getId(),
+												user,
+												workFullManage.getCompanyId(),
+												str,
+												workFullPay.getAct().getComment(),
+												"14",
+												"0",
+												"重新申请",
+												notifyRole));
+					}else{
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workFullPay.getId(),
+												user,
+												workFullManage.getCompanyId(),
+												str,
+												workFullPay.getAct().getComment(),
+												"14",
+												"0",
+												"待审批",
+												notifyRole));
+					}
+				}
+
+			}
+			workFullPayDao.update(workFullPay);
+			return "保存审核意见成功!";
+		}catch (ActivitiObjectNotFoundException e){
+			logger.error("ActivitiObjectNotFoundException e:"+e);
+			return "流程已审批,不能重新审批!";
+		}catch (Exception e){
+			logger.error("Exception e:"+e);
+			return "保存审核意见失败!!";
+		}
+	}
+
+	/**
+	 * 获取第一条记录
+	 * @param workFullPay
+	 * @return
+	 */
+	public WorkFullPay getFirstRecord(WorkFullPay workFullPay){
+		return workFullPayDao.getFirstRecord(workFullPay);
+	}
+
+	/**
+	 * 查询是否存在状态不为已通过的数据
+	 * @param workFullPay
+	 * @return
+	 */
+	public int getStatusNotFour(WorkFullPay workFullPay){
+		return workFullPayDao.getStatusNotFour(workFullPay);
+	}
+}

+ 335 - 0
src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullRecordService.java

@@ -0,0 +1,335 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.service;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.act.utils.ProcessDefCache;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workengineeringproject.entity.WorkEngineeringProject;
+import com.jeeplus.modules.workengineeringproject.service.WorkEngineeringProjectService;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullManageDao;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullRecordDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullRecord;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workreimbursement.utils.VarStr;
+import org.activiti.engine.*;
+import org.activiti.engine.history.HistoricTaskInstance;
+import org.activiti.engine.history.HistoricTaskInstanceQuery;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 全过程管理项目归档Service
+ * @author mapengbo
+ * @version 2017-11-01
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkFullRecordService extends CrudService<WorkFullRecordDao, WorkFullRecord> {
+
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	protected TaskService taskService;
+	@Autowired
+	protected HistoryService historyService;
+	@Autowired
+	protected RepositoryService repositoryService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private WorkFullRecordDao workFullRecordDao;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkEngineeringProjectService workEngineeringProjectService;
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private WorkFullManageDao workFullManageDao;
+	@Autowired
+	private WorkClientAttachmentDao workClientAttachmentDao;
+
+	public WorkFullRecord get(String id) {
+		return  workFullRecordDao.findUniqueByProperty("work_full_manage_id",id);
+//		return super.get(id);
+	}
+	public WorkFullRecord getById(String id) {
+		return super.get(id);
+	}
+	public WorkFullRecord gett(String id) {
+		WorkFullRecord workFullRecord = super.get(id);
+
+		WorkClientAttachment workClientAttachment = new WorkClientAttachment();
+		workClientAttachment.setAttachmentId(id);
+		//workClientAttachment.setAttachmentFlag("66");
+		workFullRecord.setWorkAttachments(workClientAttachmentDao.findList(workClientAttachment));
+
+		return workFullRecord;
+	}
+
+	public List<WorkFullRecord> findList(WorkFullRecord workFullRecord) {
+		return super.findList(workFullRecord);
+	}
+
+	public Page<WorkFullRecord> findPage(Page<WorkFullRecord> page, WorkFullRecord workFullRecord) {
+		return super.findPage(page, workFullRecord);
+	}
+
+	@Transactional(readOnly = false)
+	public void save(WorkFullRecord workFullRecord) {
+		super.save(workFullRecord);
+		//附件信息
+		for (WorkClientAttachment workClientAttachment : workFullRecord.getWorkAttachments()){
+			if (workClientAttachment.getId() == null){
+				continue;
+			}
+			if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())){
+				workClientAttachment.setAttachmentId(workFullRecord.getId());
+				workClientAttachment.setAttachmentFlag("66");
+				if (StringUtils.isBlank(workClientAttachment.getId())  || "null".equals(workClientAttachment.getId())&&StringUtils.isNotBlank(workClientAttachment.getUrl()) && !workClientAttachment.getUrl().equals("null")){
+					workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
+					workClientAttachment.preInsert();
+					workClientAttachmentDao.insert(workClientAttachment);
+				}else{
+					workClientAttachment.preUpdate();
+					workClientAttachmentDao.update(workClientAttachment);
+				}
+			}else{
+				workClientAttachmentDao.delete(workClientAttachment);
+			}
+		}
+	}
+
+	@Transactional(readOnly = false)
+	public void startposs(WorkFullRecord workFullRecord,Map<String, Object> variables,boolean flag,String type,String roleEnname) {
+		dao.insert(workFullRecord);
+		// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(UserUtils.getUser().getId());
+		// 启动流程
+		String businessKey = workFullRecord.getId().toString();
+		if(flag) {
+			variables.put("type", "workfullrecord");
+		}else{
+			variables.put("type", "engineeringrecord");
+		}
+		variables.put("busId", businessKey);
+		variables.put("title", "审批单:"+workFullRecord.getWorkFullManage().getId());//设置标题;
+		ProcessInstance processInstance = null;
+		if(flag){
+			processInstance = runtimeService.startProcessInstanceByKey(ActUtils.PD_WORKFULLREOCRD[0], businessKey, variables);
+		}else{
+			processInstance = runtimeService.startProcessInstanceByKey(ActUtils.PD_ENGINEERINGRECORD[0], businessKey, variables);
+		}
+		workFullRecord.setProcessInstance(processInstance);
+
+		// 更新流程实例ID
+		workFullRecord.setProcessInstanceId(processInstance.getId());
+		workFullRecordDao.updateProcessInstanceId(workFullRecord);
+		if(!flag){
+			WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.get(workFullRecord.getWorkFullManage().getId());
+			if(workEngineeringProject!=null) {
+				workEngineeringProject.setRemarks("发起归档");
+				workEngineeringProject.preUpdate();
+				workEngineeringProjectService.update(workEngineeringProject);
+			}
+		}
+		WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+		workProjectNotify.setNotifyId(workFullRecord.getId());
+		workProjectNotify.setCompanyId(workFullRecord.getCompanyId());
+		workProjectNotify.setTitle("项目归档审批申请");
+		workProjectNotify.setNotifyRole(roleEnname);
+		workProjectNotify.setContent(workFullRecord.getAct().getComment());
+		workProjectNotify.setType(type);
+		workProjectNotify.setStatus("0");
+		workProjectNotify.setRemarks("待审批");
+		workProjectNotifyService.save(workProjectNotify);
+	}
+
+	@Transactional(readOnly = false)
+	public void delete(WorkFullRecord workFullRecord) {
+		WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.get(workFullRecord.getWorkEngineeringProject().getId());
+		workEngineeringProject.setStatus("5");
+		workEngineeringProject.preUpdate();
+		workEngineeringProjectService.save(workEngineeringProject);
+		super.delete(workFullRecord);
+	}
+
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public WorkFullRecord getByProcessInstanceId(String processInstanceId) {
+		WorkFullRecord workFullRecord = workFullRecordDao.getByProcessInstanceId(processInstanceId);
+		return workFullRecord;
+	}
+
+	/**
+	 * 获取已办任务
+	 * @return
+	 */
+	public List<WorkFullRecord> historicList(Act act){
+		String userId = UserUtils.getUser().getId();
+		HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().finished().taskAssignee(userId);
+		// 设置查询条件
+		if (StringUtils.isNotBlank(act.getProcDefKey())){
+			query.processDefinitionKey(act.getProcDefKey());
+		}
+		if (act.getBeginDate() != null){
+			query.taskCompletedAfter(act.getBeginDate());
+		}
+		if (act.getEndDate() != null){
+			query.taskCompletedBefore(act.getEndDate());
+		}
+		List<HistoricTaskInstance> list = query.list();
+		List<WorkFullRecord> list1 = new ArrayList<>();
+		Office office = UserUtils.getSelectCompany();
+		String companyId = office==null?"":office.getId();
+		for (HistoricTaskInstance histTask : list) {
+			WorkFullRecord workFullRecord = this.getByProcessInstanceId(histTask.getProcessInstanceId());
+			if (workFullRecord != null && workFullRecord.getCompanyId().equals(companyId)) {
+				workFullRecord.setCreateBy(UserUtils.get(workFullRecord.getCreateBy().getId()));
+				historyService.getHistoricIdentityLinksForProcessInstance(histTask.getProcessInstanceId());
+				act.setHistTask(histTask);
+				act.setVars(histTask.getProcessVariables());
+				act.setProcDef(ProcessDefCache.get(histTask.getProcessDefinitionId()));
+				act.setStatus("finish");
+				workFullRecord.setAct(act);
+				list1.add(workFullRecord);
+			}
+		}
+		return list1;
+	}
+
+	/**
+	 * 审核流程
+	 */
+	@Transactional(readOnly = false)
+	public void auditSave(WorkFullRecord workFullRecord, String status[],String type) {
+		actTaskService.claim(workFullRecord.getAct().getTaskId(), UserUtils.getUser().getId());
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workFullRecord.getAct().getTaskDefKey();
+		//yes 的时候状态为审核通过 否则为未通过
+		//1 审核中 2 未通过
+		workFullRecord.setBackRecordStatus(("yes".equals(workFullRecord.getAct().getFlag())?status[1]:status[2]));
+		Map<String, Object> vars = Maps.newHashMap();
+		//业务逻辑对应的条件表达式
+		String exp = "";
+		Role role = UserUtils.getSelectRole().get(0);
+		StringBuffer buffer = DateUtils.getByEnnme(role.getEnname());
+		StringBuffer gly = DateUtils.getByEnnme(role.getEnname());
+		buffer.append("bmzr");
+		gly.append("glygd");
+		WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+		workProjectNotify.setRemarks("待通知");
+		// 审核环节
+		String str = "";
+		if ("deptLeaderAudit".equals(taskDefKey)){
+			exp = "deptLeaderPass";
+			workProjectNotify.setRemarks("待审批");
+			if ("yes".equals(workFullRecord.getAct().getFlag())){
+				workProjectNotify.setNotifyRole(gly.toString());
+				str = "项目归档审核:待审批!";
+			}else {
+				str = "项目归档审核:被驳回!";
+				workProjectNotify.setUser(workFullRecord.getCreateBy());
+			}
+		}
+		else if ("recordUser".equals(taskDefKey)){
+			exp = "recordPass";
+			workFullRecord.setManageUser(UserUtils.getUser().getId());
+			workProjectNotify.setUser(workFullRecord.getCreateBy());
+			if ("yes".equals(workFullRecord.getAct().getFlag())){
+				str = "项目归档审核: 已同意!";
+				workFullRecord.setBackRecordStatus(status[3]);
+			}else {
+				str = "项目归档审核:被驳回!";
+				workFullRecord.setBackRecordStatus(status[5]);
+			}
+		}
+		else if ("modifyApply".equals(taskDefKey)){
+			exp = "modifyApply";
+			if ("yes".equals(workFullRecord.getAct().getFlag())){
+				workProjectNotify.setNotifyRole(buffer.toString());
+				workProjectNotify.setRemarks("待审批");
+				str = "项目归档审核:待审批!";
+			}
+		}
+		else if ("apply_end".equals(taskDefKey)){
+		}
+		// 未知环节,直接返回
+		else{
+			return;
+		}
+		// 设置意见
+		workFullRecord.getAct().setComment(("yes".equals(workFullRecord.getAct().getFlag())?"[同意] ":"[驳回] ")+workFullRecord.getAct().getComment());
+		workFullRecord.preUpdate();
+		// 提交流程任务
+		vars.put(exp, "yes".equals(workFullRecord.getAct().getFlag())? true : false);
+		// 提交流程任务
+		actTaskService.complete(workFullRecord.getAct().getTaskId(), workFullRecord.getAct().getProcInsId(), workFullRecord.getAct().getComment(), vars);
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workFullRecord.getId());
+		workProjectNotifyService.readByNotifyId(notify);
+		workFullRecordDao.update(workFullRecord);
+		workProjectNotify.setNotifyId(workFullRecord.getId());
+		workProjectNotify.setCompanyId(workFullRecord.getCompanyId());
+		workProjectNotify.setContent(workFullRecord.getAct().getComment());
+		workProjectNotify.setType(type);
+		workProjectNotify.setStatus("0");
+		boolean state = actTaskService.isProcessEnd(workFullRecord.getAct().getProcInsId());
+		if(!state) {
+			str = "yes".equals(workFullRecord.getAct().getFlag())?"您的项目归档审核:已通过":"您的项目归档审核:未通过";
+			if("yes".equals(workFullRecord.getAct().getFlag())){
+				if (StringUtils.isNotBlank(workFullRecord.getWorkFullManage().getId()) && type.equals("15")){
+					WorkFullManage workFullManage = workFullManageDao.get(workFullRecord.getWorkFullManage().getId());
+					workFullManage.setFullProjectStatus("6");
+					workFullManage.preUpdate();
+					workFullManageDao.update(workFullManage);
+				}else if (StringUtils.isNotBlank(workFullRecord.getWorkEngineeringProject().getId()) && type.equals("4")){
+					WorkEngineeringProject workEngineeringProject = workEngineeringProjectService.get(workFullRecord.getWorkEngineeringProject().getId());
+					workEngineeringProject.setRemarks("已归档");
+					workEngineeringProject.preUpdate();
+					workEngineeringProjectService.save(workEngineeringProject);
+				}
+			}
+		}
+		if (StringUtils.isNotBlank(str)) {
+			workProjectNotify.setTitle(str);
+			workProjectNotifyService.save(workProjectNotify);
+		}
+	}
+
+	/**
+	 * 查询文件管理员
+	 * 公司编号和角色别名 @return
+	 */
+	public HashMap<Object,Object> queryWjgly(String company_id, String enname){
+		HashMap<Object, Object> map = Maps.newHashMap();
+		map.put("company_id",company_id);
+		map.put("enname",enname);
+		return workFullRecordDao.queryWjgly(map);
+	}
+}

+ 49 - 0
src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullSurveyService.java

@@ -0,0 +1,49 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.service;
+
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.modules.workfullmanage.dao.WorkFullSurveyDao;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullSurvey;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 监理单位联系人Service
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkFullSurveyService extends CrudService<WorkFullSurveyDao, WorkFullSurvey> {
+
+	public WorkFullSurvey get(String id) {
+		return super.get(id);
+	}
+	
+	public List<WorkFullSurvey> findList(WorkFullSurvey workFullSurvey) {
+		return super.findList(workFullSurvey);
+	}
+	
+	public Page<WorkFullSurvey> findPage(Page<WorkFullSurvey> page, WorkFullSurvey workFullSurvey) {
+		return super.findPage(page, workFullSurvey);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkFullSurvey workFullSurvey) {
+		super.save(workFullSurvey);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(WorkFullSurvey workFullSurvey) {
+		super.delete(workFullSurvey);
+	}
+	
+	
+	
+	
+}

+ 214 - 0
src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullConstructController.java

@@ -0,0 +1,214 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.web;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullConstruct;
+import com.jeeplus.modules.workfullmanage.service.WorkFullConstructService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 施工单位联系人Controller
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workfullmanage/workFullConstruct")
+public class WorkFullConstructController extends BaseController {
+
+	@Autowired
+	private WorkFullConstructService workFullConstructService;
+
+	@Autowired
+	private HttpServletRequest request;
+	@ModelAttribute
+	public WorkFullConstruct get(@RequestParam(required=false) String id) {
+		WorkFullConstruct entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workFullConstructService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkFullConstruct();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 施工单位联系人列表页面
+	 */
+//	@RequiresPermissions("workfullmanage:workFullConstruct:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkFullConstruct workFullConstruct, HttpServletRequest request, HttpServletResponse response, Model model) {
+		String index = request.getParameter("index");
+		Page<WorkFullConstruct> page = workFullConstructService.findPage(new Page<WorkFullConstruct>(request, response), workFullConstruct);
+		model.addAttribute("page", page);
+		model.addAttribute("indexf",index);
+		return "modules/workfullmanage/workFullConstructList";
+	}
+
+	/**
+	 * 查看,增加,编辑施工单位联系人表单页面
+	 */
+//	@RequiresPermissions(value={"workfullmanage:workFullConstruct:view","workfullmanage:workFullConstruct:add","workfullmanage:workFullConstruct:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkFullConstruct workFullConstruct, Model model) {
+		String tabId = request.getParameter("tabId");
+		String view = "workFullConstructForm";
+		if("1".equals(tabId)){
+			view = "workFullConstructFormDetail";
+		}
+		model.addAttribute("workFull", workFullConstruct);
+		return "modules/workfullmanage/"+view;
+	}
+
+	/**
+	 * 保存施工单位联系人
+	 */
+//	@RequiresPermissions(value={"workfullmanage:workFullConstruct:add","workfullmanage:workFullConstruct:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	@ResponseBody
+	public HashMap<Object,Object> save(WorkFullConstruct workFullConstruct, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		HashMap<Object, Object> map = Maps.newHashMap();
+		if(!workFullConstruct.getIsNewRecord()){//编辑表单保存
+			WorkFullConstruct t = workFullConstructService.get(workFullConstruct.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workFullConstruct, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workFullConstructService.save(t);//保存
+			map.put("str","修改成功");
+		}else{//新增表单保存
+			WorkFullConstruct unit_name = workFullConstructService.findUniqueByProperty("unit_name", workFullConstruct.getUnitName());
+			if(unit_name != null){
+				map.put("msg","cnounique");
+				return map;
+			}
+			workFullConstructService.save(workFullConstruct);//保存
+			map.put("str","新增成功");
+		}
+		map.put("id",workFullConstruct.getId());
+		map.put("unitName",workFullConstruct.getUnitName());
+		map.put("unitLinkMan",workFullConstruct.getUnitLinkMan());
+		map.put("linkPhone",workFullConstruct.getLinkPhone());
+		map.put("msg","cunique");
+		return  map;
+	}
+	
+	/**
+	 * 删除施工单位联系人
+	 */
+//	@RequiresPermissions("workfullmanage:workFullConstruct:del")
+	@RequestMapping(value = "delete")
+	@ResponseBody
+	public HashMap<Object, Object> delete(WorkFullConstruct workFullConstruct, RedirectAttributes redirectAttributes) {
+		HashMap<Object, Object> map = Maps.newHashMap();
+		workFullConstructService.delete(workFullConstruct);
+		map.put("str","success");
+		return map;
+//		addMessage(redirectAttributes, "删除施工单位联系人成功");
+//		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullConstruct/?repage";
+	}
+	
+	/**
+	 * 批量删除施工单位联系人
+	 */
+//	@RequiresPermissions("workfullmanage:workFullConstruct:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workFullConstructService.delete(workFullConstructService.get(id));
+		}
+		addMessage(redirectAttributes, "删除施工单位联系人成功");
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullConstruct/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+//	@RequiresPermissions("workfullmanage:workFullConstruct:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkFullConstruct workFullConstruct, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "施工单位联系人"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkFullConstruct> page = workFullConstructService.findPage(new Page<WorkFullConstruct>(request, response, -1), workFullConstruct);
+    		new ExportExcel("施工单位联系人", WorkFullConstruct.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出施工单位联系人记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullConstruct/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+//	@RequiresPermissions("workfullmanage:workFullConstruct:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkFullConstruct> list = ei.getDataList(WorkFullConstruct.class);
+			for (WorkFullConstruct workFullConstruct : list){
+				try{
+					workFullConstructService.save(workFullConstruct);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条施工单位联系人记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条施工单位联系人记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入施工单位联系人失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullConstruct/?repage";
+    }
+	
+	/**
+	 * 下载导入施工单位联系人数据模板
+	 */
+//	@RequiresPermissions("workfullmanage:workFullConstruct:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "施工单位联系人数据导入模板.xlsx";
+    		List<WorkFullConstruct> list = Lists.newArrayList();
+    		new ExportExcel("施工单位联系人数据", WorkFullConstruct.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullConstruct/?repage";
+    }
+	
+	
+	
+
+}

+ 215 - 0
src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullDesignController.java

@@ -0,0 +1,215 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workfullmanage.web;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.workfullmanage.entity.WorkFullDesign;
+import com.jeeplus.modules.workfullmanage.service.WorkFullDesignService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 施工监理设计单位联系人Controller
+ * @author mapengbo
+ * @version 2017-10-25
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workfullmanage/workFullDesign")
+public class WorkFullDesignController extends BaseController {
+
+	@Autowired
+	private WorkFullDesignService workFullDesignService;
+
+	@Autowired
+	private HttpServletRequest request;
+
+	@ModelAttribute
+	public WorkFullDesign get(@RequestParam(required=false) String id) {
+		WorkFullDesign entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workFullDesignService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkFullDesign();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 施工监理设计单位联系人列表页面
+	 */
+//	@RequiresPermissions("workfullmanage:workFullDesign:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkFullDesign workFullDesign, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkFullDesign> page = workFullDesignService.findPage(new Page<WorkFullDesign>(request, response), workFullDesign);
+		String index = request.getParameter("index");
+		model.addAttribute("indexf",index);
+		model.addAttribute("page", page);
+		return "modules/workfullmanage/workFullDesignList";
+	}
+
+	/**
+	 * 查看,增加,编辑施工监理设计单位联系人表单页面
+	 */
+//	@RequiresPermissions(value={"workfullmanage:workFullDesign:view","workfullmanage:workFullDesign:add","workfullmanage:workFullDesign:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkFullDesign workFullDesign, Model model) {
+		String tabId = request.getParameter("tabId");
+		String view = "workFullDesignForm";
+		if("1".equals(tabId)){
+			view = "workFullDesignFormDetail";
+		}
+		model.addAttribute("workFull", workFullDesign);
+		return "modules/workfullmanage/"+view;
+	}
+
+	/**
+	 * 保存施工监理设计单位联系人
+	 */
+//	@RequiresPermissions(value={"workfullmanage:workFullDesign:add","workfullmanage:workFullDesign:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	@ResponseBody
+	public HashMap<Object,Object> save(WorkFullDesign workFullDesign, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		HashMap<Object, Object> map = Maps.newHashMap();
+		if(!workFullDesign.getIsNewRecord()){//编辑表单保存
+			WorkFullDesign t = workFullDesignService.get(workFullDesign.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workFullDesign, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workFullDesignService.save(t);//保存
+			map.put("str","修改成功");
+		}else{//新增表单保存
+			WorkFullDesign unit_name = workFullDesignService.findUniqueByProperty("unit_name", workFullDesign.getUnitName());
+			if(unit_name != null){
+				map.put("msg","dnounique");
+				return map;
+			}
+			workFullDesignService.save(workFullDesign);//保存
+			map.put("str","新增成功");
+		}
+		map.put("id",workFullDesign.getId());
+		map.put("unitName",workFullDesign.getUnitName());
+		map.put("unitLinkMan",workFullDesign.getUnitLinkMan());
+		map.put("linkPhone",workFullDesign.getLinkPhone());
+		map.put("msg","dunique");
+		return  map;
+	}
+	
+	/**
+	 * 删除施工监理设计单位联系人
+	 */
+//	@RequiresPermissions("workfullmanage:workFullDesign:del")
+	@RequestMapping(value = "delete")
+	@ResponseBody
+	public HashMap<Object, Object> delete(WorkFullDesign workFullDesign, RedirectAttributes redirectAttributes) {
+		HashMap<Object, Object> map = Maps.newHashMap();
+		workFullDesignService.delete(workFullDesign);
+		map.put("str","success");
+		return map;
+//		addMessage(redirectAttributes, "删除施工监理设计单位联系人成功");
+//		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullDesign/?repage";
+	}
+	
+	/**
+	 * 批量删除施工监理设计单位联系人
+	 */
+//	@RequiresPermissions("workfullmanage:workFullDesign:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workFullDesignService.delete(workFullDesignService.get(id));
+		}
+		addMessage(redirectAttributes, "删除施工监理设计单位联系人成功");
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullDesign/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+//	@RequiresPermissions("workfullmanage:workFullDesign:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(WorkFullDesign workFullDesign, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "施工监理设计单位联系人"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<WorkFullDesign> page = workFullDesignService.findPage(new Page<WorkFullDesign>(request, response, -1), workFullDesign);
+    		new ExportExcel("施工监理设计单位联系人", WorkFullDesign.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出施工监理设计单位联系人记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullDesign/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+//	@RequiresPermissions("workfullmanage:workFullDesign:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<WorkFullDesign> list = ei.getDataList(WorkFullDesign.class);
+			for (WorkFullDesign workFullDesign : list){
+				try{
+					workFullDesignService.save(workFullDesign);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条施工监理设计单位联系人记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条施工监理设计单位联系人记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入施工监理设计单位联系人失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullDesign/?repage";
+    }
+	
+	/**
+	 * 下载导入施工监理设计单位联系人数据模板
+	 */
+//	@RequiresPermissions("workfullmanage:workFullDesign:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "施工监理设计单位联系人数据导入模板.xlsx";
+    		List<WorkFullDesign> list = Lists.newArrayList(); 
+    		new ExportExcel("施工监理设计单位联系人数据", WorkFullDesign.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workfullmanage/workFullDesign/?repage";
+    }
+	
+	
+	
+
+}

+ 0 - 0
src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullManageController.java


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff