Antiloveg 8 years ago
parent
commit
01dd82425e

+ 16 - 0
schema/2017-04-20.sql

@@ -0,0 +1,16 @@
+
+alter table `notice`
+ADD COLUMN  `year` INT(4) NULL COMMENT '高企记录申报年份';
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 28 - 11
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -217,8 +217,8 @@ public class AdminApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "资料完成状态"));
 			return res;
 		}
-		
-		if (null == id){
+
+		if (null == id) {
 			OrgCognizanceProportion cp = new OrgCognizanceProportion();
 			cp.setId(UUID.randomUUID().toString());
 			cp.setUid(uid);
@@ -231,7 +231,8 @@ public class AdminApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "比重ID"));
 			return res;
 		}
-		res.setData(orgCognizanceProportionService.updateByPrimaryKeySelective(disposeProportionStatus(sign, status, ocp)));
+		res.setData(
+				orgCognizanceProportionService.updateByPrimaryKeySelective(disposeProportionStatus(sign, status, ocp)));
 		return res;
 	}
 
@@ -1574,23 +1575,24 @@ public class AdminApiController extends CertifyApiController {
 				endDateFormattedDate, pNo, pSize, uid));
 		return res;
 	}
-	
+
 	/**
 	 * 研发活动详情
+	 * 
 	 * @param id
 	 * @return
 	 */
 	@RequestMapping(value = "/activityDetail", method = RequestMethod.GET)
-	public Result activityDetail(String id){
+	public Result activityDetail(String id) {
 		Result res = new Result();
-		if (StringUtils.isBlank(id)){
+		if (StringUtils.isBlank(id)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
 			return res;
 		}
-		Calendar a =Calendar.getInstance();
-		res.setData(orgActivityService.selectDetailByIdAndYear(id, a.get(Calendar.YEAR)-1));
+		Calendar a = Calendar.getInstance();
+		res.setData(orgActivityService.selectDetailByIdAndYear(id, a.get(Calendar.YEAR) - 1));
 		return res;
-		
+
 	}
 
 	/**
@@ -3000,8 +3002,12 @@ public class AdminApiController extends CertifyApiController {
 
 		LatelyCogRecord lcr = orgCognizanceService.selectLatelyRecord(cog.getUid());
 
+		if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.FOSTER.getCode() == lcr.getState()) {
+			res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企培育中!无法提交新申请!"));
+			return res;
+		}
+
 		if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() != lcr.getState()
-				&& OrgCognizanceStatus.FOSTER.getCode() != lcr.getState()
 				&& OrgCognizanceStatus.CALLBACK.getCode() != lcr.getState()) {
 			res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企申请中!无法提交新申请!"));
 			return res;
@@ -3009,7 +3015,7 @@ public class AdminApiController extends CertifyApiController {
 
 		if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() == lcr.getState()) {
 			if (null == lcr.getIssuingDate()) {
-				res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企申请中!无法提交新申请!"));
+				res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企认定未过期!无法提交新申请!"));
 				return res;
 			}
 			try {
@@ -3057,6 +3063,17 @@ public class AdminApiController extends CertifyApiController {
 		if (!checkCertify(res, uid).getError().isEmpty()) {
 			return res;
 		}
+		OrgCognizance oc = orgCognizanceService.selectByPrimaryKey(cid);
+		if (null == oc){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高企ID"));
+			return res;
+		}
+		
+		if (year != oc.getYear()){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高企ID及年份"));
+			return res;
+		}
+		
 		res.setData(handleCognizanceDetail(uid, cid, year));
 		return res;
 	}

+ 1 - 1
src/main/java/com/goafanti/admin/controller/AdminPatentApiController.java

@@ -161,7 +161,7 @@ public class AdminPatentApiController extends CertifyApiController {
 	public Result patentDetail(String pid) {
 		Result res = new Result();
 		if (StringUtils.isBlank(pid)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "公司"));
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "专利ID"));
 		} else {
 			res.setData(patentInfoService.selectPatentInfoDetail(pid));
 		}

+ 3 - 0
src/main/java/com/goafanti/cognizance/service/impl/OrgCognizanceServiceImpl.java

@@ -117,6 +117,7 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
 					null == orgInfo.getBasicResearchCost() ? new BigDecimal(0) : orgInfo.getBasicResearchCost());
 			cog.setAccident(null == orgInfo.getAccient() ? 0 : orgInfo.getAccient());
 			cog.setLargeOrder(null == orgInfo.getLargeOrder() ? 0 : orgInfo.getLargeOrder());
+			cog.setYear(orgInfo.getYear());
 		}
 
 		CognizanceResearchCostBo researchCost = orgCognizanceMapper.selectCognizanceResearchCostBoByUidAndYear(year,
@@ -324,6 +325,8 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
 		n.setUid(cog.getUid());
 		n.setRid(cog.getId());
 		
+		n.setYear(cog.getYear());
+		
 		n.setAid(l.getPrincipal());
 		n.setContent("编号" + info.getSerialNumber() + "  " + OrgCognizanceStatus.getStatus(l.getState()).getDesc());
 		n.setNoticeType(NoticeStatus.COGNIZANCE.getCode());

+ 19 - 4
src/main/java/com/goafanti/common/mapper/NoticeMapper.xml

@@ -11,9 +11,10 @@
     <result column="uid" property="uid" jdbcType="VARCHAR" />
     <result column="pid" property="pid" jdbcType="VARCHAR" />
     <result column="rid" property="rid" jdbcType="VARCHAR" />
+    <result column="year" property="year" jdbcType="INTEGER" />
   </resultMap>
   <sql id="Base_Column_List" >
-    id, aid, notice_type, content, create_time, readed, uid, pid, rid
+    id, aid, notice_type, content, create_time, readed, uid, pid, rid, year
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
@@ -27,11 +28,11 @@
   </delete>
   <insert id="insert" parameterType="com.goafanti.common.model.Notice" >
     insert into notice (id, aid, notice_type, 
-      content, create_time, readed, uid, pid, rid
+      content, create_time, readed, uid, pid, rid, year
       )
     values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{noticeType,jdbcType=INTEGER}, 
       #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{readed,jdbcType=INTEGER},
-      #{uid,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{rid,jdbcType=VARCHAR}
+      #{uid,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{rid,jdbcType=VARCHAR}, #{year,jdbcType=INTEGER}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Notice" >
@@ -67,6 +68,10 @@
         rid,
       </if>
       
+      <if test="year != null" >
+        year,
+      </if>
+      
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="id != null" >
@@ -98,6 +103,10 @@
       <if test="rid != null" >
         #{rid,jdbcType=VARCHAR},
       </if>
+      
+       <if test="year != null" >
+        #{year,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Notice" >
@@ -129,6 +138,10 @@
       <if test="rid != null" >
         rid = #{rid,jdbcType=VARCHAR},
       </if>
+      
+       <if test="year != null" >
+        year = #{year,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -143,7 +156,9 @@
       uid = #{uid,jdbcType=VARCHAR},
       pid = #{pid,jdbcType=VARCHAR},
       
-      rid = #{rid,jdbcType=VARCHAR}
+      rid = #{rid,jdbcType=VARCHAR},
+      
+      year = #{year,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   

+ 6 - 5
src/main/java/com/goafanti/common/mapper/OrgCognizanceLogMapper.xml

@@ -116,10 +116,11 @@
   </update>
   
   <select id="selectOrgCognizanceLogByCid"  parameterType="java.lang.String" resultMap="BaseResultMap">
-    select b.name as principal , m.operator , m.id , m.cid , m.state , m.comment , m.record_time  from 
-		(select a.name as operator, c.id ,c.cid  , c.state , c.comment ,c.record_time , c.principal as cri
-		from org_cognizance_log c INNER JOIN admin a 
-		on a.id = c.operator order by c.record_time desc) m INNER JOIN admin b on m.cri = b. id
-    where m.cid = #{cid,jdbcType=VARCHAR}
+    select a.name as principal, ad.name as operator, ocl.id , ocl.cid , ocl.state , ocl.comment , ocl.record_time 
+		from org_cognizance_log ocl 
+		LEFT JOIN admin a on a.id = ocl.principal
+		LEFT JOIN admin ad on ad.id = ocl.operator
+	where ocl.cid = #{cid,jdbcType=VARCHAR}
+	ORDER BY ocl.record_time DESC
   </select>
 </mapper>

+ 15 - 0
src/main/java/com/goafanti/common/model/Notice.java

@@ -47,6 +47,21 @@ public class Notice {
 	 * 业务记录ID
 	 */
 	private String rid;
+	
+	/**
+	 * 高企记录申请年份
+	 */
+	private Integer year;
+	
+	
+
+	public Integer getYear() {
+		return year;
+	}
+
+	public void setYear(Integer year) {
+		this.year = year;
+	}
 
 	public String getId() {
 		return id;

+ 4 - 1
src/main/java/com/goafanti/common/model/OrgActivity.java

@@ -6,6 +6,8 @@ import java.util.Date;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonFormat.Shape;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.utils.FileUtils;
@@ -270,7 +272,8 @@ public class OrgActivity {
 	public void setThirdYearExpenditure(BigDecimal thirdYearExpenditure) {
 		this.thirdYearExpenditure = thirdYearExpenditure;
 	}
-
+	
+	@JsonFormat(shape = Shape.STRING)
 	public Integer getProjectMode() {
 		return projectMode;
 	}