Browse Source

update 1.0.6

Antiloveg 8 years ago
parent
commit
cbb7026288

+ 29 - 24
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -112,26 +112,27 @@ public class AdminApiController extends BaseApiController {
 	@Resource
 	private AftFileService					aftFileService;
 	@Resource(name = "passwordUtil")
-	private PasswordUtil	passwordUtil;
+	private PasswordUtil					passwordUtil;
 	@Resource
-	private AdminService	adminService;
-	
+	private AdminService					adminService;
+
 	/**
 	 * 新增用户
+	 * 
 	 * @param mobile
 	 * @param type
 	 * @param unitName
 	 * @return
 	 */
 	@RequestMapping(value = "/addNewUser", method = RequestMethod.POST)
-	public Result addNewUser(String mobile, Integer type, String unitName){
+	public Result addNewUser(String mobile, Integer type, String unitName) {
 		Result res = new Result();
 		User user = userService.selectByMobieAndType(mobile, type);
 		if (null != user) {
 			res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
 			return res;
 		}
-		
+
 		User u = new User();
 		u.setId(UUID.randomUUID().toString());
 		u.setMobile(mobile);
@@ -146,7 +147,6 @@ public class AdminApiController extends BaseApiController {
 		userService.insertRegister(u, "", unitName);
 		return res;
 	}
-	
 
 	/**
 	 * 个人用户列表
@@ -303,7 +303,13 @@ public class AdminApiController extends BaseApiController {
 	public Result updateOrgHumanResource(OrgHumanResource orgHumanResource) {
 		Result res = new Result();
 		if (null == orgHumanResource.getId()) {
+			if (null != orgHumanResourceService.selectOrgHumanResourceByUidAndYear(orgHumanResource.getYear(),
+					orgHumanResource.getUid())){
+				res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度人力资源情况已录入!"));
+				return res;
+			}
 			orgHumanResource.setId(UUID.randomUUID().toString());
+			orgHumanResource.setDeletedSign(0);
 			orgHumanResourceService.insert(orgHumanResource);
 		} else {
 			orgHumanResourceService.updateByPrimaryKeySelective(orgHumanResource);
@@ -969,9 +975,10 @@ public class AdminApiController extends BaseApiController {
 		orgCognizanceService.updateByPrimaryKeySelective(cog);
 		return res;
 	}
-	
+
 	/**
 	 * 刪除高企认定
+	 * 
 	 * @param ids
 	 * @return
 	 */
@@ -1113,14 +1120,14 @@ public class AdminApiController extends BaseApiController {
 			if (res.getData() != "" && res.getData() != null && null == aftFileService.selectAftFileBySign(sign)) {
 				AftFile f = new AftFile();
 				f.setId(UUID.randomUUID().toString());
-					if ("patent_prory_statement".equals(sign)) {
-						f.setFileName("专利代理委托书模版");
-						f.setSign(sign);
-					} 
-					f.setFilePath("/admin/" + fileName);
-					f.setDeleletedSign(0);
-					aftFileService.insert(f);
-				
+				if ("patent_prory_statement".equals(sign)) {
+					f.setFileName("专利代理委托书模版");
+					f.setSign(sign);
+				}
+				f.setFilePath("/admin/" + fileName);
+				f.setDeleletedSign(0);
+				aftFileService.insert(f);
+
 			}
 		} else {
 			res.getError().add(buildError(ErrorConstants.FILE_PATTERN_ERROR, "文件格式错误,请重新上传!"));
@@ -1145,26 +1152,24 @@ public class AdminApiController extends BaseApiController {
 	// org团体列表
 	private Pagination<OrgListBo> getOrgList(String mobile, String email, String[] createTime, Integer number,
 			String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
-		return  userService.listOrg(mobile, email, createTime, number, aftUsername, auditStatus,
-				pNo, pSize);
+		return userService.listOrg(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize);
 	}
 
 	// user个人列表
 	private Pagination<UserListBo> getUserList(String mobile, String email, String[] createTime, Integer number,
 			String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
-		return  userService.listUser(mobile, email, createTime, number, aftUsername,
-				auditStatus, pNo, pSize);
+		return userService.listUser(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize);
 	}
-    
-	//高企详情
+
+	// 高企详情
 	private CognizanceDetailBo handleCognizanceDetail(String uid, String cid, Integer year) {
 		return orgCognizanceService.selectCognizanceDetailBo(uid, cid, year);
 	}
-    
-	//年报
+
+	// 年报
 	private AnnualReportBo handleAnnualReport(String uid, Integer year) {
 		return orgAnnualReportService.selectAnnualReportBo(uid, year);
-		
+
 	}
 
 	private String handleFile(Result res, HttpServletRequest req, String fileName, List<MultipartFile> files,

+ 2 - 0
src/main/java/com/goafanti/common/dao/OrgHumanResourceMapper.java

@@ -20,4 +20,6 @@ public interface OrgHumanResourceMapper {
 	OrgHumanResource selectOrgHumanResourceByUserId(String uid);
 
 	int batchDeleteByPrimaryKey(List<String> id);
+
+	OrgHumanResource selectOrgHumanResourceByUidAndYear(Integer year, String uid);
 }

+ 7 - 0
src/main/java/com/goafanti/common/mapper/OrgHumanResourceMapper.xml

@@ -471,4 +471,11 @@
 		#{item}
 	</foreach>
   </update>
+  
+   <select id="selectOrgHumanResourceByUidAndYear" resultMap="BaseResultMap"  >
+    select 
+    <include refid="Base_Column_List" />
+    from org_human_resource
+    where year = #{0} and uid = #{1}
+  </select>
 </mapper>

+ 1 - 1
src/main/java/com/goafanti/common/mapper/PatentInfoMapper.xml

@@ -47,7 +47,7 @@
     select 
     <include refid="Base_Column_List" />
     from patent_info
-    where id = #{id,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR} 
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
     delete from patent_info

+ 2 - 2
src/main/java/com/goafanti/common/mapper/PatentRegistrationMapper.xml

@@ -213,12 +213,12 @@
        m.* from 
       (select u.id as uid , p.id as pid ,o.id as oid , p.serial_number as serialNumber ,p.patent_number as patentNumber ,
               o.location_province as locationProvince , o.unit_name as unitName ,
-              p.patent_catagory as patentCatagory , p.patent_name as patentName, p.record_time as recordTime
+              p.patent_catagory as patentCatagory , p.patent_name as patentName
        from user u
 	   INNER JOIN patent_info p on u.id =p.uid and p.deleted_sign = 0
 	   LEFT JOIN organization_identity o on o.uid = u.id 
 	   ) m
-  LEFT JOIN patent_registration r on m.pid = r.pid  order by m.recordTime desc
+  LEFT JOIN patent_registration r on m.pid = r.pid  order by m.serialNumber desc
   </select>
   
   <select id="findRecieveSendCount" resultType="java.lang.Integer">

+ 4 - 3
src/main/java/com/goafanti/common/model/OrgHumanResource.java

@@ -168,7 +168,7 @@ public class OrgHumanResource {
     /**
      * 删除标记
      */
-    private String deletedSign;
+    private Integer deletedSign;
 
     public String getId() {
         return id;
@@ -439,11 +439,11 @@ public class OrgHumanResource {
 	}
     
 	@JsonIgnore
-	public String getDeletedSign() {
+	public Integer getDeletedSign() {
 		return deletedSign;
 	}
 
-	public void setDeletedSign(String deletedSign) {
+	public void setDeletedSign(Integer deletedSign) {
 		this.deletedSign = deletedSign;
 	}
 
@@ -455,6 +455,7 @@ public class OrgHumanResource {
 		}
 	}
 	
+
 	public void setRosterDownloadFileName(String rosterDownloadFileName){
 		
 	}

+ 0 - 3
src/main/java/com/goafanti/common/model/PatentInfo.java

@@ -6,10 +6,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.goafanti.common.utils.FileUtils;
-@JsonInclude(value = Include.NON_NULL)
 public class PatentInfo {
     private String id;
 

+ 4 - 70
src/main/java/com/goafanti/techservice/patent/controller/PatentApiController.java

@@ -77,9 +77,6 @@ public class PatentApiController extends BaseApiController {
 	@Resource
 	private UserService						userService;
 
-	/*
-	 * @Autowired DownloadUtils downloadUtils;
-	 */
 
 	@Value(value = "${upload.private.path}")
 	private String							uploadPrivatePath	= null;
@@ -92,38 +89,7 @@ public class PatentApiController extends BaseApiController {
 		Result res = new Result();
 		res = checkCertify(res, TokenManager.getUserId());
 		if (res.getError().isEmpty()) {
-			patentInfo.setId(UUID.randomUUID().toString());
-			patentInfo.setUid(TokenManager.getUserId());
-			Calendar now = Calendar.getInstance();
-			now.set(Calendar.MILLISECOND, 0);
-			patentInfo.setRecordTime(now.getTime());
-			patentInfo.setDeletedSign(0);
-			patentInfo.setConfirmState(0);
-			patentInfo.setPatentState(1);
-			String p = userService.selectByPrimaryKey(TokenManager.getUserId()).getAid();
-			patentInfo.setPrincipal(p);
-			patentInfoService.insert(patentInfo);
-
-			PatentRegistration patentRegistration = new PatentRegistration();
-			patentRegistration.setId(UUID.randomUUID().toString());
-			patentRegistration.setPid(patentInfo.getId());
-			patentRegistrationService.insert(patentRegistration);
-
-			PatentCost patentCost = new PatentCost();
-			patentCost.setId(UUID.randomUUID().toString());
-			patentCost.setPid(patentInfo.getId());
-			patentCost.setAnnualFeeState(0);
-			patentCost.setPaymentState(0);
-			patentCostService.insert(patentCost);
-
-			PatentLog log = new PatentLog();
-			log.setId(UUID.randomUUID().toString());
-			log.setPid(patentInfo.getId());
-			log.setRecordTime(patentInfo.getCreateTime());
-			log.setState(1);
-			log.setPrincipal(p);
-			patentLogService.insert(log);
-			res.setData(patentInfo);
+			res.setData(patentInfoService.savePatentInfo(patentInfo, TokenManager.getUserId())); 
 		}
 		return res;
 	}
@@ -150,9 +116,9 @@ public class PatentApiController extends BaseApiController {
 	 * 
 	 */
 	@RequestMapping(value = "/clientPatentInfo", method = RequestMethod.POST)
-	public Result clientPatentInfo(String patentId) {
+	public Result clientPatentInfo(String pid) {
 		Result res = new Result();
-		res.setData(patentInfoService.selectByPrimaryKey(patentId));
+		res.setData(patentInfoService.selectByPrimaryKey(pid));
 		return res;
 	}
 
@@ -253,39 +219,7 @@ public class PatentApiController extends BaseApiController {
 		Result res = new Result();
 		res = checkCertify(res, uid);
 		if (res.getError().isEmpty()) {
-			patentInfo.setId(UUID.randomUUID().toString());
-			patentInfo.setUid(uid);
-			Calendar now = Calendar.getInstance();
-			now.set(Calendar.MILLISECOND, 0);
-			patentInfo.setRecordTime(now.getTime());
-			patentInfo.setDeletedSign(0);
-			patentInfo.setConfirmState(0);
-			patentInfo.setPatentState(1);
-			String p = userService.selectByPrimaryKey(TokenManager.getUserId()).getAid();
-			patentInfo.setPrincipal(p);
-			patentInfoService.insert(patentInfo);
-			
-			PatentRegistration patentRegistration = new PatentRegistration();
-			patentRegistration.setId(UUID.randomUUID().toString());
-			patentRegistration.setPid(patentInfo.getId());
-			patentRegistrationService.insert(patentRegistration);
-			
-			PatentCost patentCost = new PatentCost();
-			patentCost.setId(UUID.randomUUID().toString());
-			patentCost.setPid(patentInfo.getId());
-			patentCost.setAnnualFeeState(0);
-			patentCost.setPaymentState(0);
-			patentCostService.insert(patentCost);
-
-			PatentLog log = new PatentLog();
-			log.setId(UUID.randomUUID().toString());
-			log.setPid(patentInfo.getId());
-			log.setRecordTime(patentInfo.getCreateTime());
-			log.setState(1);
-			log.setPrincipal(p);
-			log.setOperator(TokenManager.getAdminId());
-			patentLogService.insert(log);
-			res.setData(patentInfo);
+			res.setData(patentInfoService.savePatentInfo(patentInfo, uid));
 		}
 		return res;
 	}

+ 2 - 0
src/main/java/com/goafanti/techservice/patent/service/PatentInfoService.java

@@ -36,5 +36,7 @@ public interface PatentInfoService {
 
 	int batchDeleteByPrimaryKey(List<String> id);
 
+	PatentInfo savePatentInfo(PatentInfo patentInfo, String uid);
+
 
 }

+ 56 - 0
src/main/java/com/goafanti/techservice/patent/service/impl/PatentInfoServiceImpl.java

@@ -1,16 +1,26 @@
 package com.goafanti.techservice.patent.service.impl;
 
 import java.text.ParseException;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.goafanti.common.dao.PatentCostMapper;
 import com.goafanti.common.dao.PatentInfoMapper;
+import com.goafanti.common.dao.PatentLogMapper;
+import com.goafanti.common.dao.PatentRegistrationMapper;
+import com.goafanti.common.dao.UserMapper;
+import com.goafanti.common.model.PatentCost;
 import com.goafanti.common.model.PatentInfo;
+import com.goafanti.common.model.PatentLog;
+import com.goafanti.common.model.PatentRegistration;
+import com.goafanti.common.model.User;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -24,6 +34,14 @@ import com.goafanti.techservice.patent.service.PatentInfoService;
 public class PatentInfoServiceImpl extends BaseMybatisDao<PatentInfoMapper> implements PatentInfoService {
 	@Autowired
 	PatentInfoMapper patentInfoMapper;
+	@Autowired
+	UserMapper      userMapper;
+	@Autowired
+	PatentRegistrationMapper patentRegistrationMapper;
+	@Autowired
+	PatentCostMapper patentCostMapper;
+	@Autowired
+	PatentLogMapper  patentLogMapper;
 	
 	
 	@Override
@@ -270,6 +288,44 @@ public class PatentInfoServiceImpl extends BaseMybatisDao<PatentInfoMapper> impl
 	}
 
 
+	@Override
+	public PatentInfo savePatentInfo(PatentInfo patentInfo, String uid) {
+		patentInfo.setId(UUID.randomUUID().toString());
+		patentInfo.setUid(uid);
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		patentInfo.setRecordTime(now.getTime());
+		patentInfo.setDeletedSign(0);
+		patentInfo.setConfirmState(0);
+		patentInfo.setPatentState(1);
+		User u = userMapper.selectByPrimaryKey(uid);
+		String p = (null == u ? "" : u.getAid());
+		patentInfo.setPrincipal(p);
+		patentInfoMapper.insert(patentInfo);
+
+		PatentRegistration patentRegistration = new PatentRegistration();
+		patentRegistration.setId(UUID.randomUUID().toString());
+		patentRegistration.setPid(patentInfo.getId());
+		patentRegistrationMapper.insert(patentRegistration);
+
+		PatentCost patentCost = new PatentCost();
+		patentCost.setId(UUID.randomUUID().toString());
+		patentCost.setPid(patentInfo.getId());
+		patentCost.setAnnualFeeState(0);
+		patentCost.setPaymentState(0);
+		patentCostMapper.insert(patentCost);
+
+		PatentLog log = new PatentLog();
+		log.setId(UUID.randomUUID().toString());
+		log.setPid(patentInfo.getId());
+		log.setRecordTime(patentInfo.getCreateTime());
+		log.setState(1);
+		log.setPrincipal(p);
+		patentLogMapper.insert(log);
+		return patentInfo;
+	}
+
+
 	
 
 }

+ 6 - 0
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -631,8 +631,14 @@ public class UserApiController extends BaseApiController {
 	public Result SaveHumanResource(OrgHumanResource orgHumanResource){
 		Result res = new Result();
 		if (null == orgHumanResource.getId()){
+			if (null != orgHumanResourceService.selectOrgHumanResourceByUidAndYear(orgHumanResource.getYear(),
+					orgHumanResource.getUid())){
+				res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度人力资源情况已录入!"));
+				return res;
+			}
 			orgHumanResource.setId(UUID.randomUUID().toString());
 			orgHumanResource.setUid(TokenManager.getUserId());
+			orgHumanResource.setDeletedSign(0);
 			orgHumanResourceService.insert(orgHumanResource);
 		} else {
 			orgHumanResourceService.updateByPrimaryKeySelective(orgHumanResource);

+ 2 - 0
src/main/java/com/goafanti/user/service/OrgHumanResourceService.java

@@ -15,4 +15,6 @@ public interface OrgHumanResourceService {
 
 	int batchDeleteByPrimaryKey(List<String> id);
 
+	OrgHumanResource selectOrgHumanResourceByUidAndYear(Integer year, String uid);
+
 }

+ 5 - 0
src/main/java/com/goafanti/user/service/impl/OrgHumanResourceServiceImpl.java

@@ -58,4 +58,9 @@ public class OrgHumanResourceServiceImpl extends BaseMybatisDao<OrgHumanResource
 		return orgHumanResourceMapper.batchDeleteByPrimaryKey(id);
 	}
 
+	@Override
+	public OrgHumanResource selectOrgHumanResourceByUidAndYear(Integer year, String uid) {
+		return orgHumanResourceMapper.selectOrgHumanResourceByUidAndYear(year, uid);
+	}
+
 }

+ 2 - 2
src/main/resources/props/config_dev.properties

@@ -1,6 +1,6 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
-#\u6570\u636E\u5E93\u94FE\u63A5\uFF0C
+#\u6570\u636e\u5e93\u94fe\u63a5\uff0c
 jdbc.url=jdbc:mysql://123.57.207.214:3306/pro_aft_test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
 #\u5e10\u53f7
 jdbc.username=xiaolong
@@ -51,7 +51,7 @@ session.validate.timespan=18000000
 
 app.name=AFT
 
-static.host=//afts.hnzhiming.com/1.0.5
+static.host=//afts.hnzhiming.com/1.0.6
 
 upload.path=/data/wwwroot/aft/upload
 upload.private.path=/data/upload

+ 2 - 2
src/main/resources/props/config_local.properties

@@ -1,6 +1,6 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
-#\u6570\u636E\u5E93\u94FE\u63A5\uFF0C
+#\u6570\u636e\u5e93\u94fe\u63a5\uff0c
 jdbc.url=jdbc:mysql://localhost:3306/aft_dev?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
 #\u5e10\u53f7
 jdbc.username=root
@@ -53,7 +53,7 @@ session.validate.timespan=18000000
 
 app.name=AFT
 
-static.host=//afts.hnzhiming.com/1.0.5
+static.host=//afts.hnzhiming.com/1.0.6
 
 upload.path=/Users/xiaolong/Sites/upload
 upload.private.path=/Users/xiaolong/Sites/doc

+ 3 - 3
src/main/resources/props/config_prod.properties

@@ -1,8 +1,8 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
-#\u6570\u636E\u5E93\u94FE\u63A5\uFF0C
+#\u6570\u636e\u5e93\u94fe\u63a5\uff0c
 jdbc.url=jdbc:mysql://123.57.207.214:3306/pro_aft_test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
-#\u5E10\u53F7
+#\u5e10\u53f7
 jdbc.username=xiaolong
 #\u5bc6\u7801
 jdbc.password=!qaz2wsx
@@ -51,4 +51,4 @@ session.validate.timespan=18000000
 
 app.name=AFT
 
-static.host=//afts.hnzhiming.com/1.0.5
+static.host=//afts.hnzhiming.com/1.0.6

+ 1 - 1
src/main/resources/props/config_test.properties

@@ -53,7 +53,7 @@ session.validate.timespan=18000000
 
 app.name=AFT
 
-static.host=//aftts.hnzhiming.com/1.0.5
+static.host=//aftts.hnzhiming.com/1.0.6
 
 upload.path=/data/aft/public/upload
 upload.private.path=/data/aft/private/upload