Antiloveg преди 8 години
родител
ревизия
0af3034928

+ 61 - 0
src/main/java/com/goafanti/common/mapper/ContractMapper.xml

@@ -442,4 +442,65 @@
 		#{item}
 	</foreach>
   </update>
+  
+   <select id="findClientContractListByPage" parameterType="String" resultType="com.goafanti.contract.bo.ContractClientListBo">
+   select c.id, c.uid,  c.serial_number as serialNumber, c.type,
+   		  c.sign_date as signDate,
+   		  c.depict, c.status, c.complete_date as completeDate, c.contacts
+   from contract c 
+	  where c.deleted_sign = 0  
+	  <if test="serialNumber !=null">
+	    and c.serialNumber = #{serialNumber,jdbcType=INTEGER}
+	  </if>
+	  <if test="id !=null">
+	    and c.id = #{id,jdbcType=VARCHAR}
+	  </if>
+	  <if test="type !=null">
+	    and c.type = #{type,jdbcType=INTEGER}
+	  </if>
+	   <if test="uid !=null">
+	    and c.uid = #{uid,jdbcType=INTEGER}
+	  </if>
+	   <if test="status !=null">
+	    and c.status= #{status ,jdbcType=INTEGER}
+	  </if>
+	   <if test="cStart !=null">
+	    and c.sign_date <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
+	  </if>
+	   <if test="cEnd !=null">
+	    and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	  </if>
+		order by c.serial_number DESC
+	  <if test="page_sql!=null">
+		${page_sql}
+	  </if>
+  </select>
+  
+  <select id="findClientContractCount" resultType="java.lang.Integer"
+		parameterType="String">
+   select count(1)
+   from contract c 
+	  where c.deleted_sign = 0  
+	  <if test="serialNumber !=null">
+	    and c.serialNumber = #{serialNumber,jdbcType=INTEGER}
+	  </if>
+	  <if test="id !=null">
+	    and c.id = #{id,jdbcType=VARCHAR}
+	  </if>
+	  <if test="type !=null">
+	    and c.type = #{type,jdbcType=INTEGER}
+	  </if>
+	   <if test="uid !=null">
+	    and c.uid = #{uid,jdbcType=INTEGER}
+	  </if>
+	   <if test="status !=null">
+	    and c.status= #{status ,jdbcType=INTEGER}
+	  </if>
+	   <if test="cStart !=null">
+	    and c.sign_date <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
+	  </if>
+	   <if test="cEnd !=null">
+	    and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	  </if>
+  </select>
 </mapper>

+ 132 - 0
src/main/java/com/goafanti/contract/bo/ContractClientListBo.java

@@ -0,0 +1,132 @@
+package com.goafanti.contract.bo;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonFormat.Shape;
+import com.goafanti.common.constant.AFTConstants;
+
+public class ContractClientListBo {
+	private String	id;
+
+	private String	uid;
+
+	private Integer	contacts;
+	
+	private Integer	serialNumber;
+	
+	private Integer	type;
+	
+	private Date	signDate;
+	
+	private String	depict;
+	
+	private Integer	status;
+	
+	private Date	completeDate;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getContacts() {
+		return contacts;
+	}
+
+	public void setContacts(Integer contacts) {
+		this.contacts = contacts;
+	}
+
+	public Integer getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(Integer serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public Date getSignDate() {
+		return signDate;
+	}
+
+	public void setSignDate(Date signDate) {
+		this.signDate = signDate;
+	}
+
+	public String getDepict() {
+		return depict;
+	}
+
+	public void setDepict(String depict) {
+		this.depict = depict;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Date getCompleteDate() {
+		return completeDate;
+	}
+
+	public void setCompleteDate(Date completeDate) {
+		this.completeDate = completeDate;
+	}
+	
+	public String getSignDateFormattedDate() {
+		if (this.signDate == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getSignDate(), AFTConstants.YYYYMMDDHHMMSS);
+		}
+	}
+
+	public void setSignDateFormattedDate(String signDateFormattedDate) {
+
+	}
+
+	public String getCompleteDateFormattedDate() {
+		if (this.completeDate == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getCompleteDate(), AFTConstants.YYYYMMDDHHMMSS);
+		}
+	}
+
+	public void setCompleteDateFormattedDate(String completeDateFormattedDate) {
+
+	}
+
+	
+	
+
+}

+ 2 - 145
src/main/java/com/goafanti/contract/bo/ContractManageListBo.java

@@ -1,84 +1,14 @@
 package com.goafanti.contract.bo;
 
-import java.util.Date;
 
-import org.apache.commons.lang3.time.DateFormatUtils;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonFormat.Shape;
-import com.goafanti.common.constant.AFTConstants;
-
-public class ContractManageListBo {
-	private String	id;
-
-	private String	uid;
-
-	private Integer	contacts;
+public class ContractManageListBo extends ContractClientListBo{
 
 	private String	province;
 
 	private String	unitName;
 
-	/**
-	 * 合同编号
-	 */
-	private Integer	serialNumber;
-
-	/**
-	 * 合同类型(1-专利类型合同,2-软著类型合同,3-高企认定类型合同,4-科技项目类型合同)
-	 */
-	private Integer	type;
-
-	/**
-	 * 合同签订时间
-	 */
-	private Date	signDate;
-
-	/**
-	 * 合同记录创建人
-	 */
 	private String	founder;
 
-	/**
-	 * 合同描述
-	 */
-	private String	depict;
-
-	/**
-	 * 合同状态(0-草稿,1-签订,2-分发流转,3-完成(已结款))
-	 */
-	private Integer	status;
-
-	/**
-	 * 合同完成时间
-	 */
-	private Date	completeDate;
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public String getUid() {
-		return uid;
-	}
-
-	public void setUid(String uid) {
-		this.uid = uid;
-	}
-
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getContacts() {
-		return contacts;
-	}
-
-	public void setContacts(Integer contacts) {
-		this.contacts = contacts;
-	}
-
 	public String getProvince() {
 		return province;
 	}
@@ -95,31 +25,6 @@ public class ContractManageListBo {
 		this.unitName = unitName;
 	}
 
-	public Integer getSerialNumber() {
-		return serialNumber;
-	}
-
-	public void setSerialNumber(Integer serialNumber) {
-		this.serialNumber = serialNumber;
-	}
-
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getType() {
-		return type;
-	}
-
-	public void setType(Integer type) {
-		this.type = type;
-	}
-
-	public Date getSignDate() {
-		return signDate;
-	}
-
-	public void setSignDate(Date signDate) {
-		this.signDate = signDate;
-	}
-
 	public String getFounder() {
 		return founder;
 	}
@@ -128,54 +33,6 @@ public class ContractManageListBo {
 		this.founder = founder;
 	}
 
-
-	public String getDepict() {
-		return depict;
-	}
-
-	public void setDepict(String depict) {
-		this.depict = depict;
-	}
-
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	public Date getCompleteDate() {
-		return completeDate;
-	}
-
-	public void setCompleteDate(Date completeDate) {
-		this.completeDate = completeDate;
-	}
-
-	public String getSignDateFormattedDate() {
-		if (this.signDate == null) {
-			return null;
-		} else {
-			return DateFormatUtils.format(this.getSignDate(), AFTConstants.YYYYMMDDHHMMSS);
-		}
-	}
-
-	public void setSignDateFormattedDate(String signDateFormattedDate) {
-
-	}
-
-	public String getCompleteDateFormattedDate() {
-		if (this.completeDate == null) {
-			return null;
-		} else {
-			return DateFormatUtils.format(this.getCompleteDate(), AFTConstants.YYYYMMDDHHMMSS);
-		}
-	}
-
-	public void setCompleteDateFormattedDate(String completeDateFormattedDate) {
-
-	}
+	
 
 }

+ 38 - 0
src/main/java/com/goafanti/contract/controller/ContractApiController.java

@@ -0,0 +1,38 @@
+package com.goafanti.contract.controller;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.contract.service.ContractService;
+@RestController
+@RequestMapping(value = "/api/user/contract")
+public class ContractApiController extends CertifyApiController{
+	@Resource
+	private ContractService contractService;
+	
+	/**
+	 * 合同列表
+	 */
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	public Result listContract(String contractId, Integer serialNumber, Integer type, Integer status, String startDateFormattedDate,
+			String endDateFormattedDate, String pageNo, String pageSize){
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(contractService.getClientList(contractId, serialNumber, type, status, startDateFormattedDate,
+				endDateFormattedDate, pNo, pSize));
+		return res;
+	}
+}

+ 4 - 0
src/main/java/com/goafanti/contract/service/ContractService.java

@@ -3,6 +3,7 @@ package com.goafanti.contract.service;
 import java.util.List;
 
 import com.goafanti.common.model.Contract;
+import com.goafanti.contract.bo.ContractClientListBo;
 import com.goafanti.contract.bo.ContractDetail;
 import com.goafanti.contract.bo.ContractManageListBo;
 import com.goafanti.contract.bo.ContractSerialNumber;
@@ -31,4 +32,7 @@ public interface ContractService {
 
 	int deleteByPrimaryKey(List<String> asList);
 
+	Pagination<ContractClientListBo> getClientList(String contractId, Integer serialNumber, Integer type, Integer status,
+			String startDateFormattedDate, String endDateFormattedDate, Integer pNo, Integer pSize);
+
 }

+ 66 - 0
src/main/java/com/goafanti/contract/service/impl/ContractServiceImpl.java

@@ -31,6 +31,7 @@ import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.contract.bo.ContractClientListBo;
 import com.goafanti.contract.bo.ContractDetail;
 import com.goafanti.contract.bo.ContractManageListBo;
 import com.goafanti.contract.bo.ContractSerialNumber;
@@ -130,6 +131,67 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
 		return (Pagination<ContractManageListBo>) findPage("findManageContractListByPage", "findManageContractCount",
 				params, pNo, pSize);
 	}
+	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<ContractClientListBo> getClientList(String contractId, Integer serialNumber, Integer type,
+			Integer status, String startDateFormattedDate, String endDateFormattedDate, Integer pNo, Integer pSize) {
+		Date cStart = null;
+		Date cEnd = null;
+
+		Map<String, Object> params = new HashMap<>();
+
+        params.put("uid", TokenManager.getUserId());
+        
+		if (null != serialNumber) {
+			params.put("serialNumber", serialNumber);
+		}
+
+		if (null != type) {
+			params.put("type", type);
+		}
+
+		if (null != status) {
+			params.put("status", status);
+		}
+
+		if (!StringUtils.isBlank(contractId)) {
+			params.put("id", contractId);
+		}
+
+		if (!StringUtils.isBlank(startDateFormattedDate)) {
+			try {
+				cStart = DateUtils.parseDate(startDateFormattedDate, AFTConstants.YYYYMMDD);
+			} catch (ParseException e) {
+			}
+		}
+
+		if (null != cStart) {
+			params.put("cStart", cStart);
+		}
+
+		if (!StringUtils.isBlank(endDateFormattedDate)) {
+			try {
+				cEnd = DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDD);
+			} catch (ParseException e) {
+			}
+		}
+
+		if (null != cEnd) {
+			params.put("cEnd", cEnd);
+		}
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0) {
+			pSize = 10;
+		}
+
+		return (Pagination<ContractClientListBo>) findPage("findClientContractListByPage", "findClientContractCount",
+				params, pNo, pSize);
+	}
 
 	@Override
 	public Contract saveManageContract(Contract c) {
@@ -265,6 +327,10 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
 		return contractMapper.batchDeleteByPrimaryKey(id);
 	}
 
+	
+
+	
+	
 	private Notice createNotice(Contract c, ContractLog l) {
 		Contract info = contractMapper.selectByPrimaryKey(c.getId());