Antiloveg 8 years ago
parent
commit
f949cfe92b
24 changed files with 520 additions and 175 deletions
  1. 4 0
      pom.xml
  2. 11 8
      src/main/java/com/goafanti/admin/controller/AdminApiController.java
  3. 108 41
      src/main/java/com/goafanti/admin/controller/AdminTechProjectController.java
  4. 1 1
      src/main/java/com/goafanti/cognizance/service/OrgCognizanceService.java
  5. 3 3
      src/main/java/com/goafanti/cognizance/service/impl/OrgCognizanceServiceImpl.java
  6. 4 0
      src/main/java/com/goafanti/common/dao/TechProjectMapper.java
  7. 2 0
      src/main/java/com/goafanti/common/dao/TechWebsiteMapper.java
  8. 3 3
      src/main/java/com/goafanti/common/mapper/OrgCognizanceMapper.xml
  9. 10 2
      src/main/java/com/goafanti/common/mapper/TechProjectMapper.xml
  10. 9 1
      src/main/java/com/goafanti/common/mapper/TechWebsiteMapper.xml
  11. 2 2
      src/main/java/com/goafanti/common/mapper/UserMapper.xml
  12. 116 97
      src/main/java/com/goafanti/common/utils/AesUtils.java
  13. 37 0
      src/main/java/com/goafanti/common/utils/Base64Utils.java
  14. 4 5
      src/main/java/com/goafanti/patent/service/impl/PatentCostServiceImpl.java
  15. 160 0
      src/main/java/com/goafanti/techproject/bo/InputTechProject.java
  16. 2 1
      src/main/java/com/goafanti/techproject/controller/TechProjectApiController.java
  17. 5 2
      src/main/java/com/goafanti/techproject/service/TechProjectService.java
  18. 3 0
      src/main/java/com/goafanti/techproject/service/TechWebsiteService.java
  19. 10 4
      src/main/java/com/goafanti/techproject/service/impl/TechProjectServiceImpl.java
  20. 5 0
      src/main/java/com/goafanti/techproject/service/impl/TechWebsiteServiceImpl.java
  21. 12 0
      src/main/java/com/goafanti/user/controller/UserApiController.java
  22. 1 0
      src/main/java/com/goafanti/user/controller/UserRegisterController.java
  23. 1 1
      src/main/java/com/goafanti/user/service/UserService.java
  24. 7 4
      src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

+ 4 - 0
pom.xml

@@ -327,6 +327,10 @@
             <artifactId>aliyun-java-sdk-sms</artifactId>
             <version>3.0.0-rc1</version>
         </dependency>
+        
+
+ 
+        
 	</dependencies>
 	<build>
 		<resources>

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

@@ -231,7 +231,7 @@ public class AdminApiController extends BaseApiController {
 	@RequestMapping(value = "/orgList", method = RequestMethod.POST)
 	public Result orgList(String mobile, String email,
 			@RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number,
-			String aftUsername, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
+			String unitName, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
@@ -241,7 +241,7 @@ public class AdminApiController extends BaseApiController {
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		res.setData(getOrgList(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize));
+		res.setData(getOrgList(mobile, email, createTime, number, unitName, auditStatus, pNo, pSize));
 		return res;
 	}
 
@@ -924,8 +924,11 @@ public class AdminApiController extends BaseApiController {
 			res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度高企认定已申请!"));
 			return res;
 		}
-		
-		String aid = userService.selectByPrimaryKey(uid).getAid();
+		User u = userService.selectByPrimaryKey(uid);
+		String aid = null;
+		if (!StringUtils.isBlank(u.getAid())){
+			aid = u.getAid();
+		}
 		orgCognizanceService.insertCognizance(contacts, comment, year,  state, aid, uid);
 		
 		return res;
@@ -939,7 +942,7 @@ public class AdminApiController extends BaseApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
-	public Result listCognizance(String uid, String locationProvince, String pageNo, String pageSize) {
+	public Result listCognizance(String unitName, String locationProvince, String pageNo, String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
@@ -950,7 +953,7 @@ public class AdminApiController extends BaseApiController {
 			pNo = Integer.parseInt(pageNo);
 		}
 
-		res.setData(orgCognizanceService.listCognizance(uid, locationProvince, pNo, pSize));
+		res.setData(orgCognizanceService.listCognizance(unitName, locationProvince, pNo, pSize));
 		return res;
 	}
 
@@ -1213,8 +1216,8 @@ 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);
+			String unitName, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
+		return userService.listOrg(mobile, email, createTime, number, unitName, auditStatus, pNo, pSize);
 	}
 
 	// user个人列表

+ 108 - 41
src/main/java/com/goafanti/admin/controller/AdminTechProjectController.java

@@ -1,25 +1,34 @@
 package com.goafanti.admin.controller;
 
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 import javax.annotation.Resource;
+import javax.validation.Valid;
 
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
+import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import com.goafanti.common.bo.Result;
-import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.CopyrightFields;
 import com.goafanti.common.model.TechProject;
 import com.goafanti.common.model.TechProjectLog;
 import com.goafanti.common.model.TechWebsite;
-import com.goafanti.common.utils.AesUtils;
+import com.goafanti.common.model.User;
+import com.goafanti.common.utils.Base64Utils;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.techproject.bo.InputTechProject;
 import com.goafanti.techproject.bo.TechWebsiteListBo;
 import com.goafanti.techproject.service.TechProjectLogService;
 import com.goafanti.techproject.service.TechProjectService;
@@ -28,26 +37,27 @@ import com.goafanti.user.service.UserService;
 
 @Controller
 @RequestMapping(value = "/api/admintechproject")
-public class AdminTechProjectController extends BaseApiController{
+public class AdminTechProjectController extends CertifyApiController {
 	@Value(value = "${aesSecretKey}")
-	private  String aesSecretKey = null;
+	private String					aesSecretKey	= null;
 	@Resource
-	private TechProjectService techProjectService;
+	private TechProjectService		techProjectService;
 	@Resource
-	private TechWebsiteService techWebsiteService;
+	private TechWebsiteService		techWebsiteService;
 	@Resource
-	private TechProjectLogService techProjectLogService;
+	private TechProjectLogService	techProjectLogService;
 	@Resource
-	private UserService  userService;
-	
+	private UserService				userService;
+
 	/**
 	 * 科技项目申报列表
+	 * 
 	 * @param pageNo
 	 * @param pageSize
 	 * @return
 	 */
 	@RequestMapping(value = "/listTechProject", method = RequestMethod.POST)
-	public Result listClientTechProject(String province, String uid, String pageNo, String pageSize){
+	public Result listClientTechProject(String province, String unitName, String pageNo, String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
@@ -57,50 +67,70 @@ public class AdminTechProjectController extends BaseApiController{
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		res.setData(techProjectService.listManageTechProject(province, uid, pNo, pSize));
+		res.setData(techProjectService.listManageTechProject(province, unitName, pNo, pSize));
 		return res;
 	}
-	
-	
-	
+
 	/**
 	 * 科技项目申报
+	 * 
 	 * @return
 	 */
 	@RequestMapping(value = "/applyTechProject", method = RequestMethod.POST)
-	public Result applyTechProject(TechProject techProject, String uid){
+	public Result applyTechProject(@Valid InputTechProject techProject, BindingResult bindingResult) {
 		Result res = new Result();
-		String aid = userService.selectByPrimaryKey(uid).getAid();
-		techProjectService.saveTechProject(techProject, uid, aid);
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					CopyrightFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+		if (!checkAdminLogin(res)) {
+			return res;
+		}
+
+		if (StringUtils.isBlank(techProject.getUid())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
+			return res;
+		}
+		User curUser = userService.selectByPrimaryKey(techProject.getUid());
+		if (checkCertify(res, curUser)) {
+			return res;
+		}
+		TechProject tp = new TechProject();
+		BeanUtils.copyProperties(techProject, tp);
+		techProjectService.saveTechProject(tp, userService.selectByPrimaryKey(tp.getUid()).getAid());
 		return res;
-		
+
 	}
-	
+
 	/**
 	 * 科技项目申报详情
+	 * 
 	 * @return
 	 */
 	@RequestMapping(value = "/techProjectDetial", method = RequestMethod.POST)
-	public Result techProjectDetial(String pid){
+	public Result techProjectDetial(String pid) {
 		Result res = new Result();
 		res.setData(techProjectService.selectProjectDetail(pid));
 		return res;
 	}
-	
+
 	/**
 	 * 科技项目状态流转
+	 * 
 	 * @param pid
 	 * @return
 	 */
 	@RequestMapping(value = "/techProjectLog", method = RequestMethod.POST)
-	public Result techProjectLog(String pid){
+	public Result techProjectLog(String pid) {
 		Result res = new Result();
 		res.setData(techProjectLogService.selectTechProjectLogByPid(pid));
 		return res;
 	}
-	
+
 	/**
-	 * update科技项目 
+	 * update科技项目
+	 * 
 	 * @param t
 	 * @param l
 	 * @param recordTimeFormattedDate
@@ -108,22 +138,57 @@ public class AdminTechProjectController extends BaseApiController{
 	 * @throws ParseException
 	 */
 	@RequestMapping(value = "/updateTechProject", method = RequestMethod.POST)
-	public Result updateTechProject(TechProject t, TechProjectLog l, String recordTimeFormattedDate) throws ParseException{
+	public Result updateTechProject(TechProject t, TechProjectLog l, String recordTimeFormattedDate)
+			throws ParseException {
 		Result res = new Result();
-		Date recordTime =null;
+		Date recordTime = null;
 		if (!StringUtils.isBlank(recordTimeFormattedDate)) {
 			recordTime = DateUtils.parseDate(recordTimeFormattedDate, "yyyy-MM-dd");
 		}
 		res.setData(techProjectService.updateTechProject(t, l, recordTime));
 		return res;
 	}
+
+	/**
+	 * 删除科技项目记录
+	 * 
+	 * @param ids
+	 * @return
+	 */
+	@RequestMapping(value = "/deleteTechProject", method = RequestMethod.POST)
+	public Result deleteTechProject(@RequestParam(name = "ids[]", required = true) String[] ids) {
+		Result res = new Result();
+		List<String> id = new ArrayList<String>();
+		for (String s : ids) {
+			id.add(s);
+		}
+		res.setData(techProjectService.deleteByPrimaryKey(id));
+		return res;
+	}
+
+	 
+	/**
+	 * 删除科技网址记录
+	 * @param ids
+	 * @return
+	 */
+	@RequestMapping(value = "/deleteTechWebsite", method = RequestMethod.POST)
+	public Result deleteTechWebsite(@RequestParam(name = "ids[]", required = true) String[] ids){
+		Result res = new Result();
+		List<String> id = new ArrayList<String>();
+		for (String s : ids) {
+			id.add(s);
+		}
+		res.setData(techWebsiteService.deleteByPrimaryKey(id));
+		return res;
+	}
 	
 	/**
 	 * 科技单位网址管理list
 	 */
 	@SuppressWarnings("unchecked")
 	@RequestMapping(value = "/listTechWebsite", method = RequestMethod.POST)
-	public Result listTechWebsite(String province, String unitName, String pageNo, String pageSize){
+	public Result listTechWebsite(String province, String unitName, String pageNo, String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
@@ -133,13 +198,13 @@ public class AdminTechProjectController extends BaseApiController{
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		
+
 		Pagination<TechWebsiteListBo> t = techWebsiteService.listTechWebsite(province, unitName, pNo, pSize);
-		if (null != t){
-			List<TechWebsiteListBo> l =  (List<TechWebsiteListBo>) t.getList();
-			for (TechWebsiteListBo w : l){
-				if (!StringUtils.isBlank(w.getPassword())){
-					w.setPassword(AesUtils.AesDecrypt(w.getPassword(), aesSecretKey));
+		if (null != t) {
+			List<TechWebsiteListBo> l = (List<TechWebsiteListBo>) t.getList();
+			for (TechWebsiteListBo w : l) {
+				if (!StringUtils.isBlank(w.getPassword())) {
+					w.setPassword(Base64Utils.decodeData(w.getPassword()));
 				}
 			}
 			t.setList(l);
@@ -147,33 +212,35 @@ public class AdminTechProjectController extends BaseApiController{
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 网址管理详情
+	 * 
 	 * @param wid
 	 * @return
 	 */
 	@RequestMapping(value = "/techWebsiteDetail", method = RequestMethod.POST)
-	public Result techWebsiteDetail(String id){
+	public Result techWebsiteDetail(String id) {
 		Result res = new Result();
 		TechWebsite w = techWebsiteService.selectByPrimaryKey(id);
-		if (null != w && !StringUtils.isBlank(w.getPassword())){
-			w.setPassword(AesUtils.AesDecrypt(w.getPassword(), aesSecretKey));
+		if (null != w && !StringUtils.isBlank(w.getPassword())) {
+			w.setPassword(Base64Utils.decodeData(w.getPassword()));
 		}
 		res.setData(w);
 		return res;
 	}
-	
+
 	/**
 	 * 科技单位网址add+update
+	 * 
 	 * @param t
 	 * @return
 	 */
 	@RequestMapping(value = "/disposeTechWebsite", method = RequestMethod.POST)
-	public Result disposeTechWebsite(TechWebsite w){
+	public Result disposeTechWebsite(TechWebsite w) {
 		Result res = new Result();
-		if (null != w && null != w.getPassword()){
-			w.setPassword(AesUtils.AesEncrypt(w.getPassword(), aesSecretKey));
+		if (null != w && null != (w.getPassword())) {
+			w.setPassword(Base64Utils.encodeData(w.getPassword().trim()));
 		}
 		res.setData(techWebsiteService.saveWebsite(w));
 		return res;

+ 1 - 1
src/main/java/com/goafanti/cognizance/service/OrgCognizanceService.java

@@ -19,7 +19,7 @@ public interface OrgCognizanceService {
 
 	OrgCognizance insert(OrgCognizance c);
 
-	Pagination<CognizanceBo> listCognizance(String uid, String locationProvince, Integer pNo, Integer pSize);
+	Pagination<CognizanceBo> listCognizance(String unitName, String locationProvince, Integer pNo, Integer pSize);
 
 	CognizanceOrgInfoBo selectCognizanceOrgInfoBoByUidAndCid(String uid, String cid);
 

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

@@ -47,12 +47,12 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<CognizanceBo> listCognizance(String uid, String locationProvince,  Integer pageNo,
+	public Pagination<CognizanceBo> listCognizance(String unitName, String locationProvince,  Integer pageNo,
 			Integer pageSize) {
 		Map<String, Object> params = new HashMap<>();
 		
-		if (!StringUtils.isBlank(uid)){
-			params.put("uid", uid);
+		if (!StringUtils.isBlank(unitName)){
+			params.put("uid", unitName);
 		}
 		
 		if (!StringUtils.isBlank(locationProvince)){

+ 4 - 0
src/main/java/com/goafanti/common/dao/TechProjectMapper.java

@@ -1,5 +1,7 @@
 package com.goafanti.common.dao;
 
+import java.util.List;
+
 import com.goafanti.common.model.TechProject;
 import com.goafanti.techproject.bo.TechProjectDetailBo;
 
@@ -17,4 +19,6 @@ public interface TechProjectMapper {
     int updateByPrimaryKey(TechProject record);
 
 	TechProjectDetailBo selectProjectDetail(String pid);
+
+	int batchDeleteByPrimaryKey(List<String> id);
 }

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

@@ -18,4 +18,6 @@ public interface TechWebsiteMapper {
     int updateByPrimaryKey(TechWebsite record);
 
 	List<TechWebsite> selectTechWebsiteByUid(String uid);
+
+	int batchDeleteByPrimaryKey(List<String> id);
 }

+ 3 - 3
src/main/java/com/goafanti/common/mapper/OrgCognizanceMapper.xml

@@ -287,8 +287,8 @@
 	) x  
 	LEFT JOIN  admin a on a.id = x.consultant
 	where 1 = 1
-	<if test="uid != null">
-		and x.uid = #{uid,jdbcType=VARCHAR}
+	<if test="unitName != null">
+		and x.unit_ame like  CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
 	</if>
 	<if test="locationProvince != null">
 		and x.location_province = #{locationProvince, jdbcType=VARCHAR}
@@ -415,7 +415,7 @@
 	LEFT JOIN admin a on a.id = i.consultant
 	where u.type = 1 and u.lvl = 1
 	<if test="unitName != null">
-	    and i.unit_name = #{unitName,jdbcType=VARCHAR}
+	    and i.unit_name like  CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
 	</if>
 	<if test="province != null">
 	    and i.location_province = #{province,jdbcType=VARCHAR}

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

@@ -346,8 +346,8 @@
 		 <if test="province != null">
     	and i.location_province = #{province,jdbcType=VARCHAR}
     </if>
-    <if test="uid != null" >
-    	and p.uid = #{uid,jdbcType=VARCHAR}
+    <if test="unitName != null" >
+    	and p.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')  
     </if>
     order by p.serial_number desc
    <if test="page_sql!=null">
@@ -383,4 +383,12 @@
 		LEFT JOIN admin a on p.consultant = a.id 
 		where p.deleted_sign = 0  and p.id = #{uid,jdbcType=VARCHAR}
   </select>
+  
+   <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
+  	update tech_project set deleted_sign = 1
+  	where  id in 
+	<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+		#{item}
+	</foreach>
+  </update>
 </mapper>

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

@@ -143,7 +143,7 @@
     	and i.location_province = #{province,jdbcType=VARCHAR}
     </if>
     <if test="unitName != null" >
-    	and i.unit_name = #{unitName,jdbcType=VARCHAR}
+    	and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')  
     </if>
     order by w.create_time desc
    <if test="page_sql!=null">
@@ -163,4 +163,12 @@
     	and w.uid = #{uid,jdbcType=VARCHAR}
     </if>
   </select>
+  
+   <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
+  	update tech_website set deleted_sign = 1
+  	where  id in 
+	<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+		#{item}
+	</foreach>
+  </update>
 </mapper>

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

@@ -219,8 +219,8 @@
 	<if test=" number != null">
 		and u.number = #{number,jdbcType=INTEGER}
 	</if>
-	<if test="aftUsername != null">
-		and i.aft_username = #{aftUsername,jdbcType=VARCHAR}
+	<if test="unitName != null">
+		and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')   
 	</if>
 	<if test="auditStatus != null">
 		and i.audit_status= #{auditStatus,jdbcType=INTEGER}

+ 116 - 97
src/main/java/com/goafanti/common/utils/AesUtils.java

@@ -14,116 +14,135 @@ import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
 
 
-
 public class AesUtils {
-	
+
 	/**
 	 * 加密
-	 * @param pwd 
+	 * 
+	 * @param pwd
 	 * @param aesSecretKey
 	 * @return
 	 */
-	public static String AesEncrypt(String pwd, String aesSecretKey){
-		return parseByte2HexStr(encrypt(pwd, aesSecretKey)); 
+	public static String AesEncrypt(String pwd, String aesSecretKey) {
+		return parseByte2HexStr(encrypt(pwd, aesSecretKey));
 	}
-	
+
 	/**
 	 * 解密
+	 * 
 	 * @param pwd
 	 * @param aesSecretKey
 	 * @return
 	 */
-	public static String AesDecrypt(String pwd, String aesSecretKey){
-		return new String (decrypt(parseHexStr2Byte(pwd), aesSecretKey));
+	public static String AesDecrypt(String pwd, String aesSecretKey) {
+		return new String(decrypt(parseHexStr2Byte(pwd), aesSecretKey));
+	}
+
+	public static byte[] encrypt(String content, String password) {
+		try {
+			KeyGenerator kgen = KeyGenerator.getInstance("AES");
+			SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
+			random.setSeed(password.getBytes());
+			
+			//kgen.init(128, random);
+			 kgen.init(128, new SecureRandom(password.getBytes()));
+			SecretKey secretKey = kgen.generateKey();
+			byte[] enCodeFormat = secretKey.getEncoded();
+			SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
+			Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+			// byte[] ret = encode(content.getBytes("UTF-8"),password);  
+			  //encrypt = new String(Base64.encode(ret));  
+			 byte[] byteContent = content.getBytes("utf-8");
+			cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化
+			byte[] result = cipher.doFinal(byteContent);
+			return result; // 加密
+		} catch (NoSuchAlgorithmException e) {
+			e.printStackTrace();
+		} catch (NoSuchPaddingException e) {
+			e.printStackTrace();
+		} catch (InvalidKeyException e) {
+			e.printStackTrace();
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		} catch (IllegalBlockSizeException e) {
+			e.printStackTrace();
+		} catch (BadPaddingException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	public static byte[] decrypt(byte[] content, String password) {
+		try {
+			KeyGenerator kgen = KeyGenerator.getInstance("AES");
+			SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
+			random.setSeed(password.getBytes());
+			//kgen.init(128, random);
+			 kgen.init(128, new SecureRandom(password.getBytes()));
+			SecretKey secretKey = kgen.generateKey();
+			byte[] enCodeFormat = secretKey.getEncoded();
+			SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
+			Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+			cipher.init(Cipher.DECRYPT_MODE, key);// 初始化
+			byte[] result = cipher.doFinal(content);
+			return result; // 加密
+		} catch (NoSuchAlgorithmException e) {
+			e.printStackTrace();
+		} catch (NoSuchPaddingException e) {
+			e.printStackTrace();
+		} catch (InvalidKeyException e) {
+			e.printStackTrace();
+		} catch (IllegalBlockSizeException e) {
+			e.printStackTrace();
+		} catch (BadPaddingException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	/**
+	 * 将二进制转换成16进制
+	 * 
+	 * @param buf
+	 * @return
+	 */
+	public static String parseByte2HexStr(byte buf[]) {
+		StringBuffer sb = new StringBuffer();
+		for (int i = 0; i < buf.length; i++) {
+			String hex = Integer.toHexString(buf[i] & 0xFF);
+			if (hex.length() == 1) {
+				hex = '0' + hex;
+			}
+			sb.append(hex.toUpperCase());
+		}
+		return sb.toString();
+	}
+
+	public static byte[] parseHexStr2Byte(String hexStr) {
+		if (hexStr.length() < 1)
+			return null;
+		byte[] result = new byte[hexStr.length() / 2];
+		for (int i = 0; i < hexStr.length() / 2; i++) {
+			int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
+			int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16);
+			result[i] = (byte) (high * 16 + low);
+		}
+		return result;
+
 	}
 	
-	
-	
-	
-	
-	public static byte[] encrypt(String content, String password) {  
-        try {             
-                KeyGenerator kgen = KeyGenerator.getInstance("AES");  
-                kgen.init(128, new SecureRandom(password.getBytes()));  
-                SecretKey secretKey = kgen.generateKey();  
-                byte[] enCodeFormat = secretKey.getEncoded();  
-                SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");  
-                Cipher cipher = Cipher.getInstance("AES");// 创建密码器  
-                byte[] byteContent = content.getBytes("utf-8");  
-                cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化  
-                byte[] result = cipher.doFinal(byteContent);  
-                return result; // 加密  
-        } catch (NoSuchAlgorithmException e) {  
-                e.printStackTrace();  
-        } catch (NoSuchPaddingException e) {  
-                e.printStackTrace();  
-        } catch (InvalidKeyException e) {  
-                e.printStackTrace();  
-        } catch (UnsupportedEncodingException e) {  
-                e.printStackTrace();  
-        } catch (IllegalBlockSizeException e) {  
-                e.printStackTrace();  
-        } catch (BadPaddingException e) {  
-                e.printStackTrace();  
-        }  
-        return null;  
-	}  
-	
-	public static byte[] decrypt(byte[] content, String password) {  
-        try {  
-                 KeyGenerator kgen = KeyGenerator.getInstance("AES");  
-                 kgen.init(128, new SecureRandom(password.getBytes()));  
-                 SecretKey secretKey = kgen.generateKey();  
-                 byte[] enCodeFormat = secretKey.getEncoded();  
-                 SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");              
-                 Cipher cipher = Cipher.getInstance("AES");// 创建密码器  
-                cipher.init(Cipher.DECRYPT_MODE, key);// 初始化  
-                byte[] result = cipher.doFinal(content);  
-                return result; // 加密  
-        } catch (NoSuchAlgorithmException e) {  
-                e.printStackTrace();  
-        } catch (NoSuchPaddingException e) {  
-                e.printStackTrace();  
-        } catch (InvalidKeyException e) {  
-                e.printStackTrace();  
-        } catch (IllegalBlockSizeException e) {  
-                e.printStackTrace();  
-        } catch (BadPaddingException e) {  
-                e.printStackTrace();  
-        }  
-        return null;  
-	}  
-	
-	/**将二进制转换成16进制 
-	 * @param buf 
-	 * @return 
-	 */  
-	public static String parseByte2HexStr(byte buf[]) {  
-	        StringBuffer sb = new StringBuffer();  
-	        for (int i = 0; i < buf.length; i++) {  
-	                String hex = Integer.toHexString(buf[i] & 0xFF);  
-	                if (hex.length() == 1) {  
-	                        hex = '0' + hex;  
-	                }  
-	                sb.append(hex.toUpperCase());  
-	        }  
-	        return sb.toString();  
-	}  
-	
-	public static byte[] parseHexStr2Byte(String hexStr) {  
-        if (hexStr.length() < 1)  
-                return null;  
-        byte[] result = new byte[hexStr.length()/2];  
-        for (int i = 0;i< hexStr.length()/2; i++) {  
-                int high = Integer.parseInt(hexStr.substring(i*2, i*2+1), 16);  
-                int low = Integer.parseInt(hexStr.substring(i*2+1, i*2+2), 16);  
-                result[i] = (byte) (high * 16 + low);  
-        }  
-        return result; 
-        
-    
-	} 
-	
-	
-	
+	/*@Test
+	public void test(){
+		String s = "1";
+		String key = "aft666";
+		String ss = AesEncrypt(s,key);
+		System.out.println(ss);
+		
+		String sss = AesDecrypt(ss, key);
+		System.out.println(sss);
+		
+		System.out.println("716B715661513134686D485A34557531564C476E46513D3D".length());
+		
+	}*/
+
 }

+ 37 - 0
src/main/java/com/goafanti/common/utils/Base64Utils.java

@@ -0,0 +1,37 @@
+package com.goafanti.common.utils;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.codec.binary.Base64;
+
+public class Base64Utils {
+	public static String decodeData(String inputData) {
+        try {
+            if (null == inputData) {
+                return null;
+            }
+            return new String(Base64.decodeBase64(inputData.getBytes("utf-8")), "utf-8");
+        } catch (UnsupportedEncodingException e) {
+            
+        }
+
+        return null;
+    }
+
+    /**
+     * 对给定的字符串进行base64加密操作
+     */
+    public static String encodeData(String inputData) {
+        try {
+            if (null == inputData) {
+                return null;
+            }
+            return new String(Base64.encodeBase64(inputData.getBytes("utf-8")), "utf-8");
+        } catch (UnsupportedEncodingException e) {
+        }
+
+        return null;
+    }
+
+	
+}

+ 4 - 5
src/main/java/com/goafanti/patent/service/impl/PatentCostServiceImpl.java

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
 import com.goafanti.common.dao.PatentCostMapper;
 import com.goafanti.common.model.PatentCost;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.patent.bo.PatentApplicationFeeBo;
@@ -33,11 +34,9 @@ public class PatentCostServiceImpl extends BaseMybatisDao<PatentCostMapper> impl
 		Date pStart = null;
 		Date pEnd = null;
 		
-		if (pDate != null ){
-			pStart = DateUtils.parseDate(pDate[0], "yyyy-MM-dd");
-			if (pDate.length == 2){
-				pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], "yyyy-MM-dd"), 1);
-			}
+		if (pDate != null && pDate.length > 0) {
+			pStart = StringUtils.isBlank(pDate[0]) ? null : DateUtils.parseDate(pDate[0], "yyyy-MM-dd");
+			pEnd = StringUtils.isBlank(pDate[1]) ? null :  DateUtils.addDays(DateUtils.parseDate(pDate[1], "yyyy-MM-dd"), 1);
 		}
 		
 		if (pStart != null){

+ 160 - 0
src/main/java/com/goafanti/techproject/bo/InputTechProject.java

@@ -0,0 +1,160 @@
+package com.goafanti.techproject.bo;
+
+import java.math.BigDecimal;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Size;
+
+import com.goafanti.common.constant.ErrorConstants;
+
+public class InputTechProject {
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		id;
+    
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		uid;
+
+	@Max(value = 3, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		contacts;
+
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		department;
+
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		dispatchInfo;
+	
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		projectName;
+
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		projectCatagory;
+
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		techField;
+
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		projectDes;
+
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		projectMode;
+
+	@Max(value = (long) 999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = (long) 0.00, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private BigDecimal	projectApproval;
+
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		subsidy;
+
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		consultant;
+
+	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;
+	}
+
+	public Integer getContacts() {
+		return contacts;
+	}
+
+	public void setContacts(Integer contacts) {
+		this.contacts = contacts;
+	}
+
+	public String getDepartment() {
+		return department;
+	}
+
+	public void setDepartment(String department) {
+		this.department = department;
+	}
+
+	public String getDispatchInfo() {
+		return dispatchInfo;
+	}
+
+	public void setDispatchInfo(String dispatchInfo) {
+		this.dispatchInfo = dispatchInfo;
+	}
+
+	public String getProjectName() {
+		return projectName;
+	}
+
+	public void setProjectName(String projectName) {
+		this.projectName = projectName;
+	}
+
+	public String getProjectCatagory() {
+		return projectCatagory;
+	}
+
+	public void setProjectCatagory(String projectCatagory) {
+		this.projectCatagory = projectCatagory;
+	}
+
+	public String getTechField() {
+		return techField;
+	}
+
+	public void setTechField(String techField) {
+		this.techField = techField;
+	}
+
+	public String getProjectDes() {
+		return projectDes;
+	}
+
+	public void setProjectDes(String projectDes) {
+		this.projectDes = projectDes;
+	}
+
+	public Integer getProjectMode() {
+		return projectMode;
+	}
+
+	public void setProjectMode(Integer projectMode) {
+		this.projectMode = projectMode;
+	}
+
+	public BigDecimal getProjectApproval() {
+		return projectApproval;
+	}
+
+	public void setProjectApproval(BigDecimal projectApproval) {
+		this.projectApproval = projectApproval;
+	}
+
+	public Integer getSubsidy() {
+		return subsidy;
+	}
+
+	public void setSubsidy(Integer subsidy) {
+		this.subsidy = subsidy;
+	}
+
+	public String getConsultant() {
+		return consultant;
+	}
+
+	public void setConsultant(String consultant) {
+		this.consultant = consultant;
+	}
+	
+	
+}

+ 2 - 1
src/main/java/com/goafanti/techproject/controller/TechProjectApiController.java

@@ -65,7 +65,8 @@ public class TechProjectApiController extends BaseApiController{
 	@RequestMapping(value = "/applyTechProject", method = RequestMethod.POST)
 	public Result applyTechProject(TechProject techProject){
 		Result res = new Result();
-		techProjectService.saveTechProject(techProject, TokenManager.getUserId(), TokenManager.getToken().getAid());
+		techProject.setUid(TokenManager.getUserId());
+		techProjectService.saveTechProject(techProject, TokenManager.getToken().getAid());
 		return res;
 	}
 	

+ 5 - 2
src/main/java/com/goafanti/techproject/service/TechProjectService.java

@@ -1,6 +1,7 @@
 package com.goafanti.techproject.service;
 
 import java.util.Date;
+import java.util.List;
 
 import com.goafanti.common.model.TechProject;
 import com.goafanti.common.model.TechProjectLog;
@@ -15,10 +16,12 @@ public interface TechProjectService {
 
 	int updateTechProject(TechProject t, TechProjectLog l, Date recordTime);
 
-	void saveTechProject(TechProject techProject, String uid, String aid);
+	void saveTechProject(TechProject techProject, String aid);
 
-	Pagination<TechProjectManageListBo> listManageTechProject(String province, String uid, Integer pNo, Integer pSize);
+	Pagination<TechProjectManageListBo> listManageTechProject(String province, String unitName, Integer pNo, Integer pSize);
 
 	TechProjectDetailBo selectProjectDetail(String pid);
 
+	int deleteByPrimaryKey(List<String> id);
+
 }

+ 3 - 0
src/main/java/com/goafanti/techproject/service/TechWebsiteService.java

@@ -1,5 +1,6 @@
 package com.goafanti.techproject.service;
 
+import java.util.List;
 import java.util.Map;
 
 import com.goafanti.common.model.TechWebsite;
@@ -16,4 +17,6 @@ public interface TechWebsiteService {
 
 	TechWebsite selectByPrimaryKey(String id);
 
+	int deleteByPrimaryKey(List<String> id);
+
 }

+ 10 - 4
src/main/java/com/goafanti/techproject/service/impl/TechProjectServiceImpl.java

@@ -3,6 +3,7 @@ package com.goafanti.techproject.service.impl;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -72,7 +73,7 @@ public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> im
 	}
 
 	@Override
-	public void saveTechProject(TechProject techProject, String uid, String aid) {
+	public void saveTechProject(TechProject techProject,  String aid) {
 		techProject.setId(UUID.randomUUID().toString());
 		Calendar now = Calendar.getInstance();
 		now.set(Calendar.MILLISECOND, 0);
@@ -97,14 +98,14 @@ public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> im
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<TechProjectManageListBo> listManageTechProject(String province, String uid, Integer pageNo,
+	public Pagination<TechProjectManageListBo> listManageTechProject(String province, String unitName, Integer pageNo,
 			Integer pageSize) {
 		Map<String, Object> params = new HashMap<>();
 		if (!StringUtils.isBlank(province)){
 			params.put("province", province);
 		}
-		if (!StringUtils.isBlank(uid)){
-			params.put("uid", uid);
+		if (!StringUtils.isBlank(unitName)){
+			params.put("unitName", unitName);
 		}
 		if (pageNo == null || pageNo < 0) {
 			pageNo = 1;
@@ -122,4 +123,9 @@ public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> im
 		return techProjectMapper.selectProjectDetail(pid);
 	}
 
+	@Override
+	public int deleteByPrimaryKey(List<String> id) {
+		return techProjectMapper.batchDeleteByPrimaryKey(id);
+	}
+
 }

+ 5 - 0
src/main/java/com/goafanti/techproject/service/impl/TechWebsiteServiceImpl.java

@@ -76,4 +76,9 @@ public class TechWebsiteServiceImpl extends BaseMybatisDao<TechWebsiteMapper> im
 	public TechWebsite selectByPrimaryKey(String id) {
 		return techWebsiteMapper.selectByPrimaryKey(id);
 	}
+
+	@Override
+	public int deleteByPrimaryKey(List<String> id) {
+		return techWebsiteMapper.batchDeleteByPrimaryKey(id);
+	}
 }

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

@@ -854,6 +854,18 @@ public class UserApiController extends BaseApiController {
 		 return res;
 	}
 	
+	/**
+	 * 获取公司联系人
+	 * @param uid
+	 * @return
+	 */
+	@RequestMapping(value = "/getContacts", method = RequestMethod.POST)
+	public Result getContacts(String uid){
+		Result res = new Result();
+		res.setData(organizationIdentityService.selectContactsByUserId(StringUtils.isBlank(uid) ? TokenManager.getUserId() :uid ));
+		return res;
+	}
+	
 	
 
 	// 认证失败清除相关认证信息

+ 1 - 0
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -82,6 +82,7 @@ public class UserRegisterController extends BaseController {
 		}
 		if (res.getError().isEmpty()) {
 			user.setId(UUID.randomUUID().toString());
+			user.setMobile(user.getMobile().trim());
 			Calendar now = Calendar.getInstance();
 			now.set(Calendar.MILLISECOND, 0);
 			user.setCreateTime(now.getTime());

+ 1 - 1
src/main/java/com/goafanti/user/service/UserService.java

@@ -30,7 +30,7 @@ public interface UserService {
 	Pagination<UserListBo> listUser(String mobile, String email, String[] createTime, Integer number,
 			String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException;
 
-	Pagination<OrgListBo> listOrg(String mobile, String email, String[] createTime, Integer number, String aftUsername,
+	Pagination<OrgListBo> listOrg(String mobile, String email, String[] createTime, Integer number, String unitName,
 			Integer auditStatus, Integer pNo, Integer pSize) throws ParseException;
 
 }

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

@@ -97,7 +97,7 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<UserListBo> listUser(String mobile, String email, String[] pDate, Integer number,
-			String aftUsername, Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
+			String unitName, Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
 		Map<String, Object> params = new HashMap<>();
 		Date pStart = null;
 		Date pEnd = null;
@@ -129,8 +129,8 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 			params.put("number", number);
 		}
 		
-		if (!StringUtils.isBlank(aftUsername)){
-			params.put("aftUsername", aftUsername);
+		if (!StringUtils.isBlank(unitName)){
+			params.put("unitName", unitName);
 		}
 		
 		if (null != auditStatus){
@@ -156,7 +156,10 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		Date pStart = null;
 		Date pEnd = null;
 		
-		if (null != pDate ){
+		if (null != pDate && pDate.length > 0){
+			pStart = StringUtils.isBlank(pDate[0]) ? null : DateUtils.parseDate(pDate[0], "yyyy-MM-dd");
+			pEnd = StringUtils.isBlank(pDate[1]) ? null : DateUtils.addDays(DateUtils.parseDate(pDate[1], "yyyy-MM-dd"), 1);
+			
 			pStart = DateUtils.parseDate(pDate[0], "yyyy-MM-dd");
 			if (pDate.length == 2){
 				pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], "yyyy-MM-dd"), 1);