Browse Source

站内消息修改中...

anderx 4 years ago
parent
commit
d81e9570bf
25 changed files with 1117 additions and 693 deletions
  1. 1 1
      GeneratorConfig.xml
  2. 4 21
      src/main/java/com/goafanti/admin/controller/AdminNoticeApiController.java
  3. 4 1
      src/main/java/com/goafanti/admin/service/NoticeService.java
  4. 40 31
      src/main/java/com/goafanti/admin/service/impl/NoticeServiceImpl.java
  5. 15 23
      src/main/java/com/goafanti/common/bo/EmailBo.java
  6. 38 10
      src/main/java/com/goafanti/common/dao/NoticeMapper.java
  7. 4 0
      src/main/java/com/goafanti/common/dao/PatentNewLogMapper.java
  8. 11 36
      src/main/java/com/goafanti/common/dao/PatentNewMapper.java
  9. 2 0
      src/main/java/com/goafanti/common/dao/UserMapper.java
  10. 47 0
      src/main/java/com/goafanti/common/enums/NoticeTypes.java
  11. 258 71
      src/main/java/com/goafanti/common/mapper/NoticeMapper.xml
  12. 15 0
      src/main/java/com/goafanti/common/mapper/PatentNewLogMapper.xml
  13. 59 231
      src/main/java/com/goafanti/common/mapper/PatentNewMapper.xml
  14. 4 0
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  15. 245 96
      src/main/java/com/goafanti/common/model/Notice.java
  16. 121 59
      src/main/java/com/goafanti/common/model/PatentNew.java
  17. 173 103
      src/main/java/com/goafanti/common/task/PatentTask.java
  18. 13 0
      src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java
  19. 8 0
      src/main/java/com/goafanti/customer/service/CustomerService.java
  20. 5 0
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  21. 11 0
      src/main/java/com/goafanti/patent/bo/PatentNewBo.java
  22. 14 0
      src/main/java/com/goafanti/patent/controller/AdminPatentNewApiController.java
  23. 5 0
      src/main/java/com/goafanti/patent/service/PatentNewService.java
  24. 10 0
      src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java
  25. 10 10
      src/main/resources/props/config_local.properties

+ 1 - 1
GeneratorConfig.xml

@@ -43,7 +43,7 @@
     <property name="enableSubPackages" value="false"/>
      <property name="nullCatalogMeansCurrent" value="true"/>
     </javaClientGenerator>
-    <table schema="aft" tableName="user_service"
+    <table schema="aft" tableName="notice"
 	enableCountByExample="false" enableUpdateByExample="false"
 	enableDeleteByExample="false" enableSelectByExample="false"
 	selectByExampleQueryId="false" enableSelectByPrimaryKey="true"

+ 4 - 21
src/main/java/com/goafanti/admin/controller/AdminNoticeApiController.java

@@ -36,18 +36,9 @@ public class AdminNoticeApiController extends CertifyApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/unread", method = RequestMethod.GET)
-	public Result unread(String pageNo, String pageSize){
+	public Result unread(){
 		Result res = new Result();
-		Integer pNo = 1;
-		Integer pSize = 10;
-		if (StringUtils.isNumeric(pageSize)) {
-			pSize = Integer.parseInt(pageSize);
-		}
-		if (StringUtils.isNumeric(pageNo)) {
-			pNo = Integer.parseInt(pageNo);
-		}
-		
-		res.setData(noticeService.updateListUnreadNoticeByAid(pNo, pSize, TokenManager.getAdminId()));
+		res.setData(noticeService.updateListUnreadNoticeByAid());
 		return res;
 	}
 	
@@ -56,17 +47,9 @@ public class AdminNoticeApiController extends CertifyApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/readed", method = RequestMethod.GET)
-	public Result readed(String pageNo, String pageSize){
+	public Result readed(Integer pageNo, Integer pageSize){
 		Result res = new Result();
-		Integer pNo = 1;
-		Integer pSize = 10;
-		if (StringUtils.isNumeric(pageSize)) {
-			pSize = Integer.parseInt(pageSize);
-		}
-		if (StringUtils.isNumeric(pageNo)) {
-			pNo = Integer.parseInt(pageNo);
-		}
-		res.setData(noticeService.ListReadedNoticeByAid(pNo, pSize, TokenManager.getAdminId()));
+		res.setData(noticeService.ListReadedNoticeByAid(pageNo, pageSize, TokenManager.getAdminId()));
 		return res;
 	}
 }

+ 4 - 1
src/main/java/com/goafanti/admin/service/NoticeService.java

@@ -1,11 +1,14 @@
 package com.goafanti.admin.service;
 
+import java.util.List;
+import java.util.Map;
+
 import com.goafanti.admin.bo.NoticeBo;
 import com.goafanti.core.mybatis.page.Pagination;
 
 public interface NoticeService {
 
-	Pagination<NoticeBo> updateListUnreadNoticeByAid(Integer pageNo, Integer pageSize, String adminId);
+	List<Map<String, Object>> updateListUnreadNoticeByAid();
 
 	Pagination<NoticeBo> ListReadedNoticeByAid(Integer pNo, Integer pSize, String adminId);
 

+ 40 - 31
src/main/java/com/goafanti/admin/service/impl/NoticeServiceImpl.java

@@ -2,6 +2,7 @@ package com.goafanti.admin.service.impl;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -13,6 +14,7 @@ import com.goafanti.admin.service.NoticeService;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.NoticeMapper;
+import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.Notice;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -26,47 +28,54 @@ public class NoticeServiceImpl extends BaseMybatisDao<NoticeMapper> implements N
 	@Autowired
 	private AdminMapper adminMapper;
 
-	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<NoticeBo> updateListUnreadNoticeByAid(Integer pageNo, Integer pageSize, String aid) {
-		Map<String, Object> params = new HashMap<>();
-			params.put("aid", aid);
-		if (pageNo == null || pageNo < 0) {
-			pageNo = 1;
-		}
-		if (pageSize == null || pageSize < 0) {
-			pageSize = 10;
-		}
-		Pagination<NoticeBo> notice = (Pagination<NoticeBo>) findPage("findUnreadNoticeListByPage", "findUnreadNoticeCount",
-				params, pageNo, pageSize);
-
-		if (null != notice.getList() && notice.getList().size()>0) {
-			List<Notice> list = (List<Notice>) notice.getList();
-			List<String> dl = new ArrayList<String>();
-			for (Notice n : list) {
-				dl.add(n.getId());
+	public List<Map<String, Object>> updateListUnreadNoticeByAid() {
+		List<Map<String, Object>> list = new ArrayList<>();
+		List<NoticeBo> nl = noticeMapper.findUnreadNoticeListByPage(TokenManager.getAdminId());
+		List<String> dl = new ArrayList<String>();
+		for (NoticeBo n : nl) {
+			//添加已读
+			dl.add(n.getId());
+			
+			//0专利提醒
+			if (n.getType()==0) {
+			}
+			if (n.getNoticeType()==NoticeStatus.TASK_PATENT_ERROR.getCode()||
+					n.getNoticeType()==NoticeStatus.TASK_PATENT_REMIND.getCode()) {
 			}
-			noticeMapper.batchUpdateUnreaded(dl);
 		}
-		return notice;
+//		Map<String,Object> m0=new HashMap<>();
+//		m0.put("type", 0);
+//		m0.put("name", "专利提醒");
+//		m0.put("list", l0);
+//		Map<String,Object> m1=new HashMap<>();
+//		m1.put("type", 1);
+//		m1.put("name", "客户释放");
+//		m1.put("list", l1);
+//		Map<String,Object> m2=new HashMap<>();
+//		m2.put("type", 2);
+//		m2.put("name", "限时跟进");
+//		m2.put("list", l2);
+//		Map<String,Object> m3=new HashMap<>();
+//		m3.put("type", 3);
+//		m3.put("name", "最新审批");
+//		m3.put("list", l3);
+//		list.add(m0);
+//		list.add(m1);
+//		list.add(m2);
+//		list.add(m3);
+		
+		noticeMapper.batchUpdateUnreaded(dl);
+
+		return list;
 	}
 
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<NoticeBo> ListReadedNoticeByAid(Integer pageNo, Integer pageSize, String aid) {
 		Map<String, Object> params = new HashMap<>();
+		params.put("aid", aid);
 
-		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
-			params.put("aid", aid);
-		}
-
-		if (pageNo == null || pageNo < 0) {
-			pageNo = 1;
-		}
-
-		if (pageSize == null || pageSize < 0) {
-			pageSize = 10;
-		}
 		return (Pagination<NoticeBo>) findPage("findReadedNoticeListByPage", "findReadedNoticeCount", params, pageNo,
 				pageSize);
 	}

+ 15 - 23
src/main/java/com/goafanti/common/bo/EmailBo.java

@@ -23,28 +23,9 @@ public class EmailBo {
 	public EmailBo() {
 	}
 	
-	/**
-	 *  
-	 * @param subject	
-	 * @param address	收件地址
-	 * @param addressee 	收件人
-	 * @param deptname		部门
-	 * @param sender		发起人id
-	 * @param content		内容
-	 */
-//	public EmailBo(String subject, String address, String addressee,
-//			String deptname, String sender,
-//			String content) {
-//		this.subject = subject;
-//		this.address = address;
-//		this.addressee = addressee;
-//		this.deptname = deptname;
-//		this.sender = sender;
-//		this.content = content;
-//	}
 	
 	/**
-	 * 
+	 * 专利提醒模版接口
 	 * @param subject
 	 * @param address
 	 * @param addressee
@@ -58,13 +39,21 @@ public class EmailBo {
 	 * @param date
 	 */
 	public  EmailBo(String subject, String address, String addressee,
-			String deptname, String sender,String patentName,String patentNo,String amount,String date) {
+			String deptname, String sender,String patentName,String patentNo,String amount,String date,Integer status) {
 		this.subject = subject;
 		this.address = address;
 		this.addressee = addressee;
 		this.deptname = deptname;
 		this.sender = sender;
-		this.content=setPatentFormat( addressee, sender, patentName, patentNo, amount, date);
+		Integer days=0;
+		if (status==1) days=90;
+		else if (status==2) days=30;
+		else if (status==3) days=20;
+		else if (status==4) days=10;
+		else if (status==5) days=3;
+		else if (status==6) days=2;
+		else if (status==7) days=1;
+		this.content=setPatentFormat( addressee, sender, patentName, patentNo, amount, date,days);
 		
 		
 	}
@@ -309,7 +298,7 @@ public class EmailBo {
 	
 	
 	
-	public String setPatentFormat(String userName,String adminName,String patentName,String patentNo,String amount,String date ){
+	public String setPatentFormat(String userName,String adminName,String patentName,String patentNo,String amount,String date,Integer days ){
 		String str="<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#ffffff\" style=\"font-family:'Microsoft YaHei';\">\r\n" + 
 				"    		<tbody><tr>\r\n" + 
 				"		        <td>\r\n" + 
@@ -360,6 +349,9 @@ public class EmailBo {
 				"              </tr>\r\n" + 
 				"               <tr>\r\n" + 
 				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">金额:" + amount + " <span style=\"color: red\">(本缴费金额仅供参考,实际缴费金额,请登录国知局官方网址<a href=\"http://cpquery.sipo.gov.cn/\">cpquery.sipo.gov.cn</a>查询)</span></td>\r\n" + 
+				"              </tr>\r\n" +
+				"               <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">剩余天数:" + days + "</td>\r\n" + 
 				"              </tr>\r\n" + 
 				"               <tr>\r\n" + 
 				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">到期时间:" + date + "</td>\r\n" + 

+ 38 - 10
src/main/java/com/goafanti/common/dao/NoticeMapper.java

@@ -2,20 +2,46 @@ package com.goafanti.common.dao;
 
 import java.util.List;
 
+import com.goafanti.admin.bo.NoticeBo;
 import com.goafanti.common.model.Notice;
 
 public interface NoticeMapper {
-    int deleteByPrimaryKey(String id);
+    /**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	int deleteByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	int insert(Notice record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	int insertSelective(Notice record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	Notice selectByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	int updateByPrimaryKeySelective(Notice record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	int updateByPrimaryKey(Notice record);
 
-    int insert(Notice record);
-
-    int insertSelective(Notice record);
-
-    Notice selectByPrimaryKey(String id);
-
-    int updateByPrimaryKeySelective(Notice record);
-
-    int updateByPrimaryKey(Notice record);
 
 	int findUnreadNoticeCount(String aid);
 
@@ -24,4 +50,6 @@ public interface NoticeMapper {
 	int batchUpdateUnreaded(List<String> dl);
 
 	void insertBatch(List<Notice> notice);
+
+	List<NoticeBo> findUnreadNoticeListByPage(String aid);
 }

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

@@ -72,4 +72,8 @@ public interface PatentNewLogMapper {
 	 * @mbg.generated  Wed Apr 24 13:38:43 CST 2019
 	 */
 	int updateByPrimaryKey(PatentNewLog record);
+
+	void insertLogBatch(List<PatentNewLog> list);
+
+	List<PatentNewLog> selectPatentNewLog(Integer id);
 }

+ 11 - 36
src/main/java/com/goafanti/common/dao/PatentNewMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PatentNew;
 import com.goafanti.common.model.PatentNewExample;
+import com.goafanti.common.model.PatentNewLog;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
@@ -9,67 +11,37 @@ public interface PatentNewMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
-	 */
-	long countByExample(PatentNewExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
-	 */
-	int deleteByExample(PatentNewExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	int deleteByPrimaryKey(Integer id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	int insert(PatentNew record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	int insertSelective(PatentNew record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
-	 */
-	List<PatentNew> selectByExample(PatentNewExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	PatentNew selectByPrimaryKey(Integer id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
-	 */
-	int updateByExampleSelective(@Param("record") PatentNew record, @Param("example") PatentNewExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
-	 */
-	int updateByExample(@Param("record") PatentNew record, @Param("example") PatentNewExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	int updateByPrimaryKeySelective(PatentNew record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	int updateByPrimaryKey(PatentNew record);
 
@@ -78,4 +50,7 @@ public interface PatentNewMapper {
 	List<PatentNew> AllselectEndPatentNew();
 
 	void updateAdmin(@Param("aid")String aid, @Param("transferId")String transferId);
+
+
+	void insertLogBatch(List<PatentNewLog> list);
 }

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

@@ -290,6 +290,8 @@ public interface UserMapper {
 
 	String checkBeforeChannel(String uid);
 
+	List<CustomerSimpleBo> getUserByName(String name);
+
 	
 	
 }

+ 47 - 0
src/main/java/com/goafanti/common/enums/NoticeTypes.java

@@ -0,0 +1,47 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum NoticeTypes {
+
+//	通知分类 0专利提醒 1客户释放 2限时跟进 3最新审批
+	ZLTX(0,"专利提醒"),
+	KHSF(0,"客户释放"),
+	XSGJ(0,"限时跟进"),
+	ZXSP(0,"最新审批"),
+	ELSE(0,"其他");
+	
+	private static Map<Integer, NoticeTypes> status = new HashMap<Integer, NoticeTypes>();
+	
+	static {
+		for (NoticeTypes value : NoticeTypes.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+	
+	
+	private String desc;
+	private Integer code;
+	
+	private NoticeTypes(Integer code, String desc) {
+		this.setCode(code);
+		this.setDesc(desc);
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public void setCode(Integer code) {
+		this.code = code;
+	}
+}

+ 258 - 71
src/main/java/com/goafanti/common/mapper/NoticeMapper.xml

@@ -1,32 +1,231 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.goafanti.common.dao.NoticeMapper" >
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.Notice" >
-    <id column="id" property="id" jdbcType="VARCHAR" />
-    <result column="aid" property="aid" jdbcType="VARCHAR" />
-    <result column="notice_type" property="noticeType" jdbcType="INTEGER" />
-    <result column="content" property="content" jdbcType="VARCHAR" />
-    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
-    <result column="readed" property="readed" jdbcType="INTEGER" />
-    <result column="uid" property="uid" jdbcType="VARCHAR" />
-    <result column="pid" property="pid" jdbcType="VARCHAR" />
-    <result column="rid" property="rid" jdbcType="VARCHAR" />
-    <result column="year" property="year" jdbcType="INTEGER" />
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.NoticeMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.Notice">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="notice_type" jdbcType="INTEGER" property="noticeType" />
+    <result column="content" jdbcType="VARCHAR" property="content" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="readed" jdbcType="INTEGER" property="readed" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="pid" jdbcType="VARCHAR" property="pid" />
+    <result column="rid" jdbcType="VARCHAR" property="rid" />
+    <result column="year" jdbcType="INTEGER" property="year" />
+    <result column="type" jdbcType="INTEGER" property="type" />
   </resultMap>
-  <sql id="Base_Column_List" >
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    id, aid, notice_type, content, create_time, readed, `uid`, pid, rid, `year`, `type`
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from notice
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    delete from notice
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.Notice">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    insert into notice (id, aid, notice_type, 
+      content, create_time, readed, 
+      `uid`, pid, rid, `year`, 
+      `type`)
+    values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{noticeType,jdbcType=INTEGER}, 
+      #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{readed,jdbcType=INTEGER}, 
+      #{uid,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{rid,jdbcType=VARCHAR}, #{year,jdbcType=INTEGER}, 
+      #{type,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.Notice">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    insert into notice
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="noticeType != null">
+        notice_type,
+      </if>
+      <if test="content != null">
+        content,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="readed != null">
+        readed,
+      </if>
+      <if test="uid != null">
+        `uid`,
+      </if>
+      <if test="pid != null">
+        pid,
+      </if>
+      <if test="rid != null">
+        rid,
+      </if>
+      <if test="year != null">
+        `year`,
+      </if>
+      <if test="type != null">
+        `type`,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="noticeType != null">
+        #{noticeType,jdbcType=INTEGER},
+      </if>
+      <if test="content != null">
+        #{content,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="readed != null">
+        #{readed,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="pid != null">
+        #{pid,jdbcType=VARCHAR},
+      </if>
+      <if test="rid != null">
+        #{rid,jdbcType=VARCHAR},
+      </if>
+      <if test="year != null">
+        #{year,jdbcType=INTEGER},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Notice">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    update notice
+    <set>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="noticeType != null">
+        notice_type = #{noticeType,jdbcType=INTEGER},
+      </if>
+      <if test="content != null">
+        content = #{content,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="readed != null">
+        readed = #{readed,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        `uid` = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="pid != null">
+        pid = #{pid,jdbcType=VARCHAR},
+      </if>
+      <if test="rid != null">
+        rid = #{rid,jdbcType=VARCHAR},
+      </if>
+      <if test="year != null">
+        `year` = #{year,jdbcType=INTEGER},
+      </if>
+      <if test="type != null">
+        `type` = #{type,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Notice">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu May 27 17:22:58 CST 2021.
+    -->
+    update notice
+    set aid = #{aid,jdbcType=VARCHAR},
+      notice_type = #{noticeType,jdbcType=INTEGER},
+      content = #{content,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      readed = #{readed,jdbcType=INTEGER},
+      `uid` = #{uid,jdbcType=VARCHAR},
+      pid = #{pid,jdbcType=VARCHAR},
+      rid = #{rid,jdbcType=VARCHAR},
+      `year` = #{year,jdbcType=INTEGER},
+      `type` = #{type,jdbcType=INTEGER}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.Notice">
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="notice_type" jdbcType="INTEGER" property="noticeType" />
+    <result column="content" jdbcType="VARCHAR" property="content" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="readed" jdbcType="INTEGER" property="readed" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="pid" jdbcType="VARCHAR" property="pid" />
+    <result column="rid" jdbcType="VARCHAR" property="rid" />
+    <result column="year" jdbcType="INTEGER" property="year" />
+  </resultMap>
+  <sql id="Base_Column_List">
     id, aid, notice_type, content, create_time, readed, uid, pid, rid, year
   </sql>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select 
     <include refid="Base_Column_List" />
     from notice
     where id = #{id,jdbcType=VARCHAR}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
     delete from notice
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.Notice" >
+  <insert id="insert" parameterType="com.goafanti.common.model.Notice">
     insert into notice (id, aid, notice_type, 
       content, create_time, readed, uid, pid, rid, year
       )
@@ -35,117 +234,117 @@
       #{uid,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{rid,jdbcType=VARCHAR}, #{year,jdbcType=INTEGER}
       )
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.Notice" >
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.Notice">
     insert into notice
-    <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
         id,
       </if>
-      <if test="aid != null" >
+      <if test="aid != null">
         aid,
       </if>
-      <if test="noticeType != null" >
+      <if test="noticeType != null">
         notice_type,
       </if>
-      <if test="content != null" >
+      <if test="content != null">
         content,
       </if>
-      <if test="createTime != null" >
+      <if test="createTime != null">
         create_time,
       </if>
-      <if test="readed != null" >
+      <if test="readed != null">
         readed,
       </if>
       
-       <if test="uid != null" >
+       <if test="uid != null">
         uid,
       </if>
-      <if test="pid != null" >
+      <if test="pid != null">
         pid,
       </if>
       
-      <if test="rid != null" >
+      <if test="rid != null">
         rid,
       </if>
       
-      <if test="year != null" >
+      <if test="year != null">
         year,
       </if>
       
     </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
         #{id,jdbcType=VARCHAR},
       </if>
-      <if test="aid != null" >
+      <if test="aid != null">
         #{aid,jdbcType=VARCHAR},
       </if>
-      <if test="noticeType != null" >
+      <if test="noticeType != null">
         #{noticeType,jdbcType=INTEGER},
       </if>
-      <if test="content != null" >
+      <if test="content != null">
         #{content,jdbcType=VARCHAR},
       </if>
-      <if test="createTime != null" >
+      <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="readed != null" >
+      <if test="readed != null">
         #{readed,jdbcType=INTEGER},
       </if>
       
-      <if test="uid != null" >
+      <if test="uid != null">
         #{uid,jdbcType=VARCHAR},
       </if>
-      <if test="pid != null" >
+      <if test="pid != null">
         #{pid,jdbcType=VARCHAR},
       </if>
       
-      <if test="rid != null" >
+      <if test="rid != null">
         #{rid,jdbcType=VARCHAR},
       </if>
       
-       <if test="year != null" >
+       <if test="year != null">
         #{year,jdbcType=INTEGER},
       </if>
     </trim>
   </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Notice" >
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Notice">
     update notice
-    <set >
-      <if test="aid != null" >
+    <set>
+      <if test="aid != null">
         aid = #{aid,jdbcType=VARCHAR},
       </if>
-      <if test="noticeType != null" >
+      <if test="noticeType != null">
         notice_type = #{noticeType,jdbcType=INTEGER},
       </if>
-      <if test="content != null" >
+      <if test="content != null">
         content = #{content,jdbcType=VARCHAR},
       </if>
-      <if test="createTime != null" >
+      <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="readed != null" >
+      <if test="readed != null">
         readed = #{readed,jdbcType=INTEGER},
       </if>
       
-      <if test="uid != null" >
+      <if test="uid != null">
         uid = #{uid,jdbcType=VARCHAR},
       </if>
-      <if test="pid != null" >
+      <if test="pid != null">
         pid = #{pid,jdbcType=VARCHAR},
       </if>
       
-      <if test="rid != null" >
+      <if test="rid != null">
         rid = #{rid,jdbcType=VARCHAR},
       </if>
       
-       <if test="year != null" >
+       <if test="year != null">
         year = #{year,jdbcType=INTEGER},
       </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Notice" >
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Notice">
     update notice
     set aid = #{aid,jdbcType=VARCHAR},
       notice_type = #{noticeType,jdbcType=INTEGER},
@@ -163,7 +362,7 @@
   </update>
   
   <select id="findUnreadNoticeListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.NoticeBo">
-    select n.id, n.aid, n.uid, n.notice_type as noticeType, n.content, n.create_time as createTime, 
+    select n.id, n.aid, n.uid, n.notice_type as noticeType, n.content, n.create_time as createTime, n.type,
 		oi.unit_name as unitName, n.rid, a.name as principle, n.readed, n.year
 		from notice n 
 		LEFT JOIN organization_identity oi on n.uid = oi.uid
@@ -173,19 +372,8 @@
     	and n.aid = #{aid,jdbcType=VARCHAR}
     </if>
     order by n.create_time desc
-    <if test="page_sql!=null">
-		${page_sql}
-	</if>
-  </select>
-  
-   <select id="findUnreadNoticeCount" resultType="java.lang.Integer" parameterType="java.lang.String">
- 	select count(1) 
- 	 from notice n
-    where n.readed = 0 
-    <if test="aid != null">
-    	and n.aid = #{aid,jdbcType=VARCHAR}
-    </if>
   </select>
+    
   
   <select id="findReadedNoticeListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.NoticeBo">
      select n.id, n.uid, n.aid, n.notice_type as noticeType, n.content, n.create_time as createTime, 
@@ -203,7 +391,7 @@
 	</if>
   </select>
   
-   <select id="findReadedNoticeCount" resultType="java.lang.Integer" parameterType="java.lang.String">
+   <select id="findReadedNoticeCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  	select count(1) 
  	 from notice n
     where n.readed = 1 
@@ -212,7 +400,7 @@
     </if>
   </select>
   
-  <select id="selectUnreadedCount" resultType="java.lang.Integer" parameterType="java.lang.String">
+  <select id="selectUnreadedCount" parameterType="java.lang.String" resultType="java.lang.Integer">
    select count(1) from notice where readed = 0 
    <if test="_parameter">
     	and aid = #{_parameter,jdbcType=VARCHAR}
@@ -222,8 +410,7 @@
   <update id="batchUpdateUnreaded" parameterType="java.util.List">
 		update notice set readed = 1
 		where id in
-		<foreach item="item" index="index" collection="list" open="("
-			separator="," close=")">
+		<foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
 			#{item}
 		</foreach>
   </update>
@@ -231,7 +418,7 @@
   <insert id="insertBatch" parameterType="com.goafanti.common.model.Notice">
     insert into notice (id, aid, notice_type, content, create_time, readed, uid, pid, rid, year)
     values 
-    <foreach item="item" index="index" collection="list" separator=",">
+    <foreach collection="list" index="index" item="item" separator=",">
       (
       	#{item.id,jdbcType=VARCHAR}, #{item.aid,jdbcType=VARCHAR}, #{item.noticeType,jdbcType=INTEGER},
       	#{item.content,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.readed,jdbcType=INTEGER},

+ 15 - 0
src/main/java/com/goafanti/common/mapper/PatentNewLogMapper.xml

@@ -268,4 +268,19 @@
       pid = #{pid,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  <insert id="insertLogBatch">
+        INSERT INTO patent_new_log(content, create_time, pid)values
+      <foreach item="item" index="index" collection="list" separator=",">
+      ( #{item.content,jdbcType=VARCHAR}, #{item.createTime,jdbcType=INTEGER},
+      	#{item.pid,jdbcType=VARCHAR}
+      )
+    </foreach>
+    </insert>
+    
+    <select id="selectPatentNewLog" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from patent_new_log
+    where pid = #{id,jdbcType=INTEGER}
+  </select>
 </mapper>

+ 59 - 231
src/main/java/com/goafanti/common/mapper/PatentNewMapper.xml

@@ -5,7 +5,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="patent_no" jdbcType="VARCHAR" property="patentNo" />
@@ -24,109 +24,23 @@
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
     <result column="aid" jdbcType="VARCHAR" property="aid" />
     <result column="years" jdbcType="INTEGER" property="years" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
   </resultMap>
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
-    id, patent_no, name, type, status, apply_date, authorization_date, patent_amount, 
+    id, patent_no, `name`, `type`, `status`, apply_date, authorization_date, patent_amount, 
     applicant, province, contact_mobile, email, certificate_url, create_time, update_time, 
-    aid, years
+    aid, `years`, `uid`
   </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.PatentNewExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from patent_new
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
     select 
     <include refid="Base_Column_List" />
@@ -137,46 +51,35 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
     delete from patent_new
     where id = #{id,jdbcType=INTEGER}
   </delete>
-  <delete id="deleteByExample" parameterType="com.goafanti.common.model.PatentNewExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
-    -->
-    delete from patent_new
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
   <insert id="insert" parameterType="com.goafanti.common.model.PatentNew">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
-    insert into patent_new (id, patent_no, name, 
-      type, status, apply_date, 
+    insert into patent_new (id, patent_no, `name`, 
+      `type`, `status`, apply_date, 
       authorization_date, patent_amount, applicant, 
       province, contact_mobile, email, 
       certificate_url, create_time, update_time, 
-      aid, years)
+      aid, `years`, `uid`)
     values (#{id,jdbcType=INTEGER}, #{patentNo,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
       #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{applyDate,jdbcType=DATE}, 
       #{authorizationDate,jdbcType=DATE}, #{patentAmount,jdbcType=DECIMAL}, #{applicant,jdbcType=VARCHAR}, 
       #{province,jdbcType=INTEGER}, #{contactMobile,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, 
       #{certificateUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, 
-      #{aid,jdbcType=VARCHAR}, #{years,jdbcType=INTEGER})
+      #{aid,jdbcType=VARCHAR}, #{years,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.PatentNew">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
     insert into patent_new
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -187,13 +90,13 @@
         patent_no,
       </if>
       <if test="name != null">
-        name,
+        `name`,
       </if>
       <if test="type != null">
-        type,
+        `type`,
       </if>
       <if test="status != null">
-        status,
+        `status`,
       </if>
       <if test="applyDate != null">
         apply_date,
@@ -229,7 +132,10 @@
         aid,
       </if>
       <if test="years != null">
-        years,
+        `years`,
+      </if>
+      <if test="uid != null">
+        `uid`,
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -284,116 +190,16 @@
       <if test="years != null">
         #{years,jdbcType=INTEGER},
       </if>
+      <if test="uid != null">
+        #{uid,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.PatentNewExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
-    -->
-    select count(*) from patent_new
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
-    -->
-    update patent_new
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=INTEGER},
-      </if>
-      <if test="record.patentNo != null">
-        patent_no = #{record.patentNo,jdbcType=VARCHAR},
-      </if>
-      <if test="record.name != null">
-        name = #{record.name,jdbcType=VARCHAR},
-      </if>
-      <if test="record.type != null">
-        type = #{record.type,jdbcType=INTEGER},
-      </if>
-      <if test="record.status != null">
-        status = #{record.status,jdbcType=INTEGER},
-      </if>
-      <if test="record.applyDate != null">
-        apply_date = #{record.applyDate,jdbcType=DATE},
-      </if>
-      <if test="record.authorizationDate != null">
-        authorization_date = #{record.authorizationDate,jdbcType=DATE},
-      </if>
-      <if test="record.patentAmount != null">
-        patent_amount = #{record.patentAmount,jdbcType=DECIMAL},
-      </if>
-      <if test="record.applicant != null">
-        applicant = #{record.applicant,jdbcType=VARCHAR},
-      </if>
-      <if test="record.province != null">
-        province = #{record.province,jdbcType=INTEGER},
-      </if>
-      <if test="record.contactMobile != null">
-        contact_mobile = #{record.contactMobile,jdbcType=VARCHAR},
-      </if>
-      <if test="record.email != null">
-        email = #{record.email,jdbcType=VARCHAR},
-      </if>
-      <if test="record.certificateUrl != null">
-        certificate_url = #{record.certificateUrl,jdbcType=VARCHAR},
-      </if>
-      <if test="record.createTime != null">
-        create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.updateTime != null">
-        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.aid != null">
-        aid = #{record.aid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.years != null">
-        years = #{record.years,jdbcType=INTEGER},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
-    -->
-    update patent_new
-    set id = #{record.id,jdbcType=INTEGER},
-      patent_no = #{record.patentNo,jdbcType=VARCHAR},
-      name = #{record.name,jdbcType=VARCHAR},
-      type = #{record.type,jdbcType=INTEGER},
-      status = #{record.status,jdbcType=INTEGER},
-      apply_date = #{record.applyDate,jdbcType=DATE},
-      authorization_date = #{record.authorizationDate,jdbcType=DATE},
-      patent_amount = #{record.patentAmount,jdbcType=DECIMAL},
-      applicant = #{record.applicant,jdbcType=VARCHAR},
-      province = #{record.province,jdbcType=INTEGER},
-      contact_mobile = #{record.contactMobile,jdbcType=VARCHAR},
-      email = #{record.email,jdbcType=VARCHAR},
-      certificate_url = #{record.certificateUrl,jdbcType=VARCHAR},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-      aid = #{record.aid,jdbcType=VARCHAR},
-      years = #{record.years,jdbcType=INTEGER}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PatentNew">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
     update patent_new
     <set>
@@ -401,13 +207,13 @@
         patent_no = #{patentNo,jdbcType=VARCHAR},
       </if>
       <if test="name != null">
-        name = #{name,jdbcType=VARCHAR},
+        `name` = #{name,jdbcType=VARCHAR},
       </if>
       <if test="type != null">
-        type = #{type,jdbcType=INTEGER},
+        `type` = #{type,jdbcType=INTEGER},
       </if>
       <if test="status != null">
-        status = #{status,jdbcType=INTEGER},
+        `status` = #{status,jdbcType=INTEGER},
       </if>
       <if test="applyDate != null">
         apply_date = #{applyDate,jdbcType=DATE},
@@ -443,7 +249,10 @@
         aid = #{aid,jdbcType=VARCHAR},
       </if>
       <if test="years != null">
-        years = #{years,jdbcType=INTEGER},
+        `years` = #{years,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        `uid` = #{uid,jdbcType=VARCHAR},
       </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
@@ -452,13 +261,13 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 08 14:33:37 CST 2019.
+      This element was generated on Thu May 27 11:21:28 CST 2021.
     -->
     update patent_new
     set patent_no = #{patentNo,jdbcType=VARCHAR},
-      name = #{name,jdbcType=VARCHAR},
-      type = #{type,jdbcType=INTEGER},
-      status = #{status,jdbcType=INTEGER},
+      `name` = #{name,jdbcType=VARCHAR},
+      `type` = #{type,jdbcType=INTEGER},
+      `status` = #{status,jdbcType=INTEGER},
       apply_date = #{applyDate,jdbcType=DATE},
       authorization_date = #{authorizationDate,jdbcType=DATE},
       patent_amount = #{patentAmount,jdbcType=DECIMAL},
@@ -470,18 +279,20 @@
       create_time = #{createTime,jdbcType=TIMESTAMP},
       update_time = #{updateTime,jdbcType=TIMESTAMP},
       aid = #{aid,jdbcType=VARCHAR},
-      years = #{years,jdbcType=INTEGER}
+      `years` = #{years,jdbcType=INTEGER},
+      `uid` = #{uid,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
   
   <select id="selectPatentNewList" resultType="com.goafanti.patent.bo.PatentNewBo">
-	  	  select a.id,a.patent_no as patentNo,a.name,a.type,a.status,
-	  date_format(a.apply_date,'%Y-%m-%d') as applyDates,
+	  select a.id,a.patent_no as patentNo,a.name,a.type,a.status,
+	  date_format(a.apply_date,'%Y-%m-%d') as applyDates,a.uid,
 	  date_format(a.authorization_date ,'%Y-%m-%d ')as authorizationDates,a.patent_amount as patentAmount,a.province,
 	a.applicant,a.contact_mobile as contactMobile,a.email,a.certificate_url as certificateUrl,
 	date_format(a.create_time,'%Y-%m-%d %H:%I:%S') as createTimeS,a.apply_date as applyDate,c.name depName,
-	date_format(a.update_time,'%Y-%m-%d %H:%I:%S') as updateTimeS,b.name as aname
+	date_format(a.update_time,'%Y-%m-%d %H:%I:%S') as updateTimeS,b.name as aname,u.nickname  userName
 	from patent_new a left join admin b on a.aid=b.id
+	left join `user` u on a.uid=u.id
 	left join department c on b.department_id=c.id
 	<if test="shiro ==1">
      left join admin e on e.department_id=c.id
@@ -559,7 +370,7 @@
 	<select id="AllselectStartPatentNew" resultMap="BaseResultMap">
     select 
     <include refid="Base_Column_List" />
-    from patent_new where status =0
+    from patent_new where status &lt; 8
     </select>
     <select id="AllselectEndPatentNew" resultMap="BaseResultMap">
     select 
@@ -571,4 +382,21 @@
     update patent_new set aid= #{transferId}
 	where aid= #{aid} 
     </update>
+    <insert id="insertBatch">
+        insert into patent_new (patent_no, `name`, 
+      `type`, `status`, apply_date, 
+      authorization_date, patent_amount, applicant, 
+      province, contact_mobile, email, 
+      certificate_url, create_time, update_time, 
+      aid, `years`, `uid`)values
+      <foreach item="item" index="index" collection="list" separator=",">
+      ( #{item.aid,jdbcType=VARCHAR}, #{item.noticeType,jdbcType=INTEGER},
+      	#{item.content,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.readed,jdbcType=INTEGER},
+      	#{item.uid,jdbcType=VARCHAR}, #{item.pid,jdbcType=VARCHAR}, #{item.rid,jdbcType=VARCHAR},
+      	#{item.year,jdbcType=INTEGER}
+      )
+    </foreach>
+    </insert>
+    
+    
 </mapper>

+ 4 - 0
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -2282,4 +2282,8 @@ inner join(
 	left join `role` r on r.id=ur.rid 
 	where r.role_type=80
   </select>
+  
+  <select id="getUserByName" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
+		select id,nickname name from `user` where nickname like concat('%',#{name},'%')
+    </select>
 </mapper>

+ 245 - 96
src/main/java/com/goafanti/common/model/Notice.java

@@ -4,182 +4,331 @@ import java.util.Date;
 
 import org.apache.commons.lang3.time.DateFormatUtils;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.enums.NoticeStatus;
+import java.io.Serializable;
 
-public class Notice {
-	private String	id;
+public class Notice implements Serializable {
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.id
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	private String id;
 
-	private String	aid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.aid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	private String aid;
 
 	/**
-	 * 通知类型
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.notice_type
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
-	private Integer	noticeType;
+	private Integer noticeType;
 
 	/**
-	 * 通知内容
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.content
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
-	private String	content;
+	private String content;
 
 	/**
-	 * 创建时间
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.create_time
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
-	private Date	createTime;
-	
+	private Date createTime;
+
 	/**
-	 * 已读标记
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.readed
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
-	private Integer	readed;
-	
+	private Integer readed;
+
 	/**
-	 * 用户id
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.uid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
 	private String uid;
-	
+
 	/**
-	 * 录入公司信息业务员ID
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.pid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
 	private String pid;
-	
+
 	/**
-	 * 业务记录ID
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.rid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
 	private String rid;
-	
+
 	/**
-	 * 高企记录申请年份
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.year
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
 	private Integer year;
-	
-	public Notice() {};
-//	Readed(0);//未读
-//	 n.setAid("1");
-//	 n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
-//	 n
+
 	/**
-	 * 
-	 * @param id 编号
-	 * @param createTime 创建时间
-	 * @param readed 0未读
-	 * @param aid 发件人
-	 * @param noticeType 标题
-	 * @param content  内容
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.type
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
-	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content,String uid) {
-		this.id=id;
-		this.createTime=createTime;
-		this.readed=readed;
-		this.aid=aid;
-		this.noticeType=noticeType;
-		this.content=content;
-		this.uid=uid;
-	}
-	
-	
+	private Integer type;
+
 	/**
-	 * 
-	 * @param id 编号
-	 * @param createTime 创建时间
-	 * @param readed 0未读
-	 * @param aid 发件人
-	 * @param noticeType 标题
-	 * @param content  内容
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
 	 */
-	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content) {
-		this.id=id;
-		this.createTime=createTime;
-		this.readed=readed;
-		this.aid=aid;
-		this.noticeType=noticeType;
-		this.content=content;
-	}
-
-	public Integer getYear() {
-		return year;
-	}
-
-	public void setYear(Integer year) {
-		this.year = year;
-	}
+	private static final long serialVersionUID = 1L;
 
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.id
+	 * @return  the value of notice.id
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public String getId() {
 		return id;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.id
+	 * @param id  the value for notice.id
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setId(String id) {
-		this.id = id;
+		this.id = id == null ? null : id.trim();
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.aid
+	 * @return  the value of notice.aid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public String getAid() {
 		return aid;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.aid
+	 * @param aid  the value for notice.aid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setAid(String aid) {
-		this.aid = aid;
+		this.aid = aid == null ? null : aid.trim();
 	}
-
-
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.notice_type
+	 * @return  the value of notice.notice_type
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public Integer getNoticeType() {
 		return noticeType;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.notice_type
+	 * @param noticeType  the value for notice.notice_type
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setNoticeType(Integer noticeType) {
 		this.noticeType = noticeType;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.content
+	 * @return  the value of notice.content
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public String getContent() {
 		return content;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.content
+	 * @param content  the value for notice.content
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setContent(String content) {
-		this.content = content;
+		this.content = content == null ? null : content.trim();
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.create_time
+	 * @return  the value of notice.create_time
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public Date getCreateTime() {
 		return createTime;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.create_time
+	 * @param createTime  the value for notice.create_time
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setCreateTime(Date createTime) {
 		this.createTime = createTime;
 	}
-
-	@JsonIgnore
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.readed
+	 * @return  the value of notice.readed
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public Integer getReaded() {
 		return readed;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.readed
+	 * @param readed  the value for notice.readed
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setReaded(Integer readed) {
 		this.readed = readed;
 	}
-	
-	
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.uid
+	 * @return  the value of notice.uid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public String getUid() {
 		return uid;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.uid
+	 * @param uid  the value for notice.uid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setUid(String uid) {
-		this.uid = uid;
+		this.uid = uid == null ? null : uid.trim();
 	}
-
-	
-
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.pid
+	 * @return  the value of notice.pid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public String getPid() {
 		return pid;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.pid
+	 * @param pid  the value for notice.pid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setPid(String pid) {
-		this.pid = pid;
+		this.pid = pid == null ? null : pid.trim();
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.rid
+	 * @return  the value of notice.rid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public String getRid() {
 		return rid;
 	}
-
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.rid
+	 * @param rid  the value for notice.rid
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
 	public void setRid(String rid) {
-		this.rid = rid;
+		this.rid = rid == null ? null : rid.trim();
+	}
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.year
+	 * @return  the value of notice.year
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	public Integer getYear() {
+		return year;
 	}
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.year
+	 * @param year  the value for notice.year
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	public void setYear(Integer year) {
+		this.year = year;
+	}
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.type
+	 * @return  the value of notice.type
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	public Integer getType() {
+		return type;
+	}
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.type
+	 * @param type  the value for notice.type
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	public void setType(Integer type) {
+		this.type = type;
+	}
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
+	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
+	 */
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append(getClass().getSimpleName());
+		sb.append(" [");
+		sb.append("Hash = ").append(hashCode());
+		sb.append(", id=").append(id);
+		sb.append(", aid=").append(aid);
+		sb.append(", noticeType=").append(noticeType);
+		sb.append(", content=").append(content);
+		sb.append(", createTime=").append(createTime);
+		sb.append(", readed=").append(readed);
+		sb.append(", uid=").append(uid);
+		sb.append(", pid=").append(pid);
+		sb.append(", rid=").append(rid);
+		sb.append(", year=").append(year);
+		sb.append(", type=").append(type);
+		sb.append(", serialVersionUID=").append(serialVersionUID);
+		sb.append("]");
+		return sb.toString();
+	}
+
+
+	
+	public Notice() {};
+//	Readed(0);//未读
+//	 n.setAid("1");
+//	 n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
+//	 n
+	/**
+	 * 
+	 * @param id 编号
+	 * @param createTime 创建时间
+	 * @param readed 0未读
+	 * @param aid 发件人
+	 * @param noticeType 标题
+	 * @param content  内容
+	 */
+	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content,String uid) {
+		this.id=id;
+		this.createTime=createTime;
+		this.readed=readed;
+		this.aid=aid;
+		this.noticeType=noticeType;
+		this.content=content;
+		this.uid=uid;
+	}
+	
+	
+	/**
+	 * 
+	 * @param id 编号
+	 * @param createTime 创建时间
+	 * @param readed 0未读
+	 * @param aid 发件人
+	 * @param noticeType 标题
+	 * @param content  内容
+	 */
+	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content) {
+		this.id=id;
+		this.createTime=createTime;
+		this.readed=readed;
+		this.aid=aid;
+		this.noticeType=noticeType;
+		this.content=content;
+	}
+
+
 
 	public String getNoticeTypeName(){
 		if (null == this.noticeType)return null;

+ 121 - 59
src/main/java/com/goafanti/common/model/PatentNew.java

@@ -2,99 +2,110 @@ package com.goafanti.common.model;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.io.Serializable;
 
-public class PatentNew {
+public class PatentNew implements Serializable {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.id
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Integer id;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.patent_no
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private String patentNo;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.name
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private String name;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.type
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Integer type;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.status
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Integer status;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.apply_date
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Date applyDate;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.authorization_date
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Date authorizationDate;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.patent_amount
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private BigDecimal patentAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.applicant
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private String applicant;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.province
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Integer province;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.contact_mobile
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private String contactMobile;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.email
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private String email;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.certificate_url
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private String certificateUrl;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.create_time
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Date createTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.update_time
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Date updateTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.aid
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private String aid;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.years
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	private Integer years;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column patent_new.uid
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
+	 */
+	private String uid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table patent_new
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
+	 */
+	private static final long serialVersionUID = 1L;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.id
 	 * @return  the value of patent_new.id
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Integer getId() {
 		return id;
@@ -103,7 +114,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.id
 	 * @param id  the value for patent_new.id
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setId(Integer id) {
 		this.id = id;
@@ -112,7 +123,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.patent_no
 	 * @return  the value of patent_new.patent_no
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public String getPatentNo() {
 		return patentNo;
@@ -121,16 +132,16 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.patent_no
 	 * @param patentNo  the value for patent_new.patent_no
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setPatentNo(String patentNo) {
-		this.patentNo = patentNo;
+		this.patentNo = patentNo == null ? null : patentNo.trim();
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.name
 	 * @return  the value of patent_new.name
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public String getName() {
 		return name;
@@ -139,16 +150,16 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.name
 	 * @param name  the value for patent_new.name
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setName(String name) {
-		this.name = name;
+		this.name = name == null ? null : name.trim();
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.type
 	 * @return  the value of patent_new.type
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Integer getType() {
 		return type;
@@ -157,7 +168,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.type
 	 * @param type  the value for patent_new.type
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setType(Integer type) {
 		this.type = type;
@@ -166,7 +177,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.status
 	 * @return  the value of patent_new.status
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Integer getStatus() {
 		return status;
@@ -175,7 +186,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.status
 	 * @param status  the value for patent_new.status
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setStatus(Integer status) {
 		this.status = status;
@@ -184,7 +195,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.apply_date
 	 * @return  the value of patent_new.apply_date
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Date getApplyDate() {
 		return applyDate;
@@ -193,7 +204,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.apply_date
 	 * @param applyDate  the value for patent_new.apply_date
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setApplyDate(Date applyDate) {
 		this.applyDate = applyDate;
@@ -202,7 +213,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.authorization_date
 	 * @return  the value of patent_new.authorization_date
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Date getAuthorizationDate() {
 		return authorizationDate;
@@ -211,7 +222,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.authorization_date
 	 * @param authorizationDate  the value for patent_new.authorization_date
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setAuthorizationDate(Date authorizationDate) {
 		this.authorizationDate = authorizationDate;
@@ -220,7 +231,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.patent_amount
 	 * @return  the value of patent_new.patent_amount
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public BigDecimal getPatentAmount() {
 		return patentAmount;
@@ -229,7 +240,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.patent_amount
 	 * @param patentAmount  the value for patent_new.patent_amount
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setPatentAmount(BigDecimal patentAmount) {
 		this.patentAmount = patentAmount;
@@ -238,7 +249,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.applicant
 	 * @return  the value of patent_new.applicant
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public String getApplicant() {
 		return applicant;
@@ -247,16 +258,16 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.applicant
 	 * @param applicant  the value for patent_new.applicant
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setApplicant(String applicant) {
-		this.applicant = applicant;
+		this.applicant = applicant == null ? null : applicant.trim();
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.province
 	 * @return  the value of patent_new.province
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Integer getProvince() {
 		return province;
@@ -265,7 +276,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.province
 	 * @param province  the value for patent_new.province
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setProvince(Integer province) {
 		this.province = province;
@@ -274,7 +285,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.contact_mobile
 	 * @return  the value of patent_new.contact_mobile
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public String getContactMobile() {
 		return contactMobile;
@@ -283,16 +294,16 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.contact_mobile
 	 * @param contactMobile  the value for patent_new.contact_mobile
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setContactMobile(String contactMobile) {
-		this.contactMobile = contactMobile;
+		this.contactMobile = contactMobile == null ? null : contactMobile.trim();
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.email
 	 * @return  the value of patent_new.email
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public String getEmail() {
 		return email;
@@ -301,16 +312,16 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.email
 	 * @param email  the value for patent_new.email
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setEmail(String email) {
-		this.email = email;
+		this.email = email == null ? null : email.trim();
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.certificate_url
 	 * @return  the value of patent_new.certificate_url
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public String getCertificateUrl() {
 		return certificateUrl;
@@ -319,16 +330,16 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.certificate_url
 	 * @param certificateUrl  the value for patent_new.certificate_url
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setCertificateUrl(String certificateUrl) {
-		this.certificateUrl = certificateUrl;
+		this.certificateUrl = certificateUrl == null ? null : certificateUrl.trim();
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.create_time
 	 * @return  the value of patent_new.create_time
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Date getCreateTime() {
 		return createTime;
@@ -337,7 +348,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.create_time
 	 * @param createTime  the value for patent_new.create_time
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setCreateTime(Date createTime) {
 		this.createTime = createTime;
@@ -346,7 +357,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.update_time
 	 * @return  the value of patent_new.update_time
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Date getUpdateTime() {
 		return updateTime;
@@ -355,7 +366,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.update_time
 	 * @param updateTime  the value for patent_new.update_time
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setUpdateTime(Date updateTime) {
 		this.updateTime = updateTime;
@@ -364,7 +375,7 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.aid
 	 * @return  the value of patent_new.aid
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public String getAid() {
 		return aid;
@@ -373,16 +384,16 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.aid
 	 * @param aid  the value for patent_new.aid
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setAid(String aid) {
-		this.aid = aid;
+		this.aid = aid == null ? null : aid.trim();
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.years
 	 * @return  the value of patent_new.years
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public Integer getYears() {
 		return years;
@@ -391,9 +402,60 @@ public class PatentNew {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.years
 	 * @param years  the value for patent_new.years
-	 * @mbg.generated  Wed May 08 14:33:37 CST 2019
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
 	 */
 	public void setYears(Integer years) {
 		this.years = years;
 	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column patent_new.uid
+	 * @return  the value of patent_new.uid
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
+	 */
+	public String getUid() {
+		return uid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column patent_new.uid
+	 * @param uid  the value for patent_new.uid
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
+	 */
+	public void setUid(String uid) {
+		this.uid = uid == null ? null : uid.trim();
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table patent_new
+	 * @mbg.generated  Thu May 27 11:21:28 CST 2021
+	 */
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append(getClass().getSimpleName());
+		sb.append(" [");
+		sb.append("Hash = ").append(hashCode());
+		sb.append(", id=").append(id);
+		sb.append(", patentNo=").append(patentNo);
+		sb.append(", name=").append(name);
+		sb.append(", type=").append(type);
+		sb.append(", status=").append(status);
+		sb.append(", applyDate=").append(applyDate);
+		sb.append(", authorizationDate=").append(authorizationDate);
+		sb.append(", patentAmount=").append(patentAmount);
+		sb.append(", applicant=").append(applicant);
+		sb.append(", province=").append(province);
+		sb.append(", contactMobile=").append(contactMobile);
+		sb.append(", email=").append(email);
+		sb.append(", certificateUrl=").append(certificateUrl);
+		sb.append(", createTime=").append(createTime);
+		sb.append(", updateTime=").append(updateTime);
+		sb.append(", aid=").append(aid);
+		sb.append(", years=").append(years);
+		sb.append(", uid=").append(uid);
+		sb.append(", serialVersionUID=").append(serialVersionUID);
+		sb.append("]");
+		return sb.toString();
+	}
 }

+ 173 - 103
src/main/java/com/goafanti/common/task/PatentTask.java

@@ -22,7 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.admin.service.AdminService;
 import com.goafanti.common.bo.EmailBo;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.NoticeMapper;
+import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.PatentCategoryStatus;
 import com.goafanti.common.model.Admin;
@@ -30,6 +32,7 @@ import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.PatentNew;
 import com.goafanti.common.model.PatentNewLog;
 import com.goafanti.common.utils.AsyncUtils;
+import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.SendEmailUtil;
 import com.goafanti.patent.service.PatentNewService;
@@ -47,6 +50,8 @@ public class PatentTask {
 	@Autowired
 	private NoticeMapper	noticeMapper;
 	@Autowired
+	private UserMapper	userMapper;
+	@Autowired
 	private AsyncUtils	asyncUtils;
 	
 	
@@ -64,139 +69,177 @@ public class PatentTask {
 
 	
 	
-	
+	/**
+	 * 专利提醒定时任务
+	 * 每天0点触发任务
+	 * 1、先计算出申请时间与当前时间相隔天数 2、然后用相隔天使除以365取余计算年份差 3、在用申请时间加上年限获取最后日期
+	 * 4、在相隔30天、20天、10天、3天、2天、1天分别一次提醒。原是在距离90天提醒。
+	 */
 	@Scheduled(cron = "0 0 0  * * ?") 
 	@RequestMapping(value = "/open/patentRemind", method = RequestMethod.GET)
 	public void patentRemind() {
 		LoggerUtils.debug(getClass(), "====================开始检查专利提醒==================");
 		try {
-		List<PatentNew> l=patentNewService.AllselectStartPatentNew();
-		List<Notice> nlist=new  ArrayList<>();
-		for (PatentNew p : l) {
-			 Calendar cst =Calendar.getInstance();
-			 Calendar ced =Calendar.getInstance();
-			 Calendar ted =Calendar.getInstance();
-			 cst.setTime(p.getApplyDate());
-			 ced.setTime(new Date());
-			 //获得累计年限   
-			 int d = (int) ((ced.getTimeInMillis()-cst.getTimeInMillis()) / (1000*3600*24));
-			 int y=d/365;
-			 if(d%365>0)y++;
-			 ted.setTime(cst.getTime());
-			 ted.add(Calendar.YEAR,y);
-			 //计算相差日期
-			 int count = (int) ((ted.getTimeInMillis()-ced.getTimeInMillis()) / (1000*3600*24));
-			 Notice n =new Notice();
-			 n.setId(UUID.randomUUID().toString());
-			 n.setCreateTime(new Date());
-			 n.setReaded(0);//未读
-			 n.setAid("1");
-			 n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
-			 if (count>=0&&count<=90) {
-					 Admin a=adminService.selectByPrimaryKey(p.getAid());
-					 //设置如果找不到用户则提醒管理员
-					 String str2="专利编号="+p.getPatentNo()+"名称="+p.getName()+",email="+p.getEmail();;
-					 n.setContent(str2);
-					 if(a==null) {
-						n.setContent(str2+",aid="+p.getAid());
+			List<PatentNew> l = patentNewService.AllselectStartPatentNew();
+			List<Notice> nlist = new ArrayList<>();
+			List<PatentNewLog> logList = new ArrayList<>();
+			for (PatentNew p : l) {
+				//因为改成数据关联字段修改
+				String userName ="";
+				if (p.getUid()!=null) {
+					userName=userMapper.selectByPrimaryKey(p.getUid()).getUsername();
+				}else {
+					userName=p.getApplicant();
+				}
+				// 申请时间
+				Calendar sq = Calendar.getInstance();
+				sq.setTime(p.getApplyDate());
+				Integer status = 0;
+				// 当前时间
+				Calendar now = Calendar.getInstance();
+				now.setTime(new Date());
+				// 提醒
+				Calendar ted = Calendar.getInstance();
+				// 先获取到目前多少天数,再计算出年限
+				int d = (int) ((now.getTimeInMillis() - sq.getTimeInMillis()) / (1000 * 3600 * 24));
+				int y = d / 365;
+				if (d % 365 > 0)
+					y++;
+				ted.setTime(sq.getTime());
+				ted.add(Calendar.YEAR, y);
+				// 计算相差日期
+				int count = (int) ((ted.getTimeInMillis() - now.getTimeInMillis()) / (1000 * 3600 * 24));
+				Notice n = new Notice();
+				n.setId(UUID.randomUUID().toString());
+				n.setCreateTime(now.getTime());
+				n.setReaded(0);// 未读
+				n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
+				boolean flag=false;
+				if (count > 30 && count <= 90&&p.getStatus()!=1) {
+					flag=true;
+					status = 1;
+				} else if (count > 20 && count <= 30&&p.getStatus()!=2) {
+					flag=true;
+					status = 2;
+				}else if (count > 10 && count <= 20&&p.getStatus()!=3) {
+					flag=true;
+					status = 3;
+				}else if (count > 3 && count <= 10&&p.getStatus()!=4) {
+					flag=true;
+					status = 4;
+				}else if (count == 3&&p.getStatus()!=5) {
+					flag=true;
+					status = 5;
+				}else if (count == 2&&p.getStatus()!=6) {
+					flag=true;
+					status = 6;
+				}else if (count == 1&&p.getStatus()!=7) {
+					flag=true;
+					status = 7;
+				}
+				if (flag) {
+					Admin a = adminService.selectByPrimaryKey(p.getAid());
+					StringBuffer str2 = new StringBuffer();
+					str2.append("专利编号=").append(p.getPatentNo()).append("名称=").append(p.getName()).append(",email=")
+							.append(p.getEmail());
+					n.setContent(str2.toString());
+					if (a == null) {
+						str2.append(",aid=").append(p.getAid()).append(",找不到管理员。");
+						n.setContent(str2.toString());
+						n.setAid("1");
 						nlist.add(n);
-							continue;
-					 }else if (!SendEmailUtil.isEmail(p.getEmail().trim())) {
-						n.setContent(str2+",管理员="+a.getName());
+						continue;
+					} else if (!SendEmailUtil.isEmail(p.getEmail().trim())) {
+						str2.append(",管理员=").append(a.getName()).append(",邮箱不正确。");
+						n.setAid("1");
+						n.setContent(str2.toString());
 						nlist.add(n);
-						//再发一条给管理员
-						Notice n2 =new Notice();
+						// 再发一条给当事人
+						Notice n2 = new Notice();
 						n2.setId(UUID.randomUUID().toString());
-						n2.setCreateTime(new Date());
-						n2.setReaded(0);//未读
-						n2.setContent(str2);
+						n2.setCreateTime(now.getTime());
+						n2.setReaded(0);// 未读
+						n2.setContent(str2.toString());
 						n2.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
 						n2.setAid(a.getId());
 						nlist.add(n2);
-							continue;
-					}else {
-						 //计算出年费金额,然后存入数据库
-						 BigDecimal money=countMoney(y,p.getType());
-						ted.setTime(cst.getTime());
-						ted.add(Calendar.YEAR, y);
-						EmailBo emailBo = new EmailBo("专利提醒",p.getEmail().trim(), p.getApplicant(), "科德集团", a.getName(),p.getName(), p.getPatentNo(), money.toString(), DateFormatUtils.format(ted, "yyyy-MM-dd"));
-						 n.setNoticeType(NoticeStatus.TASK_PATENT_REMIND.getCode());
-						 String title="专利提醒";
-						 p.setStatus(1);//提醒中
+						continue;
+					} else {
+						// 计算出年费金额,然后存入数据库
+						BigDecimal money = countMoney(y, p.getType());
+						
+						EmailBo emailBo = new EmailBo("专利提醒", p.getEmail().trim(),userName, "科德集团", a.getName(),
+								p.getName(), p.getPatentNo(), money.toString(), DateFormatUtils.format(ted, "yyyy-MM-dd"),status);
+						n.setNoticeType(NoticeStatus.TASK_PATENT_REMIND.getCode());
+						String title = "专利提醒";
+						p.setStatus(status);// 提醒中
 						try {
 							asyncUtils.patentSend(emailBo);
 						} catch (SendFailedException e) {
-							//如果邮件发送失败提醒
-							 n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
-							 title="专利提醒失败!对方邮箱不存在或者拒收";
-							 p.setStatus(0);
+							// 如果邮件发送失败提醒
+							n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
+							title = "专利提醒失败!对方邮箱不存在或者拒收";
+							p.setStatus(0);
 						}
-						 p.setPatentAmount(money);
-						 p.setYears(y);
-						 patentNewService.updatePatenNew(p);
-						 PatentNewLog pl=new PatentNewLog();
-						 String str=StrToString(title,p.getEmail().trim(), p.getApplicant(), a.getName(),p.getName(), p.getPatentNo(),
-								 money.toString(), DateFormatUtils.format(ted, "yyyy-MM-dd"));
-						 pl.setContent(str);
-						 pl.setCreateTime(new Date());
-						 pl.setPid(p.getId());
-						 patentNewService.addPatenNewLog(pl);
-						 n.setAid(p.getAid());
-						 n.setContent(str);
-						 nlist.add(n);
+						p.setPatentAmount(money);
+						p.setYears(y);
+						patentNewService.updatePatenNew(p);
+						PatentNewLog pl = new PatentNewLog();
+						String str = StrToString(title, p.getEmail().trim(), userName, a.getName(), p.getName(),
+								p.getPatentNo(), money.toString(), DateFormatUtils.format(ted, "yyyy-MM-dd"),status);
+						pl.setContent(str);
+						pl.setCreateTime(new Date());
+						pl.setPid(p.getId());
+						logList.add(pl);
+						n.setAid(p.getAid());
+						n.setContent(str);
+						nlist.add(n);
 					}
-					
-					 Thread.sleep(2000);
+					Thread.sleep(2000);
 				}
-		}
-		if (!nlist.isEmpty()) {
-			List<Notice> newList=new  ArrayList<>();
-				  for(int i=0;i<nlist.size();i++){
-					  newList.add(nlist.get(i));
-					  if(pointsDataLimit == newList.size()||i == nlist.size()-1){
-						  if(newList.size()>0) noticeMapper.insertBatch(newList);	
-						  newList.clear();
-						  Thread.sleep(2000);
-					  }  
 			}
-		}
-		List<PatentNew> ls=patentNewService.AllselectEndPatentNew();
-		for (PatentNew p : ls) {
-			Calendar cst =Calendar.getInstance();
-			Calendar ced =Calendar.getInstance();
-			Calendar ted =Calendar.getInstance();
-			cst.setTime(p.getApplyDate());
-			ced.setTime(new Date());
-			int d = (int) ((ced.getTimeInMillis()-cst.getTimeInMillis()) / (1000*3600*24));
-			int y=(d/365);
-			if(d%365>0)y++;
-			ted.setTime(cst.getTime());
-			ted.add(Calendar.YEAR,y);
-			//计算相差日期
-			int count = (int) ((ted.getTimeInMillis()-ced.getTimeInMillis()) / (1000*3600*24));
-			if (count>200) {
-			p.setStatus(0);//恢复待提醒
-			patentNewService.updatePatenNew(p);
-			 }
-		}
+			if (!nlist.isEmpty()) {
+				List<Notice> newList = new ArrayList<>();
+				for (int i = 0; i < nlist.size(); i++) {
+					newList.add(nlist.get(i));
+					if (pointsDataLimit == newList.size() || i == nlist.size() - 1) {
+						if (newList.size() > 0)
+							noticeMapper.insertBatch(newList);
+						newList.clear();
+						Thread.sleep(2000);
+					}
+				}
+			}
+			if (!logList.isEmpty()) {
+				List<PatentNewLog> logList2 = new ArrayList<>();
+				for (int i = 0; i < logList.size(); i++) {
+					logList2.add(logList.get(i));
+					if (pointsDataLimit == logList2.size() || i == logList.size() - 1) {
+						if (logList2.size() > 0) patentNewService.insertLogBatch(logList2);
+						logList2.clear();
+						Thread.sleep(2000);
+					}
+				}
+
+			}
 		} catch (Exception e) {
 			LoggerUtils.debug(getClass(), "=====================专利提醒失败======================");
-			 Notice n =new Notice(UUID.randomUUID().toString(),new Date(),0,"1",NoticeStatus.TASK_PATENT_ERROR.getCode(),"==============专利提醒失败================");
-			 noticeMapper.insert(n);
+			Notice n = new Notice(UUID.randomUUID().toString(), new Date(), 0, "1",
+					NoticeStatus.TASK_PATENT_ERROR.getCode(), "==============专利提醒失败================");
+			noticeMapper.insert(n);
 			e.printStackTrace();
 		}
-					 
+
 		LoggerUtils.debug(getClass(), "=====================专利提醒结束======================");
 	}
 	
 
 	private String StrToString(String name, String email, String applicant,  String adminName, String pantentName,
-		String pantentNo, String money, String format) {
-		StringBuilder str =new StringBuilder("");
+		String pantentNo, String money, String format, Integer status) {
+		StringBuilder str =new StringBuilder();
 		str.append(name).append(":").append("邮箱:").append(email).append(",授权公司:").append(applicant).append(",录入人:").append(adminName)
 		.append(",专利名称:").append(pantentName).append (",专利编号:").append(pantentNo).append(",金额:").append(money).append(",时间:").append(format);
 		return str.toString();
-	
 }
 
 
@@ -270,4 +313,31 @@ public class PatentTask {
             htmlStr = htmlStr.replaceAll("&nbsp;", "");
             return htmlStr;
         }
+        
+        
+        public static void main(String[] args) {
+        	// 申请时间一月份是0。
+			Calendar sq = Calendar.getInstance();
+			sq.set(2020, 4, 27);
+			sq.add(Calendar.DATE, 1);
+			sq.add(Calendar.DATE, 90);
+			System.out.println(DateUtils.formatDate(sq.getTime(), AFTConstants.YYYYMMDD));
+			// 当前时间
+			Calendar now = Calendar.getInstance();
+			now.setTime(new Date());
+			// 提醒
+			Calendar ted = Calendar.getInstance();
+			// 先获取到目前多少天数,再计算出年限
+			int d = (int) ((now.getTimeInMillis() - sq.getTimeInMillis()) / (1000 * 3600 * 24));
+			System.out.println(d);
+			int y = d / 365;
+			if (d % 365 > 0)y++;
+			System.out.println(y);
+			ted.setTime(sq.getTime());
+			ted.add(Calendar.YEAR, y);
+			System.out.println(DateUtils.formatDate(ted.getTime(), AFTConstants.YYYYMMDD));
+			// 计算相差日期
+			int count = (int) ((ted.getTimeInMillis() - now.getTimeInMillis()) / (1000 * 3600 * 24));
+			System.out.println(count);
+		}
 }

+ 13 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -241,6 +241,19 @@ public class AdminCustomerApiController extends BaseApiController{
 		return res;
 	}
 	
+	/** 客户查询 **/
+	@RequestMapping(value = "/getUserByName",method = RequestMethod.GET)
+	public Result getUserByName(String name){
+		Result res = new Result();
+		if(StringUtils.isEmpty(name)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "名称","名称"));
+			return res;
+		}
+		if(name.length()<2) return res;
+		res.data(customerService.getUserByName(name));
+		return res;
+	}
+	
 	/** 添加客户基本信息  
 	 * @throws Exception 
 	 * @throws NumberFormatException **/

+ 8 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -126,6 +126,14 @@ public interface CustomerService {
 	 */
 	List<CustomerSimpleBo> getSignedCustomerByName(String name);
 	
+	
+	/**
+	 * 客户全查询
+	 * @param name
+	 * @return
+	 */
+	List<CustomerSimpleBo> getUserByName(String name);
+	
 	/**
 	 * 判断是否存在某个单位客户
 	 * @param name

+ 5 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -2202,4 +2202,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 				in.getPageSize());
 	}
 
+	@Override
+	public List<CustomerSimpleBo> getUserByName(String name) {
+		return userMapper.getUserByName(name);
+	}
+
 }

+ 11 - 0
src/main/java/com/goafanti/patent/bo/PatentNewBo.java

@@ -4,6 +4,10 @@ package com.goafanti.patent.bo;
 import com.goafanti.common.model.PatentNew;
 
 public class PatentNewBo extends PatentNew{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
 	private String applyDates;
 	private String authorizationDates;
 	private String aname;
@@ -13,6 +17,7 @@ public class PatentNewBo extends PatentNew{
 	private String startDate;
 	private String endDate;
 	private String departmentId;
+	private String userName;
 	public String getApplyDates() {
 		return applyDates;
 	}
@@ -67,4 +72,10 @@ public class PatentNewBo extends PatentNew{
 	public void setDepartmentId(String departmentId) {
 		this.departmentId = departmentId;
 	}
+	public String getUserName() {
+		return userName;
+	}
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
 }

+ 14 - 0
src/main/java/com/goafanti/patent/controller/AdminPatentNewApiController.java

@@ -89,6 +89,20 @@ public class AdminPatentNewApiController extends CertifyApiController {
 		Result res = new Result();
 		return res.data(patentNewService.selectPatentNew(p,pageSize,pageNo));
 	}
+	
+	
+	/**
+	 * 专利列表
+	 */
+	@RequestMapping(value = "/selectPatentNewLog", method = RequestMethod.GET)
+	public Result selectPatentNew(Integer id){
+		Result res = new Result();
+		if (id==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"编号","编号"));
+			return res;
+		}
+		return res.data(patentNewService.selectPatentNewLog(id));
+	}
 	/** 证件上传 **/
 	@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
 	public Result uploadRefundOrderFile(HttpServletRequest req,String sign){

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

@@ -22,4 +22,9 @@ public interface PatentNewService {
 
 	List<PatentNew> AllselectEndPatentNew();
 
+
+	void insertLogBatch(List<PatentNewLog> logList2);
+
+	List<PatentNewLog> selectPatentNewLog(Integer id);
+
 }

+ 10 - 0
src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java

@@ -79,6 +79,16 @@ public class PatentNewServiceImpl  extends BaseMybatisDao<PatentNewMapper> imple
 		return patentNewMapper.AllselectEndPatentNew();
 	}
 
+	@Override
+	public void insertLogBatch(List<PatentNewLog> list) {
+		patentNewLogMapper.insertLogBatch(list);
+	}
+
+	@Override
+	public List<PatentNewLog> selectPatentNewLog(Integer id) {
+		return patentNewLogMapper.selectPatentNewLog(id);
+	}
+
 	
 	
 	

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

@@ -1,13 +1,13 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #本地
-#jdbc.url=jdbc\:mysql://localhost:3306/aft20210514?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.username=root
-#jdbc.password=123456
-#测试
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
-jdbc.password=aftdev
+jdbc.password=123456
+#测试
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 #\u68c0\u6d4b\u6570\u636e\u5e93\u94fe\u63a5\u662f\u5426\u6709\u6548\uff0c\u5fc5\u987b\u914d\u7f6e
 jdbc.validationQuery=SELECT 'x'
 #\u521d\u59cb\u8fde\u63a5\u6570
@@ -64,12 +64,12 @@ user_remind_days=15
 portal.host=//sf.jishutao.com/portal/2.0.6
 avatar.upload.host=//sb.jishutao.com/upload
 #连接开�
-static.host=//172.16.0.253/1.1.73
-avatar.host=//172.16.0.253
+#static.host=//172.16.0.253/1.1.73
+#avatar.host=//172.16.0.253
 
-#avatar.host=//static.jishutao.com
-#static.host=//static.jishutao.com/1.1.73
+avatar.host=//static.jishutao.com
+static.host=//static.jishutao.com/1.1.73
 
 upload.path=F:/data/public/upload
 upload.private.path=F:/data/private/upload