Antiloveg %!s(int64=8) %!d(string=hai) anos
pai
achega
9c8b3a1c52

+ 2 - 0
src/main/java/com/goafanti/common/constant/ErrorConstants.java

@@ -86,4 +86,6 @@ public class ErrorConstants {
 
 	public static final String	EVALUATE_PARAM					= "EVALUATE_PARAM";
 
+	public static final String	CONTRACT_YEAR_SECTION			= "CONTRACT_YEAR_SECTION";
+
 }

+ 2 - 1
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -121,8 +121,9 @@ public class PublicController extends BaseController {
 				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "图形验证码"));
 				return res;
 			}
-			if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.V_CODE).equals(verificationCode)) {
+			if (!VerifyCodeUtils.verifyCode(verificationCode)) {
 				res.getError().add(buildError(ErrorConstants.VCODE_ERROR, "", "验证码"));
+				
 				return res;
 			}
 		}

+ 0 - 1
src/main/java/com/goafanti/common/dao/ContractMapper.java

@@ -1,7 +1,6 @@
 package com.goafanti.common.dao;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.ibatis.annotations.Param;
 

+ 11 - 6
src/main/java/com/goafanti/common/mapper/ContractMapper.xml

@@ -526,11 +526,16 @@
     and deleted_sign = 0
   </select>
   
-  <select id="findLatelyRecordByUid" parameterType="java.lang.String" resultType="java.lang.Integer">
-   	select
-   		Max(cognizance_year)
-   	from contract
-   	where uid = #{uid,jdbcType=VARCHAR}
-   	and deleted_sign = 0
+  <select id="findLatelyRecordByUid" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    	<include refid="Base_Column_List" />
+    from contract 
+    where year =  
+	   	(select
+	   		Max(cognizance_year)
+	   	from contract
+	   	where uid = #{uid,jdbcType=VARCHAR}
+	   	and deleted_sign = 0
+	   	)
   </select>
 </mapper>

+ 8 - 8
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -388,7 +388,7 @@
     	and i.audit_status = #{auditStatus,jdbcType=INTEGER}
     </if>
      <if test="auditName !=null">
-    	and i.username like CONCAT('%', #{auditName,jdbcType=VARCHAR}, '%')
+    	and i.username like '%'#{auditName,jdbcType=VARCHAR}'%'
     </if>
     <if test="email !=null">
     	and u.email = #{email,jdbcType=VARCHAR}
@@ -425,7 +425,7 @@
     	and i.audit_status = #{auditStatus,jdbcType=INTEGER}
     </if>
     <if test="auditName !=null">
-    	and i.username like CONCAT('%', #{auditName,jdbcType=VARCHAR}, '%')
+    	and i.username like '%'#{auditName,jdbcType=VARCHAR}'%'
     </if>
     <if test="email !=null">
     	and u.email = #{email,jdbcType=VARCHAR}
@@ -468,7 +468,7 @@
     	and i.audit_status = #{auditStatus,jdbcType=INTEGER}
     </if>
      <if test="auditName !=null">
-    	and i.username like CONCAT('%', #{auditName,jdbcType=VARCHAR}, '%')
+    	and i.username like '%'#{auditName,jdbcType=VARCHAR}'%'
     </if>
     <if test="email !=null">
     	and u.email = #{email,jdbcType=VARCHAR}
@@ -505,7 +505,7 @@
     	and i.audit_status = #{auditStatus,jdbcType=INTEGER}
     </if>
     <if test="auditName !=null">
-    	and i.unit_name like CONCAT('%', #{auditName,jdbcType=VARCHAR}, '%')
+    	and i.unit_name like '%'#{auditName,jdbcType=VARCHAR}'%'
     </if>
     <if test="email !=null">
     	and u.email = #{email,jdbcType=VARCHAR}
@@ -581,7 +581,7 @@
 		and u.number = #{number,jdbcType=INTEGER}
 	</if>
 	<if test="username != null">
-		and i.username like CONCAT('%', #{username,jdbcType=VARCHAR}, '%')   
+		and i.username like '%'#{username,jdbcType=VARCHAR}'%'   
 	</if>
 	<if test="auditStatus != null">
 		and i.audit_status= #{auditStatus,jdbcType=INTEGER}
@@ -627,7 +627,7 @@
 		and u.number = #{number,jdbcType=INTEGER}
 	</if>
 	<if test="username != null">
-		and i.username like CONCAT('%', #{username,jdbcType=VARCHAR}, '%')   
+		and i.username like '%'#{username,jdbcType=VARCHAR}'%'   
 	</if>
 	<if test="auditStatus != null">
 		and i.audit_status= #{auditStatus,jdbcType=INTEGER}
@@ -683,7 +683,7 @@
 		and u.number = #{number,jdbcType=INTEGER}
 	</if>
 	<if test="unitName != null">
-		and o.unit_name = #{unitName,jdbcType=VARCHAR}
+		and o.unit_name like '%'#{unitName,jdbcType=VARCHAR}'%'
 	</if>
 	<if test="auditStatus != null">
 		and o.audit_status= #{auditStatus,jdbcType=INTEGER}
@@ -730,7 +730,7 @@
 		and u.number = #{number,jdbcType=INTEGER}
 	</if>
 	<if test="unitName != null">
-		and o.unit_name = #{unitName,jdbcType=VARCHAR}
+		and o.unit_name like '%'#{unitName,jdbcType=VARCHAR}'%'
 	</if>
 	<if test="auditStatus != null">
 		and o.audit_status= #{auditStatus,jdbcType=INTEGER}

+ 28 - 15
src/main/java/com/goafanti/contract/controller/ContractApiController.java

@@ -3,7 +3,6 @@ package com.goafanti.contract.controller;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
@@ -49,6 +48,8 @@ public class ContractApiController extends CertifyApiController {
 	@Resource
 	private PatentInfoService		patentInfoService;
 
+	private static final Integer	SECTION_YEAR	= 4;
+
 	/**
 	 * 合同详情-科技项目列表
 	 */
@@ -176,14 +177,15 @@ public class ContractApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到合同ID", "合同ID"));
 			return res;
 		}
-		
-		if (null == contract.getType()){
+
+		if (null == contract.getType()) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "合同类型"));
 			return res;
 		}
 
 		if (null != contract.getCognizanceYear() && !contract.getCognizanceYear().equals(0)) {
-			if (!disposeCog(contract.getCognizanceYear(), contract.getUid(), res).getError().isEmpty()) {
+			if (!disposeCog(contract.getId(), contract.getCognizanceYear(), contract.getUid(), res).getError()
+					.isEmpty()) {
 				return res;
 			}
 		}
@@ -210,19 +212,18 @@ public class ContractApiController extends CertifyApiController {
 					ContractFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 		}
-		
-		if (null == contract.getType()){
+
+		if (null == contract.getType()) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "合同类型"));
 			return res;
 		}
-		
-		
+
 		User curUser = TokenManager.getUserToken();
 		if (!checkCertify(res, curUser)) {
 			return res;
 		}
 		if (null != contract.getCognizanceYear() && !contract.getCognizanceYear().equals(0)) {
-			if (!disposeCog(contract.getCognizanceYear(), contract.getUid(), res).getError().isEmpty()) {
+			if (!disposeCog(null, contract.getCognizanceYear(), contract.getUid(), res).getError().isEmpty()) {
 				return res;
 			}
 		}
@@ -255,19 +256,31 @@ public class ContractApiController extends CertifyApiController {
 		return res;
 	}
 
-	private Result disposeCog(Integer year, String uid, Result res) {
+	private Result disposeCog(String id, Integer year, String uid, Result res) {
 		Integer latelyYear = orgCognizanceService.selectLatelyRecordYear(uid);
-		if (null != latelyYear && year - latelyYear < 4) {
+		if (null != latelyYear && year - latelyYear < SECTION_YEAR) {
 			res.getError()
 					.add(buildError(ErrorConstants.STATUS_ERROR, "高企认定申请中或认定未到期!无法提交新申请!", "高企认定申请中或认定未到期!无法提交新申请!"));
 			return res;
 		}
 
 		Contract c = contractService.findLatelyRecordByUid(uid);
-		
-		/*if (null != cYear) {
-			res.getError().add(buildError("", "当前年份已有合同申请,无法提交新申请!"));
-		}*/
+		boolean flag = Boolean.TRUE;
+		if (null != c) {
+			if (StringUtils.isNotBlank(id)) {
+				if (null != c.getCognizanceYear() && year - c.getCognizanceYear() < SECTION_YEAR && !id.equals(c.getId())) {
+					flag = false;
+				}
+			} else {
+				if (null != c.getCognizanceYear() && year - c.getCognizanceYear() < SECTION_YEAR) {
+					flag = false;
+				}
+			}
+		}
+		if (!flag) {
+			res.getError().add(buildError(ErrorConstants.CONTRACT_YEAR_SECTION));
+		}
+
 		return res;
 	}
 }

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

@@ -1,7 +1,6 @@
 package com.goafanti.contract.service;
 
 import java.util.List;
-import java.util.Map;
 
 import com.goafanti.common.model.Contract;
 import com.goafanti.contract.bo.ContractClientListBo;

+ 2 - 2
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -176,8 +176,8 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 			params.put("auditStatus", auditStatus);
 		}
 
-		if (!StringUtils.isBlank(username)) {
-			params.put("username", username);
+		if (!StringUtils.isBlank(aftUsername)) {
+			params.put("username", aftUsername);
 		}
 
 		if (pageNo == null || pageNo < 0) {

+ 2 - 0
src/main/resources/props/error.properties

@@ -64,3 +64,5 @@ CONTRACT_COGNIZANCE_CREATED=\u5f53\u524d\u5408\u540c\u9ad8\u4f01\u8ba4\u5b9a\u75
 EVALUATE_ID=\u8bc4\u4f30\u62a5\u544a\u627e\u4e0d\u5230\uff01
 EVALUATE_STEP=\u9519\u8bef\u7684\u8bc4\u4f30\u6b65\u9aa4\uff01
 EVALUATE_PARAM=\u8bc4\u4f30\u53c2\u6570\u9519\u8bef\uff01
+
+CONTRACT_YEAR_SECTION=\u5f53\u524d\u7533\u8bf7\u5e74\u4efd\u5df2\u4e0e\u5176\u4ed6\u5408\u540c\u7533\u8bf7\u5e74\u4efd\u91cd\u53e0\uff0c\u65e0\u6cd5\u63d0\u4ea4\u65b0\u7533\u8bf7\uff01