فهرست منبع

合同借出模块和管理员修改合同功能

user5 4 سال پیش
والد
کامیت
5a4dd3138d
19فایلهای تغییر یافته به همراه4037 افزوده شده و 18 حذف شده
  1. 61 0
      src/main/java/com/jeeplus/modules/workcontractinfo/dao/WorkContractBorrowDao.java
  2. 189 0
      src/main/java/com/jeeplus/modules/workcontractinfo/entity/WorkCntractBorrow.java
  3. 83 7
      src/main/java/com/jeeplus/modules/workcontractinfo/entity/WorkContractInfo.java
  4. 674 0
      src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractBorrowService.java
  5. 12 4
      src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java
  6. 370 0
      src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractBorrowController.java
  7. 83 4
      src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractInfoController.java
  8. 28 0
      src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java
  9. 329 0
      src/main/resources/mappings/modules/workcontractinfo/WorkContractBorrowDao.xml
  10. 2 0
      src/main/resources/mappings/modules/workcontractinfo/WorkContractInfoDao.xml
  11. 1 1
      src/main/webapp/static/common/jeeplus.js
  12. 199 0
      src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowAudit.jsp
  13. 203 0
      src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowForm.jsp
  14. 195 0
      src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowList.jsp
  15. 214 0
      src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowModify.jsp
  16. 196 0
      src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowView.jsp
  17. 15 0
      src/main/webapp/webpage/modules/workContractBorrow/workTrack.jsp
  18. 1087 0
      src/main/webapp/webpage/modules/workcontractinfo/workContractInfoAdminForm.jsp
  19. 96 2
      src/main/webapp/webpage/modules/workcontractinfo/workContractInfoList.jsp

+ 61 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/dao/WorkContractBorrowDao.java

@@ -0,0 +1,61 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workcontractinfo.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 合同归档DAO接口
+ * @author lw
+ * @version 2018-06-08
+ */
+@MyBatisDao
+public interface WorkContractBorrowDao extends CrudDao<WorkCntractBorrow> {
+
+	List<WorkContractInfo> findListByworkContractInfo(WorkContractInfo workContractInfo);
+	/**
+	 * 更新流程实例ID
+	 * @return
+	 */
+	int updateProcessInstanceId(WorkCntractBorrow workCntractBorrow);
+
+	/**
+	 * 根据流程实例ID获取
+	 * @param processInstanceId
+	 * @return
+	 */
+	WorkCntractBorrow getByProcessInstanceId(String processInstanceId);
+	//更新归档状态
+	int updateRecordStatus(String id);
+	//按照合同编号获取最新的归档编号
+	String findRecordNum(@Param("num") String num);
+
+
+
+	/**
+	 * 根据合同id查询最后一条数据记录
+	 * @param contractId
+	 * @return
+	 */
+	WorkCntractBorrow getLastInfo(String contractId);
+
+	/**
+	 * 归还合同修改
+	 * @param workCntractBorrow
+	 */
+	void updateGiveDate(WorkCntractBorrow workCntractBorrow);
+
+	/**
+	 * 根据合同查询所有借用信息
+	 * @param contractId
+	 * @return
+	 */
+	List<WorkCntractBorrow> getWorkCntractBorrowList(String contractId);
+}

+ 189 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/entity/WorkCntractBorrow.java

@@ -0,0 +1,189 @@
+package com.jeeplus.modules.workcontractinfo.entity;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+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: 大猫
+ * @create: 2020-10-29 17:28
+ **/
+public class WorkCntractBorrow extends ActEntity<WorkCntractBorrow> {
+
+    private static final long serialVersionUID = 1L;
+    private String processInstanceId;		// 流程号
+    private String officeId;		// 部门ID
+    private String companyId;		// 公司ID
+    private WorkContractInfo workContractInfo;		// 合同
+    private String recordNum;		// 借用合同申请编号
+    private Date borrowDate;		// 借用时间
+    private Date aboutGiveDate;		// 大概归还时间
+    private Date actualGiveDate;	// 实际归还时间
+    private String status;		// 借用审核状态
+    private String giveStatus;		// 归还状态
+    private String home;       //跳转首页标记
+    private Date beginContractDate;		// 开始
+    private Date endContractDate;		// 结束
+    // 流程任务
+    private Task task;
+    private Map<String, Object> variables;
+    // 运行中的流程实例
+    private ProcessInstance processInstance;
+    // 历史的流程实例
+    private HistoricProcessInstance historicProcessInstance;
+    // 流程定义
+    private ProcessDefinition processDefinition;
+
+    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;
+    }
+
+    public String getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(String companyId) {
+        this.companyId = companyId;
+    }
+
+    public WorkContractInfo getWorkContractInfo() {
+        return workContractInfo;
+    }
+
+    public void setWorkContractInfo(WorkContractInfo workContractInfo) {
+        this.workContractInfo = workContractInfo;
+    }
+
+    public String getRecordNum() {
+        return recordNum;
+    }
+
+    public void setRecordNum(String recordNum) {
+        this.recordNum = recordNum;
+    }
+
+    public Date getBorrowDate() {
+        return borrowDate;
+    }
+
+    public void setBorrowDate(Date borrowDate) {
+        this.borrowDate = borrowDate;
+    }
+
+    public Date getAboutGiveDate() {
+        return aboutGiveDate;
+    }
+
+    public void setAboutGiveDate(Date aboutGiveDate) {
+        this.aboutGiveDate = aboutGiveDate;
+    }
+
+    public Date getActualGiveDate() {
+        return actualGiveDate;
+    }
+
+    public void setActualGiveDate(Date actualGiveDate) {
+        this.actualGiveDate = actualGiveDate;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getGiveStatus() {
+        return giveStatus;
+    }
+
+    public void setGiveStatus(String giveStatus) {
+        this.giveStatus = giveStatus;
+    }
+
+    public String getHome() {
+        return home;
+    }
+
+    public void setHome(String home) {
+        this.home = home;
+    }
+
+    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;
+    }
+
+    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;
+    }
+}

+ 83 - 7
src/main/java/com/jeeplus/modules/workcontractinfo/entity/WorkContractInfo.java

@@ -48,6 +48,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 /*-----------------------------------------------------------------*/
 	private static final long serialVersionUID = 1L;
 	private WorkClientInfo client;		// 客户ID(主委托方)
+	private String clientName;		// 主委托方名称
 	private List<WorkClientInfo> workClientInfoList = Lists.newArrayList(); //委托方列表
 	private Date contractDate;			// 签订日期
 	private Date effectiveDate;			// 合同生效日期
@@ -117,6 +118,14 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	private String contrractRecordId;   //归档合同id
 	private String recordNum;   //归档编号
 
+	private String borrowStatus;   //借用状态
+	private String giveStatus;   //归还状态
+	private String borrowCreateById;   //借用人id
+	private String borrowId;   //借用信息id
+	private String opinion;   //判断
+	private String flagAdmin;   //判断admin
+	private String createUser;   //创建者信息
+
 	public String getBeginInvestmentAmount() {
 		return beginInvestmentAmount;
 	}
@@ -232,7 +241,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 		this.home = home;
 	}
 
-	@ExcelField(title="总合同名称", align=2, sort=2)
+	@ExcelField(title="总合同名称", align=2, sort=3)
 	public String getTotalContractName() {
 		return totalContractName;
 	}
@@ -241,7 +250,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 		this.totalContractName = totalContractName;
 	}
 
-	@ExcelField(title="合同名称", align=2, sort=3)
+	@ExcelField(title="合同名称", align=2, sort=4)
 	public String getName() {
 		return name;
 	}
@@ -298,7 +307,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 		this.times = times;
 	}
 
-	@ExcelField(title="合同金额(元)", align=2, sort=4)
+	@ExcelField(title="合同金额(元)", align=2, sort=5)
 	public String getContractPrice() {
 		return contractPrice;
 	}
@@ -308,7 +317,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	}
 
 
-	@ExcelField(title="合同编号", align=2, sort=5)
+	@ExcelField(title="合同编号", align=2, sort=2)
 	public String getContractNum() {
 		return contractNum;
 	}
@@ -325,7 +334,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 		this.oldWorkContractInfo = oldWorkContractInfo;
 	}
 
-	@ExcelField(title="工程分类", mainDictType="contract_type", align=2, sort=6)
+	@ExcelField(title="工程分类", mainDictType="contract_type", align=2, sort=7)
 	public String getContractType() {
 		return contractType;
 	}
@@ -344,7 +353,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	}
 
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	@ExcelField(title="签订日期", align=2, sort=8)
+	@ExcelField(title="签订日期", align=2, sort=9)
 	public Date getContractDate() {
 		return contractDate;
 	}
@@ -416,7 +425,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 		this.contractSpecial = contractSpecial;
 	}
 	
-	@ExcelField(title="合同状态", dictType="audit_state", align=2, sort=15)
+	@ExcelField(title="合同状态", dictType="audit_state", align=2, sort=9)
 	public String getContractState() {
 		return contractState;
 	}
@@ -837,6 +846,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 		this.signatureStatus = signatureStatus;
 	}
 
+	@ExcelField(title="归档状态", dictType="audit_state", align=2, sort=10)
 	public String getContrractRecordStatus() {
 		return contrractRecordStatus;
 	}
@@ -860,4 +870,70 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	public void setRecordNum(String recordNum) {
 		this.recordNum = recordNum;
 	}
+
+	public String getBorrowStatus() {
+		return borrowStatus;
+	}
+
+	public void setBorrowStatus(String borrowStatus) {
+		this.borrowStatus = borrowStatus;
+	}
+
+	public String getGiveStatus() {
+		return giveStatus;
+	}
+
+	public void setGiveStatus(String giveStatus) {
+		this.giveStatus = giveStatus;
+	}
+
+	public String getBorrowCreateById() {
+		return borrowCreateById;
+	}
+
+	public void setBorrowCreateById(String borrowCreateById) {
+		this.borrowCreateById = borrowCreateById;
+	}
+
+	public String getBorrowId() {
+		return borrowId;
+	}
+
+	public void setBorrowId(String borrowId) {
+		this.borrowId = borrowId;
+	}
+
+	public String getOpinion() {
+		return opinion;
+	}
+
+	public void setOpinion(String opinion) {
+		this.opinion = opinion;
+	}
+
+	public String getFlagAdmin() {
+		return flagAdmin;
+	}
+
+	public void setFlagAdmin(String flagAdmin) {
+		this.flagAdmin = flagAdmin;
+	}
+
+	@ExcelField(title="客户名称", align=2, sort=6)
+	public String getClientName() {
+		return clientName;
+	}
+
+	public void setClientName(String clientName) {
+		this.clientName = clientName;
+	}
+
+	@ExcelField(title="创建人", align=2, sort=8)
+	public String getCreateUser() {
+		return createUser;
+	}
+
+	public void setCreateUser(String createUser) {
+		this.createUser = createUser;
+	}
 }

+ 674 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractBorrowService.java

@@ -0,0 +1,674 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workcontractinfo.service;
+
+import com.google.common.collect.Maps;
+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.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+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.workcontractinfo.dao.WorkContractBorrowDao;
+import com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workcontractrecord.dao.WorkContractRecordDao;
+import com.jeeplus.modules.workcontractrecord.entity.WorkContractRecord;
+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.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 java.util.*;
+
+/**
+ * 合同归档Service
+ * @author lw
+ * @version 2018-06-08
+ */
+@Service
+@Transactional(readOnly = true)
+public class WorkContractBorrowService extends CrudService<WorkContractBorrowDao, WorkCntractBorrow> {
+	@Autowired
+	private WorkContractInfoService workConttractInfoService;
+	@Autowired
+	private WorkContractInfoService workContractInfoService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private OfficeService officeService;
+
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private WorkActivityProcessDao workActivityProcessDao;
+
+	@SuppressWarnings("unchecked")
+	public WorkCntractBorrow get(String id) {
+		WorkCntractBorrow workCntractBorrow = super.get(id);
+		if(workCntractBorrow!=null&&workCntractBorrow.getWorkContractInfo()!=null&& StringUtils.isNotBlank(workCntractBorrow.getWorkContractInfo().getId())){
+			WorkContractInfo w = workConttractInfoService.get(workCntractBorrow.getWorkContractInfo().getId());
+			if(w!=null){
+				workCntractBorrow.setWorkContractInfo(w);
+			}
+		}
+		return workCntractBorrow;
+	}
+	
+	public List<WorkCntractBorrow> findList(WorkCntractBorrow workCntractBorrow) {
+		return super.findList(workCntractBorrow);
+	}
+	
+	public Page<WorkCntractBorrow> findPage(Page<WorkCntractBorrow> page, WorkCntractBorrow workCntractBorrow) {
+		String companyId = UserUtils.getUser().getComId();
+		workCntractBorrow.getSqlMap().put("dsf","and (a.company_id='"+companyId+"')");
+		workCntractBorrow.setPage(page);
+		page.setList(findList(workCntractBorrow));
+		return page;
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(WorkCntractBorrow workCntractBorrow) {
+		super.save(workCntractBorrow);
+	}
+
+	/**
+	 * 提交存储
+	 * @param
+	 * @param variables
+	 */
+	@Transactional(readOnly = false)
+	public String save(WorkCntractBorrow workCntractBorrow, Map<String, Object> variables, String processInstanceId) {
+			User user = UserUtils.getUser();
+
+			super.save(workCntractBorrow);
+			String str = "";
+			Office office = officeService.get(workCntractBorrow.getOfficeId());
+			str =  "主委托方:"+workCntractBorrow.getWorkContractInfo().getClient().getName()+",申请人:"+user.getName()+",所属部门:"+office.getName();
+			String title = "合同名称:"+workCntractBorrow.getWorkContractInfo().getName();
+			// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+			identityService.setAuthenticatedUserId(user.getId());
+			// 启动流程
+			String businessKey = workCntractBorrow.getId().toString();
+			WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("zth3125f1f194c82bdea9htgdc750904", office);
+			// 启动流程
+			String processType = workActivityMenu.getProcessType();
+			StringBuffer buffer = new StringBuffer();
+			Activity activity = new Activity();
+			WorkProjectNotify workProjectNotify = UtilNotify
+					.saveNotify(workCntractBorrow.getId(),
+							null,
+							workCntractBorrow.getCompanyId(),
+							title,
+							str,
+							"93",
+							"0",
+							"待审批",
+							""
+					);
+			List<User> users = new ArrayList<>();
+			List<User> bmzrs = UserUtils.getByRoleActivityEnname("htgdgly",3,office.getId(),"8",workCntractBorrow.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(),"3",workCntractBorrow.getCreateBy());
+						if (enusers.size()==0){
+							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(),"3",workCntractBorrow.getCreateBy());
+					}
+					//人员审批
+					if (StringUtils.isNotBlank(activity.getUser().getId())) {
+						users.add(activity.getUser());
+					}
+				}
+				workProjectNotify.setId("");
+			} else {
+				if (bmzrs.size()==0){
+					return "流程审批人不能为空,角色合同借用管理员下无用户,请联系管理员!";
+				}
+				variables.put("bmzrList", bmzrs);
+				variables.put("bmzrCount",bmzrs.size());
+				processType = "contractArchive";
+				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","7001");
+				extras.put("id",workProjectNotify.getId());
+				extras.put("procDefKey","93");
+				UserUtils.pushInfoToApp(title,str,extras,u.getId());
+				UserUtils.pushIm(u.getId(),str);
+			}
+			variables.put("type", processType);
+			variables.put("busId", businessKey);
+			variables.put("title", "审批单:" + workCntractBorrow.getRecordNum());//设置标题;
+
+			ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+			workCntractBorrow.setProcessInstance(processInstance);
+			if (StringUtils.isNotBlank(processInstanceId)) {
+				workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+				workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+				workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
+			}
+			// 更新流程实例ID
+			workCntractBorrow.setProcessInstanceId(processInstance.getId());
+			dao.updateProcessInstanceId(workCntractBorrow);
+			List<Activity> list = workActivityMenu.getActivities();
+			if (list != null && list.size() != 0) {
+				workActivityProcessService.saveList(list, processInstance.getId());
+			} else {
+				WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+				workActivityProcess.setProcessKey("contractArchive");
+				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(WorkCntractBorrow workCntractBorrow) {
+		//恢复为待归档状态
+		if(workCntractBorrow.getWorkContractInfo()!=null){
+			if(StringUtils.isNotBlank(workCntractBorrow.getWorkContractInfo().getId())){
+				WorkContractInfo workContractInfo = workConttractInfoService.get(workCntractBorrow.getWorkContractInfo().getId());
+				workContractInfo.setRecordState("1");
+				workConttractInfoService.save(workContractInfo);
+			}
+		}
+		super.delete(workCntractBorrow);
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workCntractBorrow.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(WorkCntractBorrow workCntractBorrow,List<User> auditUsers) {
+			String userName = UserUtils.get(workCntractBorrow.getCreateBy().getId()).getName();
+			Office office = officeService.get(workCntractBorrow.getOfficeId());
+			String str =  "主委托方:"+workCntractBorrow.getWorkContractInfo().getClient().getName()+",申请人:"+userName+",所属部门:"+office.getName();
+			String title = "合同名称:"+workCntractBorrow.getWorkContractInfo().getName();
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workCntractBorrow.getAct().getTaskDefKey();
+			if (!"modifyApply".equals(taskDefKey)) {
+				actTaskService.claim(workCntractBorrow.getAct().getTaskId(), UserUtils.getUser().getId());
+			}else {
+				workCntractBorrow.getAct().setFlag("yes");
+			}
+			String comment = "";
+			if (workCntractBorrow.getStatus().equals("4")){
+				comment = ("yes".equals(workCntractBorrow.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+			}else {
+				comment = ("yes".equals(workCntractBorrow.getAct().getFlag())?"[同意] ":"[驳回] ")+workCntractBorrow.getAct().getComment();
+			}
+			//yes 的时候状态为审核通过 否则为未通过
+			workCntractBorrow.setStatus(("yes".equals(workCntractBorrow.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(workCntractBorrow.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(workCntractBorrow.getProcessInstanceId());
+			List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+			List<Activity> activities = workActivityMenu.getActivities();
+			if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("contractArchive")) {
+				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(workCntractBorrow.getAct().getFlag())) {
+							workCntractBorrow.setStatus("4");
+							workActivityProcess.setIsApproval("2");
+							String returnBack = "-1";
+							for (Activity activity : activities) {
+								if (activity.getCount() == activityProcess.getCount()) {
+									notifyRole = activity.getName();
+									returnBack = activity.getReturnBack();
+									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(workCntractBorrow.getAct().getFlag())) {
+							workCntractBorrow.setStatus("3");
+							workActivityProcess.setIsApproval("2");
+						} else {
+							workActivityProcess.setIsApproval("1");
+						}
+						break;
+					}
+				}
+			} else {
+				workActivityMenu.setProcessType("contractArchive");
+				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(workCntractBorrow.getAct().getFlag())) {
+							notifyRole = "借用完成";
+							workActivityProcess.setIsApproval("1");
+						} else {
+							notifyRole = "调整申请";
+							workActivityProcess.setIsApproval("2");
+						}
+						break;
+					} else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+						notifyRole = "合同管理员审批借用";
+						taskCount = "0";
+						exp = "pass";
+						workActivityProcess.setCount(0);
+						enname ="bmzr";
+						if (!"yes".equals(workCntractBorrow.getAct().getFlag())) {
+							workCntractBorrow.setStatus("3");
+						}
+						break;
+					} else if ("apply_end".equals(taskDefKey)) {
+					}
+
+				}
+			}
+			// 设置意见
+			workCntractBorrow.getAct().setComment(("yes".equals(workCntractBorrow.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workCntractBorrow.getAct().getComment());
+			workCntractBorrow.preUpdate();
+			// 提交流程任务
+			vars.put(exp, "yes".equals(workCntractBorrow.getAct().getFlag()) ? true : false);
+		    vars.put("passs", true);
+			workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workCntractBorrow.getProcessInstanceId(),taskDefKey,"modifyApply",workCntractBorrow.getAct().getFlag(),comment, activities);
+			// 提交流程任务
+			actTaskService.complete(workCntractBorrow.getAct().getTaskId(), workCntractBorrow.getAct().getProcInsId(), workCntractBorrow.getAct().getComment(), vars);
+			boolean state = actTaskService.isProcessEnd(workCntractBorrow.getAct().getProcInsId());
+			List<User> users = new ArrayList<>();
+			List<User> userList = new ArrayList<>();
+			if (!state) {
+				str =  "主委托方:"+workCntractBorrow.getWorkContractInfo().getClient().getName();
+				title = "合同名称:"+workCntractBorrow.getWorkContractInfo().getName();
+				users.add(workCntractBorrow.getCreateBy());
+				if ("yes".equals(workCntractBorrow.getAct().getFlag())) {
+					workCntractBorrow.setStatus("5");
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workCntractBorrow.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workCntractBorrow.getId(),
+											workCntractBorrow.getCreateBy(),
+											workCntractBorrow.getCompanyId(),
+											title,
+											str,
+											"93",
+											"0",
+											"待通知",
+											notifyRole));
+
+				} else {
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workCntractBorrow.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					if (StringUtils.isNotBlank(workCntractBorrow.getStatus()) && !workCntractBorrow.getStatus().equals("3")){
+						workCntractBorrow.setStatus("4");
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workCntractBorrow.getId(),
+												workCntractBorrow.getCreateBy(),
+												workCntractBorrow.getCompanyId(),
+												title,
+												str,
+												"93",
+												"0",
+												"待通知",
+												notifyRole));
+					}
+				}
+				workActivityProcessService.deleteProcessIdAuditUsers(workCntractBorrow.getProcessInstanceId());
+			} else {
+				if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("contractArchive")) {
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workCntractBorrow.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					WorkProjectNotify workProjectNotify = UtilNotify
+							.saveNotify(workCntractBorrow.getId(),
+									new User(),
+									workCntractBorrow.getCompanyId(),
+									title,
+									str,
+									"93",
+									"0",
+									"待审批",
+									notifyRole);
+					List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+							activities,
+							workProjectNotify,
+							taskDefKey,
+							workCntractBorrow.getAct().getFlag(),
+							taskCount,
+							workCntractBorrow.getCreateBy(),
+							workCntractBorrow.getOfficeId(),
+							"3");
+					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","7001");
+							extras.put("id",workProjectNotify.getId());
+							extras.put("procDefKey","93");
+							UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
+
+						}
+					}
+
+				} else {
+					if (!"yes".equals(workCntractBorrow.getAct().getFlag())) {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workCntractBorrow.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workCntractBorrow.getId(),
+												workCntractBorrow.getCreateBy(),
+												workCntractBorrow.getCompanyId(),
+												title,
+												str,
+												"93",
+												"0",
+												"重新申请",
+												notifyRole));
+						users.add( workCntractBorrow.getCreateBy());
+					} else {
+						if (StringUtils.isNotBlank(enname)) {
+							WorkProjectNotify notify = new WorkProjectNotify();
+							notify.setNotifyId(workCntractBorrow.getId());
+							userList = workProjectNotifyService.readByNotifyId(notify);
+							WorkProjectNotify workProjectNotify = UtilNotify
+									.saveNotify(workCntractBorrow.getId(),
+											new User(),
+											workCntractBorrow.getCompanyId(),
+											title,
+											str,
+											"93",
+											"0",
+											"待审批",
+											notifyRole);
+							for (User user1:auditUsers){
+								users.add(user1);
+								workProjectNotify.setUser(user1);
+								workProjectNotify.setId("");
+								workProjectNotify.setIsNewRecord(false);
+								workProjectNotifyService
+										.save(workProjectNotify);
+								if (!"modifyApply".equals(taskDefKey)){
+									Map<String,Object> extras = new HashMap<>();
+										extras.put("type","7001");
+									extras.put("id",workProjectNotify.getId());
+									extras.put("procDefKey","93");
+									UserUtils.pushInfoToApp(title,str,extras,user1.getId());
+
+								}
+							}
+						}else {
+							WorkProjectNotify notify = new WorkProjectNotify();
+							notify.setNotifyId(workCntractBorrow.getId());
+							userList = workProjectNotifyService.readByNotifyId(notify);
+							users.addAll(userList);
+							users.add(workCntractBorrow.getCreateBy());
+							workProjectNotifyService
+									.save(UtilNotify
+											.saveNotify(workCntractBorrow.getId(),
+													workCntractBorrow.getCreateBy(),
+													workCntractBorrow.getCompanyId(),
+													title,
+													str,
+													"93",
+													"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());
+				}
+			}
+			dao.update(workCntractBorrow);
+			return "保存审核意见成功!";
+	}
+	public Page<WorkContractInfo> findPageByworkContractInfo(Page<WorkContractInfo> page, WorkContractInfo workContractInfo) {
+		workContractInfo.getSqlMap().put("dsf", dataScopeFilter(workContractInfo.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_CONTRACTRECORD.getValue()));
+		workContractInfo.setPage(page);
+		page.setList(dao.findListByworkContractInfo(workContractInfo));
+		return page;
+	}
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public WorkCntractBorrow getByProcessInstanceId(String processInstanceId) {
+		WorkCntractBorrow workCntractBorrow = dao.getByProcessInstanceId(processInstanceId);
+		return workCntractBorrow;
+	}
+	/**
+	 * 强制撤销
+	 * @param
+	 */
+	@Transactional(readOnly = false)
+	public void cancelInvalidate(WorkCntractBorrow workCntractBorrow) {
+		String invalidateProcessInstanceId = workCntractBorrow.getProcessInstanceId();
+		try {
+			//将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
+			WorkActivityProcess process = new WorkActivityProcess();
+			process.setProcessInstanceId(workCntractBorrow.getProcessInstanceId());
+			process.setIsApproval("0");
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(workCntractBorrow.getProcessInstanceId());
+			List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
+			WorkProjectNotify notify = new WorkProjectNotify();
+			notify.setNotifyId(workCntractBorrow.getId());
+			List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+			if (userList!=null && userList.size()!=0) {
+				for (User u : userList) {
+					User user = UserUtils.get(u.getId());
+					UserUtils.pushIm(u.getId(),"借用申请人:"+ user.getName()+" 强制撤销!");
+
+				}
+			}
+			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,"归档申请-强制撤销");
+			workCntractBorrow.setStatus("3");
+			workCntractBorrow.preUpdate();
+			dao.update(workCntractBorrow);
+
+		}catch (ActivitiObjectNotFoundException e){
+			System.err.println("撤销合同作废异常,因为这个流程已不存在!");
+			e.printStackTrace();
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	//获取同合同编号下 最新的归档编号
+	public String findRecordNum(String num) {
+		String s = dao.findRecordNum(num);
+		if(StringUtils.isNotBlank(s)){
+			String s2 = s.replace(num+"-","");
+			try {
+				int a = Integer.parseInt(s2);
+				a  = a+1;
+				return num+"-"+String.valueOf(a);
+			} catch (NumberFormatException e) {
+				e.printStackTrace();
+			}
+		}
+		return s;
+	}
+
+	/**
+	 * 根据合同查询最后一条借用信息
+	 * @param contractId
+	 * @return
+	 */
+	public WorkCntractBorrow getLastInfo(String contractId){
+		return dao.getLastInfo(contractId);
+	}
+
+	/**
+	 * 归还操作
+	 * @param workCntractBorrow
+	 */
+	@Transactional(readOnly = false)
+	public void updateGiveDate(WorkCntractBorrow workCntractBorrow){
+		workCntractBorrow.setGiveStatus("5");
+		workCntractBorrow.setActualGiveDate(new Date());
+		workCntractBorrow.preUpdate();
+		dao.updateGiveDate(workCntractBorrow);
+	}
+
+	/**
+	 * 根据合同id查询所有对应数据信息
+	 * @param contractId
+	 * @return
+	 */
+	public List<WorkCntractBorrow> getWorkCntractBorrowList(String contractId){
+		List<WorkCntractBorrow> workCntractBorrowList = dao.getWorkCntractBorrowList(contractId);
+		if(workCntractBorrowList.size()>0){
+			for (WorkCntractBorrow info:
+			workCntractBorrowList) {
+				info.setWorkContractInfo(workConttractInfoService.get(contractId));
+			}
+		}
+		return workCntractBorrowList;
+	}
+}

+ 12 - 4
src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java

@@ -44,10 +44,7 @@ import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workclientinfo.service.WorkClientInfoService;
 import com.jeeplus.modules.workcontractinfo.dao.*;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfoCopy;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractListInfo;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractReview;
+import com.jeeplus.modules.workcontractinfo.entity.*;
 import com.jeeplus.modules.workfullmanage.dao.WorkFullRecordDao;
 import com.jeeplus.modules.workfullmanage.entity.WorkFullManage;
 import com.jeeplus.modules.workfullmanage.entity.WorkFullRecord;
@@ -145,6 +142,8 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 	private WorkContractListInfoDao workContractListInfoDao;
 	@Autowired
 	private WorkBidProjectDao workBidProjectDao;
+	@Autowired
+	private WorkContractBorrowDao workContractBorrowDao;
 
 	public WorkContractInfo get(String id) {
 		WorkContractInfo workContractInfo = super.get(id);
@@ -3136,4 +3135,13 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 		return workContractListInfos;
 	}
 
+	/**
+	 * 根据合同id查询借用合同信息
+	 * @param contractId
+	 * @return
+	 */
+	public WorkCntractBorrow getBorrowInfo(String contractId){
+		return workContractBorrowDao.getLastInfo(contractId);
+	}
+
 }

+ 370 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractBorrowController.java

@@ -0,0 +1,370 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workcontractinfo.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.mapper.JsonMapper;
+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.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.workcontractinfo.entity.WorkCntractBorrow;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workcontractinfo.service.WorkContractBorrowService;
+import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
+import com.jeeplus.modules.workcontractrecord.entity.WorkContractRecord;
+import com.jeeplus.modules.workcontractrecord.service.WorkContractRecordService;
+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.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 合同借用Controller
+ * @author 徐滕
+ * @version 2020-10-29
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/workContractBorrow/workContractBorrow")
+public class WorkContractBorrowController extends BaseController {
+
+	@Autowired
+	private WorkContractBorrowService workCntractBorrowService;
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private WorkContractInfoService workContractInfoService;
+	@ModelAttribute
+	public WorkCntractBorrow get(@RequestParam(required=false) String id) {
+		WorkCntractBorrow entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workCntractBorrowService.get(id);
+		}
+		if (entity == null){
+			entity = new WorkCntractBorrow();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 合同借用列表页面
+	 */
+	@RequiresPermissions("workcontractrecord:workContractRecord:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(WorkCntractBorrow workCntractBorrow, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<WorkCntractBorrow> page = workCntractBorrowService.findPage(new Page<WorkCntractBorrow>(request, response), workCntractBorrow);
+		model.addAttribute("page", page);
+		return "modules/workcontractrecord/workContractRecordList";
+	}
+
+	/**
+	 * 查看,增加,编辑合同借用表单页面
+	 */
+	//@RequiresPermissions(value={"workcontractrecord:workContractRecord:view","workcontractrecord:workContractRecord:add","workcontractrecord:workContractRecord:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(WorkCntractBorrow workCntractBorrow, Model model) {
+		String view = "workContractBorrowForm";
+		Office office = UserUtils.getSelectOffice();
+		String tabId = request.getParameter("tabId");
+		if("1".equals(tabId)){
+			view = "workContractView";
+		}else if("3".equals(tabId)){
+			ProcessInstance processInstance = actTaskService.getProcIns(workCntractBorrow.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);
+				workCntractBorrow.setAct(act);
+				view = "workContractBorrowModify";
+			}
+		}if("4".equals(tabId)){
+			WorkContractInfo workContractInfo=workContractInfoService.get(workCntractBorrow.getId());
+			workCntractBorrow.setWorkContractInfo(workContractInfo);
+			workCntractBorrow.setId(null);
+			view = "workContractBorrowForm";
+		}
+		// 环节编号
+		String taskDefKey = workCntractBorrow.getAct().getTaskDefKey();
+		if (StringUtils.isNotBlank(taskDefKey) && ("htgdgly".equals(taskDefKey))){
+			view = "workContractRecordAudit";
+		}
+		if(StringUtils.isBlank(workCntractBorrow.getId())){
+			workCntractBorrow.setCreateBy(UserUtils.getUser());
+			workCntractBorrow.setCreateDate(new Date());
+		}
+		model.addAttribute("workContractBorrow", workCntractBorrow);
+		return "modules/workContractBorrow/"+view;
+	}
+
+	/**
+	 * 暂存
+	 */
+	@RequestMapping(value = "store")
+	public String store(WorkCntractBorrow workCntractBorrow,
+						Model model,
+						RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workCntractBorrow)){
+			return form(workCntractBorrow, model);
+		}
+		//归档中状态
+		if(workCntractBorrow.getWorkContractInfo()!=null){
+			if(StringUtils.isNotBlank(workCntractBorrow.getWorkContractInfo().getId())){
+				WorkContractInfo workContractInfo = workContractInfoService.get(workCntractBorrow.getWorkContractInfo().getId());
+				workContractInfo.setRecordState("2");
+				workContractInfoService.save(workContractInfo);
+			}
+		}
+		User user = workCntractBorrow.getCreateBy();
+		String submitter = "";
+		if(user != null){
+			submitter = user.getId();
+		}
+		String sta = workCntractBorrow.getStatus();
+		if(!UserUtils.getUser().getId().equals(submitter) && !Strings.isNullOrEmpty(submitter) && sta != null){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workcontractrecord/workContractRecord/?repage";
+		}
+		workCntractBorrow.setStatus("1"); //暂存状态
+		workCntractBorrow.setCompanyId(UserUtils.getSelectCompany().getId());
+		workCntractBorrow.setOfficeId(UserUtils.getSelectOffice().getId());
+		if (StringUtils.isNotBlank(workCntractBorrow.getProcessInstanceId()) && workCntractBorrow.getProcessInstanceId().equals("NULL")){
+			workCntractBorrow.setProcessInstanceId("");
+		}
+		if(!workCntractBorrow.getIsNewRecord()){//编辑表单保存
+			WorkCntractBorrow t = workCntractBorrowService.get(workCntractBorrow.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workCntractBorrow, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workCntractBorrowService.save(t);//保存
+		}else{//新增表单保存
+			workCntractBorrowService.save(workCntractBorrow);//保存
+		}
+		addMessage(redirectAttributes, "保存合同归档成功");
+		return "redirect:"+Global.getAdminPath()+"/workcontractrecord/workContractRecord/?repage";
+	}
+
+
+	/**
+	 * 保存合同借用
+	 */
+	@RequiresPermissions(value={"workcontractrecord:workContractRecord:add","workcontractrecord:workContractRecord:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public String save(WorkCntractBorrow workCntractBorrow, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workCntractBorrow)){
+			return form(workCntractBorrow, model);
+		}
+		User user = workCntractBorrow.getCreateBy();
+		String sta = workCntractBorrow.getStatus();
+		if(user!=null && !UserUtils.getUser().getId().equals(user.getId()) && StringUtils.isNotBlank(user.getId())){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workcontractinfo/workContractInfo/?repage";
+		}
+		//状态设置为审核中
+		workCntractBorrow.setStatus("2");
+		String processInstanceId ="";
+		if (user!=null && StringUtils.isNotBlank(user.getId()) && StringUtils.isNotBlank(sta) && "3".equals(sta)){
+			processInstanceId = workCntractBorrowService.get(workCntractBorrow.getId()).getProcessInstanceId();
+		}
+		try {
+			Map<String, Object> variables = Maps.newHashMap();
+			workCntractBorrow.setCompanyId(UserUtils.getSelectCompany().getId());
+			workCntractBorrow.setOfficeId(UserUtils.getSelectOffice().getId());
+			String str = "";
+			synchronized (this){
+				User loginUser = UserUtils.getUser();
+				WorkCntractBorrow lastInfo = workCntractBorrowService.getLastInfo(workCntractBorrow.getWorkContractInfo().getId());
+				if(null != lastInfo){
+					//判定只有最后一条已经审核完成并归还之后或者必须是登记人撤销的才可以进行借出操作
+					if(("5".equals(lastInfo.getStatus()) && "5".equals(lastInfo.getGiveStatus())) || ("3".equals(lastInfo.getStatus())) && lastInfo.getCreateBy().getId().equals(loginUser.getId())){
+						str = workCntractBorrowService.save(workCntractBorrow, variables,processInstanceId);
+					}else{
+						addMessage(redirectAttributes, "该合同已经借出,无法重复借取");
+						return "redirect:"+Global.getAdminPath()+"/workcontractinfo/workContractInfo/?repage";
+					}
+				}else{
+					str = workCntractBorrowService.save(workCntractBorrow, variables,processInstanceId);
+				}
+			}
+			if (StringUtils.isNotBlank(str)){
+				addMessage(redirectAttributes, "合同借用申请提交失败:"+str);
+			}else {
+				addMessage(redirectAttributes, "合同借用申请已经提交");
+			}
+
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "合同借用申请提交失败!");
+			addMessage(redirectAttributes, "系统内部错误");
+		}
+		return "redirect:"+Global.getAdminPath()+"/workcontractinfo/workContractInfo/?repage";
+	}
+
+
+	/**
+	 * 工单执行(完成任务)
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "saveAudit")
+	public String saveAudit(WorkCntractBorrow workCntractBorrow, Model model,
+							RedirectAttributes redirectAttributes) {
+		try {
+			List<User> users = UserUtils.getByProssType(workCntractBorrow.getProcessInstanceId(),1);
+			String flag = workCntractBorrow.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+			}else {
+				String str = workCntractBorrowService.auditSave(workCntractBorrow,users);
+				addMessage(redirectAttributes, str);
+			}
+		}catch (Exception e){
+			addMessage(redirectAttributes, "审批失败");
+		}
+
+		if (StringUtils.isNotBlank(workCntractBorrow.getHome()) && "home".equals(workCntractBorrow.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else {
+			return "redirect:"+Global.getAdminPath()+"/workcontractinfo/workContractInfo/?repage";
+		}
+	}
+
+
+	/**
+	 * 删除合同借用
+	 */
+	@RequiresPermissions("workcontractrecord:workContractRecord:del")
+	@RequestMapping(value = "delete")
+	public String delete(WorkCntractBorrow workCntractBorrow, RedirectAttributes redirectAttributes) {
+		workCntractBorrowService.delete(workCntractBorrow);
+		addMessage(redirectAttributes, "删除合同归档成功");
+		return "redirect:"+Global.getAdminPath()+"/workcontractinfo/workContractInfo/?repage";
+	}
+
+	/**
+	 * 选择合同
+	 */
+	@RequestMapping(value = "selectworkContractInfo")
+	public String selectworkContractInfo(WorkContractInfo workContractInfo, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, HttpServletRequest request, HttpServletResponse response, Model model) {
+		workContractInfo.setCompanyId(UserUtils.getSelectCompany().getId());
+		Page<WorkContractInfo> page = workCntractBorrowService.findPageByworkContractInfo(new Page<WorkContractInfo>(request, response),  workContractInfo);
+		try {
+			fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
+			fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
+			searchLabel = URLDecoder.decode(searchLabel, "UTF-8");
+			searchKey = URLDecoder.decode(searchKey, "UTF-8");
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		model.addAttribute("labelNames", fieldLabels.split("\\|"));
+		model.addAttribute("labelValues", fieldKeys.split("\\|"));
+		model.addAttribute("fieldLabels", fieldLabels);
+		model.addAttribute("fieldKeys", fieldKeys);
+		model.addAttribute("url", url);
+		model.addAttribute("searchLabel", searchLabel);
+		model.addAttribute("searchKey", searchKey);
+		model.addAttribute("obj", workContractInfo);
+		model.addAttribute("page", page);
+		return "modules/sys/gridselectrecord";
+	}
+
+	/**
+	 * 强制撤销
+	 */
+	@RequestMapping("cancelInvalidate")
+	public String cancelInvalidate(WorkCntractBorrow workCntractBorrow,RedirectAttributes redirectAttributes){
+		workCntractBorrowService.cancelInvalidate(workCntractBorrow);
+		return "redirect:"+Global.getAdminPath()+"/workcontractinfo/workContractInfo/?repage";
+	}
+
+	/**
+	 * 读取单个实体流程
+	 * @return
+	 */
+	@RequestMapping(value = "getProcessOne")
+	public String getProcessOne(WorkCntractBorrow workCntractBorrow,Model model) {
+		model.addAttribute("processInstanceId", workCntractBorrow.getProcessInstanceId());
+		return "modules/workContractBorrow/workTrack";
+	}
+
+	/**
+	 * 查询借用列表
+	 * @return
+	 */
+	@RequestMapping(value = "getWorkCntractBorrowList")
+	public String getWorkCntractBorrowList(String contractId,Model model) {
+		List<WorkCntractBorrow> workCntractBorrowList = workCntractBorrowService.getWorkCntractBorrowList(contractId);
+		model.addAttribute("workCntractBorrowList", workCntractBorrowList);
+		return "modules/workContractBorrow/workContractBorrowList";
+	}
+
+	/**
+	 * 归还合同
+	 * @return
+	 */
+	@RequestMapping(value = "updateGiveDate")
+	public String updateGiveDate(WorkCntractBorrow workCntractBorrow, RedirectAttributes redirectAttributes) {
+		workCntractBorrowService.updateGiveDate(workCntractBorrow);
+		addMessage(redirectAttributes, "合同归还成功");
+		return "redirect:"+Global.getAdminPath()+"/workcontractinfo/workContractInfo/?repage";
+	}
+
+	//获取合同
+	@RequestMapping(value = "getPNumberr")
+	@ResponseBody
+	public String getPNumberr() {
+		HashMap<Object, Object> map = Maps.newHashMap();
+		String obj = request.getParameter("obj");
+		WorkContractInfo workContractInfo = workContractInfoService.get(obj);
+		if(StringUtils.isNotBlank(workContractInfo.getContractNum())){
+			String recordNum = workCntractBorrowService.findRecordNum(workContractInfo.getContractNum());
+			if(StringUtils.isBlank(recordNum)){
+				map.put("recordNum",workContractInfo.getContractNum()+"-1");
+			}else{
+				map.put("recordNum",recordNum);
+			}
+		}else{
+			map.put("recordNum","-合同HT-2018-00000-1");
+		}
+		map.put("contractNum",workContractInfo.getContractNum());
+		if(workContractInfo.getClient()!=null){
+			map.put("cName",workContractInfo.getClient().getName());
+		}
+		String a= workContractInfo.getContractType();
+		map.put("contractType",DictUtils.getMainDictLabel(workContractInfo.getContractType(),"contract_type",""));
+		return JsonMapper.toJsonString(map);
+	}
+
+}

+ 83 - 4
src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractInfoController.java

@@ -45,10 +45,7 @@ import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workclientinfo.service.WorkClientInfoService;
 import com.jeeplus.modules.workcontractinfo.dao.WorkContractInfoCopyDao;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfoCopy;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractListInfo;
-import com.jeeplus.modules.workcontractinfo.entity.WorkContractReview;
+import com.jeeplus.modules.workcontractinfo.entity.*;
 import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
 import com.jeeplus.modules.workcontractinfo.service.WorkContractReviewService;
 import com.jeeplus.modules.workcontractrecord.entity.WorkContractRecord;
@@ -156,6 +153,41 @@ public class WorkContractInfoController extends BaseController {
         //workContractInfo.setCurrentUser(user);
         //workContractInfo.setIsTotal("1");
         Page<WorkContractInfo> page = workContractInfoService.findPage(new Page<WorkContractInfo>(request, response), workContractInfo);
+        List<WorkContractInfo> list = page.getList();
+        //查询合同借用信息状态
+        if(list.size()>0){
+            for (WorkContractInfo info: list) {
+                WorkCntractBorrow workCntractBorrow = workContractInfoService.getBorrowInfo(info.getId());
+                if(null != workCntractBorrow){
+                    info.setBorrowStatus(workCntractBorrow.getStatus());
+                    info.setGiveStatus(workCntractBorrow.getGiveStatus());
+                    info.setBorrowCreateById(workCntractBorrow.getCreateBy().getId());
+                    info.setBorrowId(workCntractBorrow.getId());
+                }else{
+                    info.setBorrowStatus("0");
+                    info.setGiveStatus("0");
+                    info.setBorrowCreateById("");
+                    info.setBorrowId("");
+                }
+                if(user.getRoleList().size()>0){
+                    //判断是否为归档员
+                    if ("htgly".equals(user.getRoleList().get(0).getEnname())){
+                        info.setOpinion("1");
+                    }else{
+                        info.setOpinion("0");
+                    }
+                    //判断是否为admin
+                    if ("newUser".equals(user.getRoleList().get(0).getEnname())){
+                        info.setFlagAdmin("1");
+                    }else{
+                        info.setFlagAdmin("0");
+                    }
+                }else{
+                    info.setOpinion("0");
+                    info.setFlagAdmin("0");
+                }
+            }
+        }
         model.addAttribute("page", page);
         return "modules/workcontractinfo/workContractInfoList";
     }
@@ -379,6 +411,15 @@ public class WorkContractInfoController extends BaseController {
     }
 
     /**
+     * admin修改合同管理表单页面
+     */
+    @RequestMapping(value = "adminForm")
+    public String adminForm(WorkContractInfo workContractInfo, Model model) {
+        model.addAttribute("workContractInfo", workContractInfo);
+        return "modules/workcontractinfo/workContractInfoAdminForm";
+    }
+
+    /**
      * 归档页面(暂弃)
      */
     @RequestMapping(value = "forms")
@@ -957,6 +998,44 @@ public class WorkContractInfoController extends BaseController {
         }
         return "redirect:" + Global.getAdminPath() + "/workcontractinfo/workContractInfo/?repage";
     }
+
+
+
+    /**
+     * admin修改信息
+     */
+    @RequestMapping(value = "adminUpdate")
+    public String adminUpdate(HttpServletRequest request,WorkContractInfo workContractInfo, Model model, RedirectAttributes redirectAttributes) throws Exception{
+        if (!beanValidator(model, workContractInfo)){
+            return form(workContractInfo, model);
+        }
+        //判断是否有总合同
+        if(!Strings.isNullOrEmpty(workContractInfo.getTotalContractId()) && !"0".equals(workContractInfo.getTotalContractId())){
+            workContractInfo.setIsTotalName("子合同");
+            workContractInfo.setIsTotal(null);
+        }else{
+            workContractInfo.setIsTotalName("总合同");
+            workContractInfo.setIsTotal("1");
+            workContractInfo.setTotalContractId("0");
+            //workContractInfo.setCommonFlag(IdGen.uuid());
+        }
+        List<WorkClientAttachment> list = workContractInfo.getWorkAttachments();
+        List<WorkClientAttachment> list1 = new ArrayList<>();
+        for (WorkClientAttachment workClientAttachment:list){
+            if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+                list1.add(workClientAttachment);
+            }
+        }
+        workContractInfo.setWorkAttachments(list1);
+        WorkContractInfo t = workContractInfoService.get(workContractInfo.getId());//从数据库取出记录的值
+        //将编辑表单中的非NULL值覆盖数据库记录中的值
+        MyBeanUtils.copyBeanNotNull2Bean(workContractInfo, t);
+        workContractInfoService.save(t);//保存
+        workContractInfoService.updateWorkContractInfo(workContractInfo);
+        addMessage(redirectAttributes, "修改合同管理成功");
+        return "redirect:" + Global.getAdminPath() + "/workcontractinfo/workContractInfo/?repage";
+    }
+
     /**
      * 修改合同金额
      */

+ 28 - 0
src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java

@@ -90,7 +90,9 @@ import com.jeeplus.modules.workchangejob.entity.WorkChangeJobUser;
 import com.jeeplus.modules.workchangejob.service.WorkChangeJobService;
 import com.jeeplus.modules.workchangejob.service.WorkChangeJobUserService;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workcontractinfo.service.WorkContractBorrowService;
 import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
 import com.jeeplus.modules.workcontractrecord.entity.WorkContractRecord;
 import com.jeeplus.modules.workcontractrecord.service.WorkContractRecordService;
@@ -265,6 +267,8 @@ public class WorkProjectNotifyController extends BaseController {
 	@Autowired
 	private WorkContractRecordService workContractRecordService;
 	@Autowired
+	private WorkContractBorrowService workContractBorrowService;
+	@Autowired
 	private SerialNumTplService serialNumTplService;
 
 	@Autowired
@@ -724,6 +728,11 @@ public class WorkProjectNotifyController extends BaseController {
 				if(workContractRecord!=null){
 					processInstanceId = workContractRecord.getProcessInstanceId();
 				}
+			}else if(workProjectNotify.getType().equals("93")){	//合同借用
+				WorkCntractBorrow workCntractBorrow = workContractBorrowService.get(workProjectNotify.getNotifyId());
+				if(workCntractBorrow!=null){
+					processInstanceId = workCntractBorrow.getProcessInstanceId();
+				}
 			}else if(workProjectNotify.getType().equals("91")){	//合同簽章
 				WorkContractSignature workContractSignature = workContractSignatureService.get(workProjectNotify.getNotifyId());
 				if(workContractSignature!=null){
@@ -1245,6 +1254,18 @@ public class WorkProjectNotifyController extends BaseController {
 					} else {
 						return "modules/workcontractrecord/workContractView";
 					}
+				} else if (workProjectNotify.getType().equals("93")) {    //合同借用
+					WorkCntractBorrow workContractBorrow = workContractBorrowService.get(workProjectNotify.getNotifyId());
+					workContractBorrow.setAct(getByAct(workContractBorrow.getProcessInstanceId()));
+					workContractBorrow.setHome("home");
+					model.addAttribute("workContractBorrow", workContractBorrow);
+					if (workProjectNotify.getRemarks().contains("待审批") && !"1".equals(workProjectNotify.getStatus())) {
+						return "modules/workContractBorrow/workContractBorrowAudit";
+					} else if (workProjectNotify.getRemarks().contains("重新申请") && !"1".equals(workProjectNotify.getStatus())) {
+						return "modules/workContractBorrow/workContractBorrowModify";
+					} else {
+						return "modules/workContractBorrow/workContractBorrowView";
+					}
 				}  else if (workProjectNotify.getType().equals("91")) {    //合同簽章
 					WorkContractSignature workContractSignature = workContractSignatureService.get(workProjectNotify.getNotifyId());
 					workContractSignature.setAct(getByAct(workContractSignature.getProcessInstanceId()));
@@ -2432,6 +2453,13 @@ public class WorkProjectNotifyController extends BaseController {
 					workContractRecord.setHome("home");
 					model.addAttribute("workContractRecord",workContractRecord);
 					return "modules/workcontractrecord/workContractView";
+				}
+				else if(workProjectNotify.getType().equals("93")){	//合同归档
+					WorkCntractBorrow workCntractBorrow = workContractBorrowService.get(workProjectNotify.getNotifyId());
+					workCntractBorrow.setAct(getByAct(workCntractBorrow.getProcessInstanceId()));
+					workCntractBorrow.setHome("home");
+					model.addAttribute("workCntractBorrow",workCntractBorrow);
+					return "modules/workContractBorrow/workContractBorrowView";
 				}else if(workProjectNotify.getType().equals("54")){	//收入调整作废
 					WorkReceiptsRevise workReceiptsRevise = workReceiptsReviseService.get(workProjectNotify.getNotifyId());
 					workReceiptsRevise.setAct(getByAct(workReceiptsRevise.getInvalidProcessInstanceId()));

+ 329 - 0
src/main/resources/mappings/modules/workcontractinfo/WorkContractBorrowDao.xml

@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeeplus.modules.workcontractinfo.dao.WorkContractBorrowDao">
+    
+	<sql id="workContractRecordColumns">
+		a.id AS "id",
+		a.create_by as "createBy.id",
+		a.create_date as "createDate",
+		a.update_by as "updateBy.id",
+		a.update_date as "updateDate",
+		a.remarks as "remarks",
+		a.del_flag as "delFlag",
+		a.process_instance_id as "processInstanceId",
+		a.office_id as "officeId",
+		a.company_id as "companyId",
+		a.contract_info_id as "workContractInfo.id",
+		a.record_num as "recordNum",
+		a.borrow_date as "borrowDate",
+		a.about_give_date as "aboutGiveDate",
+		a.actual_give_date as "actualGiveDate",
+		a.status as "status",
+		a.give_status as "giveStatus"
+	</sql>
+
+	<sql id="workContractRecordJoins">
+		LEFT JOIN work_contract_info workContractInfo ON workContractInfo.id = a.contract_info_id
+		LEFT JOIN work_client_info wc ON workContractInfo.client_id = wc.id
+		LEFT JOIN sys_office o ON o.id = a.office_id
+		LEFT JOIN sys_office s ON s.id = a.company_id
+		left JOIN sys_user su on su.id = a.create_by
+	</sql>
+	
+    
+	<select id="get" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow" >
+		SELECT 
+			<include refid="workContractRecordColumns"/>
+			,su.name AS "createBy.name"
+		FROM work_contract_borrow a
+		<include refid="workContractRecordJoins"/>
+		WHERE a.id = #{id}
+	</select>
+
+	<select id="getLastInfo" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow">
+		SELECT
+			<include refid="workContractRecordColumns"/>
+		FROM work_contract_borrow a
+		WHERE a.contract_info_id = #{contractId}
+		order by a.create_date desc
+		limit 1
+	</select>
+
+	<select id="findList" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow" >
+		SELECT
+			<include refid="workContractRecordColumns"/>
+		FROM work_contract_borrow a
+		<include refid="workContractRecordJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="recordNum != null and recordNum != ''">
+				AND a.record_num = #{recordNum}
+			</if>
+			<if test="status != null and status != ''">
+				AND a.status = #{status}
+			</if>
+			<if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
+				AND a.create_date BETWEEN #{beginContractDate} AND #{endContractDate}
+			</if>
+			<if test="workContractInfo != null and workContractInfo.name != null and workContractInfo.name != ''">
+				AND workContractInfo.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{workContractInfo.name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{workContractInfo.name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{workContractInfo.name},'%')</if>
+			</if>
+			<if test="workContractInfo != null and workContractInfo.contractNum != null and workContractInfo.contractNum != ''">
+				AND workContractInfo.contract_num LIKE
+				<if test="dbName == 'oracle'">'%'||#{workContractInfo.contractNum}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{workContractInfo.contractNum}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{workContractInfo.contractNum},'%')</if>
+			</if>
+			<if test="workContractInfo != null and workContractInfo.contractType != null and workContractInfo.contractType != ''">
+				AND workContractInfo.contract_type = #{workContractInfo.contractType}
+			</if>
+			<if test="workContractInfo != null and workContractInfo.id != null and workContractInfo.id != ''">
+				AND a.contract_info_id = #{workContractInfo.id}
+			</if>
+			<if test="workContractInfo != null and workContractInfo.client != null and workContractInfo.client.name != null and workContractInfo.client.name != ''">
+				AND wc.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{workContractInfo.client.name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{workContractInfo.client.name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{workContractInfo.client.name},'%')</if>
+			</if>
+			${sqlMap.dsf}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="findAllList" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow" >
+		SELECT
+			<include refid="workContractRecordColumns"/>
+		FROM work_contract_borrow a
+		<include refid="workContractRecordJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<insert id="insert">
+		INSERT INTO work_contract_borrow(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			process_instance_id,
+			office_id,
+			company_id,
+			contract_info_id,
+			record_num,
+			borrow_date,
+			about_give_date,
+			actual_give_date,
+			status,
+			give_status
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{processInstanceId},
+			#{officeId},
+			#{companyId},
+			#{workContractInfo.id},
+			#{recordNum},
+			#{borrowDate},
+			#{aboutGiveDate},
+			#{actualGiveDate},
+			#{status},
+			#{giveStatus}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE work_contract_borrow SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			process_instance_id = #{processInstanceId},
+			office_id = #{officeId},
+			company_id = #{companyId},
+			contract_info_id = #{workContractInfo.id},
+			borrow_date = #{borrowDate},
+			about_give_date = #{aboutGiveDate},
+			status = #{status}
+		WHERE id = #{id}
+	</update>
+
+	<update id="updateGiveDate">
+		UPDATE work_contract_borrow SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			give_status = #{giveStatus},
+			actual_give_date = #{actualGiveDate}
+		WHERE id = #{id}
+	</update>
+
+	<select id="getWorkCntractBorrowList" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow">
+		SELECT
+		<include refid="workContractRecordColumns"/>
+		,su.name AS "createBy.name"
+		FROM work_contract_borrow a
+		<include refid="workContractRecordJoins"/>
+		<where>
+			a.del_flag = 0 and contract_info_id = #{contractId}
+		</where>
+		ORDER BY a.update_date DESC
+	</select>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM work_contract_borrow
+		WHERE id = #{id}
+	</update>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE work_contract_borrow SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+
+
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow" statementType="STATEMENT">
+		select * FROM work_contract_borrow  where ${propertyName} = '${value}'
+	</select>
+
+	<select id="findListByworkContractInfo" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow">
+		SELECT
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		(select name from sys_user user where user.id=a.create_by) AS "createBy.name",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.project_id AS "project.id",
+		a.project_name AS "projectName",
+		a.ext AS "ext",
+		p.project_name AS "project.projectName",
+		p.project_number AS "project.projectNumber",
+		a.del_flag AS "delFlag",
+		a.remarks AS "remarks",
+		a.client_id AS "client.id",
+		a.contract_date AS "contractDate",
+		a.effective_date AS "effectiveDate",
+		a.closing_date AS "closingDate",
+		a.name AS "name",
+		a.contract_category AS "contractCategory",
+		a.contract_num AS "contractNum",
+		a.contract_price AS "contractPrice",
+		a.contract_opposite AS "contractOpposite",
+		a.contract_type AS "contractType",
+		a.contract_fee AS "contractFee",
+		a.contract_special AS "contractSpecial",
+		a.contract_state AS "contractState",
+		a.create_name AS "createName",
+		a.charge_company AS "chargeCompany",
+		a.charge_company_name AS "chargeCompanyName",
+		a.contract_file_id AS "contractFileId",
+		a.contract_role AS  "contractRole",
+		a.apply_view AS  "applyView",
+		a.company_id AS "companyId",
+		a.office_id AS "officeId",
+		a.contractFeeDoc AS "contractFeeDoc",
+		a.contractTypeDoc AS "contractTypeDoc",
+		a.process_instance_id AS "processInstanceId",
+		client.name AS "client.name",
+		a.is_total AS "isTotal",
+		a.total_contract_id AS "totalContractId",
+		a.common_flag AS "commonFlag",
+		a.status AS "status",
+		a.investment_scale AS "investmentScale",
+		a.summary_payment AS "summaryPayment",
+		a.investment_amount AS "investmentAmount",
+		a.create_bys AS "createBys",
+		a.construction_project_type AS "constructionProjectType",
+		a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
+		a.alter_process_instance_id AS "alterProcessInstanceId",
+		a.invalidate_status AS "invalidateStatus",
+		a.invalidate_user AS "invalidateUserId",
+		a.alter_state AS "alterState",
+		a.alterbefore_id AS "alterBeforeId",
+		a.alter_sign AS "alterSign",
+		a.record_state AS "recordState",
+		(select count(1) from work_contract_info c where c.total_contract_id = a.id)  cnt
+		FROM work_contract_info a
+		LEFT JOIN work_client_info client ON client.id = a.client_id
+		LEFT JOIN sys_user u on u.id = a.create_by
+		LEFT JOIN sys_office o ON o.id = a.charge_company
+		LEFT JOIN work_bid_project p ON  p.id = a.project_id
+		LEFT JOIN sys_office s ON s.id = a.company_id
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL} and (a.contract_state =5 or a.contract_state =7 ) and a.record_state = 1 and alter_state is null
+			<if test="name != null and name != ''">
+				AND a.name LIKE
+				<if test="dbName == 'oracle'">#{name}||'%'</if>
+				<if test="dbName == 'mssql'">#{name}+'%'</if>
+				<if test="dbName == 'mysql'">concat(#{name},'%')</if>
+			</if>
+			<if test="companyId != null and companyId != ''">
+				AND a.company_id = #{companyId}
+			</if>
+			${sqlMap.dsf}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<update id="updateProcessInstanceId">
+		UPDATE work_contract_borrow SET
+		process_instance_id = #{processInstanceId}
+		WHERE id = #{id}
+	</update>
+
+	<update id="updateRecordStatus">
+		UPDATE work_contract_info SET
+		record_state = 3
+		WHERE id = #{id}
+	</update>
+	<!-- 获取流程ID -->
+	<select id="getByProcessInstanceId" resultType="com.jeeplus.modules.workcontractinfo.entity.WorkCntractBorrow">
+		SELECT
+		<include refid="workContractRecordColumns"/>
+		FROM work_contract_borrow a
+		<include refid="workContractRecordJoins"/>
+		WHERE a.process_instance_id = #{processInstanceId}
+	</select>
+
+	<select id="findRecordNum" resultType="java.lang.String">
+		 SELECT a2.record_num from(select * from work_contract_record a
+		 where a.del_flag = 0 and a.record_num like concat(#{num},'%') ORDER BY a.create_date desc LIMIT 1) a2
+	</select>
+</mapper>

+ 2 - 0
src/main/resources/mappings/modules/workcontractinfo/WorkContractInfoDao.xml

@@ -195,6 +195,7 @@
 		SELECT
 		a.id AS "id",
 		u.name AS "createBy.name",
+		u.name AS "createUser",
 		a.create_by AS "createBy.id",
 		a.create_date AS "createDate",
 		a.update_by AS "updateBy.id",
@@ -227,6 +228,7 @@
 		a.contractTypeDoc AS "contractTypeDoc",
 		a.another_contract_num AS "anotherContractNum",
 		client.name AS "client.name",
+		client.name as "clientName",
 		a.is_total AS "isTotal",
 		a.total_contract_id AS "totalContractId",
 		a.status AS "status",

+ 1 - 1
src/main/webapp/static/common/jeeplus.js

@@ -468,7 +468,7 @@ function getBorrowState(id)
     result.action = true;
     switch(id)
     {
-        case "0":result.label = "tempstore";result.status="未借用";result.action = false;break;
+        case "0":result.label = "tempstore";result.status="未借用";break;
         case "1":result.label = "tempstore";result.status="暂存";result.action = false;break;
         case "2":result.label = "auditing";result.status="借用中";break;
         case "3":result.label = "cancel";result.status="撤回";break;

+ 199 - 0
src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowAudit.jsp

@@ -0,0 +1,199 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>合同归档管理</title>
+	<meta name="decorator" content="default"/>
+	<script src="${ctxStatic}/layer-v2.3/laydate/laydate.js"></script>
+	<script type="text/javascript">
+		var validateForm;
+		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+		  if(validateForm.form()){
+		      var fileNum =  $("#fileNum").val();
+              if(obj == 1){
+                  $('#flag').val('yes');
+              }else{
+                  $('#flag').val('no');
+              }
+			  $("#inputForm").submit();
+			  return true;
+		  }else {
+              parent.layer.msg("信息未填写完整!", {icon: 5});
+          }
+		  return false;
+		}
+		$(document).ready(function() {
+			validateForm = $("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+            $("#attachment_btn").click(function () {
+                $("#attachment_file").click();
+            });
+		});
+
+        function setValue(obj){
+            $.ajax({
+                type:'post',
+                url:'${ctx}/workContractBorrow/workContractBorrow/getPNumberr',
+                data:{
+                    "obj":obj
+                },
+                success:function(data){
+                    var d = JSON.parse(data);
+                    $("#recordNum").val(d.recordNum);
+                    $("#contractNum").val(d.contractNum);
+                    $("#cName").val(d.cName);
+                    $("#contractType").val(d.contractType);
+                }
+            })
+        }
+	</script>
+</head>
+<body >
+<div class="single-form">
+	<div class="container">
+		<form:form id="inputForm" modelAttribute="workContractBorrow" action="${ctx}/workContractBorrow/workContractBorrow/saveAudit" method="post" class="form-horizontal">
+			<form:hidden path="id"/>
+			<form:hidden path="workContractInfo.id"/>
+			<form:hidden path="home"/>
+			<form:hidden path="act.taskId"/>
+			<form:hidden path="act.taskName"/>
+			<form:hidden path="act.taskDefKey"/>
+			<form:hidden path="act.procInsId"/>
+			<form:hidden path="act.procDefId"/>
+			<form:hidden id="flag" path="act.flag"/>
+			<sys:message content="${message}"/>
+
+			<div class="form-group layui-row first lw8">
+				<div class="form-group-label"><h2>基础信息</h2></div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label"><span class="require-item">*</span>合同名称:</label>
+					<div class="layui-input-block with-icon">
+						<input htmlEscape="false"   readonly="true" class="form-control layui-input" value="${workContractBorrow.workContractInfo.name}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">合同编号:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${workContractBorrow.workContractInfo.contractNum}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">主委托方:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${workContractBorrow.workContractInfo.client.name}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">工程分类:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${fns:getMainDictLabel(workContractBorrow.workContractInfo.contractType, 'contract_type','')}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">借用人:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${workContractBorrow.createBy.name}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">借用日期:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="<fmt:formatDate value="${workContractBorrow.borrowDate}" pattern="yyyy-MM-dd" type="date" dateStyle="full"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">大概归还日期:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="<fmt:formatDate value="${workContractBorrow.aboutGiveDate}" pattern="yyyy-MM-dd" type="date" dateStyle="full"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12  with-textarea">
+					<label class="layui-form-label">备注:</label>
+					<div class="layui-input-block">
+						<textarea  htmlEscape="false" rows="4" readonly="true"    class="form-control ">${workContractBorrow.remarks}</textarea>
+					</div>
+				</div>
+			</div>
+			<%--<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								&lt;%&ndash; <th>序号</th>&ndash;%&gt;
+							<th>文件预览</th>
+							<th>上传人</th>
+							<th>上传时间</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workContractRecord.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									&lt;%&ndash; <td>${status.index + 1}</td>&ndash;%&gt;
+								<c:choose>
+									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
+										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+									</c:when>
+									<c:otherwise>
+										<c:choose>
+											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
+											</c:when>
+											<c:otherwise>
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
+											</c:otherwise>
+										</c:choose>
+									</c:otherwise>
+								</c:choose>
+								<td>${workClientAttachment.createBy.name}</td>
+								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td class="op-td">
+									<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>--%>
+			<div class="form-group layui-row lw8">
+				<div class="form-group-label"><h2>审批意见</h2></div>
+				<div class="layui-item layui-col-sm12  with-textarea">
+					<label class="layui-form-label">审批意见:</label>
+					<div class="layui-input-block">
+						<form:textarea path="act.comment" class="form-control" rows="4" maxlength="127" />
+						<input type="file" name="upload_files" style="display: none;">
+					</div>
+				</div>
+			</div>
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>审批流程</h2></div>
+				<div class="layui-item layui-col-xs12 form-table-container" >
+					<act:flowChart procInsId="${workContractBorrow.act.procInsId}"/>
+					<act:histoicFlow procInsId="${workContractBorrow.act.procInsId}"/>
+				</div>
+			</div>
+			<div class="form-group layui-row page-end"></div>
+		</form:form>
+	</div>
+</div>
+</body>
+</html>

+ 203 - 0
src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowForm.jsp

@@ -0,0 +1,203 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>合同归档管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+        var validateForm;
+        function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+            if(validateForm.form()){
+				$("#inputForm").attr("action","${ctx}/workContractBorrow/workContractBorrow/save");
+                $("#inputForm").submit();
+                return true;
+            }else {
+                parent.layer.msg("信息未填写完整!", {icon: 5});
+            }
+            return false;
+        }
+        $(document).ready(function() {
+            validateForm = $("#inputForm").validate({
+                submitHandler: function(form){
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function(error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+            $("#attachment_btn").click(function () {
+                $("#attachment_file").click();
+            });
+
+             laydate.render({
+                 elem: '#borrowDate',
+                 event: 'focus',
+                 type : 'date'
+             });
+
+             laydate.render({
+                 elem: '#aboutGiveDate',
+                 event: 'focus',
+                 type : 'date'
+             });
+        });
+
+        function setValue(obj){
+            $.ajax({
+                type:'post',
+                url:'${ctx}/workContractBorrow/workContractBorrow/getPNumberr',
+                data:{
+                    "obj":obj
+                },
+                success:function(data){
+                    var d = JSON.parse(data);
+                    $("#recordNum").val(d.recordNum);
+                    $("#contractNum").val(d.contractNum);
+                    $("#cName").val(d.cName);
+                    $("#contractType").val(d.contractType);
+                }
+            })
+        }
+	</script>
+</head>
+<body>
+<div class="single-form">
+	<div class="container">
+		<form:form id="inputForm" modelAttribute="workContractBorrow" action="${ctx}/workContractBorrow/workContractBorrow/save" method="post" class="form-horizontal">
+			<form:hidden path="id"/>
+			<form:hidden path="workContractInfo.id"/>
+			<div class="form-group layui-row first lw8">
+				<div class="form-group-label"><h2>基础信息</h2></div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">合同名称:</label>
+					<div class="layui-input-block">
+						<form:input id="workContractInfoName" path="workContractInfo.name" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">合同编号:</label>
+					<div class="layui-input-block">
+						<form:input id="contractNum" path="workContractInfo.contractNum" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">主委托方:</label>
+					<div class="layui-input-block">
+						<form:input id="cName" path="workContractInfo.client.name" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">工程分类:</label>
+					<div class="layui-input-block">
+						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${fns:getMainDictLabel(workContractBorrow.workContractInfo.contractType, 'contract_type', '')}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">借用人:</label>
+					<div class="layui-input-block">
+						<form:input id="cBName" path="createBy.name" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>借用日期:</label>
+					<div class="layui-input-block">
+						<input id="borrowDate" name="borrowDate"  htmlEscape="false" class="laydate-icondate required form-control layer-date  layui-input laydate-icon" value="<fmt:formatDate value="${workContractBorrow.borrowDate}" pattern="yyyy-MM-dd"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>大概归还日期:</label>
+					<div class="layui-input-block">
+						<input id="aboutGiveDate" name="aboutGiveDate"  htmlEscape="false" class="laydate-icondate required form-control layer-date  layui-input laydate-icon" value="<fmt:formatDate value="${workContractBorrow.aboutGiveDate}" pattern="yyyy-MM-dd"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line">实际归还日期:</label>
+					<div class="layui-input-block">
+						<input id="actualGiveDate" name="actualGiveDate" readonly="true" htmlEscape="false" class="laydate-icondate form-control layer-date  layui-input laydate-icon" value="<fmt:formatDate value="${workContractBorrow.actualGiveDate}" pattern="yyyy-MM-dd"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12  with-textarea">
+					<label class="layui-form-label">备注:</label>
+					<div class="layui-input-block">
+						<form:textarea path="remarks" htmlEscape="false" rows="4"    class="form-control "/>
+					</div>
+				</div>
+			</div>
+			<%--<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<div class="layui-item nav-btns">
+					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								&lt;%&ndash; <th>序号</th>&ndash;%&gt;
+							<th>文件预览</th>
+							<th>上传人</th>
+							<th>上传时间</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workContractRecord.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									&lt;%&ndash; <td>${status.index + 1}</td>&ndash;%&gt;
+								<c:choose>
+									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
+										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+									</c:when>
+									<c:otherwise>
+										<c:choose>
+											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
+											</c:when>
+											<c:otherwise>
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
+											</c:otherwise>
+										</c:choose>
+									</c:otherwise>
+								</c:choose>
+								<td>${workClientAttachment.createBy.name}</td>
+								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
+											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
+										</c:if>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>--%>
+			<div class="form-group layui-row page-end"></div>
+		</form:form>
+	</div>
+</div>
+</body>
+</html>

+ 195 - 0
src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowList.jsp

@@ -0,0 +1,195 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>合同归档管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+            //搜索框收放
+            $('#moresee').click(function(){
+                if($('#moresees').is(':visible'))
+                {
+                    $('#moresees').slideUp(0,resizeListWindow1);
+                    $('#moresee i').removeClass("glyphicon glyphicon-menu-up").addClass("glyphicon glyphicon-menu-down");
+                }else{
+                    $('#moresees').slideDown(0,resizeListWindow1);
+                    $('#moresee i').removeClass("glyphicon glyphicon-menu-down").addClass("glyphicon glyphicon-menu-up");
+                }
+            });
+            laydate.render({
+                elem: '#beginContractDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
+                event: 'focus' //响应事件。如果没有传入event,则按照默认的click
+            });
+
+
+            laydate.render({
+                elem: '#endContractDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
+                event: 'focus' //响应事件。如果没有传入event,则按照默认的click
+            });
+		});
+        function switchInput(obj){
+            $("#"+obj).show();
+            $("#"+obj).siblings().hide();
+        }
+        function openDialogre(title,url,width,height,target){
+
+            if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+                width='auto';
+                height='auto';
+            }else{//如果是PC端,根据用户设置的width和height显示。
+
+            }
+            top.layer.open({
+                type: 2,
+                area: [width, height],
+                title: title,
+                maxmin: false, //开启最大化最小化按钮
+                skin: 'three-btns',
+                content: url ,
+                btn: ['送审','暂存','关闭'],
+                btn1: function(index, layero){
+                    var body = top.layer.getChildFrame('body', index);
+                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                    var inputForm = body.find('#inputForm');
+                    var top_iframe;
+                    if(target){
+                        top_iframe = target;//如果指定了iframe,则在改frame中跳转
+                    }else{
+                        top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+                    }
+                    inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+                    if(iframeWin.contentWindow.doSubmit(1) ){
+                        top.layer.close(index);//关闭对话框。
+                        setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒,对应360 7.1版本bug
+                    }
+                },
+                btn2:function(index,layero){
+                    var body = top.layer.getChildFrame('body', index);
+                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                    var inputForm = body.find('#inputForm');
+                    var top_iframe;
+                    if(target){
+                        top_iframe = target;//如果指定了iframe,则在改frame中跳转
+                    }else{
+                        top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+                    }
+                    inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+                    if(iframeWin.contentWindow.doSubmit(2) ){
+                        top.layer.close(index);//关闭对话框。
+//                        setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒,对应360 7.1版本bug
+                    }
+                    return false;
+                },
+                btn3: function(index){
+                }
+            });
+        }
+        function openDialogreplay(title,url,width,height,target){
+
+            if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+                width='auto';
+                height='auto';
+            }else{//如果是PC端,根据用户设置的width和height显示。
+
+            }
+            top.layer.open({
+                type: 2,
+                area: [width, height],
+                title: title,
+                maxmin: false, //开启最大化最小化按钮
+                skin: 'two-btns',
+                content: url ,
+                btn: ['送审','关闭'],
+                yes: function(index, layero){
+                    var body = top.layer.getChildFrame('body', index);
+                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                    var inputForm = body.find('#inputForm');
+                    var top_iframe;
+                    if(target){
+                        top_iframe = target;//如果指定了iframe,则在改frame中跳转
+                    }else{
+                        top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+                    }
+                    inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+
+                    if(iframeWin.contentWindow.doSubmit() ){
+                        top.layer.close(index);//关闭对话框。
+                        //setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒,对应360 7.1版本bug
+                    }
+
+                },
+                cancel: function(index){
+                }
+            });
+        }
+	</script>
+	<style>
+		body{
+			background-color:transparent;
+			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
+			color:#ffffff;
+			background-color:rgba(255,255,255,0);
+			height:100%;
+		}
+	</style>
+</head>
+<body>
+	<div class="wrapper wrapper-content">
+	<sys:message content="${message}"/>
+		<div class="form-group layui-row">
+			<div class="form-group-label"><h2>合同借用详情</h2></div>
+			<div class="layui-item layui-col-xs12 form-table-container">
+				<table id="contentTableBase" class="table table-bordered table-condensed details">
+					<thead>
+					<tr>
+						<th class="hide"></th>
+						<th >合同名称</th>
+						<th >借用人</th>
+						<th >借用时间</th>
+						<th >大概归还时间</th>
+						<th >实际归还时间</th>
+					</tr>
+					</thead>
+					<tbody id="workBaseDataList">
+					<c:choose>
+						<c:when test="${not empty workCntractBorrowList}">
+							<c:forEach items="${workCntractBorrowList}" var="workCntractBorrow" varStatus="idx">
+								<tr>
+									<td class="hide">
+										<input type="hidden" id="workBaseDataList${idx.index}_id" value="${workCntractBorrow.id}">
+									</td>
+									<td title="${workCntractBorrow.workContractInfo.name}" style="text-align:center;">
+											${workCntractBorrow.workContractInfo.name}
+									</td>
+									<td title="${workCntractBorrow.createBy.name}" style="text-align:center;">
+											${workCntractBorrow.createBy.name}
+									</td>
+									<td style="text-align:center;">
+										<fmt:formatDate value="${workCntractBorrow.borrowDate}" pattern="yyyy-MM-dd"/>
+									</td>
+									<td style="text-align:center;">
+										<fmt:formatDate value="${workCntractBorrow.aboutGiveDate}" pattern="yyyy-MM-dd"/>
+									</td>
+									<td style="text-align:center;">
+										<fmt:formatDate value="${workCntractBorrow.actualGiveDate}" pattern="yyyy-MM-dd"/>
+									</td>
+								</tr>
+							</c:forEach>
+						</c:when>
+						<c:otherwise>
+							<tr>
+								<td colspan="5">
+									暂无数据
+								</td>
+							</tr>
+						</c:otherwise>
+					</c:choose>
+					</tbody>
+				</table>
+			</div>
+		</div>
+	</div>
+	<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
+</body>
+</html>

+ 214 - 0
src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowModify.jsp

@@ -0,0 +1,214 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>合同归档管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		var validateForm;
+		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+		  if(validateForm.form()){
+              if(obj == 2){
+                  $("#flag").val("no");
+              }else{
+                  $("#flag").val("yes");
+              }
+			  $("#inputForm").submit();
+			  return true;
+		  }else {
+              parent.layer.msg("信息未填写完整!", {icon: 5});
+          }
+		  return false;
+		}
+		$(document).ready(function() {
+			validateForm = $("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+            $("#attachment_btn").click(function () {
+                $("#attachment_file").click();
+            });
+
+			laydate.render({
+				elem: '#borrowDate',
+				event: 'focus',
+				type : 'date'
+			});
+
+			laydate.render({
+				elem: '#aboutGiveDate',
+				event: 'focus',
+				type : 'date'
+			});
+		});
+
+        function setValue(obj){
+            $.ajax({
+                type:'post',
+                url:'${ctx}/workcontractrecord/workContractRecord/getPNumberr',
+                data:{
+                    "obj":obj
+                },
+                success:function(data){
+                    var d = JSON.parse(data);
+                    $("#recordNum").val(d.recordNum);
+                    $("#contractNum").val(d.contractNum);
+                    $("#cName").val(d.cName);
+                    $("#contractType").val(d.contractType);
+                }
+            })
+        }
+	</script>
+</head>
+<body >
+<div class="single-form">
+	<div class="container">
+		<form:form id="inputForm" modelAttribute="workContractBorrow" action="${ctx}/workContractBorrow/workContractBorrow/saveAudit" method="post" class="form-horizontal">
+			<form:hidden path="id"/>
+			<form:hidden path="workContractInfo.id"/>
+			<form:hidden path="home"/>
+			<form:hidden path="act.taskId"/>
+			<form:hidden path="act.taskName"/>
+			<form:hidden path="act.taskDefKey"/>
+			<form:hidden path="act.procInsId"/>
+			<form:hidden path="act.procDefId"/>
+			<form:hidden id="flag" path="act.flag"/>
+			<div class="form-group layui-row first">
+				<div class="form-group-label"><h2>基础信息</h2></div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">合同名称:</label>
+					<div class="layui-input-block">
+						<form:input id="workContractInfoName" path="workContractInfo.name" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">合同编号:</label>
+					<div class="layui-input-block">
+						<form:input id="contractNum" path="workContractInfo.contractNum" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">主委托方:</label>
+					<div class="layui-input-block">
+						<form:input id="cName" path="workContractInfo.client.name" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">工程分类:</label>
+					<div class="layui-input-block">
+							<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${fns:getMainDictLabel(workContractBorrow.workContractInfo.contractType, 'contract_type', '')}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">借用人:</label>
+					<div class="layui-input-block">
+						<form:input id="cBName" path="createBy.name" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>借用日期:</label>
+					<div class="layui-input-block">
+						<input id="borrowDate" name="borrowDate"  htmlEscape="false" class="laydate-icondate required form-control layer-date  layui-input laydate-icon" value="<fmt:formatDate value="${workContractBorrow.borrowDate}" pattern="yyyy-MM-dd"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>大概归还日期:</label>
+					<div class="layui-input-block">
+						<input id="aboutGiveDate" name="aboutGiveDate"  htmlEscape="false" class="laydate-icondate required form-control layer-date  layui-input laydate-icon" value="<fmt:formatDate value="${workContractBorrow.aboutGiveDate}" pattern="yyyy-MM-dd"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line">实际归还日期:</label>
+					<div class="layui-input-block">
+						<input id="actualGiveDate" name="actualGiveDate" readonly="true" htmlEscape="false" class="laydate-icondate form-control layer-date  layui-input laydate-icon" value="<fmt:formatDate value="${workContractBorrow.actualGiveDate}" pattern="yyyy-MM-dd"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12  with-textarea">
+					<label class="layui-form-label">备注:</label>
+					<div class="layui-input-block">
+						<form:textarea path="remarks" htmlEscape="false" rows="4"    class="form-control "/>
+					</div>
+				</div>
+			</div>
+			<%--<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<div class="layui-item nav-btns">
+					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								&lt;%&ndash; <th>序号</th>&ndash;%&gt;
+							<th>文件预览</th>
+							<th>上传人</th>
+							<th>上传时间</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workContractRecord.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									&lt;%&ndash; <td>${status.index + 1}</td>&ndash;%&gt;
+								<c:choose>
+									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
+										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+									</c:when>
+									<c:otherwise>
+										<c:choose>
+											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
+											</c:when>
+											<c:otherwise>
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
+											</c:otherwise>
+										</c:choose>
+									</c:otherwise>
+								</c:choose>
+								<td>${workClientAttachment.createBy.name}</td>
+								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
+											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
+										</c:if>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>--%>
+			<div class="form-group layui-row page-end"></div>
+		</form:form>
+	</div>
+</div>
+</body>
+</html>

+ 196 - 0
src/main/webapp/webpage/modules/workContractBorrow/workContractBorrowView.jsp

@@ -0,0 +1,196 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>合同归档管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		var validateForm;
+		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+		  if(validateForm.form()){
+              if(obj == 2){
+                  $("#inputForm").attr("action","${ctx}/workcontractrecord/workContractRecord/store");
+              }else{
+                  $("#inputForm").attr("action","${ctx}/workcontractrecord/workContractRecord/save");
+              }
+			  $("#inputForm").submit();
+			  return true;
+		  }else {
+              parent.layer.msg("信息未填写完整!", {icon: 5});
+          }
+		  return false;
+		}
+		$(document).ready(function() {
+			validateForm = $("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+			
+		});
+        function insertTitle(tValue){
+            var list = "${workContractRecord.workAttachments}";
+            var size = (list.split('url')).length-1;
+            var files = $("#attachment_file")[0].files;            for(var i = 0;i<files.length;i++) {                var file = files[i];
+            var attachmentId = "";
+            var attachmentFlag = "85";
+            console.log(file);
+            var timestamp=new Date().getTime();
+
+            var storeAs = "attachment-file/workContractRd/"+timestamp+"/"+file['name'];
+            var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
+            var divId = "_attachment";
+            $("#addFile"+divId).show();
+            multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);}
+        }
+
+
+        function setValue(obj){
+            $.ajax({
+                type:'post',
+                url:'${ctx}/workcontractrecord/workContractRecord/getPNumberr',
+                data:{
+                    "obj":obj
+                },
+                success:function(data){
+                    var d = JSON.parse(data);
+                    $("#recordNum").val(d.recordNum);
+                    $("#contractNum").val(d.contractNum);
+                    $("#cName").val(d.cName);
+                    $("#contractType").val(d.contractType);
+                }
+            })
+        }
+	</script>
+</head>
+<body>
+<div class="single-form view-form">
+	<div class="container">
+		<form:form id="inputForm" modelAttribute="workContractRecord" action="${ctx}/workcontractrecord/workContractRecord/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+
+			<div class="form-group layui-row first lw8">
+				<div class="form-group-label"><h2>基础信息</h2></div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label"><span class="require-item">*</span>合同名称:</label>
+					<div class="layui-input-block with-icon">
+						<input htmlEscape="false"   readonly="true" class="form-control layui-input" value="${workContractRecord.workContractInfo.name}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">归档申请编号:</label>
+					<div class="layui-input-block">
+						<div class="input-group">
+							<input  htmlEscape="false"   readonly="true" class="form-control layui-input" value="${workContractRecord.recordNum}"/>
+							<span class="input-group-btn">
+								<label class="form-status"><c:choose><c:when test="${ empty workContractRecord.status}">新添</c:when><c:otherwise>${fns:getDictLabel(workContractRecord.status, 'audit_state','')}</c:otherwise>	</c:choose></label>
+							</span>
+						</div>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">合同编号:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${workContractRecord.workContractInfo.contractNum}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">主委托方:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${workContractRecord.workContractInfo.client.name}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">工程分类:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${fns:getMainDictLabel(workContractRecord.workContractInfo.contractType, 'contract_type','')}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">归档人:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${workContractRecord.createBy.name}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">归档日期:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="<fmt:formatDate value="${workContractRecord.createDate}" pattern="yyyy年MM月dd日" type="date" dateStyle="full"/>"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">档案号:</label>
+					<div class="layui-input-block">
+						<input  htmlEscape="false" readonly="true" class="form-control  layui-input" value="${workContractRecord.fileNum}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12  with-textarea">
+					<label class="layui-form-label">说明:</label>
+					<div class="layui-input-block">
+						<textarea  htmlEscape="false" rows="4" readonly="true"    class="form-control ">${workContractRecord.instruction}</textarea>
+					</div>
+				</div>
+			</div>
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>文件预览</th>
+							<th>上传人</th>
+							<th>上传时间</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workContractRecord.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
+										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+									</c:when>
+									<c:otherwise>
+										<c:choose>
+											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
+											</c:when>
+											<c:otherwise>
+												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
+											</c:otherwise>
+										</c:choose>
+									</c:otherwise>
+								</c:choose>
+								<td>${workClientAttachment.createBy.name}</td>
+								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td class="op-td">
+									<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<div class="form-group layui-row page-end"></div>
+		</form:form>
+	</div>
+</div>
+</body>
+</html>

+ 15 - 0
src/main/webapp/webpage/modules/workContractBorrow/workTrack.jsp

@@ -0,0 +1,15 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>归档流程</title>
+	<meta name="decorator" content="default"/>
+</head>
+<body class="gray-bg">
+<div class="container form layui-form">
+		<act:flowChart procInsId="${processInstanceId}"/>
+		<act:histoicFlow procInsId="${processInstanceId}"/>
+</div>
+</body>
+</html>
+

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1087 - 0
src/main/webapp/webpage/modules/workcontractinfo/workContractInfoAdminForm.jsp


+ 96 - 2
src/main/webapp/webpage/modules/workcontractinfo/workContractInfoList.jsp

@@ -169,6 +169,43 @@
             });
 
         }
+
+        function contractAdminUpdate(title,url,width,height,target){
+            if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+                width='auto';
+                height='auto';
+            }else{//如果是PC端,根据用户设置的width和height显示。
+
+            }
+            top.layer.open({
+                type: 2,
+                area: [width, height],
+                title: title,
+                maxmin: false, //开启最大化最小化按钮
+                skin:"three-btns",
+                content: url ,
+                btn: ['提交','关闭'],
+                btn1: function(index, layero){
+                    var body = top.layer.getChildFrame('body', index);
+                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                    var inputForm = body.find('#inputForm');
+                    var top_iframe;
+                    if(target){
+                        top_iframe = target;//如果指定了iframe,则在改frame中跳转
+                    }else{
+                        top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+                    }
+                    inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+                    if(iframeWin.contentWindow.doSubmit(1) ){
+                        // top.layer.close(index);//关闭对话框。
+                        setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒,对应360 7.1版本bug
+                    }
+                },
+                btn3: function(index){
+                }
+            });
+
+        }
         function openDialogre(title,url,width,height,target){
             if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
                 width='auto';
@@ -601,9 +638,17 @@
                         return xml;
                     }}
                 ,{align:'center', title: '借用状态',  width:70,templet:function(d){
-                        var st = getBorrowState(d.status);
+						var result = '';
+						if(d.borrowStatus == "0" || d.giveStatus == "5"){
+							result = "0";
+						}else if(d.borrowStatus != "0" && d.giveStatus != "5"){
+							result = "2";
+						}else if(d.borrowStatus == "5"){
+							result = "5";
+						}
+                        var st = getBorrowState(result);
                         if(st.action)
-                            var xml = "<span onclick=\"openDialogView('流程追踪', '${ctx}/workcontractinfo/workContractInfo/getProcess?id=" + d.id + "','95%','95%')\" class=\"status-label status-label-" + st.label + "\" >" + st.status + "</span>";
+                            var xml = "<span onclick=\"openDialogView('借用详情列表', '${ctx}/workContractBorrow/workContractBorrow/getWorkCntractBorrowList?contractId=" + d.id + "','95%','95%')\" class=\"status-label status-label-" + st.label + "\" >" + st.status + "</span>";
                         else
                             var xml = "<span style=\"cursor:default;\" class=\"status-label status-label-" + st.label + "\" >" + st.status + "</span>";
                         return xml;
@@ -612,6 +657,9 @@
                         ////对操作进行初始化
                         var xml="";
 
+						if(d.updateAdmin != undefined && d.updateAdmin == "1" ){
+							xml +="<a href=\"javascript:void(0)\" onclick=\"contractAdminUpdate('修改合同管理', '${ctx}/workcontractinfo/workContractInfo/adminForm?id=" + d.id + "','95%','95%')\" class=\"op-btn op-btn-edit\" ><i class=\"fa fa-edit\"></i> 修改</a>";
+						}
                         if(d.status != 5){
 							/*if(d.signature != undefined && d.signature =="1")
                                                     {
@@ -675,7 +723,26 @@
 							if(d.candeleteRecord != undefined && d.candeleteRecord == "1")
 								xml +="<a href=\"${ctx}/workcontractrecord/workContractRecord/delete?id=" + d.contrractRecordId + "\" onclick=\"return confirmx('确认要删除该合同归档申请吗?', this.href)\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 删除</a>";
 						}
+                        //合同借用
+                        else if(d.contrractRecordStatus =="5"){
+							if((d.borrowStatus != undefined && d.borrowStatus == "0") || (d.giveStatus != undefined && d.giveStatus == "5"))
+							{
+								xml += "<a href=\"javascript:void(0)\" onclick=\"contractOpenDialogres('借用申请', '${ctx}/workContractBorrow/workContractBorrow/form?id="+ d.id +"&tabId=4','95%','95%')\" style='background-color: #1E9FFF' class=\"op-btn op-btn-revert\" ><i class=\"fa fa-edit\"></i> 借用</a>";
+							}
 
+							if(d.cancancelBorrow != undefined && d.cancancelBorrow == "1")
+								xml += "<a href=\"${ctx}/workContractBorrow/workContractBorrow/cancelInvalidate?id=" + d.borrowId + "\" onclick=\"return confirmx('确认要强制撤回?', this.href)\"   class=\"op-btn op-btn-cancel\"><i class=\"glyphicon glyphicon-share-alt\"></i> 撤回</a>";
+							if(d.caneditBorrow1 != undefined && d.caneditBorrow1 == "1")
+								xml +="<a href=\"javascript:void(0)\" onclick=\"openDialogre('修改归档信息', '${ctx}/workContractBorrow/workContractBorrow/form?id="+ d.borrowId + "','95%','95%')\" class=\"op-btn op-btn-edit\" ><i class=\"fa fa-edit\"></i> 修改</a>";
+							if(d.caneditBorrow2 != undefined && d.caneditBorrow2 == "1")
+								xml +="<a href=\"javascript:void(0)\" onclick=\"openDialogreplay('修改归档信息', '${ctx}/workContractBorrow/workContractBorrow/form?id="+ d.borrowId + "&tabId=3','95%','95%')\" class=\"op-btn op-btn-edit\" ><i class=\"fa fa-edit\"></i> 修改</a>";
+							if(d.caneditBorrow3 != undefined && d.caneditBorrow3 == "1")
+								xml +="<a href=\"javascript:void(0)\" onclick=\"openDialogreplay('重新申请归档', '${ctx}/workContractBorrow/workContractBorrow/form?id=" + d.borrowId + "&tabId=3','95%','95%')\" class=\"op-btn op-btn-edit\" ><i class=\"fa fa-edit\"></i> 修改</a>";
+							if(d.candeleteBorrow != undefined && d.candeleteBorrow == "1")
+								xml +="<a href=\"${ctx}/workContractBorrow/workContractBorrow/delete?id=" + d.borrowId + "\" onclick=\"return confirmx('确认要删除该合同归档申请吗?', this.href)\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 删除</a>";
+							if(d.giveBorrow != undefined && d.giveBorrow == "1")
+								xml +="<a href=\"${ctx}/workContractBorrow/workContractBorrow/updateGiveDate?id=" + d.borrowId + "\" onclick=\"return confirmx('确认归还该合同信息吗?', this.href)\"   class=\"btn btn-info btn-xs\"><i class=\"fa fa-edit\"></i> 归还</a>";
+						}
                         return xml;
 
                     }}
@@ -700,6 +767,11 @@
                     ,"contrractRecordStatus":"${workContractInfo.contrractRecordStatus}"
                     ,"contrractRecordId":"${workContractInfo.contrractRecordId}"
                     ,"recordNum":"${workContractInfo.recordNum}"
+                    ,"borrowStatus":"${workContractInfo.borrowStatus}"
+                    ,"giveStatus":"${workContractInfo.giveStatus}"
+                    ,"borrowId":"${workContractInfo.borrowId}"
+                    ,"opinion":"${workContractInfo.opinion}"
+                    ,"flagAdmin":"${workContractInfo.flagAdmin}"
                     <%--<c:if test="${workContractInfo.contractState == 5 && fns:getUser().id == workContractInfo.createBy.id && workContractInfo.signatureStatus == 1   }">,"signature":"1"</c:if>/*签章*/--%>
                     <%--<c:if test="${workContractInfo.contractState == 5 && fns:getUser().id == workContractInfo.createBy.id}">,"canalter":"1"</c:if>/*变更*/--%>
 					<%--<c:if test="${workContractInfo.contractState == 5 && fns:getUser().id == workContractInfo.createBy.id}">,"caninvalid":"1"</c:if>/*作废*/--%>
@@ -728,6 +800,28 @@
 							</c:choose>
 						</shiro:hasPermission>
 					</c:if>
+					//借用状态处理
+					<c:if test="${fns:getUser().id == workContractInfo.borrowCreateById}">
+						<c:if test="${workContractInfo.borrowStatus == '2' }">,"cancancelBorrow":"1"</c:if>
+						<c:choose>
+							<c:when test="${workContractInfo.borrowStatus == '1'}">,"caneditBorrow1":"1"</c:when>
+							<c:when test="${workContractInfo.borrowStatus == '4'}">,"caneditBorrow2":"1"</c:when>
+							<c:when test="${workContractInfo.borrowStatus == '3'}">,"caneditBorrow3":"1"</c:when>
+						</c:choose>
+						<c:choose>
+							<c:when test="${(workContractInfo.borrowStatus == '1' or workContractInfo.borrowStatus == '3' or workContractInfo.borrowStatus == '4')}">,"candeleteBorrow":"1"</c:when>
+						</c:choose>
+					</c:if>
+					<c:if test="${'1' == workContractInfo.opinion}">
+						<c:choose>
+							<c:when test="${workContractInfo.borrowStatus == '5' && workContractInfo.giveStatus != '5'}">,"giveBorrow":"1"</c:when>
+						</c:choose>
+					</c:if>
+					<c:if test="${'1' == workContractInfo.flagAdmin}">
+						<c:choose>
+							<c:when test="${workContractInfo.contractState == 5 }">,"updateAdmin":"1"</c:when>
+						</c:choose>
+					</c:if>
                 }
                 </c:forEach>
                 </c:if>