Explorar o código

审定单签章部分代码

user5 %!s(int64=3) %!d(string=hai) anos
pai
achega
2bee1fc3f1
Modificáronse 29 ficheiros con 2162 adicións e 483 borrados
  1. 15 1
      src/main/java/com/jeeplus/modules/projectcontentinfo/dao/ProjectReportDataDao.java
  2. 45 0
      src/main/java/com/jeeplus/modules/projectcontentinfo/entity/ProjectReportData.java
  3. 22 0
      src/main/java/com/jeeplus/modules/projectcontentinfo/service/ProjectReportDataService.java
  4. 64 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/Action.java
  5. 27 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ActionOperatorInfo.java
  6. 203 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/CoordinateInfo.java
  7. 164 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/Location.java
  8. 117 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/PresignCallBack.java
  9. 18 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecords.java
  10. 95 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SealUserInfo.java
  11. 38 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SignByCompanyInfo.java
  12. 47 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SignatorieInfo.java
  13. 74 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SignatureContract.java
  14. 81 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/Stamper.java
  15. 46 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageAllService.java
  16. 75 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageService.java
  17. 72 8
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageController.java
  18. 1 455
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageElectronicSealController.java
  19. 259 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectSignatureCallBackController.java
  20. 585 0
      src/main/java/com/jeeplus/modules/tools/utils/SignaturePostUtil.java
  21. 43 1
      src/main/resources/mappings/modules/projectcontentinfo/ProjectReportDataDao.xml
  22. 2 0
      src/main/resources/mappings/modules/ruralprojectrecords/RuralProjectMessageAllDao.xml
  23. 2 1
      src/main/resources/spring-context-shiro.xml
  24. 2 0
      src/main/webapp/static/common/js/common.js
  25. 3 2
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/downloadType/importWordApprovalForm.jsp
  26. 1 0
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/downloadType/importWordReportForm.jsp
  27. 59 13
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/electronicSeal/ruralProjectMessageElectronicSealList.jsp
  28. 1 1
      src/main/webapp/webpage/modules/ruralprojectrecords/view/reportIssueView.jsp
  29. 1 1
      src/main/webapp/webpage/modules/ruralprojectrecords/view/reportView.jsp

+ 15 - 1
src/main/java/com/jeeplus/modules/projectcontentinfo/dao/ProjectReportDataDao.java

@@ -147,4 +147,18 @@ public interface ProjectReportDataDao extends CrudDao<ProjectReportData> {
      * @return
      */
     Integer updateProjectBzshUserId(ProjectReportData projectReportData);
-}
+
+    /**
+     * 修改质量复核的签章信息
+     * @param projectReportData
+     * @return
+     */
+    Integer updateSignatureInfo(ProjectReportData projectReportData);
+
+    /**
+     * 根据签章的contractId查询报告信息
+     * @param contractId
+     * @return
+     */
+    ProjectReportData getProjectReportDataByContractId(String contractId);
+}

+ 45 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/entity/ProjectReportData.java

@@ -120,6 +120,11 @@ public class ProjectReportData extends ActEntity<ProjectReportData> {
 	private String contractRate;	//合同费率
 
 	private String examinScore;		//抽查总分
+	private Integer signatureFlag;		//是否审定单签章(1为已签章)
+	private String signatureDocumentId;		//签章documentid
+	private String signatureContractId;		//签章contractid
+	private String signatureInvalidDocumentId;		//无效的签章documentid
+	private String signatureFileName;		//签章文件名称
 
 
 	public String getUpId() {
@@ -799,4 +804,44 @@ public class ProjectReportData extends ActEntity<ProjectReportData> {
 	public void setZiXunShou(String ziXunShou) {
 		this.ziXunShou = ziXunShou;
 	}
+
+	public Integer getSignatureFlag() {
+		return signatureFlag;
+	}
+
+	public void setSignatureFlag(Integer signatureFlag) {
+		this.signatureFlag = signatureFlag;
+	}
+
+	public String getSignatureDocumentId() {
+		return signatureDocumentId;
+	}
+
+	public void setSignatureDocumentId(String signatureDocumentId) {
+		this.signatureDocumentId = signatureDocumentId;
+	}
+
+	public String getSignatureContractId() {
+		return signatureContractId;
+	}
+
+	public void setSignatureContractId(String signatureContractId) {
+		this.signatureContractId = signatureContractId;
+	}
+
+	public String getSignatureInvalidDocumentId() {
+		return signatureInvalidDocumentId;
+	}
+
+	public void setSignatureInvalidDocumentId(String signatureInvalidDocumentId) {
+		this.signatureInvalidDocumentId = signatureInvalidDocumentId;
+	}
+
+	public String getSignatureFileName() {
+		return signatureFileName;
+	}
+
+	public void setSignatureFileName(String signatureFileName) {
+		this.signatureFileName = signatureFileName;
+	}
 }

+ 22 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/service/ProjectReportDataService.java

@@ -1609,4 +1609,26 @@ public class ProjectReportDataService extends CrudService<ProjectReportDataDao,
 		List<RuralReportConsultant> consultantList = dao.getConsultantList(projectId);
 		return consultantList;
 	}
+
+
+	/**
+	 * 根据项目id查询报告信息
+	 * @param projectReportData
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public ProjectReportData updateSignatureInfo(ProjectReportData projectReportData) {
+		dao.updateSignatureInfo(projectReportData);
+		return projectReportData;
+	}
+
+	/**
+	 * 根据签章contractId查询报告信息
+	 * @param contractId
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public ProjectReportData getProjectReportDataByContractId(String contractId) {
+		return dao.getProjectReportDataByContractId(contractId);
+	}
 }

+ 64 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/Action.java

@@ -0,0 +1,64 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+import java.util.List;
+
+/**
+ * @author: 大猫
+ * @create: 2021-11-02 18:32
+ **/
+public class Action {
+    private String type;
+    private String name;
+    private String serialNo;
+    private String sealId;
+    private List<ActionOperatorInfo> actionOperators; //签署人信息
+    private List<Location> locations; //位置信息
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getSerialNo() {
+        return serialNo;
+    }
+
+    public void setSerialNo(String serialNo) {
+        this.serialNo = serialNo;
+    }
+
+    public List<ActionOperatorInfo> getActionOperators() {
+        return actionOperators;
+    }
+
+    public void setActionOperators(List<ActionOperatorInfo> actionOperators) {
+        this.actionOperators = actionOperators;
+    }
+
+    public List<Location> getLocations() {
+        return locations;
+    }
+
+    public void setLocations(List<Location> locations) {
+        this.locations = locations;
+    }
+
+    public String getSealId() {
+        return sealId;
+    }
+
+    public void setSealId(String sealId) {
+        this.sealId = sealId;
+    }
+}

+ 27 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ActionOperatorInfo.java

@@ -0,0 +1,27 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+/**
+ * 签署人信息
+ * @author: 徐滕
+ * @create: 2021-11-02 18:10
+ **/
+public class ActionOperatorInfo {
+    private String operatorName; //签署人名称
+    private String operatorContact; //签署人手机号
+
+    public String getOperatorName() {
+        return operatorName;
+    }
+
+    public void setOperatorName(String operatorName) {
+        this.operatorName = operatorName;
+    }
+
+    public String getOperatorContact() {
+        return operatorContact;
+    }
+
+    public void setOperatorContact(String operatorContact) {
+        this.operatorContact = operatorContact;
+    }
+}

+ 203 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/CoordinateInfo.java

@@ -0,0 +1,203 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+import com.google.common.collect.Lists;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 调用坐标返回数据表
+ * @author: 徐滕
+ * @create: 2021-11-04 10:54
+ **/
+public class CoordinateInfo {
+    private String id;
+    private String contractId;
+    private String categoryId;
+    private String tenantType;
+    private String tenantId;
+    private String tenantName;
+    private String receiverType;
+    private String receiverId;
+    private String receiverName;
+    private String contact;
+    private String serialNo;
+    private String status;
+    private Boolean sponsor;
+    private Boolean remind;
+    private Boolean configured;
+    private Date createTime;
+    private Date updateTime;
+    private Date receiveTime;
+    private Boolean complete;
+    private String statusDesc;
+    private List<Location> locations = Lists.newArrayList();
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getContractId() {
+        return contractId;
+    }
+
+    public void setContractId(String contractId) {
+        this.contractId = contractId;
+    }
+
+    public String getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(String categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public String getTenantType() {
+        return tenantType;
+    }
+
+    public void setTenantType(String tenantType) {
+        this.tenantType = tenantType;
+    }
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getTenantName() {
+        return tenantName;
+    }
+
+    public void setTenantName(String tenantName) {
+        this.tenantName = tenantName;
+    }
+
+    public String getReceiverType() {
+        return receiverType;
+    }
+
+    public void setReceiverType(String receiverType) {
+        this.receiverType = receiverType;
+    }
+
+    public String getReceiverId() {
+        return receiverId;
+    }
+
+    public void setReceiverId(String receiverId) {
+        this.receiverId = receiverId;
+    }
+
+    public String getReceiverName() {
+        return receiverName;
+    }
+
+    public void setReceiverName(String receiverName) {
+        this.receiverName = receiverName;
+    }
+
+    public String getContact() {
+        return contact;
+    }
+
+    public void setContact(String contact) {
+        this.contact = contact;
+    }
+
+    public String getSerialNo() {
+        return serialNo;
+    }
+
+    public void setSerialNo(String serialNo) {
+        this.serialNo = serialNo;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Boolean getSponsor() {
+        return sponsor;
+    }
+
+    public void setSponsor(Boolean sponsor) {
+        this.sponsor = sponsor;
+    }
+
+    public Boolean getRemind() {
+        return remind;
+    }
+
+    public void setRemind(Boolean remind) {
+        this.remind = remind;
+    }
+
+    public Boolean getConfigured() {
+        return configured;
+    }
+
+    public void setConfigured(Boolean configured) {
+        this.configured = configured;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getReceiveTime() {
+        return receiveTime;
+    }
+
+    public void setReceiveTime(Date receiveTime) {
+        this.receiveTime = receiveTime;
+    }
+
+    public Boolean getComplete() {
+        return complete;
+    }
+
+    public void setComplete(Boolean complete) {
+        this.complete = complete;
+    }
+
+    public String getStatusDesc() {
+        return statusDesc;
+    }
+
+    public void setStatusDesc(String statusDesc) {
+        this.statusDesc = statusDesc;
+    }
+
+    public List<Location> getLocations() {
+        return locations;
+    }
+
+    public void setLocations(List<Location> locations) {
+        this.locations = locations;
+    }
+}

+ 164 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/Location.java

@@ -0,0 +1,164 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+/**
+ * 签署位置表
+ * @author: 徐滕
+ * @create: 2021-11-03 15:50
+ **/
+public class Location {
+    private String id;
+    private String documentId ; //合同文档ID
+    private String rectType ;   //签章类型
+    private Integer page ;      //签署页码,坐标指定位置时必须,0:全部页,-1:最后一页,其他:第page页
+    private String keyword ;    //关键字,关键字指定位置时必须
+    private Integer keywordIndex ;  //第几个关键字,0:全部,-1:最后一个,其他:第keyIndex 个,默认为1
+    private Double offsetX ;    //X轴坐标,坐标定位时必传,关键字定位时选传
+    private Double offsetY ;    //Y轴坐标,坐标定位时必传,关键字定位时选传
+    private String contractId ;
+    private String signatoryId ;
+    private String actionId ;
+    private String width ;
+    private String height ;
+    private String fromTemplate ;
+    private String createTime ;
+    private String samePositionId ;
+    private String sealId ;
+
+
+
+    public String getDocumentId() {
+        return documentId;
+    }
+
+    public void setDocumentId(String documentId) {
+        this.documentId = documentId;
+    }
+
+    public String getRectType() {
+        return rectType;
+    }
+
+    public void setRectType(String rectType) {
+        this.rectType = rectType;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public String getKeyword() {
+        return keyword;
+    }
+
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+
+    public Integer getKeywordIndex() {
+        return keywordIndex;
+    }
+
+    public void setKeywordIndex(Integer keywordIndex) {
+        this.keywordIndex = keywordIndex;
+    }
+
+    public Double getOffsetX() {
+        return offsetX;
+    }
+
+    public void setOffsetX(Double offsetX) {
+        this.offsetX = offsetX;
+    }
+
+    public Double getOffsetY() {
+        return offsetY;
+    }
+
+    public void setOffsetY(Double offsetY) {
+        this.offsetY = offsetY;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getContractId() {
+        return contractId;
+    }
+
+    public void setContractId(String contractId) {
+        this.contractId = contractId;
+    }
+
+    public String getSignatoryId() {
+        return signatoryId;
+    }
+
+    public void setSignatoryId(String signatoryId) {
+        this.signatoryId = signatoryId;
+    }
+
+    public String getActionId() {
+        return actionId;
+    }
+
+    public void setActionId(String actionId) {
+        this.actionId = actionId;
+    }
+
+    public String getWidth() {
+        return width;
+    }
+
+    public void setWidth(String width) {
+        this.width = width;
+    }
+
+    public String getHeight() {
+        return height;
+    }
+
+    public void setHeight(String height) {
+        this.height = height;
+    }
+
+    public String getFromTemplate() {
+        return fromTemplate;
+    }
+
+    public void setFromTemplate(String fromTemplate) {
+        this.fromTemplate = fromTemplate;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getSamePositionId() {
+        return samePositionId;
+    }
+
+    public void setSamePositionId(String samePositionId) {
+        this.samePositionId = samePositionId;
+    }
+
+    public String getSealId() {
+        return sealId;
+    }
+
+    public void setSealId(String sealId) {
+        this.sealId = sealId;
+    }
+}

+ 117 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/PresignCallBack.java

@@ -0,0 +1,117 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+/**
+ * 预签署回调参数表
+ * @author: 大猫
+ * @create: 2021-11-04 09:27
+ **/
+public class PresignCallBack {
+    private String contractId;  //文件编号
+    private String documentId;  //文档ID
+    private String tenantId;    //签署方编号
+    private String tenantName;  //签署方名称
+    private String sn;  //文件自定义编号
+    private String status;  //文件状态
+    private String type;    //回调类型
+    private String contact; //联系方式
+    private String operatorName;    //操作人姓名
+    private String operatorMobile;  //操作人手机号
+    private String operatorNumber;  //操作人员工编号
+    private String receiverNumber;  //经办人员工编号
+
+    public String getContractId() {
+        return contractId;
+    }
+
+    public void setContractId(String contractId) {
+        this.contractId = contractId;
+    }
+
+    public String getDocumentId() {
+        return documentId;
+    }
+
+    public void setDocumentId(String documentId) {
+        this.documentId = documentId;
+    }
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getTenantName() {
+        return tenantName;
+    }
+
+    public void setTenantName(String tenantName) {
+        this.tenantName = tenantName;
+    }
+
+    public String getSn() {
+        return sn;
+    }
+
+    public void setSn(String sn) {
+        this.sn = sn;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getContact() {
+        return contact;
+    }
+
+    public void setContact(String contact) {
+        this.contact = contact;
+    }
+
+    public String getOperatorName() {
+        return operatorName;
+    }
+
+    public void setOperatorName(String operatorName) {
+        this.operatorName = operatorName;
+    }
+
+    public String getOperatorMobile() {
+        return operatorMobile;
+    }
+
+    public void setOperatorMobile(String operatorMobile) {
+        this.operatorMobile = operatorMobile;
+    }
+
+    public String getOperatorNumber() {
+        return operatorNumber;
+    }
+
+    public void setOperatorNumber(String operatorNumber) {
+        this.operatorNumber = operatorNumber;
+    }
+
+    public String getReceiverNumber() {
+        return receiverNumber;
+    }
+
+    public void setReceiverNumber(String receiverNumber) {
+        this.receiverNumber = receiverNumber;
+    }
+}

+ 18 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecords.java

@@ -256,6 +256,8 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	private String money; //收费金额
 	private String prdAuditDate; //报告审批通过时间时间
 	private String whetherReportNumber; //是否需要报告号
+	private String signatureFlag; //审定单签章状态
+	private String signatureContractId; //审定单签章contractId
 
 	private List<String> civilProjectList = Lists.newArrayList();
 	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
@@ -1866,4 +1868,20 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	public void setWhetherReportNumber(String whetherReportNumber) {
 		this.whetherReportNumber = whetherReportNumber;
 	}
+
+	public String getSignatureFlag() {
+		return signatureFlag;
+	}
+
+	public void setSignatureFlag(String signatureFlag) {
+		this.signatureFlag = signatureFlag;
+	}
+
+	public String getSignatureContractId() {
+		return signatureContractId;
+	}
+
+	public void setSignatureContractId(String signatureContractId) {
+		this.signatureContractId = signatureContractId;
+	}
 }

+ 95 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SealUserInfo.java

@@ -0,0 +1,95 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+import java.util.Date;
+
+/**
+ * 员工印章表
+ * @author: 徐滕
+ * @create: 2021-11-05 09:18
+ **/
+public class SealUserInfo {
+    private String id;  //印章ID
+    private String owner;   //公司ID
+    private String name;    //印章名称
+    private String otherName;   //印章别名
+    //private SealType type;    //签章类型
+    //private SealSpec spec;    //印章规格
+    private String sealKey; //印章图片key
+    private Date createTime; //创建时间
+    //private SealStatus status; //印章状态
+    private String useCount; //印章使用的次数
+    private String category; //印章类型:物理章,电子章
+    private String sealCategoryName; //印章分类名称
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getOtherName() {
+        return otherName;
+    }
+
+    public void setOtherName(String otherName) {
+        this.otherName = otherName;
+    }
+
+    public String getSealKey() {
+        return sealKey;
+    }
+
+    public void setSealKey(String sealKey) {
+        this.sealKey = sealKey;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUseCount() {
+        return useCount;
+    }
+
+    public void setUseCount(String useCount) {
+        this.useCount = useCount;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getSealCategoryName() {
+        return sealCategoryName;
+    }
+
+    public void setSealCategoryName(String sealCategoryName) {
+        this.sealCategoryName = sealCategoryName;
+    }
+}

+ 38 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SignByCompanyInfo.java

@@ -0,0 +1,38 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+import java.util.List;
+
+/**
+ * 静默公司签署信息表
+ * @author: 徐滕
+ * @create: 2021-11-04 14:14
+ **/
+public class SignByCompanyInfo {
+    private String contractId;
+    private String tenantName;
+    private List<Stamper> stampers;
+
+    public String getContractId() {
+        return contractId;
+    }
+
+    public void setContractId(String contractId) {
+        this.contractId = contractId;
+    }
+
+    public String getTenantName() {
+        return tenantName;
+    }
+
+    public void setTenantName(String tenantName) {
+        this.tenantName = tenantName;
+    }
+
+    public List<Stamper> getStampers() {
+        return stampers;
+    }
+
+    public void setStampers(List<Stamper> stampers) {
+        this.stampers = stampers;
+    }
+}

+ 47 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SignatorieInfo.java

@@ -0,0 +1,47 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+import java.util.List;
+
+/**
+ * 签署方信息表
+ * @author: 徐滕
+ * @create: 2021-11-02 18:08
+ **/
+public class SignatorieInfo {
+    private String tenantType; //签署方类型
+    private String tenantName; //签署方名称
+    private String serialNo; //签署顺序
+    private List<Action> actions; //签署顺序
+
+    public String getTenantType() {
+        return tenantType;
+    }
+
+    public void setTenantType(String tenantType) {
+        this.tenantType = tenantType;
+    }
+
+    public String getTenantName() {
+        return tenantName;
+    }
+
+    public void setTenantName(String tenantName) {
+        this.tenantName = tenantName;
+    }
+
+    public String getSerialNo() {
+        return serialNo;
+    }
+
+    public void setSerialNo(String serialNo) {
+        this.serialNo = serialNo;
+    }
+
+    public List<Action> getActions() {
+        return actions;
+    }
+
+    public void setActions(List<Action> actions) {
+        this.actions = actions;
+    }
+}

+ 74 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/SignatureContract.java

@@ -0,0 +1,74 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+import java.util.List;
+
+/**
+ * 签章合同表
+ * @author: 徐滕
+ * @create: 2021-11-02 18:05
+ **/
+public class SignatureContract {
+    private String subject; //合同名称
+    private String sn; //合同编号 非必填
+    private String categoryId; //用印流程ID 非必填
+    private String tenantName; //用印流程名称 非必填
+    private List<String> documents; //文档ID的集合 非必填
+    private List<SignatorieInfo> signatories; //签署方信息 非必填
+    private Boolean send;   //是否发起(预签署为不发起)
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public String getSn() {
+        return sn;
+    }
+
+    public void setSn(String sn) {
+        this.sn = sn;
+    }
+
+    public String getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(String categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public String getTenantName() {
+        return tenantName;
+    }
+
+    public void setTenantName(String tenantName) {
+        this.tenantName = tenantName;
+    }
+
+    public List<String> getDocuments() {
+        return documents;
+    }
+
+    public void setDocuments(List<String> documents) {
+        this.documents = documents;
+    }
+
+    public List<SignatorieInfo> getSignatories() {
+        return signatories;
+    }
+
+    public void setSignatories(List<SignatorieInfo> signatories) {
+        this.signatories = signatories;
+    }
+
+    public Boolean getSend() {
+        return send;
+    }
+
+    public void setSend(Boolean send) {
+        this.send = send;
+    }
+}

+ 81 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/Stamper.java

@@ -0,0 +1,81 @@
+package com.jeeplus.modules.ruralprojectrecords.entity;
+
+/**
+ * 印章坐标表
+ * @author: 大猫
+ * @create: 2021-11-04 14:19
+ **/
+public class Stamper {
+    private String documentId;  //合同文档ID
+    private String type;        //签章类型:SEAL_CORPORATE(公章),ACROSS_PAGE(骑缝章),TIMESTAMP(时间戳)
+    private String sealId;      //印章ID
+    private Integer page;        //签署页码,从1开始,坐标定位时必传,0:全部页,-1:最后一页,其他:第page页
+    private Boolean allPage;     //是否签署所有页面
+    private Double x;           //签署位置在页面宽的占比,取值0~1,坐标定位时必传,关键字定位时选传
+    private Double y;           //签署位置在页面高的占比,取值0~1,坐标定位时必传,关键字定位时选传
+    private String keyword;     //定位关键字
+
+    public String getDocumentId() {
+        return documentId;
+    }
+
+    public void setDocumentId(String documentId) {
+        this.documentId = documentId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getSealId() {
+        return sealId;
+    }
+
+    public void setSealId(String sealId) {
+        this.sealId = sealId;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Boolean getAllPage() {
+        return allPage;
+    }
+
+    public void setAllPage(Boolean allPage) {
+        this.allPage = allPage;
+    }
+
+    public Double getX() {
+        return x;
+    }
+
+    public void setX(Double x) {
+        this.x = x;
+    }
+
+    public Double getY() {
+        return y;
+    }
+
+    public void setY(Double y) {
+        this.y = y;
+    }
+
+    public String getKeyword() {
+        return keyword;
+    }
+
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+}

+ 46 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageAllService.java

@@ -3,6 +3,7 @@ package com.jeeplus.modules.ruralprojectrecords.service;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.CrudService;
 import com.jeeplus.common.utils.Collections3;
+import com.jeeplus.common.utils.MenuStatusEnum;
 import com.jeeplus.modules.projectFilingBatch.dao.ProjectFilingBatchDao;
 import com.jeeplus.modules.projectFilingBatch.dao.ProjectFilingbatchRelationDao;
 import com.jeeplus.modules.projectFilingBatch.entity.ProjectFilingBatch;
@@ -1064,4 +1065,49 @@ public class RuralProjectMessageAllService extends CrudService<RuralProjectMessa
         }
         return getSumMoney;
     }
+
+
+    public Page<RuralProjectRecords> findSignaturePage(Page<RuralProjectRecords> page, RuralProjectRecords projectRecords) {
+        //设置数据权限
+        if(!UserUtils.getUser().isAdmin()) {
+            String dataScopeSql = dataScopeFilterOR(projectRecords.getCurrentUser(), "o", "u", "s", MenuStatusEnum.OVERALL_WORK_RECORD_LIST.getValue());
+            projectRecords.getSqlMap().put("dsf", dataScopeSql);
+        }
+        //查询超期时间天数
+        List<MainDictDetail> adventCount = DictUtils.getMainDictListOnProjectAdvent("advent_count");
+        if(adventCount.size()>0){
+            //获取超期时间天数转int
+            Integer endingCount = Integer.parseInt(adventCount.get(0).getLabel());
+            projectRecords.setEndingCount(endingCount);
+        }
+        if(null!= projectRecords.getOffice() && StringUtils.isNotBlank(projectRecords.getOffice().getId())){
+            //查询该选择节点下所有的部门Id
+            List<String> officeIdList = officeService.getChildrenOffice(projectRecords.getOffice().getId());
+            officeIdList.add(projectRecords.getOffice().getId());
+            projectRecords.setOfficeIdList(officeIdList);
+        }
+
+        int count = dao.queryCount(projectRecords);
+        page.setCount(count);
+        page.setCountFlag(false);
+        projectRecords.setPage(page);
+        List<RuralProjectRecords> recordsList = findList(projectRecords);
+
+
+        //查询负责人信息
+        for (RuralProjectRecords records : recordsList) {
+            if(null != records.getRecordState() && 0 == records.getProjectReportRecordStatus()){
+                records.setProjectReportRecordStatus(records.getRecordState());
+            }
+            this.queryContractInfos(records);
+            //获取项目负责人
+            List<User> users = workProjectUserDao.getProjectprincipalList(records.getId());
+            records.setProjectLeaders(users);
+            records.setLeaderNameStr(Collections3.extractToString(users, "name", ","));
+            records.setLeaderIds(Collections3.extractToString(users, "id", ","));
+
+        }
+        page.setList(recordsList);
+        return page;
+    }
 }

+ 75 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageService.java

@@ -52,6 +52,7 @@ import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.tools.utils.HttpPostTest;
 import com.jeeplus.modules.tools.utils.HttpPostTool;
+import com.jeeplus.modules.tools.utils.SignaturePostUtil;
 import com.jeeplus.modules.utils.Aestool;
 import com.jeeplus.modules.utils.MapToXmlUtil;
 import com.jeeplus.modules.utils.Rsatool;
@@ -105,6 +106,7 @@ import java.util.*;
 @Service
 @Transactional(readOnly = true)
 public class RuralProjectMessageService extends CrudService<RuralProjectMessageDao, RuralProjectRecords> {
+    private static final String HTTPTOP = "http://121.40.158.10:9182";
     //AES 对称加密公钥
     private static final String AES_KEY = "63304b5db43265c103ebe576d38bd9f8";
     //RSA 非对称加密密钥
@@ -3848,4 +3850,77 @@ public class RuralProjectMessageService extends CrudService<RuralProjectMessageD
         projectRecordsReported.setWorkAttachments(rural.getWorkAttachments());
         return projectRecordsReported;
     }
+
+
+    /**
+     * 根据项目id 和 documentId生成合同id
+     * @param projectId
+     * @param documentList
+     * @return
+     */
+    public String getSignatureContractId(String projectId, List<String> documentList ){
+        //根据项目id查询项目信息
+        RuralProjectRecords ruralProjectRecords = ruralProjectRecordsService.get(projectId);
+        //创建签署方信息
+        List<Action> actions = Lists.newArrayList();
+        Action companyAction = new Action();
+        companyAction.setType("CORPORATE");
+        companyAction.setName("公司盖章");
+        companyAction.setSerialNo("1");
+        companyAction.setSealId("2893044362440138791");
+        actions.add(companyAction);
+
+        Action action2 = new Action();
+        action2.setType("CORPORATE");
+        action2.setName("测试印章");    //填写人员信息
+        action2.setSerialNo("1");
+        action2.setSealId("2893435338694385711");   //人员印章id
+        actions.add(action2);
+
+
+        //创建签署方信息表
+        List<SignatorieInfo> signatories = Lists.newArrayList();
+        SignatorieInfo signatorieInfo1 = new SignatorieInfo();
+        signatorieInfo1.setSerialNo("1");
+        signatorieInfo1.setTenantName("江苏兴光项目管理有限公司");
+        signatorieInfo1.setTenantType("COMPANY");
+        signatorieInfo1.setActions(actions);
+        signatories.add(signatorieInfo1);
+        SignatureContract signatureContract = new SignatureContract();
+        signatureContract.setDocuments(documentList);
+        signatureContract.setCategoryId("2893044445151813683");
+        signatureContract.setSend(false);
+        signatureContract.setSignatories(signatories);
+        signatureContract.setSn("");
+        signatureContract.setSubject(ruralProjectRecords.getProjectName());//添加项目名称
+        net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(signatureContract);
+        String contractIdMapStr = SignaturePostUtil.sendPostApplicationJson(HTTPTOP + "/contract/createbycategory", json.toString());
+        HashMap hashMap = JSON.parseObject(contractIdMapStr, HashMap.class);
+        String contractId = hashMap.get("contractId").toString();
+        return contractId;
+    }
+
+    /**
+     * 根据合同编号查询签章合同对应的url访问界面
+     * @param contractId
+     * @param contractId
+     * @return
+     */
+    public String getSignatureContractUrl( String contractId ){
+        Map map = new HashMap();
+        map.put("contractId",contractId);
+        map.put("tenantType","COMPANY");
+        map.put("tenantName","江苏兴光项目管理有限公司");
+        map.put("receiverName","徐滕");
+        map.put("contact","15240492484");
+        map.put("canSend","false");
+        String contractIdUrl = SignaturePostUtil.doGet(map,HTTPTOP + "/contract/presignurl" );
+        HashMap signUrlHashMap = JSON.parseObject(contractIdUrl, HashMap.class);
+        String signUrl = signUrlHashMap.get("presignUrl").toString();
+        /*String jsonString = JSON.toJSONString(map);
+        String contractIdUrl = SignaturePostUtil.sendPostApplicationJson(HTTPTOP + "/contract/signurl", jsonString);
+        HashMap signUrlHashMap = JSON.parseObject(contractIdUrl, HashMap.class);
+        String signUrl = signUrlHashMap.get("signUrl").toString();*/
+        return signUrl;
+    }
 }

+ 72 - 8
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageController.java

@@ -1,7 +1,9 @@
 package com.jeeplus.modules.ruralprojectrecords.web;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.gson.Gson;
+import com.jeeplus.common.bos.BOSClientUtil;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.utils.MyBeanUtils;
@@ -44,6 +46,8 @@ import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.service.UserService;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.tools.utils.SignaturePostUtil;
+import com.jeeplus.modules.utils.SftpClientUtil;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
 import com.jeeplus.modules.workstaff.entity.WorkStaffCertificate;
@@ -63,6 +67,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
 import java.util.*;
 
 /**
@@ -1762,10 +1768,11 @@ public class RuralProjectMessageController extends BaseController {
      */
     @RequiresPermissions("ruralProject:ruralProjectMessage:importApprovalFile")
     @RequestMapping(value = "skipImportApprovalWord")
-    public String skipImportApprovalWord(RuralProjectRecords projectRecords, Model model) {
+    public String skipImportApprovalWord(RuralProjectRecords projectRecords, String visitType, Model model) {
         ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(projectRecords.getId());
         model.addAttribute("projectReportData", projectReportData);
         model.addAttribute("projectId", projectRecords.getId());
+        model.addAttribute("visitType", visitType);
         return "modules/ruralprojectrecords/ruralporjectmessage/downloadType/importWordApprovalForm";
     }
 
@@ -1774,15 +1781,65 @@ public class RuralProjectMessageController extends BaseController {
      */
     @RequiresPermissions("ruralProject:ruralProjectMessage:importApprovalFile")
     @RequestMapping(value = "importApprovalFile", method= RequestMethod.POST)
-    public String importApprovalFile(MultipartFile uploadFile, RedirectAttributes redirectAttributes) {
+    @ResponseBody
+    public HashMap<String, String> importApprovalFile(MultipartFile uploadFile, String visitType,String projectId, RedirectAttributes redirectAttributes) {
+        HashMap<String, String> map = Maps.newHashMap();
+        map.put("contractUrl","");
         try {
+            //根据项目id查询是否已经提交过了审定单签章
+            ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(projectId);
+            if(null == projectReportData){
+                map.put("str","查询不到该项目的质量复核信息");
+                return map;
+            }
+            if(null!= projectReportData.getSignatureFlag() && 1 == projectReportData.getSignatureFlag()){
+                map.put("str","该质量复核已经审定单盖章完成");
+                return map;
+            }
+            if(null == uploadFile){
+                map.put("str","未上传附件信息");
+                return map;
+            }
+
+            //获取成员印章id信息
+            String userSealByMobile = SignaturePostUtil.getUserSealByMobile("15240492484");
+
             //MultipartFile转File
             File srcFile = FileUtil.transformMultipartFile(uploadFile);
-            System.out.println("");
+            File verticalInvalidFile = FileUtil.transformMultipartFile(uploadFile);
+            File acrossInvalidFile = FileUtil.transformMultipartFile(uploadFile);
+            //截取文件名称
+            String fileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
+            //获取真签单的documentId
+            String documentId = SignaturePostUtil.getDocument(srcFile);
+            //获取竖版假(空白)签单的documentId
+            String verticalInvalidDocumentId = SignaturePostUtil.getVerticalInvalidDocument(verticalInvalidFile.getName(),verticalInvalidFile);
+            //获取横板假(空白)签单的documentId
+            String acrossInvalidDocumentId = SignaturePostUtil.getAcrossVerticalInvalidDocument(acrossInvalidFile.getName(),acrossInvalidFile);
+            List<String> documentList = Lists.newArrayList();
+            List<String> invalidDocumentList = Lists.newArrayList();
+            documentList.add(documentId);
+            documentList.add(verticalInvalidDocumentId);
+            documentList.add(acrossInvalidDocumentId);
+            invalidDocumentList.add(verticalInvalidDocumentId);
+            invalidDocumentList.add(acrossInvalidDocumentId);
+            //将空白单的documentId存入数据库种
+            projectReportData.setSignatureInvalidDocumentId(String.join(",", invalidDocumentList));
+            //根据项目id 和 documentId生成合同id
+            String contractId = ruralProjectMessageService.getSignatureContractId(projectId, documentList);
+            //获取contractUrl路径
+            String contractUrl = ruralProjectMessageService.getSignatureContractUrl(contractId);
+            //将documentId 和contractId存储到质量复核对应的数据种
+            projectReportData.setSignatureDocumentId(documentId);
+            projectReportData.setSignatureContractId(contractId);
+            projectReportData.setSignatureFileName(fileName);
+            //修改签章对应信息文件
+            projectReportDataService.updateSignatureInfo(projectReportData);
+            map.put("contractUrl",contractUrl);
         } catch (Exception e) {
-            addMessage(redirectAttributes, "导入B类项目失败!失败信息:"+e.getMessage());
+            addMessage(redirectAttributes, "审定单签章失败!");
         }
-        return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectMessage/?repage";
+        return map;
     }
 
 
@@ -1791,10 +1848,11 @@ public class RuralProjectMessageController extends BaseController {
      */
     @RequiresPermissions("ruralProject:ruralProjectMessage:importReportFile")
     @RequestMapping(value = "skipImportReportWord")
-    public String skipImportReportWord(RuralProjectRecords projectRecords, Model model) {
+    public String skipImportReportWord(RuralProjectRecords projectRecords, String visitType, Model model) {
         ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(projectRecords.getId());
         model.addAttribute("projectReportData", projectReportData);
         model.addAttribute("projectId", projectRecords.getId());
+        model.addAttribute("visitType", visitType);
         return "modules/ruralprojectrecords/ruralporjectmessage/downloadType/importWordReportForm";
     }
 
@@ -1803,14 +1861,20 @@ public class RuralProjectMessageController extends BaseController {
      */
     @RequiresPermissions("ruralProject:ruralProjectMessage:importReportFile")
     @RequestMapping(value = "importReportFile", method= RequestMethod.POST)
-    public String importReportFile(MultipartFile uploadFile, RedirectAttributes redirectAttributes) {
+    public String importReportFile(MultipartFile uploadFile, String visitType, RedirectAttributes redirectAttributes) {
         try {
             //MultipartFile转File
             File srcFile = FileUtil.transformMultipartFile(uploadFile);
-            System.out.println("");
+            System.out.println(srcFile.getName());
+            String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
+            System.out.println(substring);
+            System.out.println(srcFile.getPath());
         } catch (Exception e) {
             addMessage(redirectAttributes, "导入B类项目失败!失败信息:"+e.getMessage());
         }
+        if("1".equals(visitType)){
+            return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+        }
         return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectMessage/?repage";
     }
 

+ 1 - 455
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageElectronicSealController.java

@@ -1,35 +1,18 @@
 package com.jeeplus.modules.ruralprojectrecords.web;
 
-import com.jeeplus.common.config.Global;
-import com.jeeplus.common.json.AjaxJson;
 import com.jeeplus.common.persistence.Page;
-import com.jeeplus.common.utils.DateUtils;
-import com.jeeplus.common.utils.MyBeanUtils;
 import com.jeeplus.common.utils.StringUtils;
-import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.web.BaseController;
-import com.jeeplus.modules.historical.entity.HistoricalData;
-import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
 import com.jeeplus.modules.projectEngineering.entity.ProjectEngineeringInfo;
 import com.jeeplus.modules.projectEngineering.service.ProjectEngineeringService;
-import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
-import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
-import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
-import com.jeeplus.modules.projectcontentinfo.service.ProjectcontentinfoService;
-import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.entity.*;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageAllService;
-import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
-import com.jeeplus.modules.sys.entity.Dict;
-import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.service.UserService;
-import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
-import com.jeeplus.modules.workstaff.entity.WorkStaffCertificate;
 import jersey.repackaged.com.google.common.collect.Lists;
 import org.activiti.engine.HistoryService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -37,11 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -62,12 +43,6 @@ public class RuralProjectMessageElectronicSealController extends BaseController
     @Autowired
     private UserService userService;
     @Autowired
-    private ProjectcontentinfoService projectcontentinfoService;
-    @Autowired
-    private ProjectReportDataService projectReportDataService;
-    @Autowired
-    private RuralProjectMessageService ruralProjectMessageService;
-    @Autowired
     private ProjectEngineeringService engineeringService;
 
     @ModelAttribute
@@ -122,7 +97,7 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         //添加查询类型list
         projectRecords.setTypeList(typeList);
         projectRecords.setSubmitMoney("1");
-        Page<RuralProjectRecords> page = ruralProjectMessageAllService.findPage(new Page<RuralProjectRecords>(request, response), projectRecords);
+        Page<RuralProjectRecords> page = ruralProjectMessageAllService.findSignaturePage(new Page<RuralProjectRecords>(request, response), projectRecords);
         model.addAttribute("page", page);
         if(null != projectRecords.getWorkContractInfo()){
             model.addAttribute("workContractInfoName", projectRecords.getWorkContractInfo().getName());
@@ -163,434 +138,5 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         return "modules/ruralprojectrecords/ruralporjectmessage/electronicSeal/ruralProjectMessageElectronicSealList";
     }
 
-    /**
-     * 项目列表页面
-     */
-    @RequestMapping(value = "getProjectList")
-    @ResponseBody
-    public Map<String,List> getProjectList(RuralProjectRecords projectRecords, HttpServletRequest request, HttpServletResponse response) {
-        Map<String, List> map = ruralProjectMessageAllService.getProjectList(projectRecords, request, response);
-        return map;
-    }
-    /**
-     * admin跳转修改报告页面
-     * @param projectcontentinfo
-     * @param request
-     * @param response
-     * @param model
-     * @param attr
-     * @return
-     */
-    @RequestMapping(value = {"adminEditForm"})
-    public String adminEditForm(RuralProjectcontentinfo projectcontentinfo, HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes attr) {
-        RuralProjectRecords projectRecords=new RuralProjectRecords();
-        if (null!=projectcontentinfo.getProjectId()){
-            projectRecords = projectRecordsService.get(projectcontentinfo.getProjectId());
-            model.addAttribute("projectRecords", projectRecords);
-        }
-        Projectcontentinfo projectcontentinfo1 = projectcontentinfoService.getByProjectId(projectcontentinfo.getProjectId());
-        if (null ==projectcontentinfo1){
-            model.addAttribute("projectReportData",null);
-            return "modules/ruralprojectrecords/view/reportView";
-        }
-        ProjectReportData projectReportData = projectReportDataService.getOnRural(projectcontentinfo1.getInfoId());
-        if (null ==projectReportData){
-            model.addAttribute("projectReportData",null);
-            return "modules/ruralprojectrecords/view/reportView";
-        }
-        projectReportData = projectReportDataService.get(projectReportData.getId());
-        RuralProjectRecords ruralProjectRecords = projectRecordsService.getQueryProjectUsers(projectcontentinfo1.getProject().getId());
-        Projectcontentinfo projectcontent = projectcontentinfoService.getByInfoId(projectReportData.getId());
-        projectcontent.setProjectReportData(projectReportData);
-        RuralProjectcontentinfo ruralProjectcontentinfo = projectRecordsService.formAccessory(projectRecords);
-        projectRecordsService.disposeData(ruralProjectcontentinfo);
-        projectcontent.setFileAttachmentList(ruralProjectcontentinfo.getFileAttachmentList());
-        projectcontent.setFileGistdataList(ruralProjectcontentinfo.getFileGistdataList());
-        projectcontent.setFileOtherList(ruralProjectcontentinfo.getFileOtherList());
-        //根据条件查询附件必填项
-        ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
-        //添加项目类型
-        relateInfo.setAttachmentProjectType(ruralProjectRecords.getProjectType());
-        relateInfo.setAttachmentProjectSort(ruralProjectRecords.getAttachmentProjectSort());
-        //判断是否为打包项目,打包项目无需查看项目送审金额是否为500w以上判定
-        String money=ruralProjectRecords.getSubmitMoney();
-        Integer approvalMoney=null;
-        if(StringUtils.isBlank(money)){
-            approvalMoney=1;
-        }else{
-            approvalMoney=Integer.parseInt(money);
-        }
-        switch (approvalMoney){
-            case 0:
-                //金额为0
-                relateInfo.setAttachmentProjectApprovalMoney(null);
-                break;
-            case 1:
-                //500w以下金额状态
-                relateInfo.setAttachmentProjectApprovalMoney("1");
-                break;
-            case 2:
-                //500w以上金额状态
-                relateInfo.setAttachmentProjectApprovalMoney("2");
-                break;
-        }
-        //添加报告类型
-        relateInfo.setRequiredStage(1);
-        relateInfo.setId(ruralProjectRecords.getId());
-        List<RuralReportConsultant> consultants = com.google.common.collect.Lists.newArrayList();
-        //将自己添加到咨询员数据中
-        //根据用户查询技能信息
-        RuralReportConsultant currentConsultant = new RuralReportConsultant();
-        List<WorkStaffCertificate> userCertificateList = com.google.common.collect.Lists.newArrayList();
-        if(StringUtils.isNotBlank(ruralProjectRecords.getProjectMasterId())){
-            userCertificateList = ruralProjectMessageService.getCertificateByUser(ruralProjectRecords.getProjectMasterId());
-        }
-        //获取专业类型
-        List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("certificate_major");
-        for (WorkStaffCertificate certificateInfo: userCertificateList) {
-            currentConsultant.setZhucezigezhID(certificateInfo.getNum());
-            currentConsultant.setZhucezigezhKey(certificateInfo.getName());
-            for (MainDictDetail type : certificateMajor) {
-                if(certificateInfo.getMajor().equals(type.getValue())){
-                    currentConsultant.setMajor(type.getLabel());
-                }
-            }
-            User currentUser=userService.get(ruralProjectRecords.getProjectMasterId());
-            currentConsultant.setZixunyuanName(currentUser.getName());
-            currentConsultant.setZixunyuan(currentUser.getId());
-            currentConsultant.setRole("负责人");
-            consultants.add(currentConsultant);
-        }
-        //查询总审人员信息
-        RuralReportConsultant bzshbConsultant = new RuralReportConsultant();
-        //根据项目id查找报告咨询员信息
-        List<RuralReportConsultant> consultantList = ruralProjectMessageService.getConsultantsList(projectcontentinfo.getProjectId());
-        //使用迭代器去除重复信息
-        //排除 重新申请|撤销
-        Iterator<RuralReportConsultant> it = consultantList.iterator();
-        while(it.hasNext()){
-            RuralReportConsultant consultant = it.next();
-            if(consultant.getZixunyuan().equals(currentConsultant.getZixunyuan())){
-                try {
-                    MyBeanUtils.copyBeanNotNull2Bean(consultant, currentConsultant);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-                it.remove();
-            }else{
-                //根据用户查询技能信息
-                List<WorkStaffCertificate> certificateList = ruralProjectMessageService.getCertificateByUser(consultant.getZixunyuan());
-                for (WorkStaffCertificate certificateInfo: certificateList) {
-                    if(certificateInfo.getName().equals(consultant.getZhucezigezhKey())){
-                        consultant.setZhucezigezhID(certificateInfo.getNum());
-                    }
-                    for (MainDictDetail type : certificateMajor) {
-                        if(certificateInfo.getMajor().equals(type.getValue())){
-                            consultant.setMajor(type.getLabel());
-                        }
-                    }
-                }
-                User user=userService.get(consultant.getZixunyuan());
-                consultant.setRole("咨询员");
-                consultant.setZixunyuanName(user.getName());
-                if(consultant.getZixunyuan().equals(projectReportData.getBzshbUserId())){
-                    bzshbConsultant = consultant;
-                    bzshbConsultant.setZixunyuanName("陈红星("+consultant.getZixunyuanName()+"代)");
-                    bzshbConsultant.setRole("技术负责人");
-                    it.remove();
-                }
-            }
-        }
-        consultants.addAll(consultantList);
-
-        if(StringUtils.isNotBlank(bzshbConsultant.getZixunyuan())){
-            consultants.add(bzshbConsultant);
-        }else{
-            //查询总审人员信息
-            bzshbConsultant = new RuralReportConsultant();
-            List<WorkStaffCertificate> bzshbCertificateList = com.google.common.collect.Lists.newArrayList();
-            if(StringUtils.isNotBlank(ruralProjectRecords.getProjectMasterId())){
-                bzshbCertificateList = ruralProjectMessageService.getCertificateByUser(projectReportData.getBzshbUserId());
-            }
-            for (WorkStaffCertificate certificateInfo: bzshbCertificateList) {
-                bzshbConsultant.setZhucezigezhID(certificateInfo.getNum());
-                bzshbConsultant.setZhucezigezhKey(certificateInfo.getName());
-                for (MainDictDetail dictType : certificateMajor) {
-                    if(certificateInfo.getMajor().equals(dictType.getValue())){
-                        bzshbConsultant.setMajor(dictType.getLabel());
-                    }
-                }
-                User bzshbUser=userService.get(projectReportData.getBzshbUserId());
-                bzshbConsultant.setZixunyuanName(bzshbUser.getName());
-                bzshbConsultant.setZixunyuan(bzshbUser.getId());
-                consultants.add(bzshbConsultant);
-            }
-            Iterator<RuralReportConsultant> itView = consultants.iterator();
-            while(itView.hasNext()){
-                RuralReportConsultant consultant = itView.next();
-                if(bzshbCertificateList.size()>0){
-                    if(consultant.getZixunyuan().equals(bzshbConsultant.getZixunyuan())){
-                        try {
-                            MyBeanUtils.copyBeanNotNull2Bean(consultant, bzshbConsultant);
-                            bzshbConsultant.setZixunyuanName("陈红星("+bzshbConsultant.getZixunyuanName()+"代)");
-                            bzshbConsultant.setRole("技术负责人");
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                        itView.remove();
-                    }
-                }else{
-                    if(consultant.getZixunyuan().equals(projectReportData.getBzshbUserId())){
-                        try {
-                            MyBeanUtils.copyBeanNotNull2Bean(consultant, bzshbConsultant);
-                            bzshbConsultant.setZixunyuanName("陈红星("+bzshbConsultant.getZixunyuanName()+"代)");
-                            bzshbConsultant.setRole("技术负责人");
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                        itView.remove();
-                    }
-                }
-            }
-            if(StringUtils.isNotBlank(bzshbConsultant.getZixunyuan())){
-                consultants.add(bzshbConsultant);
-            }else{
-                User user=userService.get(projectReportData.getBzshbUserId());
-                bzshbConsultant.setZixunyuanName("陈红星("+user.getName()+"代)");
-                bzshbConsultant.setZixunyuan(user.getId());
-                bzshbConsultant.setRole("技术负责人");
-                consultants.add(bzshbConsultant);
-            }
-        }
-
-        //查询上报信息表中是否含有数据,没有则进行获取基础数据
-        RuralProjectRecordsReported reported = ruralProjectMessageService.getRuralProjectRecordsReported(projectRecords.getId());
-        if(reported == null){
-            model.addAttribute("reportedFalg", false);
-
-        }else{
-            //根据上报id查询上报咨询员的信息
-            List<RuralReportConsultant> reportedConsultants=ruralProjectMessageService.getReportedConsultantsList(reported.getId());
-            //查询报告咨询员的信息
-            List<RuralReportConsultant> reportConsultants=ruralProjectMessageService.getConsultantsList(projectRecords.getId());
-            List<RuralReportConsultant> consultantLista = com.google.common.collect.Lists.newArrayList();
-            if(reportedConsultants.size() == 0){
-                //如果上报的咨询员信息为空 则处理报告咨询员信息
-                consultantLista = ruralProjectMessageService.disposeConsultant(reportConsultants, projectRecords);
-            }else{
-                //对上报的咨询员进行处理
-                consultantLista = ruralProjectMessageService.disposereportedConsultant(reportedConsultants);
-            }
-            RuralProjectRecords records = projectRecordsService.getQueryProjectUsers(reported.getProjectId());
-            if(StringUtils.isBlank(reported.getProjectRecordId())){
-                reported.setProjectRecordId(records.getProjectId());
-            }
-            model.addAttribute("ruralProjectRecordsReported", reported);
-            projectcontent.setRecordsReported(reported);
-            //查询项目信息
-            model.addAttribute("ruralProjectRecords", records);
-            model.addAttribute("consultantInfo1", consultantLista);
-            if(StringUtils.isBlank(reported.getS1())){
-                reported.setS1("10");
-            }
-            //获取工程类型
-            ProjectEngineeringInfo engineeringInfos=engineeringService.getProjectReportedType(reported.getPorjectUse());
-            model.addAttribute("engineeringInfo", engineeringInfos);
-        }
-
-        //查询总审人员信息
-        List<User> auditUserList = userService.getAuditUserList();
-        ruralProjectRecords.setBzshbUserList(auditUserList);
-        model.addAttribute("processInstanceId",projectReportData.getProcessInstanceId());
-        model.addAttribute("projectReportData",projectReportData);
-        model.addAttribute("projectId", projectcontentinfo1.getProject().getId());
-        model.addAttribute("project", projectcontentinfo1.getProject());
-        model.addAttribute("reportedId", projectcontentinfo.getReportedId());
-        model.addAttribute("projectRecords", ruralProjectRecords);
-        model.addAttribute("id", projectcontentinfo.getId());
-        model.addAttribute("projectcontentinfo", projectcontent);
-        model.addAttribute("consultantinfo", consultants);
-
-        List<MainDictDetail> achievementTypes = DictUtils.getMainDictList("achievement_type");
-        if(null != achievementTypes){
-            for (MainDictDetail achievementType:achievementTypes) {
-                if(achievementType.getValue().equals(projectReportData.getAchievementType())){
-                    projectReportData.setAchievementType(achievementType.getLabel());
-                    break;
-                }
-            }
-        }
-        return "modules/ruralprojectrecords/ruralporjectmessage/all/adminReportEditFormAlls";
-    }
-    /**
-     * admin修改报告信息
-     * @param projectcontentinfo
-     * @param model
-     * @param redirectAttributes
-     * @return
-     */
-    @RequestMapping(value = {"adminModifyReport"})
-    public String adminModifyReport(Projectcontentinfo projectcontentinfo,HttpServletRequest request, Model model,RedirectAttributes redirectAttributes)  {
-        try{
-            String toJson = ruralProjectMessageService.getReportToJson(projectcontentinfo);
-            HistoricalData historicalData = new HistoricalData();
-            historicalData.setDataType("1");
-            historicalData.setDataId(projectcontentinfo.getProjectReportData().getId());
-            historicalData.setIp(StringUtils.getRemoteAddr(request));
-            historicalData.setOperator(UserUtils.getUser().getId());
-            historicalData.setDataObj(toJson);
-            String str = ruralProjectMessageService.adminModifyReport(projectcontentinfo,historicalData);
-            addMessage(redirectAttributes, "修改报告"+(str.equals("true")?"成功":"失败"));
-            ProjectReportData projectReportData = projectcontentinfo.getProjectReportData();
-            if (projectReportData!=null){
-                if (StringUtils.isNotBlank(projectcontentinfo.getEdit()) && projectcontentinfo.getEdit().equals("edit")){
-                    return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectMessageAll/?repage";
-                }
-                return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectMessageAll/?repage";
-            }
-        }catch (Exception e){
-            logger.error("ProjectcontentinfoController save Exception e"+e);
-        }
-        if(UserUtils.isManager()){
-            model.addAttribute("flag","1");
-        }
-        addMessage(redirectAttributes, "修改报告失败");
-        ProjectRecords projectRecords = projectcontentinfo.getProject()==null?new ProjectRecords():projectcontentinfo.getProject();
-        return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectMessageAll/?repage";
-    }
-
-    /**
-     * 设置上报按钮开关
-     */
-    @RequestMapping(value = "setReportSwitch")
-    @ResponseBody
-    public String setReportSwitch(boolean reportSwitch){
-        BaseController.REPORTSWITCH=reportSwitch;
-        String str="";
-        if (reportSwitch){
-            str="修改成功,上报按钮已开启";
-        }else{
-            str="修改成功,上报按钮已关闭";
-        }
-        return str;
-    }
-
-    /**
-     * 跳转归档信息导出信息页
-     */
-    @RequestMapping(value = "skipDownloadRecordForm")
-    public String skipDownloadRecordForm(RuralProjectRecords projectRecords,Model model) {
-        model.addAttribute("projectRecords",projectRecords);
-        return "modules/ruralprojectrecords/ruralporjectmessage/all/downloadRecordForm";
-    }
-
-    /**
-     * 查询归档
-     * @return
-     */
-    @RequestMapping("getRecordType")
-    @ResponseBody
-    public AjaxJson getRecordType(String type){
-        AjaxJson ajaxJson = new AjaxJson();
-        try {
-            List<Dict> archiveStateList = DictUtils.getDictList(type);
-            List<Map<String, Object>> mapList = new ArrayList<>();
-            for (int i = 0; i < archiveStateList.size(); i++) {
-                Map<String, Object> map = new HashMap<>();
-                map.put("name", archiveStateList.get(i).getLabel());
-                map.put("value", archiveStateList.get(i).getValue());
-                mapList.add(map);
-            }
-            ajaxJson.getBody().put("list", mapList);
-            ajaxJson.setMsg("获取数据成功");
-        } catch (Exception e) {
-            logger.error("获取数据异常!", e);
-            ajaxJson.setSuccess(false);
-            ajaxJson.setMsg("获取数据异常");
-        }
-        return ajaxJson;
-    }
-
-    /**
-     * 导出归档excel文件
-     */
-    @RequiresPermissions("ruralProject:ruralProjectMessageAll:recordDownload")
-    @RequestMapping(value = "recordDownload", method= RequestMethod.POST)
-    public String recordDownload(RuralProjectRecords projectRecords, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
-        try {
-            String fileName = "归档项目"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
-            Page<DownloadProjectRecords> page = ruralProjectMessageAllService.findPageRecordDownload(new Page<DownloadProjectRecords>(request, response, -1), projectRecords);
-            if(null != projectRecords.getBeginDate() && null != projectRecords.getEndDate()){
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                new ExportExcel(sdf.format(projectRecords.getBeginDate()) + " 至 " + sdf.format(projectRecords.getEndDate()) + "归档一览表", DownloadProjectRecords.class).setDataList(page.getList()).write(response, fileName).dispose();
-            }else{
-                new ExportExcel("归档一览表", DownloadProjectRecords.class).setDataList(page.getList()).write(response, fileName).dispose();
-            }
 
-            return null;
-        } catch (Exception e) {
-            addMessage(redirectAttributes, "导出项目记录失败!失败信息:"+e.getMessage());
-            logger.error("Exception e:"+e);
-        }
-        return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectMessageAll/?repage";
-    }
-
-    /**
-     * 跳转上报信息导出信息页
-     */
-    @RequestMapping(value = "skipDownloadReportedForm")
-    public String skipDownloadReportedForm(RuralProjectRecords projectRecords,Model model) {
-        model.addAttribute("projectRecords",projectRecords);
-        return "modules/ruralprojectrecords/ruralporjectmessage/all/downloadReportedForm";
-    }
-
-
-    /**
-     * 导出上报excel文件
-     */
-    @RequiresPermissions("ruralProject:ruralProjectMessageAll:reportedDownload")
-    @RequestMapping(value = "reportedDownload", method= RequestMethod.POST)
-    public String reportedDownload(RuralProjectRecords projectRecords, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
-        try {
-            String fileName = "上报项目"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
-            Page<DownloadProjectReporteds> page = ruralProjectMessageAllService.findPageReportedDownload(new Page<DownloadProjectReporteds>(request, response, -1), projectRecords);
-            if(null != projectRecords.getBeginDate() && null != projectRecords.getEndDate()){
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                new ExportExcel(sdf.format(projectRecords.getBeginDate()) + " 至 " + sdf.format(projectRecords.getEndDate()) + "上报一览表", DownloadProjectReporteds.class).setDataList(page.getList()).write(response, fileName).dispose();
-            }else{
-                new ExportExcel("上报一览表", DownloadProjectReporteds.class).setDataList(page.getList()).write(response, fileName).dispose();
-            }
-
-            return null;
-        } catch (Exception e) {
-            addMessage(redirectAttributes, "导出项目记录失败!失败信息:"+e.getMessage());
-            logger.error("Exception e:"+e);
-        }
-        return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectMessageAll/?repage";
-    }
-
-    /**
-     * 导出excel文件
-     */
-    @RequiresPermissions("ruralProject:ruralProjectMessageAll:export")
-    @RequestMapping(value = "export", method=RequestMethod.POST)
-    public String exportFile(RuralProjectRecords projectRecords, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
-        try {
-
-            //添加查询类型(工程咨询)
-            List<String> typeList = Lists.newArrayList();
-            typeList.add("1");
-            typeList.add("2");
-            //添加查询类型list
-            projectRecords.setTypeList(typeList);
-            String fileName = "项目"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
-            Page<RuralProjectRecords> page = ruralProjectMessageAllService.findPageByExport(new Page<RuralProjectRecords>(request, response, -1), projectRecords);
-            new ExportExcel("项目一览表", RuralProjectRecords.class).setDataList(page.getList()).write(response, fileName).dispose();
-            return null;
-        } catch (Exception e) {
-            addMessage(redirectAttributes, "导出项目记录失败!失败信息:"+e.getMessage());
-            logger.error("Exception e:"+e);
-        }
-        return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralCostProjectRecords/?repage";
-    }
 }

+ 259 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectSignatureCallBackController.java

@@ -0,0 +1,259 @@
+package com.jeeplus.modules.ruralprojectrecords.web;
+
+import com.alibaba.fastjson.JSON;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.historical.entity.HistoricalData;
+import com.jeeplus.modules.historical.service.HistoricalService;
+import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
+import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
+import com.jeeplus.modules.projectAccessory.service.ProjectAccessoryRelationService;
+import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
+import com.jeeplus.modules.projectEngineering.entity.ProjectEngineeringInfo;
+import com.jeeplus.modules.projectEngineering.service.ProjectEngineeringService;
+import com.jeeplus.modules.projectFilingBatch.dao.ProjectFilingBatchDao;
+import com.jeeplus.modules.projectFilingBatch.dao.ProjectFilingbatchRelationDao;
+import com.jeeplus.modules.projectFilingBatch.entity.ProjectFilingBatch;
+import com.jeeplus.modules.projectFilingBatch.entity.ProjectFilingbatchRelation;
+import com.jeeplus.modules.projectFilingBatch.service.ProjectFilingBatchService;
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportRecord;
+import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportChangeService;
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportRecordService;
+import com.jeeplus.modules.projectcontentinfo.service.ProjectcontentinfoService;
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
+import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
+import com.jeeplus.modules.projectrecord.service.ProjectPlanService;
+import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectRecordsReportedDao;
+import com.jeeplus.modules.ruralprojectrecords.entity.*;
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
+import com.jeeplus.modules.ruralprojectrecords.utils.FileUtil;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.MainDictDetail;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.UserService;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.tools.utils.SignaturePostUtil;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
+import com.jeeplus.modules.workstaff.entity.WorkStaffCertificate;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.util.*;
+
+/**
+ * 项目签章回调接口Controller
+ * @author 徐滕
+ * @version 2021-11-04
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/ruralProject/signatureCallBack")
+public class RuralProjectSignatureCallBackController extends BaseController {
+    @Autowired
+    private RuralProjectRecordsService projectRecordsService;
+    @Autowired
+    private ProjectRecordsService projectRecordsServices;
+    @Autowired
+    private RuralProjectMessageService ruralProjectMessageService;
+    @Autowired
+    private ProjectReportDataService projectReportDataService;
+    @Autowired
+    private ProjectcontentinfoService projectcontentinfoService;
+    @Autowired
+    private ProjectReportChangeService projectReportChangeService;
+    @Autowired
+    protected HistoryService historyService;
+    @Autowired
+    private ProjectReportRecordService projectReportRecordService;
+    @Autowired
+    private ProjectPlanService projectPlanService;
+    @Autowired
+    private ProjectTemplateService projectTemplateService;
+    @Autowired
+    private HistoricalService historicalService;
+    @Autowired
+    private ProjectAccessoryRelationService projectAccessoryRelationService;
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private ProjectFilingBatchService projectFilingBatchService;
+    @Autowired
+    private ProjectFilingbatchRelationDao projectFilingbatchRelationDao;
+    @Autowired
+    private ProjectFilingBatchDao projectFilingBatchDao;
+    @Autowired
+    private RuralProjectRecordsService ruralProjectRecordsService;
+    @Autowired
+    private RuralProjectRecordsReportedDao ruralProjectRecordsReportedDao;
+    @Autowired
+    private ProjectEngineeringService engineeringService;
+
+    private static byte[] SYN_BYTE = new byte[0];
+
+    private static final String HTTPTOP = "http://121.40.158.10:9182";
+
+    @ModelAttribute
+    public RuralProjectRecords get(@RequestParam(required=false) String id) {
+        RuralProjectRecords entity = null;
+        if (StringUtils.isNotBlank(id)){
+            entity = projectRecordsService.get(id);
+        }
+        if (entity == null){
+            entity = new RuralProjectRecords();
+        }
+        return entity;
+    }
+
+    /**
+     * 预签署回调操作
+     * @param presignCallBack  回调参数
+     * @return
+     */
+    @RequestMapping(value = "/getPresignCoordinates", method=RequestMethod.POST)
+    public String getPresignCoordinates(PresignCallBack presignCallBack) {
+        //根据contractId查询对应的报告信息
+        ProjectReportData projectReportData = projectReportDataService.getProjectReportDataByContractId(presignCallBack.getContractId());
+        if(null == projectReportData){
+            return null;
+        }
+        //根据合同id查询坐标
+        Map map = new HashMap();
+        map.put("contractId",presignCallBack.getContractId());
+        String coordinateMapStr = SignaturePostUtil.doGet( map,HTTPTOP + "/contract/query/location");
+        HashMap hashMap = JSON.parseObject(coordinateMapStr, HashMap.class);
+        String resultStr = hashMap.get("result").toString();
+        Map  classMap = new HashMap();
+        classMap.put("locations", Location.class);
+        //2、使用JSONArray
+        JSONArray jsonArray= JSONArray.fromObject(resultStr);
+        //获得jsonArray的第一个元素
+        Object o=jsonArray.get(0);
+        JSONObject jsonObject= JSONObject.fromObject(o);
+        //对json数据进行实例化
+        CoordinateInfo coordinateInfo = (CoordinateInfo) JSONObject.toBean(jsonObject, CoordinateInfo.class, classMap);
+
+        //发起合同
+        Map sendContractMap = new HashMap();
+        sendContractMap.put("contractId",presignCallBack.getContractId());
+        String sendContractJsonString = JSON.toJSONString(sendContractMap);
+        String sendContractStr = SignaturePostUtil.sendPostApplicationJson( HTTPTOP + "/contract/send",sendContractJsonString);
+        HashMap signUrlHashMap = JSON.parseObject(sendContractStr, HashMap.class);
+        String sendContractResult = signUrlHashMap.get("code").toString();
+        //如果发起合同成功,则进行静默签署(静默签署,有几个章就会签署几次)
+        if("0".equals(sendContractResult)){
+            SignByCompanyInfo signByCompanyInfo = new SignByCompanyInfo();
+            signByCompanyInfo.setContractId(presignCallBack.getContractId());
+            signByCompanyInfo.setTenantName("江苏兴光项目管理有限公司");
+            List<Location> locations = coordinateInfo.getLocations();
+            //将无效的documentId转换为List
+            List<String> invalidDocumentIdList = Arrays.asList(projectReportData.getSignatureInvalidDocumentId().split(","));
+            //遍历坐标 将对应的印章和坐标填写在Stamper种
+            for (Location location: locations) {
+                List<Stamper> stampers = Lists.newArrayList();
+                for (String invalidDocumentId: invalidDocumentIdList) {
+                    Stamper stamper = new Stamper();
+                    stamper.setDocumentId(invalidDocumentId);
+                    stamper.setType("SEAL_CORPORATE");
+                    stamper.setSealId(location.getSealId());
+                    stamper.setPage(location.getPage());
+                    stamper.setX(location.getOffsetX());
+                    stamper.setY(location.getOffsetY());
+                    stampers.add(stamper);
+                }
+                signByCompanyInfo.setStampers(stampers);
+                //将数据转换为jsonString
+                Object obj = com.alibaba.fastjson.JSONArray.toJSON(signByCompanyInfo);
+                String signByCompanyInfoJsonStr = obj.toString();
+                //进行静默签署
+                String signByCompanyStr = SignaturePostUtil.sendPostApplicationJson( HTTPTOP + "/contract/signbycompany",signByCompanyInfoJsonStr);
+                HashMap signByCompanyStrMap = JSON.parseObject(signByCompanyStr, HashMap.class);
+                String signByCompanyStrResult = signByCompanyStrMap.get("code").toString();
+                if(!"0".equals(signByCompanyStrResult)){
+                    return null;
+                }
+            }
+        }
+        //签章完成则进行数据的保存
+        projectReportData.setSignatureFlag(1);
+        projectReportDataService.updateInvalidProcessInstanceId(projectReportData);
+
+        return null;
+    }
+
+
+    /**
+     * 下载附件
+     */
+    @RequestMapping(value = "/downLoadAttach", method=RequestMethod.GET)
+    public void downLoadAttach(String contractId,HttpServletResponse response) {
+        //根据contractId查询对应的报告信息
+        ProjectReportData projectReportData = projectReportDataService.getProjectReportDataByContractId(contractId);
+        if(null == projectReportData || StringUtils.isBlank(projectReportData.getSignatureContractId())){
+            return ;
+        }
+        //根据contractId将文件下载下来 并上传到阿里云服务种
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken","cUUUYYw5R0");
+        requestHeaderMap.put("x-qys-signature","0584191d6eb2f9411f8645fd16b32327");
+        requestHeaderMap.put("x-qys-timestamp","0");
+        SignaturePostUtil.downloadZipGet(HTTPTOP + "/contract/download?contractId="+contractId,requestHeaderMap,projectReportData.getSignatureFileName()+".zip","",response);
+    }
+
+    /**
+     * 查看附件
+     */
+    @RequestMapping(value = "/getViewUrlByContractId", method=RequestMethod.GET)
+    public String getViewUrlByContractId(String contractId) {
+        //根据contractId查询对应的报告信息
+        ProjectReportData projectReportData = projectReportDataService.getProjectReportDataByContractId(contractId);
+        if(null == projectReportData || StringUtils.isBlank(projectReportData.getSignatureContractId())){
+            return "";
+        }
+        //根据contractId将文件下载下来 并上传到阿里云服务种
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken","cUUUYYw5R0");
+        requestHeaderMap.put("x-qys-signature","0584191d6eb2f9411f8645fd16b32327");
+        requestHeaderMap.put("x-qys-timestamp","0");
+
+        Map map =new HashMap();
+        map.put("contractId",contractId);
+        String viewUrlStr = SignaturePostUtil.doGet(map, HTTPTOP + "/contract/viewurl");
+        HashMap viewUrlStrMap = JSON.parseObject(viewUrlStr, HashMap.class);
+        String code = viewUrlStrMap.get("code").toString();
+        if("0".equals(code)){
+            return viewUrlStrMap.get("viewUrl").toString();
+        }
+        return "";
+    }
+}

+ 585 - 0
src/main/java/com/jeeplus/modules/tools/utils/SignaturePostUtil.java

@@ -0,0 +1,585 @@
+package com.jeeplus.modules.tools.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.ruralprojectrecords.entity.CoordinateInfo;
+import com.jeeplus.modules.ruralprojectrecords.entity.Location;
+import com.jeeplus.modules.ruralprojectrecords.entity.SealUserInfo;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.Map.Entry;
+
+/**
+ * @author: 徐滕
+ * @create: 2021-11-02 14:20
+ **/
+public class SignaturePostUtil {
+
+    //竖版模板templateId
+    private static final String VERTICALTEMPLATEID = "2893051207158391002";
+    //横板模板templateId
+    private static final String ACROSSTEMPLATEID = "2893769317217788089";
+    private static final String HTTPTOP = "http://121.40.158.10:9182";
+
+    /**
+     * 发送get请求
+     *
+     * @param requestUrl
+     *      请求url
+     * @param requestHeader
+     *      请求头
+     * @param responseEncoding
+     *      响应编码
+     * @return 页面响应html
+     */
+    public static String sendGet(String requestUrl, Map<String, String> requestHeader, String responseEncoding) {
+        String result = "";
+        BufferedReader reader = null;
+        try {
+            if (requestUrl == null || requestUrl.isEmpty()) {
+                return result;
+            }
+            URL realUrl = new URL(requestUrl);
+            URLConnection connection = realUrl.openConnection();
+            connection.setRequestProperty("accept", "text/html, application/xhtml+xml, image/jxr, */*");
+            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            connection.connect();
+            if (responseEncoding == null || responseEncoding.isEmpty()) {
+                responseEncoding = "UTF-8";
+            }
+            reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), responseEncoding));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!");
+            e.printStackTrace();
+        } finally {
+            try {
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        result = decodeUnicode(result);
+        return result;
+    }
+
+    /**
+     * 发送下载压缩包get请求
+     * @param requestUrl 请求url
+     * @param requestHeader 请求头
+     * @param fileName 下载文件名称
+     * @param responseEncoding 响应编码
+     * @return 页面响应html
+     */
+    public static String downloadZipGet(String requestUrl, Map<String, String> requestHeader, String fileName, String responseEncoding, HttpServletResponse response) {
+        String result = "";
+        BufferedReader reader = null;
+        try {
+            if (requestUrl == null || requestUrl.isEmpty()) {
+                return result;
+            }
+            URL realUrl = new URL(requestUrl);
+            URLConnection connection = realUrl.openConnection();
+            connection.setRequestProperty("accept", "text/html, application/xhtml+xml, image/jxr, */*");
+            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            connection.setRequestProperty("Content-Type", "application/zip");
+            connection.connect();
+            if (responseEncoding == null || responseEncoding.isEmpty()) {
+                responseEncoding = "UTF-8";
+            }
+            InputStream inputStream = connection.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //设置HTTP响应头
+            response.reset();//重置 响应头
+            response.setContentType("application/x-download");//告知浏览器下载文件,而不是直接打开,浏览器默认为打开
+            fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
+            response.addHeader("Content-Disposition" ,"attachment;filename=" +fileName+ "");//下载文件的名称
+            // 循环取出流中的数据
+            response.getOutputStream().write(getData);
+            response.getOutputStream().close();
+
+            if(inputStream!=null){
+                inputStream.close();
+            }
+
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!");
+            e.printStackTrace();
+        } finally {
+            try {
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 从输入流中获取字节数组
+     * @param inputStream
+     * @return
+     * @throws IOException
+     */
+    public static byte[] readInputStream(InputStream inputStream) throws IOException {
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        while((len = inputStream.read(buffer)) != -1) {
+            bos.write(buffer, 0, len);
+        }
+        bos.close();
+        return bos.toByteArray();
+    }
+
+    /**
+     * 发送post请求
+     *
+     * @param requestUrl 请求url
+     * @param requestHeader 请求头
+     * @param formTexts 表单数据
+     * @param files 上传文件
+     * @param requestEncoding 请求编码
+     * @param responseEncoding 响应编码
+     * @return 页面响应html
+     */
+    public static String sendPost(String requestUrl, Map<String, String> requestHeader, Map<String, String> formTexts, File[] files, String requestEncoding, String responseEncoding) {
+        OutputStream out = null;
+        BufferedReader reader = null;
+        String result = "";
+        try {
+            if (requestUrl == null || requestUrl.isEmpty()) {
+                return result;
+            }
+            URL realUrl = new URL(requestUrl);
+            HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
+            connection.setRequestProperty("accept", "text/html, application/xhtml+xml, image/jxr, */*");
+            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setRequestMethod("POST");
+            if (requestEncoding == null || requestEncoding.isEmpty()) {
+                requestEncoding = "UTF-8";
+            }
+            if (responseEncoding == null || responseEncoding.isEmpty()) {
+                responseEncoding = "UTF-8";
+            }
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            if (files == null || files.length == 0) {
+                String boundary = "-----------------------------" + String.valueOf(new Date().getTime());
+                connection.setRequestProperty("content-type", "multipart/form-data; boundary=" + boundary);
+                out = new DataOutputStream(connection.getOutputStream());
+                if (formTexts != null && formTexts.size() > 0) {
+                    StringBuilder sbFormData = new StringBuilder();
+                    for (Entry<String, String> entry : formTexts.entrySet()) {
+                        sbFormData.append("--" + boundary + "\r\n");
+                        sbFormData.append("Content-Disposition: form-data; name=\"" + entry.getKey() + "\"\r\n\r\n");
+                        sbFormData.append(entry.getValue() + "\r\n");
+                    }
+                    out.write(sbFormData.toString().getBytes(requestEncoding));
+                }
+            } else {
+                String boundary = "-----------------------------" + String.valueOf(new Date().getTime());
+                connection.setRequestProperty("content-type", "multipart/form-data; boundary=" + boundary);
+                out = new DataOutputStream(connection.getOutputStream());
+                if (formTexts != null && formTexts.size() > 0) {
+                    StringBuilder sbFormData = new StringBuilder();
+                    for (Entry<String, String> entry : formTexts.entrySet()) {
+                        sbFormData.append("--" + boundary + "\r\n");
+                        sbFormData.append("Content-Disposition: form-data; name=\"" + entry.getKey() + "\"\r\n\r\n");
+                        sbFormData.append(entry.getValue() + "\r\n");
+                    }
+                    out.write(sbFormData.toString().getBytes(requestEncoding));
+                }
+                for (File file : files) {
+                    if (!file.exists()) {
+                        continue;
+                    }
+                    out.write(("--" + boundary + "\r\n").getBytes(requestEncoding));
+                    out.write(("Content-Disposition: form-data; name=\" file \"; filename=\"" + file.getName() + "\"\r\n").getBytes(requestEncoding));
+                    out.write(("Content-Type: application/x-msdownload\r\n\r\n").getBytes(requestEncoding));
+                    DataInputStream in = new DataInputStream(new FileInputStream(file));
+                    int bytes = 0;
+                    byte[] bufferOut = new byte[1024];
+                    while ((bytes = in.read(bufferOut)) != -1) {
+                        out.write(bufferOut, 0, bytes);
+                    }
+                    in.close();
+                    out.write(("\r\n").getBytes(requestEncoding));
+                }
+                out.write(("--" + boundary + "--").getBytes(requestEncoding));
+            }
+            out.flush();
+            out.close();
+            out = null;
+            reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), responseEncoding));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送POST请求出现异常!");
+            e.printStackTrace();
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        result = decodeUnicode(result);
+        return result;
+    }
+
+    /**
+     * ApplicationJson的post请求
+     * @return
+     */
+    public static String sendPostApplicationJson(String url, String jsonString) {
+        CloseableHttpClient httpClient = null;
+        CloseableHttpResponse httpResponse = null;
+        String result = "";
+        // 创建httpClient实例
+        httpClient = HttpClients.createDefault();
+        // 创建httpPost远程连接实例
+        HttpPost httpPost = new HttpPost(url);
+        // 配置请求参数实例
+        RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(35000)// 设置连接主机服务超时时间
+                .setConnectionRequestTimeout(35000)// 设置连接请求超时时间
+                .setSocketTimeout(60000)// 设置读取数据连接超时时间
+                .build();
+        // 为httpPost实例设置配置
+        httpPost.setConfig(requestConfig);
+        // 设置请求头鉴权
+        httpPost.setHeader("x-qys-accesstoken", "cUUUYYw5R0");
+        httpPost.setHeader("x-qys-signature", "0584191d6eb2f9411f8645fd16b32327");
+        httpPost.setHeader("x-qys-timestamp", "0");
+        // 包含内容格式设置
+        httpPost.addHeader("Content-Type", "application/json");
+        // 封装post请求参数
+        if (null != jsonString) {
+            // 为httpPost设置封装好的请求参数
+            System.out.println("添加到实体------");
+            httpPost.setEntity(new StringEntity(jsonString, "UTF-8"));
+        }
+        try {
+            // httpClient对象执行post请求,并返回响应参数对象
+            httpResponse = httpClient.execute(httpPost);
+            // 从响应对象中获取响应内容
+            HttpEntity entity = httpResponse.getEntity();
+            result = EntityUtils.toString(entity);
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭资源
+            if (null != httpResponse) {
+                try {
+                    httpResponse.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != httpClient) {
+                try {
+                    httpClient.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        result = decodeUnicode(result);
+        System.out.println(result);
+        return result;
+    }
+
+    private static String decodeUnicode(String theString) {
+        char aChar;
+        int len = theString.length();
+        StringBuffer outBuffer = new StringBuffer(len);
+        for (int x = 0; x < len;) {
+            aChar = theString.charAt(x++);
+            if (aChar == '\\') {
+                aChar = theString.charAt(x++);
+                if (aChar == 'u') {
+                    // Read the xxxx
+                    int value = 0;
+                    for (int i = 0; i < 4; i++) {
+                        aChar = theString.charAt(x++);
+                        switch (aChar) {
+                            case '0':
+                            case '1':
+                            case '2':
+                            case '3':
+                            case '4':
+                            case '5':
+                            case '6':
+                            case '7':
+                            case '8':
+                            case '9':
+                                value = (value << 4) + aChar - '0';
+                                break;
+                            case 'a':
+                            case 'b':
+                            case 'c':
+                            case 'd':
+                            case 'e':
+                            case 'f':
+                                value = (value << 4) + 10 + aChar - 'a';
+                                break;
+                            case 'A':
+                            case 'B':
+                            case 'C':
+                            case 'D':
+                            case 'E':
+                            case 'F':
+                                value = (value << 4) + 10 + aChar - 'A';
+                                break;
+                            default:
+                                throw new IllegalArgumentException(
+                                        "Malformed   \\uxxxx   encoding.");
+                        }
+
+                    }
+                    outBuffer.append((char) value);
+                } else {
+                    if (aChar == 't')
+                        aChar = '\t';
+                    else if (aChar == 'r')
+                        aChar = '\r';
+                    else if (aChar == 'n')
+                        aChar = '\n';
+                    else if (aChar == 'f')
+                        aChar = '\f';
+                    outBuffer.append(aChar);
+                }
+            } else
+                outBuffer.append(aChar);
+        }
+        return outBuffer.toString();
+    }
+
+    /**
+     * 根据文件创建合同信息
+     * @param srcFile
+     * @return
+     */
+    public static String getDocument(File srcFile) {
+        //截取文件后缀名
+        String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken","cUUUYYw5R0");
+        requestHeaderMap.put("x-qys-signature","0584191d6eb2f9411f8645fd16b32327");
+        requestHeaderMap.put("x-qys-timestamp","0");
+        //添加文件参数
+        Map<String,String> formTextsMap = new HashMap<>();
+        formTextsMap.put("title",srcFile.getName());
+        formTextsMap.put("fileType",substring);
+        //创建文件数组
+        File[] files = new File[]{srcFile};
+        //访问方法
+        String documentResult = sendPost(HTTPTOP + "/v2/document/createbyfile", requestHeaderMap, formTextsMap, files, "", "");
+        HashMap hashMap = JSON.parseObject(documentResult, HashMap.class);
+        String result = hashMap.get("result").toString();
+        HashMap documentIdMap = JSON.parseObject(result, HashMap.class);
+        String documentId = documentIdMap.get("documentId").toString();
+        return documentId;
+    }
+
+    /**
+     * 运行无效合同信息
+     * @param fileName
+     * @param invalidFile
+     * @return
+     */
+    public static String getVerticalInvalidDocument(String fileName,File invalidFile){
+        File[] files = new File[]{invalidFile};
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken","cUUUYYw5R0");
+        requestHeaderMap.put("x-qys-signature","0584191d6eb2f9411f8645fd16b32327");
+        requestHeaderMap.put("x-qys-timestamp","0");
+        //添加文件参数
+        Map<String,String> formTextsMap = new HashMap<>();
+        formTextsMap.put("title",fileName);
+        formTextsMap.put("templateId",VERTICALTEMPLATEID);
+        //访问方法
+        String documentResult = sendPost(HTTPTOP + "/document/createbytemplate", requestHeaderMap, formTextsMap, files, "", "");
+        HashMap hashMap = JSON.parseObject(documentResult, HashMap.class);
+        String documentId = hashMap.get("documentId").toString();
+        return documentId;
+    }
+
+    /**
+     * 运行无效合同信息
+     * @param fileName
+     * @param invalidFile
+     * @return
+     */
+    public static String getAcrossVerticalInvalidDocument(String fileName,File invalidFile){
+        File[] files = new File[]{invalidFile};
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken","cUUUYYw5R0");
+        requestHeaderMap.put("x-qys-signature","0584191d6eb2f9411f8645fd16b32327");
+        requestHeaderMap.put("x-qys-timestamp","0");
+        //添加文件参数
+        Map<String,String> formTextsMap = new HashMap<>();
+        formTextsMap.put("title",fileName);
+        formTextsMap.put("templateId",ACROSSTEMPLATEID);
+        //访问方法
+        String documentResult = sendPost(HTTPTOP + "/document/createbytemplate", requestHeaderMap, formTextsMap, files, "", "");
+        HashMap hashMap = JSON.parseObject(documentResult, HashMap.class);
+        String documentId = hashMap.get("documentId").toString();
+        return documentId;
+    }
+
+
+    public static String doGet(Map<String, String> paramMap, String url){
+        String result = "";
+        HttpGet get = new HttpGet(url);
+        try{
+            // 设置请求头鉴权
+            get.setHeader("x-qys-accesstoken", "cUUUYYw5R0");
+            get.setHeader("x-qys-signature", "0584191d6eb2f9411f8645fd16b32327");
+            get.setHeader("x-qys-timestamp", "0");
+            CloseableHttpClient httpClient = HttpClients.createDefault();
+            List<NameValuePair> params = setHttpParams(paramMap);
+            String param = URLEncodedUtils.format(params, "UTF-8");
+            get.setURI(URI.create(url + "?" + param));
+            HttpResponse response = httpClient.execute(get);
+            result = getHttpEntityContent(response);
+
+            if(response.getStatusLine().getStatusCode()!= HttpStatus.SC_OK){
+                result = "服务器异常";
+            }
+        } catch (Exception e){
+            System.out.println("请求异常");
+            throw new RuntimeException(e);
+        } finally{
+            get.abort();
+        }
+        result = decodeUnicode(result);
+        return result;
+    }
+
+    public static List<NameValuePair> setHttpParams(Map<String, String> paramMap){
+        List<NameValuePair> params = new ArrayList<NameValuePair>();
+        Set<Entry<String, String>> set = paramMap.entrySet();
+        for(Map.Entry<String, String> entry : set){
+            params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
+        }
+        return params;
+    }
+
+    public static String getHttpEntityContent(HttpResponse response) throws UnsupportedOperationException, IOException{
+        String result = "";
+        HttpEntity entity = response.getEntity();
+        if(entity != null){
+            InputStream in = entity.getContent();
+            BufferedReader br = new BufferedReader(new InputStreamReader(in, "utf-8"));
+            StringBuilder strber= new StringBuilder();
+            String line = null;
+            while((line = br.readLine())!=null){
+                strber.append(line+'\n');
+            }
+            br.close();
+            in.close();
+            result = strber.toString();
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 根据用户手机号查询用户章信息
+     * @param userMobile
+     * @return
+     */
+    public static String getUserSealByMobile(String userMobile){
+        //根据contractId将文件下载下来 并上传到阿里云服务种
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken","cUUUYYw5R0");
+        requestHeaderMap.put("x-qys-signature","0584191d6eb2f9411f8645fd16b32327");
+        requestHeaderMap.put("x-qys-timestamp","0");
+
+        Map map =new HashMap();
+        map.put("companyName","江苏兴光项目管理有限公司");
+        map.put("mobile",userMobile);
+        String viewUrlStr = SignaturePostUtil.doGet(map, HTTPTOP + "/seal/user/charge");
+        HashMap userSealStrMap = JSON.parseObject(viewUrlStr, HashMap.class);
+        String code = userSealStrMap.get("code").toString();
+        if("0".equals(code)){
+            String resultStr = userSealStrMap.get("result").toString();
+            //获取成员印章信息列表
+            List <SealUserInfo> userSealList =new Gson().fromJson(resultStr, new TypeToken<List<SealUserInfo>>() {}.getType());
+            if(userSealList.size()>0){
+                if(StringUtils.isNotBlank(userSealList.get(0).getId())){
+                    //返回成员第一个印章编号id
+                    return userSealList.get(0).getId();
+                }
+            }
+        }
+        return "";
+    }
+}
+

+ 43 - 1
src/main/resources/mappings/modules/projectcontentinfo/ProjectReportDataDao.xml

@@ -53,7 +53,12 @@
 		a.technicist_date as "technicistDate",
 		a.contract_category as "contractCategory",
 		a.contract_rate as "contractRate",
-		a.ZiXunShouRu as "ZiXunShouRu"
+		a.ZiXunShouRu as "ZiXunShouRu",
+		a.signature_flag as "signatureFlag",
+		a.signature_document_id as "signatureDocumentId",
+		a.signature_invalid_document_id as "signatureInvalidDocumentId",
+		a.signature_contract_id as "signatureContractId",
+		a.signature_file_name as "signatureFileName"
 	</sql>
 
 	<sql id="projectReportDataJoins">
@@ -1093,4 +1098,41 @@
 		WHERE id = #{id}
 	</update>
 
+	<update id="updateSignatureInfo">
+		UPDATE project_report_data SET
+			<if test="signatureDocumentId != null and signatureDocumentId != ''">
+				signature_document_id = #{signatureDocumentId}
+			</if>
+			<if test="signatureInvalidDocumentId != null and signatureInvalidDocumentId != ''">
+				,signature_invalid_document_id = #{signatureInvalidDocumentId}
+			</if>
+			<if test="signatureContractId != null and signatureContractId != ''">
+				,signature_contract_id = #{signatureContractId}
+			</if>
+			<if test="signatureFlag != null and signatureFlag != ''">
+				,signature_flag = #{signatureFlag}
+			</if>
+			<if test="signatureFileName != null and signatureFileName != ''">
+				,signature_file_name = #{signatureFileName}
+			</if>
+		WHERE id = #{id}
+	</update>
+
+	<select id="getProjectReportDataByContractId" resultType="ProjectReportData" >
+		SELECT
+		<include refid="projectReportDataColumns"/>
+		,a.bzshb_user_id as "bzshbUserId"
+		,a.audit_pass_date as "auditPassDate"
+		,c.name as "consultant.name"
+		,p.name as "principal.name"
+		,t.name as "technicist.name"
+		FROM project_report_data a
+		<include refid="projectReportDataJoins"/>
+		LEFT JOIN sys_user c ON c.id = a.consultant_id
+		LEFT JOIN sys_user p ON p.id = a.principal_id
+		LEFT JOIN sys_user t ON t.id = a.technicist_id
+		WHERE a.signature_contract_id = #{contractId}
+	</select>
+
+
 </mapper>

+ 2 - 0
src/main/resources/mappings/modules/ruralprojectrecords/RuralProjectMessageAllDao.xml

@@ -263,6 +263,8 @@ END) as projectScale*/
 		,prdt.audit_pass_date as "reportTwoAuditDate"
 		/*,SUM(wi.money) as "money"*/
 		,prd.ZiXunShouRu as "money"
+		,prd.signature_flag as "signatureFlag"
+		,prd.signature_contract_id as "signatureContractId"
 		FROM rural_project_records a
 		LEFT JOIN sys_area area ON area.id = a.area_id
 		left join rural_project_records_reported rprr on rprr.id = a.id

+ 2 - 1
src/main/resources/spring-context-shiro.xml

@@ -19,6 +19,7 @@
                 ${adminPath}/workMaterialCollect/total/** = anon
                 ${adminPath}/weChatCallBack/** = anon
                 ${adminPath}/ruralProject/ruralProjectRecords/getDownloadProjectView = anon
+                ${adminPath}/ruralProject/signatureCallBack/** = anon
                 ${adminPath}/weXin/theOrder/** = anon
                 ${adminPath}/viewFile/viewFile/** = anon
                 ${adminPath}/webpage/weixin/orderMeal.jsp = anon
@@ -194,4 +195,4 @@
 
 
 
-</beans>
+</beans>

+ 2 - 0
src/main/webapp/static/common/js/common.js

@@ -158,6 +158,8 @@ function openPreview(url,flag){
         var url = 'https://view.officeapps.live.com/op/view.aspx?src='+encodeURIComponent(url);
     }else if(flag == 3){
         var url = 'http://ow365.cn/?i=25008&furl='+encodeURIComponent(url);
+    }else if(flag == 4){
+        var url = url;
     }else{
         $.ajax({
             type:"POST",

+ 3 - 2
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/downloadType/importWordApprovalForm.jsp

@@ -36,8 +36,9 @@
 <body>
 <div >
 	<div class="container view-form">
-		<form:form id="inputForm" modelAttribute="projectReportData" enctype="multipart/form-data" action="${ctx}/ruralProject/ruralProjectMessage/importReportFile" method="post" class="form-horizontal">
-			<form:hidden path="project.id" htmlEscape="false" value="${projectId}" class="form-control layui-input required"/>
+		<form:form id="inputForm" modelAttribute="projectReportData" enctype="multipart/form-data" action="${ctx}/ruralProject/ruralProjectMessage/importApprovalFile" method="post" class="form-horizontal">
+			<input type="hidden" id="visitType" name="visitType" value="${visitType}">
+			<input type="hidden" id="projectId" name="projectId" value="${projectId}">
 			<div class="form-group layui-row first">
 				<div class="layui-item layui-col-sm12 ">
 					<input id="uploadFile" name="uploadFile" type="file" style="width:330px"/>导入文件不能超过5M,仅允许导入“doc”或“docx”格式文件!<br/> 

+ 1 - 0
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/downloadType/importWordReportForm.jsp

@@ -38,6 +38,7 @@
 	<div class="container view-form">
 		<form:form id="inputForm" modelAttribute="projectReportData" enctype="multipart/form-data" action="${ctx}/ruralProject/ruralProjectMessage/importApprovalFile" method="post" class="form-horizontal">
 			<form:hidden path="project.id" htmlEscape="false" value="${projectId}" class="form-control layui-input required"/>
+			<input type="hidden" id="visitType" name="visitType" value="${visitType}">
 			<div class="form-group layui-row first">
 				<div class="layui-item layui-col-sm12 ">
 					<input id="uploadFile" name="uploadFile" type="file" style="width:330px"/>导入文件不能超过5M,仅允许导入“doc”或“docx”格式文件!<br/> 

+ 59 - 13
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/electronicSeal/ruralProjectMessageElectronicSealList.jsp

@@ -156,10 +156,14 @@
 						top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
 					}
 					inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
-					if(iframeWin.contentWindow.doSubmit(1) ){
+					inputForm.attr("action","${ctx}/ruralProject/ruralProjectMessage/importApprovalFile");//表单提交成功后,从服务器返回的url在当前tab中展示
+					var $document = iframeWin.contentWindow.document;
+
+					formSubmitsignature($document,"inputForm",index);
+					/*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){
 					if(split.length==2){return}
@@ -379,6 +383,43 @@
 			}
 		}
 
+		function formSubmitsignature($document,inputForm,index,tableId){
+
+			var validateForm = $($document.getElementById(inputForm)).validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$($document.getElementById("#messageBox")).text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+			if(validateForm.form()){
+				$($document.getElementById(inputForm)).ajaxSubmit({
+					success:function(data) {
+						var d = data;
+						if(d.contractUrl.length>0){
+							window.open(d.contractUrl)
+						}else{
+							//输出提示信息
+							if(d.str.length>0){
+								parent.layer.msg(d.str,{icon:0});
+							}
+						}
+						window.location.reload();
+						//关闭当前页
+						top.layer.close(index)
+					}
+				});
+			}
+		}
+
 		//打开对话框(查看)
 		function openDialogReportView(title,url,id,width,height){
 
@@ -993,19 +1034,22 @@
 							var xml = "<span style=\"cursor:default;\" class=\"new-status-label status-label-" + st.label + "\" >" + st.status + "</span>";
 						return xml;
 					}}*/
-                ,{field:'op',align:'center',title:"操作",width:300,templet:function(d) {
+                ,{field:'op',align:'center',title:"操作",width:320,templet:function(d) {
 						////对操作进行初始化
 						var xml = '<div class=\"layui-btn-group\">';
-						//上传审定单进行签章
-						<shiro:hasPermission name="ruralProject:ruralProjectMessage:importApprovalFile">
-							xml+="<a href=\"javascript:void(0)\" onclick=\"openDialogreByImportFile('上传审定单签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportApprovalWord?id=" + d.id + "','400px', '35%','','导入,关闭')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" > 上传审定单签章</a>";
-						</shiro:hasPermission>
-						<shiro:hasPermission name="ruralProject:ruralProjectMessage:importReportFile">
-							xml+="<a href=\"javascript:void(0)\" onclick=\"openDialogreByImportFile('上传报告签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportReportWord?id=" + d.id + "','400px', '35%','','导入,关闭')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" > 上传报告签章</a>";
-						</shiro:hasPermission>
-						//自动生成电子签章报告(在有报告的前提下可使用,没有报告信息则不进行展示该按钮)
-						xml+="<a href=\"${ctx}/workfullmanage/workFullManage/downloadMassControl1?id=${projectReportData.id}\" onclick=\"return confirmx('确认要自动生成报告签章吗?', this.href)\" class=\"layui-btn  layui-btn-xs\" > 自动生成报告签章</a>";
-
+						if(d.falg=="1"){
+							//上传审定单进行签章
+							<shiro:hasPermission name="ruralProject:ruralProjectMessage:importApprovalFile">
+								if(d.signatureFlag != "1"){
+									xml+="<a href=\"javascript:void(0)\" onclick=\"openDialogreByImportFile('上传审定单签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportApprovalWord?id=" + d.id + "&visitType=1','400px', '35%','','导入,关闭')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" > 上传审定单签章</a>";
+								}
+							</shiro:hasPermission>
+							<%--<shiro:hasPermission name="ruralProject:ruralProjectMessage:importReportFile">
+								xml+="<a href=\"javascript:void(0)\" onclick=\"openDialogreByImportFile('上传报告签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportReportWord?id=" + d.id + "&visitType=1','400px', '35%','','导入,关闭')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" > 上传报告签章</a>";
+							</shiro:hasPermission>--%>
+							//自动生成电子签章报告(在有报告的前提下可使用,没有报告信息则不进行展示该按钮)
+							//xml+="<a href=\"${ctx}/workfullmanage/workFullManage/downloadMassControl1?id=${projectReportData.id}\" onclick=\"return confirmx('确认要自动生成报告签章吗?', this.href)\" class=\"layui-btn  layui-btn-xs\" > 自动生成报告签章</a>";
+						}
 						xml+="</div>";
 						return[xml].join('');
 					}}
@@ -1061,6 +1105,8 @@
 					,"ppfProcessInstanceId":"${projectRecords.ppfProcessInstanceId}"
 					,"submitMoney":"${projectRecords.submitMoney}"
 					,"money":"${projectRecords.money}"
+					,"signatureFlag":"${projectRecords.signatureFlag}"
+					,"signatureContractId":"${projectRecords.signatureContractId}"
 					,"falg":
 					<c:choose>
 						<c:when test="${fns:getUser().id == projectRecords.leaderIds || fns:getUser().id eq projectRecords.createBy.id}">

+ 1 - 1
src/main/webapp/webpage/modules/ruralprojectrecords/view/reportIssueView.jsp

@@ -193,7 +193,7 @@
 				<div class="form-group-label">
 					<c:if test="${projectRecords.submitMoney == 2}">
 						<shiro:hasPermission name="ruralProject:ruralProjectMessage:importReportFile">
-							<div style="float: right;margin:0px 0px 0px 5px;"> <a href="javascript:void(0)" style='background-color: #009FFA' onclick="openDialogre('报告签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportReportWord?id=${projectRecords.id}','400px', '35%','','导入,关闭')" class="layui-btn layui-btn-sm" > 报告签章</a></div>
+							<div style="float: right;margin:0px 0px 0px 5px;"> <a href="javascript:void(0)" style='background-color: #009FFA' onclick="openDialogre('报告签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportReportWord?id=${projectRecords.id}&visitType=0','400px', '35%','','导入,关闭')" class="layui-btn layui-btn-sm" > 报告签章</a></div>
 						</shiro:hasPermission>
 					</c:if>
 					<div style="float: right"> <a href="${ctx}/workfullmanage/workFullManage/downloadMassControl1?id=${projectReportData.id}"  onclick="return confirmx('确认要下载签发流程单吗?', this.href)" class="layui-btn layui-btn-sm" ><i class="fa fa-file-excel-o"></i> 下载签发流程单</a></div>

+ 1 - 1
src/main/webapp/webpage/modules/ruralprojectrecords/view/reportView.jsp

@@ -208,7 +208,7 @@
 				<div class="form-group-label">
 					<c:if test="${projectRecords.submitMoney == 2}">
 						<shiro:hasPermission name="ruralProject:ruralProjectMessage:importApprovalFile">
-							<div style="float: right;margin:0px 0px 0px 5px;"> <a href="javascript:void(0)" style='background-color: #009FFA' onclick="openDialogre('审定单签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportApprovalWord?id=${projectRecords.id}','400px', '35%','','导入,关闭')" class="layui-btn layui-btn-sm" > 审定单签章</a></div>
+							<div style="float: right;margin:0px 0px 0px 5px;"> <a href="javascript:void(0)" style='background-color: #009FFA' onclick="openDialogre('审定单签章', '${ctx}/ruralProject/ruralProjectMessage/skipImportApprovalWord?id=${projectRecords.id}&visitType=0','400px', '35%','','导入,关闭')" class="layui-btn layui-btn-sm" > 审定单签章</a></div>
 						</shiro:hasPermission>
 					</c:if>
 					<div style="float: right"> <a href="javascript:void(0)" style='background-color: #FFB800' onclick="openDialogre('下载模板', '${ctx}/ruralProject/ruralProjectMessage/skipDownloadFtl?id=${projectRecords.id}','35%', '35%','','下载,关闭')" class="layui-btn layui-btn-sm" ><i class="fa fa-file-excel-o"></i> 下载模板</a></div>