Kaynağa Gözat

coganizanceRecord search

Antiloveg 8 yıl önce
ebeveyn
işleme
33f52f025c

+ 16 - 0
schema/20170705-coganizance-record.sql

@@ -0,0 +1,16 @@
+ALTER TABLE `organization_tech` MODIFY COLUMN `specialty` VARCHAR (255) NULL COMMENT '擅长领域';
+
+ALTER TABLE `achievement` MODIFY COLUMN `owner_mobile` VARCHAR(36) NULL COMMENT '所有人联系电话';
+
+ALTER TABLE `demand` MODIFY COLUMN `employer_contacts_mobile` VARCHAR(36) COMMENT '雇主联系人电话';
+
+ALTER TABLE `demand` MODIFY COLUMN `employer_name` VARCHAR(45) COMMENT'雇主名称';
+
+CREATE TABLE `coganizance_record` (
+  `id` BIGINT(18) NOT NULL  AUTO_INCREMENT,
+  `district` INT(4) NOT NULL COMMENT '地区(省份/市)',
+  `unit_name` VARCHAR(45) NOT NULL COMMENT '公司名称',
+  `year` INT(4) NOT NULL COMMENT '高企认定年份',
+  PRIMARY KEY (`id`))AUTO_INCREMENT = 1
+ENGINE = InnoDB
+COMMENT = '高企认定数据';

+ 46 - 0
src/main/java/com/goafanti/admin/controller/AdminCognizanceRecordApiController.java

@@ -0,0 +1,46 @@
+package com.goafanti.admin.controller;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.goafanti.cognizanceRecord.service.CoganizanceRecordService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+
+@Controller
+@RequestMapping(value = "/api/admin/cognizanceRecord")
+public class AdminCognizanceRecordApiController extends CertifyApiController{
+	@Resource
+	private CoganizanceRecordService coganizanceRecordService;
+	
+	
+	/**
+	 * 查询
+	 */
+	@RequestMapping(value = "/search", method = RequestMethod.GET)
+	public Result search(Integer district, String unitName, Integer year, String pageSize, String pageNo){
+		Result res = new Result();
+		if (null == district && StringUtils.isBlank(unitName) && null == year){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "查询条件"));
+			return res;
+		}
+		Integer pNo = 1;
+		Integer pSize = 20;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(coganizanceRecordService.listSearch(district, unitName, year, pNo, pSize));
+		return res;
+	}
+	
+	
+}

+ 11 - 0
src/main/java/com/goafanti/cognizanceRecord/service/CoganizanceRecordService.java

@@ -0,0 +1,11 @@
+package com.goafanti.cognizanceRecord.service;
+
+import com.goafanti.common.model.CoganizanceRecord;
+import com.goafanti.core.mybatis.page.Pagination;
+
+public interface CoganizanceRecordService {
+
+	Pagination<CoganizanceRecord> listSearch(Integer district, String unitName, Integer year, Integer pNo,
+			Integer pSize);
+
+}

+ 52 - 0
src/main/java/com/goafanti/cognizanceRecord/service/impl/CognizanceRecordServiceImpl.java

@@ -0,0 +1,52 @@
+package com.goafanti.cognizanceRecord.service.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.cognizanceRecord.service.CoganizanceRecordService;
+import com.goafanti.common.dao.CoganizanceRecordMapper;
+import com.goafanti.common.model.CoganizanceRecord;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+
+@Service
+public class CognizanceRecordServiceImpl extends BaseMybatisDao<CoganizanceRecordMapper>
+		implements CoganizanceRecordService {
+	@Autowired
+	private CoganizanceRecordMapper coganizanceRecordMapper;
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<CoganizanceRecord> listSearch(Integer district, String unitName, Integer year, Integer pNo,
+			Integer pSize) {
+		Map<String, Object> params = new HashMap<>();
+		
+		if (null != district) {
+			params.put("district", district);
+		}
+		
+		if (StringUtils.isNotBlank(unitName)) {
+			params.put("unitName", unitName);
+		}
+		
+		if (null != year){
+			params.put("year", year);
+		}
+		
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 20) {
+			pSize = 20;
+		}
+		
+		return (Pagination<CoganizanceRecord>) findPage("findCoganizanceRecordListByPage", "findCoganizanceRecordCount",
+				params, pNo, pSize);
+	}
+
+}

+ 17 - 0
src/main/java/com/goafanti/common/dao/CoganizanceRecordMapper.java

@@ -0,0 +1,17 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.CoganizanceRecord;
+
+public interface CoganizanceRecordMapper {
+    int deleteByPrimaryKey(Long id);
+
+    int insert(CoganizanceRecord record);
+
+    int insertSelective(CoganizanceRecord record);
+
+    CoganizanceRecord selectByPrimaryKey(Long id);
+
+    int updateByPrimaryKeySelective(CoganizanceRecord record);
+
+    int updateByPrimaryKey(CoganizanceRecord record);
+}

+ 118 - 0
src/main/java/com/goafanti/common/mapper/CoganizanceRecordMapper.xml

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.goafanti.common.dao.CoganizanceRecordMapper" >
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.CoganizanceRecord" >
+    <id column="id" property="id" jdbcType="BIGINT" />
+    <result column="district" property="district" jdbcType="INTEGER" />
+    <result column="unit_name" property="unitName" jdbcType="VARCHAR" />
+    <result column="year" property="year" jdbcType="INTEGER" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, district, unit_name, year
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select 
+    <include refid="Base_Column_List" />
+    from coganizance_record
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from coganizance_record
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.CoganizanceRecord" >
+    insert into coganizance_record (id, district, unit_name, 
+      year)
+    values (#{id,jdbcType=BIGINT}, #{district,jdbcType=INTEGER}, #{unitName,jdbcType=VARCHAR}, 
+      #{year,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.CoganizanceRecord" >
+    insert into coganizance_record
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="district != null" >
+        district,
+      </if>
+      <if test="unitName != null" >
+        unit_name,
+      </if>
+      <if test="year != null" >
+        year,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="district != null" >
+        #{district,jdbcType=INTEGER},
+      </if>
+      <if test="unitName != null" >
+        #{unitName,jdbcType=VARCHAR},
+      </if>
+      <if test="year != null" >
+        #{year,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.CoganizanceRecord" >
+    update coganizance_record
+    <set >
+      <if test="district != null" >
+        district = #{district,jdbcType=INTEGER},
+      </if>
+      <if test="unitName != null" >
+        unit_name = #{unitName,jdbcType=VARCHAR},
+      </if>
+      <if test="year != null" >
+        year = #{year,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.CoganizanceRecord" >
+    update coganizance_record
+    set district = #{district,jdbcType=INTEGER},
+      unit_name = #{unitName,jdbcType=VARCHAR},
+      year = #{year,jdbcType=INTEGER}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  
+  <select id="findCoganizanceRecordListByPage" parameterType="String" resultMap="BaseResultMap">
+    select 
+   	 <include refid="Base_Column_List" />
+    from coganizance_record
+    where 1 = 1
+    <if test="district != null">
+    	and district = #{district,jdbcType=INTEGER}
+    </if>
+     <if test="unitName != null">
+     	and unit_name like CONCAT(#{unitName,jdbcType=VARCHAR},'%')
+    </if>
+     <if test="year != null">
+     	and year = #{year,jdbcType=INTEGER}
+    </if>
+    ORDER BY id DESC
+	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findCoganizanceRecordCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+   	 count(1)
+    from coganizance_record
+    where 1 = 1
+    <if test="district != null">
+    	and district = #{district,jdbcType=INTEGER}
+    </if>
+     <if test="unitName != null">
+     	and unit_name like CONCAT(#{unitName,jdbcType=VARCHAR},'%')
+    </if>
+     <if test="year != null">
+     	and year = #{year,jdbcType=INTEGER}
+    </if>
+  </select>
+</mapper>

+ 52 - 0
src/main/java/com/goafanti/common/model/CoganizanceRecord.java

@@ -0,0 +1,52 @@
+package com.goafanti.common.model;
+
+public class CoganizanceRecord {
+    private Long id;
+
+    /**
+    * 地区(省份/市)
+    */
+    private Integer district;
+
+    /**
+    * 公司名称
+    */
+    private String unitName;
+
+    /**
+    * 高企认定年份
+    */
+    private Integer year;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Integer getDistrict() {
+        return district;
+    }
+
+    public void setDistrict(Integer district) {
+        this.district = district;
+    }
+
+    public String getUnitName() {
+        return unitName;
+    }
+
+    public void setUnitName(String unitName) {
+        this.unitName = unitName;
+    }
+
+    public Integer getYear() {
+        return year;
+    }
+
+    public void setYear(Integer year) {
+        this.year = year;
+    }
+}

+ 43 - 26
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -110,6 +110,20 @@ public class UserApiController extends BaseApiController {
 	@Resource
 	private OrgRatepayService				orgRatepayService;
 
+	private static final Integer			STEP_ONE			= 1;
+
+	// private static final Integer STEP_TWO = 2;
+
+	private static final Integer			STEP_THREE			= 3;
+
+	// private static final Integer STEP_FOUR = 4;
+
+	private static final Integer			STEP_FIVE			= 5;
+
+	private static final Integer			MAX_WRONG_COUNT		= 3;
+
+	private static final Integer			INIT_WRONG_COUNT	= 0;
+
 	/**
 	 * 修改密码
 	 * 
@@ -143,10 +157,6 @@ public class UserApiController extends BaseApiController {
 		return res;
 	}
 
-	
-
-	
-
 	/**
 	 * 更换手机
 	 * 
@@ -673,22 +683,26 @@ public class UserApiController extends BaseApiController {
 	@RequestMapping(value = "/userNextPro", method = RequestMethod.POST)
 	public Result userNextProcess(UserIdentity userIdentity, String verificationCode) {
 		Result res = new Result();
-		if ((IdentityProcess.UNCOMMITTED.getCode() + 1) == userIdentity.getProcess()) {
+		if (null == userIdentity.getProcess()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "process"));
+			return res;
+		}
+		if (StringUtils.isBlank(verificationCode)) {
+			res.getError().add(buildError(ErrorConstants.VCODE_EMPTY_ERROR));
+			return res;
+		}
+		if (STEP_ONE.equals(userIdentity.getProcess())) {
 			if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.V_CODE).equals(verificationCode)) {
-				res.getError().add(buildError(ErrorConstants.VCODE_ERROR, "验证码错误"));
+				res.getError().add(buildError(ErrorConstants.VCODE_ERROR));
 				return res;
 			}
-		}
-
-		if (IdentityProcess.COMMITTED.getCode() == userIdentity.getProcess()) {// 3
+		} else if (STEP_THREE.equals(userIdentity.getProcess())) {
 			UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
 			u.setProcess(IdentityProcess.COMMITTED.getCode());
 			u.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
 			userIdentityService.updateByPrimaryKeySelective(u);
 			return res;
-		}
-
-		if (IdentityProcess.RESULTS.getCode() == userIdentity.getProcess()) {
+		} else if (STEP_FIVE.equals(userIdentity.getProcess())) {
 			UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
 			if ((System.currentTimeMillis() - u.getPaymentDate().getTime()) > 432000000) {
 				u.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
@@ -696,7 +710,7 @@ public class UserApiController extends BaseApiController {
 				res.getError().add(buildError("", "1"));// 超过打款日期5日,无法提交确认
 				return res;
 			}
-			if (3 == u.getWrongCount()) {
+			if (MAX_WRONG_COUNT.equals(u.getWrongCount())) {
 				u.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
 				u.setProcess(IdentityProcess.RESULTS.getCode());// 5
 				userIdentityService.updateByPrimaryKeySelective(u);
@@ -744,23 +758,29 @@ public class UserApiController extends BaseApiController {
 	public Result orgNextProcess(OrganizationIdentity orgIdentity, String listedDateFormattedDate,
 			String verificationCode) throws ParseException {
 		Result res = new Result();
-		if ((IdentityProcess.UNCOMMITTED.getCode() + 1) == orgIdentity.getProcess()) {
+		if (null == orgIdentity.getProcess()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "process"));
+			return res;
+		}
+		if (StringUtils.isBlank(verificationCode)) {
+			res.getError().add(buildError(ErrorConstants.VCODE_EMPTY_ERROR));
+			return res;
+		}
+		if (STEP_ONE.equals(orgIdentity.getProcess())) {
 			if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.V_CODE).equals(verificationCode)) {
-				res.getError().add(buildError(ErrorConstants.VCODE_ERROR, "验证码错误"));
+				res.getError().add(buildError(ErrorConstants.VCODE_ERROR));
 				return res;
 			}
 			if (!StringUtils.isBlank(listedDateFormattedDate)) {
 				orgIdentity.setListedDate(DateUtils.parseDate(listedDateFormattedDate, AFTConstants.YYYYMMDD));
 			}
-		}
-		if (IdentityProcess.COMMITTED.getCode() == orgIdentity.getProcess()) {
+		} else if (STEP_THREE.equals(orgIdentity.getProcess())) {
 			OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
 			o.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
 			o.setProcess(IdentityProcess.COMMITTED.getCode());
 			organizationIdentityService.updateByPrimaryKeySelective(o);
 			return res;
-		}
-		if (5 == orgIdentity.getProcess()) {
+		} else if (STEP_FIVE.equals(orgIdentity.getProcess())) {
 			OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
 			if (System.currentTimeMillis() - o.getPaymentDate().getTime() > 432000000) {
 				o.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
@@ -768,7 +788,7 @@ public class UserApiController extends BaseApiController {
 				res.getError().add(buildError("", "1"));// 超过打款日期5日,无法提交确认
 				return res;
 			}
-			if (3 == o.getWrongCount()) {
+			if (MAX_WRONG_COUNT.equals(o.getWrongCount())) {
 				o.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
 				o.setProcess(IdentityProcess.RESULTS.getCode());// 5
 				organizationIdentityService.updateByPrimaryKeySelective(o);
@@ -824,7 +844,7 @@ public class UserApiController extends BaseApiController {
 			user.setId(u.getId());
 			user.setUid(u.getUid());
 			user.setProcess(IdentityProcess.UNCOMMITTED.getCode());
-			user.setWrongCount(0);
+			user.setWrongCount(INIT_WRONG_COUNT);
 			user.setAmountMoney(new BigDecimal(0));
 			user.setAuditStatus(IdentityAuditStatus.UNCOMMITTED.getCode());
 			res.setData(userIdentityService.updateByPrimaryKey(user));
@@ -834,7 +854,7 @@ public class UserApiController extends BaseApiController {
 			org.setId(o.getId());
 			org.setUid(o.getUid());
 			org.setProcess(IdentityProcess.UNCOMMITTED.getCode());
-			org.setWrongCount(0);
+			org.setWrongCount(INIT_WRONG_COUNT);
 			org.setAuditStatus(IdentityAuditStatus.UNCOMMITTED.getCode());
 			org.setValidationAmount(new BigDecimal(0));
 			res.setData(organizationIdentityService.updateByPrimaryKey(org));
@@ -854,8 +874,6 @@ public class UserApiController extends BaseApiController {
 		return res;
 	}
 
-	
-
 	private UidAndTypeBo basicInfo(UserService userService) {
 		User u = userService.selectByPrimaryKey(TokenManager.getUserId());
 		UidAndTypeBo ub = new UidAndTypeBo();
@@ -869,10 +887,9 @@ public class UserApiController extends BaseApiController {
 	// 判断用户是否通过认证
 	private Result checkCertify(Result res) {
 		OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
-		if (null == o || 5 != o.getAuditStatus()) {
+		if (null == o || !IdentityAuditStatus.PASSED.getCode().equals(o.getAuditStatus())) {
 			res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
 		}
-
 		return res;
 	}