Browse Source

科技服务--专利相关接口

Antiloveg 9 years ago
parent
commit
35519076c8
29 changed files with 444 additions and 152 deletions
  1. 3 1
      src/main/java/com/goafanti/common/constant/ErrorConstants.java
  2. 5 0
      src/main/java/com/goafanti/common/controller/WebpageController.java
  3. 2 0
      src/main/java/com/goafanti/common/dao/AdminMapper.java
  4. 5 0
      src/main/java/com/goafanti/common/dao/PatentRegistrationMapper.java
  5. 7 0
      src/main/java/com/goafanti/common/mapper/AdminMapper.xml
  6. 53 1
      src/main/java/com/goafanti/common/mapper/PatentCostMapper.xml
  7. 3 18
      src/main/java/com/goafanti/common/mapper/PatentInfoMapper.xml
  8. 9 9
      src/main/java/com/goafanti/common/mapper/PatentLogMapper.xml
  9. 38 0
      src/main/java/com/goafanti/common/mapper/PatentRegistrationMapper.xml
  10. 17 15
      src/main/java/com/goafanti/common/model/PatentLog.java
  11. 46 41
      src/main/java/com/goafanti/common/utils/PasswordUtil.java
  12. 5 0
      src/main/java/com/goafanti/core/shiro/token/ShiroToken.java
  13. 26 1
      src/main/java/com/goafanti/core/shiro/token/TokenManager.java
  14. 48 32
      src/main/java/com/goafanti/core/shiro/token/UserRealm.java
  15. 6 5
      src/main/java/com/goafanti/techservice/patent/bo/PatentApplicationFeeBo.java
  16. 92 13
      src/main/java/com/goafanti/techservice/patent/controller/PatentApiController.java
  17. 2 0
      src/main/java/com/goafanti/techservice/patent/service/AdminService.java
  18. 2 0
      src/main/java/com/goafanti/techservice/patent/service/PatentCostService.java
  19. 0 3
      src/main/java/com/goafanti/techservice/patent/service/PatentInfoService.java
  20. 5 0
      src/main/java/com/goafanti/techservice/patent/service/PatentRegistrationService.java
  21. 5 0
      src/main/java/com/goafanti/techservice/patent/service/impl/AdminServiceImpl.java
  22. 7 1
      src/main/java/com/goafanti/techservice/patent/service/impl/PatentCostServiceImpl.java
  23. 0 6
      src/main/java/com/goafanti/techservice/patent/service/impl/PatentInfoServiceImpl.java
  24. 25 1
      src/main/java/com/goafanti/techservice/patent/service/impl/PatentRegistrationServiceImpl.java
  25. 19 2
      src/main/java/com/goafanti/user/controller/UserLoginController.java
  26. 1 1
      src/main/resources/spring/spring-shiro.xml
  27. 1 1
      src/main/webapp/WEB-INF/html/test.html
  28. 11 0
      src/main/webapp/WEB-INF/views/user/certify.jsp
  29. 1 1
      src/main/webapp/WEB-INF/web.xml

+ 3 - 1
src/main/java/com/goafanti/common/constant/ErrorConstants.java

@@ -52,6 +52,8 @@ public class ErrorConstants {
 	
 	public static final String FILE_NON_EXISTENT = "FILE_NON_EXISTENT";
 	
-	public static final String INSUFFICIENT_AUTHORITY_ERROR ="INSUFFICIENT_AUTHORITY_ERROR";
+	public static final String INSUFFICIENT_AUTHORITY_ERROR = "INSUFFICIENT_AUTHORITY_ERROR";
+	
+	public static final String FEE_EMPTY_ERROR = "FEE_EMPTY_ERROR";
 
 }

+ 5 - 0
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -35,6 +35,11 @@ public class WebpageController extends BaseController {
 		return "/user/signIn";
 	}
 	
+	@RequestMapping(value = "/user/certify", method = RequestMethod.GET)
+	public String userCertify(HttpServletRequest request, ModelAndView modelview) {
+		return "/user/certify";
+	}
+	
 	@RequestMapping(value = "/user/account/services", method = RequestMethod.GET)
 	public String userServices(HttpServletRequest request, ModelAndView modelview) {
 		return "/user/account/services";

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

@@ -18,4 +18,6 @@ public interface AdminMapper {
     int updateByPrimaryKey(Admin record);
 
 	List<Admin> selectAllAdmin();
+
+	Admin selectByMobile(String mobile);
 }

+ 5 - 0
src/main/java/com/goafanti/common/dao/PatentRegistrationMapper.java

@@ -1,6 +1,8 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PatentRegistration;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.techservice.patent.bo.PatentRecieveSendBo;
 
 public interface PatentRegistrationMapper {
     int deleteByPrimaryKey(String id);
@@ -14,4 +16,7 @@ public interface PatentRegistrationMapper {
     int updateByPrimaryKeySelective(PatentRegistration record);
 
     int updateByPrimaryKey(PatentRegistration record);
+
+	Pagination<PatentRecieveSendBo> getRecieveSendList(Integer pNo, Integer pSize);
+
 }

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

@@ -120,4 +120,11 @@
     <include refid="Base_Column_List" />
     from admin 
   </select>
+  
+  <select id="selectByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
+     select 
+    <include refid="Base_Column_List" />
+    from admin 
+    where mobile = #{mobile,jdbcType=VARCHAR}
+  </select> 
 </mapper>

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

@@ -151,6 +151,58 @@
     where id = #{id,jdbcType=VARCHAR}
   </update>
   
-  <select>
+  <select id="findApplicationFeeListByPage" parameterType="String" resultType="com.goafanti.techservice.patent.bo.PatentApplicationFeeBo">
+  	select m.uid as uid , m.pid as pid , m.oid ,
+       		m.serialNumber ,m.patentNumber ,
+     	    m.locationProvince , m.unitName , 
+      		m.patentName , m.authorizedDate ,
+  	    c.id as cid ,
+    	c.payment_state as paymentState,c.application_fee as applicationFee ,
+    	c.trial_fee as trialFee , c.printing_fee as printingFee , 
+   	    c.is_request_funds as isRequestFunds , c.is_reimbursement as isReimbursement
+   	from patent_cost c RIGHT JOIN 
+     	(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_name as patentName , p.authorized_date as authorizedDate
+    from user u
+		INNER JOIN patent_info p on u.id =p.uid
+		INNER JOIN organization_identity o on o.uid = u.id  
+		where 1=1
+		<if test="locationProvince != null">
+		 and o.location_province = #{locationProvince,jdbcType=VARCHAR}
+		</if>
+		<if test="pStart != null">
+		 and p.authorized_date <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
+		</if>
+		<if test="pEnd">
+		 and p.authorized_date <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
+		</if>
+		order by p.authorized_date DESC) m
+   on c.pid = m.pid 
+   <if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findApplicationFeeCount" resultType="java.lang.Integer"> 
+	select count(1) from   (select  m.uid as uid , m.pid as pid , m.oid ,
+       		m.serialNumber ,m.patentNumber ,
+     	    m.locationProvince , m.unitName , 
+      		m.patentName , m.authorizedDate ,
+      		c.id as cid ,
+		    	c.payment_state as paymentState,c.application_fee as applicationFee ,
+		    	c.trial_fee as trialFee , c.printing_fee as printingFee , 
+		   	    c.is_request_funds as isRequestFunds , c.is_reimbursement as isReimbursement
+		   	from patent_cost c RIGHT JOIN 
+		     	(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_name as patentName , p.authorized_date as authorizedDate
+		    from user u
+				INNER JOIN patent_info p on u.id =p.uid
+				INNER JOIN organization_identity o on o.uid = u.id  
+				order by p.authorized_date DESC) m
+		   on c.pid = m.pid) n 
   </select>
 </mapper>

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

@@ -517,10 +517,11 @@
                p.patent_catagory as patentCatagory ,p.patent_state as patentState , p.authorized_date as authorizedDate
         from user u
 		INNER JOIN patent_info p on u.id =p.uid
-		INNER JOIN organization_identity o on o.uid = u.id where p.patent_state=8 order by p.authorized_date DESC
+		INNER JOIN organization_identity o on o.uid = u.id where p.patent_state=8 
 		<if test="locationProvince != null">
 		 and o.location_province = #{locationProvince,jdbcType=VARCHAR}
 		</if>
+		order by p.authorized_date DESC
 		) n
 		on n.pid= c.pid where c.annual_fee_state=0
 		
@@ -595,23 +596,7 @@
 	where p.patent_state in (4,6) order by p.authorized_date DESC  ) as n
   </select>
   
-  <select id="getPatentRecieveSendList" resultType="com.goafanti.techservice.patent.bo.PatentRecieveSendBo">
-   select r.id as rid, r.acceptance_receive_time as acceptanceReceiveTime , r.acceptance_issue_time as acceptanceIssueTime, 
-  	   r.acceptance_tracking_number as acceptanceTrackingNumber , r.acceptance_express_company as acceptanceExpressCompany,
-       r.authorization_receive_time as authorizationReceiveTime , r.authorization_issue_time as authorizationIssueTime, 
-       r.authorization_tracking_number as authorizationTrackingNumber , r.authorization_express_company as authorizationExpressCompany,
-       r.certificate_recieve_time as certificateRecieveTime, r.certificate_issue_time as certificateIssueTime, 
-       r.certificate_tracking_number as certificateTrackingNumber, r.certificate_express_company as certificateExpressCompany,
-       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
-       from user u
-	   INNER JOIN patent_info p on u.id =p.uid
-	   INNER JOIN organization_identity o on o.uid = u.id
-	   ) m
-  LEFT JOIN patent_registration r on m.pid = r.pid
-  </select>
+  
   
   
 </mapper>

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

@@ -6,8 +6,8 @@
     <result column="pid" property="pid" jdbcType="VARCHAR" />
     <result column="record_time" property="recordTime" jdbcType="TIMESTAMP" />
     <result column="state" property="state" jdbcType="INTEGER" />
-    <result column="principal" property="principal" jdbcType="INTEGER" />
-    <result column="operator" property="operator" jdbcType="INTEGER" />
+    <result column="principal" property="principal" jdbcType="VARCHAR" />
+    <result column="operator" property="operator" jdbcType="VARCHAR" />
     <result column="comment" property="comment" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
@@ -28,7 +28,7 @@
       state, principal, operator, 
       comment)
     values (#{id,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{recordTime,jdbcType=TIMESTAMP}, 
-      #{state,jdbcType=INTEGER}, #{principal,jdbcType=INTEGER}, #{operator,jdbcType=INTEGER}, 
+      #{state,jdbcType=INTEGER}, #{principal,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR}, 
       #{comment,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.PatentLog" >
@@ -70,10 +70,10 @@
         #{state,jdbcType=INTEGER},
       </if>
       <if test="principal != null" >
-        #{principal,jdbcType=INTEGER},
+        #{principal,jdbcType=VARCHAR},
       </if>
       <if test="operator != null" >
-        #{operator,jdbcType=INTEGER},
+        #{operator,jdbcType=VARCHAR},
       </if>
       <if test="comment != null" >
         #{comment,jdbcType=VARCHAR},
@@ -93,10 +93,10 @@
         state = #{state,jdbcType=INTEGER},
       </if>
       <if test="principal != null" >
-        principal = #{principal,jdbcType=INTEGER},
+        principal = #{principal,jdbcType=VARCHAR},
       </if>
       <if test="operator != null" >
-        operator = #{operator,jdbcType=INTEGER},
+        operator = #{operator,jdbcType=VARCHAR},
       </if>
       <if test="comment != null" >
         comment = #{comment,jdbcType=VARCHAR},
@@ -109,8 +109,8 @@
     set pid = #{pid,jdbcType=VARCHAR},
       record_time = #{recordTime,jdbcType=TIMESTAMP},
       state = #{state,jdbcType=INTEGER},
-      principal = #{principal,jdbcType=INTEGER},
-      operator = #{operator,jdbcType=INTEGER},
+      principal = #{principal,jdbcType=VARCHAR},
+      operator = #{operator,jdbcType=VARCHAR},
       comment = #{comment,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>

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

@@ -202,4 +202,42 @@
       certificate_express_company = #{certificateExpressCompany,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  
+  <select id="findRecieveSendList" resultType="com.goafanti.techservice.patent.bo.PatentRecieveSendBo">
+   select r.id as rid, r.acceptance_receive_time as acceptanceReceiveTime , r.acceptance_issue_time as acceptanceIssueTime, 
+  	   r.acceptance_tracking_number as acceptanceTrackingNumber , r.acceptance_express_company as acceptanceExpressCompany,
+       r.authorization_receive_time as authorizationReceiveTime , r.authorization_issue_time as authorizationIssueTime, 
+       r.authorization_tracking_number as authorizationTrackingNumber , r.authorization_express_company as authorizationExpressCompany,
+       r.certificate_recieve_time as certificateRecieveTime, r.certificate_issue_time as certificateIssueTime, 
+       r.certificate_tracking_number as certificateTrackingNumber, r.certificate_express_company as certificateExpressCompany,
+       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
+       from user u
+	   INNER JOIN patent_info p on u.id =p.uid
+	   INNER JOIN organization_identity o on o.uid = u.id
+	   ) m
+  LEFT JOIN patent_registration r on m.pid = r.pid
+  </select>
+  
+  <select id="findRecieveSendCount" resultType="java.lang.Integer">
+  	select count(1) from (
+  	 select r.id as rid, r.acceptance_receive_time as acceptanceReceiveTime , r.acceptance_issue_time as acceptanceIssueTime, 
+  	   r.acceptance_tracking_number as acceptanceTrackingNumber , r.acceptance_express_company as acceptanceExpressCompany,
+       r.authorization_receive_time as authorizationReceiveTime , r.authorization_issue_time as authorizationIssueTime, 
+       r.authorization_tracking_number as authorizationTrackingNumber , r.authorization_express_company as authorizationExpressCompany,
+       r.certificate_recieve_time as certificateRecieveTime, r.certificate_issue_time as certificateIssueTime, 
+       r.certificate_tracking_number as certificateTrackingNumber, r.certificate_express_company as certificateExpressCompany,
+       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
+       from user u
+	   INNER JOIN patent_info p on u.id =p.uid
+	   INNER JOIN organization_identity o on o.uid = u.id
+	   ) m
+    LEFT JOIN patent_registration r on m.pid = r.pid
+  	) k
+  </select>
 </mapper>

+ 17 - 15
src/main/java/com/goafanti/common/model/PatentLog.java

@@ -20,12 +20,12 @@ public class PatentLog {
     /**
     * 负责人
     */
-    private Integer principal;
+    private String principal;
 
     /**
     * 操作人
     */
-    private Integer operator;
+    private String operator;
 
     /**
     * 备注
@@ -64,23 +64,25 @@ public class PatentLog {
         this.state = state;
     }
 
-    public Integer getPrincipal() {
-        return principal;
-    }
+    
 
-    public void setPrincipal(Integer principal) {
-        this.principal = principal;
-    }
+    public String getPrincipal() {
+		return principal;
+	}
 
-    public Integer getOperator() {
-        return operator;
-    }
+	public void setPrincipal(String principal) {
+		this.principal = principal;
+	}
 
-    public void setOperator(Integer operator) {
-        this.operator = operator;
-    }
+	public String getOperator() {
+		return operator;
+	}
+
+	public void setOperator(String operator) {
+		this.operator = operator;
+	}
 
-    public String getComment() {
+	public String getComment() {
         return comment;
     }
 

+ 46 - 41
src/main/java/com/goafanti/common/utils/PasswordUtil.java

@@ -1,41 +1,46 @@
-package com.goafanti.common.utils;
-
-import java.util.Date;
-
-import org.apache.shiro.crypto.hash.SimpleHash;
-import org.apache.shiro.util.ByteSource;
-
-import com.goafanti.common.model.User;
-
-public class PasswordUtil {
-	private String algorithmName = "md5";
-	private int hashIterations = 2;
-
-	public void setAlgorithmName(String algorithmName) {
-		this.algorithmName = algorithmName;
-	}
-
-	public void setHashIterations(int hashIterations) {
-		this.hashIterations = hashIterations;
-	}
-
-	public void encryptPassword(User user) {
-		user.setPassword(getEncryptPwd(user));
-	}
-
-	public String getEncryptPwd(User user) {
-		return new SimpleHash(algorithmName, user.getPassword(), getSalt(user), hashIterations).toHex();
-	}
-
-	public String getEncryptPwd(String pwd, Date date) {
-		return new SimpleHash(algorithmName, pwd, getSalt(date), hashIterations).toHex();
-	}
-
-	public ByteSource getSalt(User user) {
-		return ByteSource.Util.bytes(String.valueOf(user.getCreateTime().getTime()));
-	}
-
-	public ByteSource getSalt(Date date) {
-		return ByteSource.Util.bytes(String.valueOf(date.getTime()));
-	}
-}
+package com.goafanti.common.utils;
+
+import java.util.Date;
+
+import org.apache.shiro.crypto.hash.SimpleHash;
+import org.apache.shiro.util.ByteSource;
+
+import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.User;
+
+public class PasswordUtil {
+	private String algorithmName = "md5";
+	private int hashIterations = 2;
+
+	public void setAlgorithmName(String algorithmName) {
+		this.algorithmName = algorithmName;
+	}
+
+	public void setHashIterations(int hashIterations) {
+		this.hashIterations = hashIterations;
+	}
+
+	public void encryptPassword(User user) {
+		user.setPassword(getEncryptPwd(user));
+	}
+
+	public String getEncryptPwd(User user) {
+		return new SimpleHash(algorithmName, user.getPassword(), getSalt(user), hashIterations).toHex();
+	}
+
+	public String getEncryptPwd(String pwd, Date date) {
+		return new SimpleHash(algorithmName, pwd, getSalt(date), hashIterations).toHex();
+	}
+
+	public ByteSource getSalt(User user) {
+		return ByteSource.Util.bytes(String.valueOf(user.getCreateTime().getTime()));
+	}
+	
+	public ByteSource getManageSalt(Admin admin) {
+		return ByteSource.Util.bytes(String.valueOf(admin.getCreateTime().getTime()));
+	}
+
+	public ByteSource getSalt(Date date) {
+		return ByteSource.Util.bytes(String.valueOf(date.getTime()));
+	}
+}

+ 5 - 0
src/main/java/com/goafanti/core/shiro/token/ShiroToken.java

@@ -13,6 +13,11 @@ public class ShiroToken extends UsernamePasswordToken implements Serializable {
 		this.pwd = pwd;
 		this.type = type;
 	}
+	
+	public ShiroToken(String username, String pwd) {
+		super(username, pwd);
+		this.pwd = pwd;
+	}
 
 	/** 登录密码[字符串类型] 因为父类是char[] ] **/
 	private String pwd;

+ 26 - 1
src/main/java/com/goafanti/core/shiro/token/TokenManager.java

@@ -6,6 +6,7 @@ import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.session.Session;
 import org.apache.shiro.subject.SimplePrincipalCollection;
 
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.SpringContextUtils;
 import com.goafanti.core.shiro.session.CustomSessionManager;
@@ -73,6 +74,15 @@ public class TokenManager {
 	public static Object getVal2Session(Object key) {
 		return getSession().getAttribute(key);
 	}
+	
+	/**
+	 * 获取当前登录的管理员对象
+	 * @return
+	 */
+	public static Admin getAdminToken() {
+		Admin token = (Admin) SecurityUtils.getSubject().getPrincipal();
+		return token;
+	}
 
 	/**
 	 * 获取验证码,获取一次后删除
@@ -86,7 +96,7 @@ public class TokenManager {
 	}
 
 	/**
-	 * 登录
+	 * 用户登录
 	 * 
 	 * @param user
 	 * @param rememberMe
@@ -98,6 +108,21 @@ public class TokenManager {
 		SecurityUtils.getSubject().login(token);
 		return getToken();
 	}
+	
+	/**
+	 * 管理员登录
+	 * @param admin
+	 * @param rememberMe
+	 * @return
+	 */
+	public static Admin manageLogin(Admin admin, Boolean rememberMe) {
+		ShiroToken token = new ShiroToken(admin.getMobile(), admin.getPassword());
+		token.setRememberMe(null == rememberMe ? false : rememberMe);
+		SecurityUtils.getSubject().login(token);
+		return getAdminToken();
+	}
+    
+	
 
 	/**
 	 * 判断是否登录

+ 48 - 32
src/main/java/com/goafanti/core/shiro/token/UserRealm.java

@@ -14,46 +14,61 @@ import org.apache.shiro.subject.PrincipalCollection;
 import org.apache.shiro.subject.SimplePrincipalCollection;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.PasswordUtil;
+import com.goafanti.techservice.patent.service.AdminService;
 import com.goafanti.user.service.UserService;
 
-
 public class UserRealm extends AuthorizingRealm {
 	@Autowired
-    UserService userService;
+	UserService				userService;
+	@Autowired
+	AdminService			adminService;
 	@Resource(name = "passwordUtil")
-	private PasswordUtil passwordUtil;
+	private PasswordUtil	passwordUtil;
+
 	public UserRealm() {
 		super();
 	}
 
 	/**
-	 * 认证信息,主要针对用户登录
+	 * 登录
 	 */
 	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken)
 			throws AuthenticationException {
 
 		ShiroToken token = (ShiroToken) authcToken;
-		 User user = userService.selectByMobieAndType(token.getUsername(),token.getType());
-		 if (null == user){
-			 throw new UnknownAccountException();
-		 }
-		 return new SimpleAuthenticationInfo(user, user.getPassword(), passwordUtil.getSalt(user), getName());
-//		User user = userService.findUserByEmail(token.getUsername());
-//		if (null == user) {
-//			throw new UnknownAccountException();
-//		} else if (ShiroConstants.USER_DISABLE.equals(user.getStatus())) {
-//			/**
-//			 * 如果用户的status为禁用。那么就抛出<code>DisabledAccountException</code>
-//			 */
-//			throw new DisabledAccountException("帐号已经禁止登录!");
-//		} else {
-//			user.setLastLoginTime(new Date());
-//			userService.updateByPrimaryKeySelective(user);
-//		}
-//		return new SimpleAuthenticationInfo(user, user.getPwd(), passwordUtil.getSalt(user), getName());
-		//return null;
+		if (null == token.getType()) {
+			Admin admin = adminService.selectByMobile(token.getUsername());
+			if (null == admin) {
+				throw new UnknownAccountException();
+			}
+			return new SimpleAuthenticationInfo(admin, admin.getPassword(), passwordUtil.getManageSalt(admin),
+					getName());
+		} else {
+			User user = userService.selectByMobieAndType(token.getUsername(), token.getType());
+			if (null == user) {
+
+				throw new UnknownAccountException();
+			}
+			return new SimpleAuthenticationInfo(user, user.getPassword(), passwordUtil.getSalt(user), getName());
+		}
+		// User user = userService.findUserByEmail(token.getUsername());
+		// if (null == user) {
+		// throw new UnknownAccountException();
+		// } else if (ShiroConstants.USER_DISABLE.equals(user.getStatus())) {
+		// /**
+		// * 如果用户的status为禁用。那么就抛出<code>DisabledAccountException</code>
+		// */
+		// throw new DisabledAccountException("帐号已经禁止登录!");
+		// } else {
+		// user.setLastLoginTime(new Date());
+		// userService.updateByPrimaryKeySelective(user);
+		// }
+		// return new SimpleAuthenticationInfo(user, user.getPwd(),
+		// passwordUtil.getSalt(user), getName());
+		// return null;
 	}
 
 	/**
@@ -62,15 +77,16 @@ public class UserRealm extends AuthorizingRealm {
 	@Override
 	protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
 
-//		Long userId = TokenManager.getUserId();
-//		SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
-//		// 根据用户ID查询角色(role),放入到Authorization里。
-//		Set<String> roles = roleService.findRoleByUserId(userId);
-//		info.setRoles(roles);
-//		// 根据用户ID查询权限(permission),放入到Authorization里。
-//		Set<String> permissions = permissionService.findPermissionByUserId(userId);
-//		info.setStringPermissions(permissions);
-//		return info;
+		// Long userId = TokenManager.getUserId();
+		// SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
+		// // 根据用户ID查询角色(role),放入到Authorization里。
+		// Set<String> roles = roleService.findRoleByUserId(userId);
+		// info.setRoles(roles);
+		// // 根据用户ID查询权限(permission),放入到Authorization里。
+		// Set<String> permissions =
+		// permissionService.findPermissionByUserId(userId);
+		// info.setStringPermissions(permissions);
+		// return info;
 		return null;
 	}
 

+ 6 - 5
src/main/java/com/goafanti/techservice/patent/bo/PatentApplicationFeeBo.java

@@ -36,7 +36,7 @@ public class PatentApplicationFeeBo {
 	
 	private Integer isReimbursement;
 	
-	private Date patentApplicationDate;
+	private Date authorizedDate;
 
 	public String getUid() {
 		return uid;
@@ -158,13 +158,14 @@ public class PatentApplicationFeeBo {
 		this.isReimbursement = isReimbursement;
 	}
 
-	public Date getPatentApplicationDate() {
-		return patentApplicationDate;
+	public Date getAuthorizedDate() {
+		return authorizedDate;
 	}
 
-	public void setPatentApplicationDate(Date patentApplicationDate) {
-		this.patentApplicationDate = patentApplicationDate;
+	public void setAuthorizedDate(Date authorizedDate) {
+		this.authorizedDate = authorizedDate;
 	}
+
 	
 	
 }

+ 92 - 13
src/main/java/com/goafanti/techservice/patent/controller/PatentApiController.java

@@ -1,6 +1,7 @@
 package com.goafanti.techservice.patent.controller;
 
 import java.text.ParseException;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.OrganizationIdentity;
@@ -66,6 +68,10 @@ public class PatentApiController extends BaseApiController {
 		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());
+		patentCostService.insert(patentCost);
 		res.setData(patentInfo);
 		return res;
 	}
@@ -89,7 +95,7 @@ public class PatentApiController extends BaseApiController {
 			String pageNo, String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
-		Integer pSize = 15;
+		Integer pSize = 10;
 
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
@@ -122,7 +128,7 @@ public class PatentApiController extends BaseApiController {
 			String author,String pageNo, String pageSize) throws ParseException{
 		Result res =new Result();
 		Integer pNo = 1;
-		Integer pSize = 15;
+		Integer pSize = 10;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
@@ -178,6 +184,10 @@ public class PatentApiController extends BaseApiController {
 		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());
+		patentCostService.insert(patentCost);
 		res.setData(patentInfo);
 		return res;
 	}
@@ -219,7 +229,7 @@ public class PatentApiController extends BaseApiController {
 	public Result managePendingPaymentList(String locationProvince,String pageNo, String pageSize){
 		Result res = new Result();
 		Integer pNo = 1;
-		Integer pSize = 15;
+		Integer pSize = 10;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
@@ -255,7 +265,7 @@ public class PatentApiController extends BaseApiController {
 			 Integer patentCatagory, String patentName, Integer patentState ,String author ,String pageNo, String pageSize){
 		Result res = new Result();
 		Integer pNo = 1;
-		Integer pSize = 15;
+		Integer pSize = 10;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
@@ -268,20 +278,60 @@ public class PatentApiController extends BaseApiController {
 	}
 	
 	/**
+	 * 补正审查通知答复确认
+	 */
+	@RequestMapping(value="/replyConfirm",method = RequestMethod.POST)
+	public Result replyConfirm(String pid ,Integer patentState){
+		Result res = new Result();
+		PatentInfo patentInfo = new PatentInfo();
+		patentInfo.setId(pid);
+		if(patentState == 4){
+			patentInfo.setPatentState(5);
+		}else if(patentState == 6){
+			patentInfo.setPatentState(7);
+		}else{
+			res.getError().add(buildError("通知答复确认失败!"));
+			return res;
+		}
+		patentInfoService.updateByPrimaryKeySelective(patentInfo);
+		PatentLog patentLog = new PatentLog();
+		PatentInfo p = patentInfoService.selectByPrimaryKey(pid);
+		patentLog.setId(UUID.randomUUID().toString());
+		patentLog.setPid(pid);
+		patentLog.setState(p.getPatentState());
+		patentLog.setOperator(TokenManager.getAdminToken().getId());
+		patentLog.setPrincipal(p.getPrincipal());
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		patentLog.setRecordTime(now.getTime());
+		patentLogService.insert(patentLog);
+		return res;
+	}
+	
+	/**
 	 * 收发详情入口/收发纸件登记
 	 */
 	@RequestMapping(value="/getRecieveSendList",method = RequestMethod.POST)
-	public Result getRecieveSendList(){
+	public Result RecieveSendList(String pageNo, String pageSize){
 		Result res = new Result();
-		List<PatentRecieveSendBo> patentRecieveSendBo = patentInfoService.getPatentRecieveSendList();
-		res.setData(patentRecieveSendBo);
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(getRecieveSendList(pNo,pSize));
 		return res;
 	}
 	
+	
+
 	/**
 	 * 收发详情保存修改
 	 */
-	@RequestMapping(value="/getRecieveSendList",method = RequestMethod.GET)
+	@RequestMapping(value="/saveRecieveSend",method = RequestMethod.POST)
 	public Result recieveSendDetail(String rid,PatentRegistration patentRegistration){
 		Result res = new Result();
 		patentRegistration.setId(rid);
@@ -297,20 +347,47 @@ public class PatentApiController extends BaseApiController {
 			throws ParseException{
 		Result res = new Result();
 		Integer pNo = 1;
-		Integer pSize = 15;
+		Integer pSize = 10;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		res.setData(getApplicationFeeList(patentApplicationDate,locationProvince,pSize,pNo));
+		res.setData(getApplicationFeeList(patentApplicationDate,locationProvince,pNo,pSize));
+		return res;
+	}
+	
+	/**
+	 * 登记申请费用
+	 */
+	@RequestMapping(value="/registerApplicationFee",method=RequestMethod.POST)
+	public Result registerApplicationFee(PatentCost patentCost,String cid){
+		Result res = new Result();
+		PatentCost p = new PatentCost();
+		if(null == patentCost.getApplicationFee() || null == patentCost.getPrintingFee() || null == patentCost.getTrialFee()){
+			res.getError().add(buildError(ErrorConstants.FEE_EMPTY_ERROR,"申请费、实审费、文印费均不能为空!"));
+			return res;
+		}
+		p.setId(cid);
+		p.setApplicationFee(patentCost.getApplicationFee());
+		p.setIsReimbursement(patentCost.getIsReimbursement());
+		p.setIsRequestFunds(patentCost.getIsRequestFunds());
+		p.setTrialFee(patentCost.getTrialFee());
+		p.setPrintingFee(patentCost.getPrintingFee());
+		p.setPaymentState("1");
+		res.setData(patentCostService.updateByPrimaryKeySelective(p));
 		return res;
 	}
 	
 	
 	
 	
+	//专利纸件收发登记
+	private Pagination<PatentRecieveSendBo> getRecieveSendList(Integer pNo,Integer pSize) {
+		return (Pagination<PatentRecieveSendBo>) patentRegistrationService.getRecieveSendList(pNo,pSize) ;
+	}
+	
 	
 	//专利申请费用管理
 	private Pagination<PatentApplicationFeeBo> getApplicationFeeList(String[] patentApplicationDate, String locationProvince, 
@@ -326,11 +403,12 @@ public class PatentApiController extends BaseApiController {
 				patentCatagory,patentName,patentState,author,pNo,pSize);
 	}
     
-	//
+	//待缴费专利管理
 	private Pagination<PatentPendingBo> getManagePendingPaymentList(String locationProvince, Integer pNo, Integer pSize) {
 		return (Pagination<PatentPendingBo>) patentInfoService.getManagePendingPaymentList(locationProvince,pNo,pSize);
 	}
-
+    
+	//管理端申请专利列表
 	private Pagination<PatentCompositeBo> getManagePatentList(String serialNumber,String patentNumber,String office,String locationProvince,String unitName,
 			Integer patentCatagory,String patentName,Integer patentState,String[] createTime,String[] patentApplicationDate,
 			String author,Integer pNo, Integer pSize) throws ParseException{
@@ -338,7 +416,8 @@ public class PatentApiController extends BaseApiController {
 				 patentCatagory, patentName, patentState, createTime, patentApplicationDate,
 				  author, pNo,  pSize);
 	}
-
+    
+	//用户端申请专利列表
 	private Pagination<PatentInfo> getClientApplyList(Result res, String patentNumber, String patentName,
 			Integer patentCatagory, Integer patentState, Integer pNo, Integer pSize) {
 		return (Pagination<PatentInfo>) patentInfoService.getClientApplyList(TokenManager.getUserId(), patentNumber,

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

@@ -8,4 +8,6 @@ public interface AdminService {
 
 	List<Admin> selectAllAdmin();
 
+	Admin selectByMobile(String username);
+
 }

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

@@ -13,5 +13,7 @@ public interface PatentCostService {
 	Pagination<PatentApplicationFeeBo> getApplicationFeeList(String[] patentApplicationDate, String locationProvince,
 			Integer pNo, Integer pSize) throws ParseException;
 
+	PatentCost insert(PatentCost patentCost);
+
 
 }

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

@@ -2,14 +2,12 @@ package com.goafanti.techservice.patent.service;
 
 import java.text.ParseException;
 import java.util.Date;
-import java.util.List;
 
 import com.goafanti.common.model.PatentInfo;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.techservice.patent.bo.PatentCompositeBo;
 import com.goafanti.techservice.patent.bo.PatentNoticeOfCorrectionBo;
 import com.goafanti.techservice.patent.bo.PatentPendingBo;
-import com.goafanti.techservice.patent.bo.PatentRecieveSendBo;
 
 public interface PatentInfoService {
 
@@ -35,6 +33,5 @@ public interface PatentInfoService {
 			String patentNumber, String office, String locationProvince, String unitName, Integer patentCatagory,
 			String patentName, Integer patentState, String author, Integer pNo, Integer pSize);
 
-	List<PatentRecieveSendBo> getPatentRecieveSendList();
 
 }

+ 5 - 0
src/main/java/com/goafanti/techservice/patent/service/PatentRegistrationService.java

@@ -1,6 +1,8 @@
 package com.goafanti.techservice.patent.service;
 
 import com.goafanti.common.model.PatentRegistration;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.techservice.patent.bo.PatentRecieveSendBo;
 
 public interface PatentRegistrationService {
 
@@ -8,4 +10,7 @@ public interface PatentRegistrationService {
 
 	int updateByPrimaryKeySelective(PatentRegistration patentRegistration);
 
+	Pagination<PatentRecieveSendBo> getRecieveSendList(Integer pNo, Integer pSize);
+
+
 }

+ 5 - 0
src/main/java/com/goafanti/techservice/patent/service/impl/AdminServiceImpl.java

@@ -16,5 +16,10 @@ public class AdminServiceImpl implements AdminService {
 	public List<Admin> selectAllAdmin() {
 		return adminMapper.selectAllAdmin();
 	}
+	
+	@Override
+	public Admin selectByMobile(String mobile) {
+		return adminMapper.selectByMobile(mobile);
+	}
 
 }

+ 7 - 1
src/main/java/com/goafanti/techservice/patent/service/impl/PatentCostServiceImpl.java

@@ -59,8 +59,14 @@ public class PatentCostServiceImpl extends BaseMybatisDao<PatentCostMapper> impl
 		if (pageSize == null || pageSize < 0) {
 			pageSize = 15;
 		}
-		return (Pagination<PatentApplicationFeeBo>) findPage("findApplicationFeeListByPage", "finddApplicationFeeCount", params, pageNo,
+		return (Pagination<PatentApplicationFeeBo>) findPage("findApplicationFeeListByPage", "findApplicationFeeCount", params, pageNo,
 				pageSize);
 	}
 
+	@Override
+	public PatentCost insert(PatentCost patentCost) {
+		patentCostMapper.insert(patentCost);
+		return patentCost;
+	}
+
 }

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

@@ -3,7 +3,6 @@ package com.goafanti.techservice.patent.service.impl;
 import java.text.ParseException;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +16,6 @@ import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.techservice.patent.bo.PatentCompositeBo;
 import com.goafanti.techservice.patent.bo.PatentNoticeOfCorrectionBo;
 import com.goafanti.techservice.patent.bo.PatentPendingBo;
-import com.goafanti.techservice.patent.bo.PatentRecieveSendBo;
 import com.goafanti.techservice.patent.service.PatentInfoService;
 
 
@@ -265,10 +263,6 @@ public class PatentInfoServiceImpl extends BaseMybatisDao<PatentInfoMapper> impl
 	}
 
 
-	@Override
-	public List<PatentRecieveSendBo> getPatentRecieveSendList() {
-		return patentInfoMapper.getPatentRecieveSendList();
-	}
 	
 
 }

+ 25 - 1
src/main/java/com/goafanti/techservice/patent/service/impl/PatentRegistrationServiceImpl.java

@@ -1,13 +1,20 @@
 package com.goafanti.techservice.patent.service.impl;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.dao.PatentRegistrationMapper;
 import com.goafanti.common.model.PatentRegistration;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.techservice.patent.bo.PatentApplicationFeeBo;
+import com.goafanti.techservice.patent.bo.PatentRecieveSendBo;
 import com.goafanti.techservice.patent.service.PatentRegistrationService;
 @Service
-public class PatentRegistrationServiceImpl implements PatentRegistrationService {
+public class PatentRegistrationServiceImpl extends BaseMybatisDao<PatentRegistrationMapper> implements PatentRegistrationService {
 	@Autowired
     private PatentRegistrationMapper patentRegistrationMapper;
 
@@ -22,4 +29,21 @@ public class PatentRegistrationServiceImpl implements PatentRegistrationService
 		return patentRegistrationMapper.updateByPrimaryKeySelective(patentRegistration);
 	}
 
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<PatentRecieveSendBo> getRecieveSendList(Integer pageNo, Integer pageSize) {
+		Map<String, Object> params = new HashMap<>();
+		
+		if (pageNo == null || pageNo < 0) {
+			pageNo = 1;
+		}
+
+		if (pageSize == null || pageSize < 0) {
+			pageSize = 15;
+		}
+		return (Pagination<PatentRecieveSendBo>) findPage("findRecieveSendList","findRecieveSendCount",params, pageNo,
+				pageSize);
+	}
+
+
 }

+ 19 - 2
src/main/java/com/goafanti/user/controller/UserLoginController.java

@@ -4,7 +4,6 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,6 +15,7 @@ import org.springframework.web.servlet.view.RedirectView;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.TimeUtils;
 import com.goafanti.common.utils.VerifyCodeUtils;
@@ -56,7 +56,7 @@ public class UserLoginController extends BaseController {
 	}
     
 	/**
-	 * 登录
+	 * 用户登录
 	 * @param user
 	 * @param remember
 	 * @param request
@@ -71,6 +71,23 @@ public class UserLoginController extends BaseController {
 	}
 	
 	/**
+	 * 管理端登录
+	 * @param user
+	 * @param remember
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping(value = "/managesignin", method = RequestMethod.POST)
+	@ResponseBody
+	public Result managesignin(Admin admin,Boolean remember, HttpServletRequest request) {
+		Result res = new Result();
+		res.setData(TokenManager.manageLogin(admin, remember));
+		return res;
+	}
+	
+	
+	
+	/**
 	 * 忘记密码 使用手机号+手机验证码登录
 	 * @param mobile
 	 * @param mobileCode

+ 1 - 1
src/main/resources/spring/spring-shiro.xml

@@ -21,7 +21,7 @@
 	    <constructor-arg index="1" value="${jedis.host}" name="host" type="java.lang.String"/>
 	    <constructor-arg index="2" value="${jedis.port}"  name="port" type="int"/>
 	    <constructor-arg index="3" value="${jedis.timeout}"  name="timeout" type="int"/>
-	    <constructor-arg index="4" value="${jedis.password}"  name="password" type="java.lang.String"/>
+	   <!--  <constructor-arg index="4" value="${jedis.password}"  name="password" type="java.lang.String"/> -->
 	  
 	</bean>
 	

+ 1 - 1
src/main/webapp/WEB-INF/html/test.html

@@ -54,7 +54,7 @@
   <div id="root">
     <label>
       <span>接口前缀</span>
-      <input type="text" id="context" value="aft/techservice/patent" >
+      <input type="text" id="context" value="AFT" >
     </label>
     <label>
       <span>接口地址</span>

+ 11 - 0
src/main/webapp/WEB-INF/views/user/certify.jsp

@@ -0,0 +1,11 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
+<%@ include file="../header.jsp"%>
+<title>认证页面</title>
+<link href="${staticHost}/user/certify.css" rel="stylesheet">
+</head>
+<body>
+	<div id="root"></div>
+	<script type="text/javascript" src="${staticHost}/user/certify.js"></script>
+</body>
+</html>

+ 1 - 1
src/main/webapp/WEB-INF/web.xml

@@ -10,7 +10,7 @@
 		and Filters -->
 	<context-param>
 		<param-name>spring.profiles.active</param-name>
-		<param-value>dev</param-value>
+		<param-value>local</param-value>
 	</context-param>
 
 	<!-- Creates the Spring Container shared by all Servlets and Filters -->