Browse Source

修改详情接口
Signed-off-by: anderx <312518615@qq.com>

anderx 5 years ago
parent
commit
bca9768f9a

+ 1 - 0
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -47,6 +47,7 @@ public enum NoticeStatus {
 	PROJECT_OUTSOURCE_YES(38,"项目外包通过"),
 	PROJECT_OUTSOURCE_NO(39,"项目外包拒绝"),
 	ORDER_ARREARS_DUN(40,"欠款催款信息"),
+	TASK_PATENT_ERROR(41,"定时专利失败"),
 	OTHER(0, "其他");
 
 	private NoticeStatus(Integer code, String desc) {

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

@@ -976,16 +976,15 @@
 	a.job_nature_remarks jobNatureRemarks, b.jobs_name jobsName,a.lvl,b.lvl_name starName,date_format(a.entry_time,'%Y-%m-%d')entryTimes,
 	date_format(a.promotion_time,'%Y-%m-%d')promotionTimes,date_format(a.birthday,'%Y-%m-%d')birthdays,a.star,a.jobs,
 	a.entry_time entryTime, a.sex,a.son,a.girl,a.political_outlook politicalOutlook,d.education,
-	d.school,d.major,d.title,e.promotion_remarks promotionRemarks,a.mobile,a.fixed_tel fixedTel,
-	date_format(e.promotion_time,'%Y-%m-%d') promotionTime,a.id_card idCard,a.birthday,a.allowance,m.welfare_remarks welfareRemarks,
+	d.school,d.major,d.title,m.promotion_remarks promotionRemarks,a.mobile,a.fixed_tel fixedTel,
+	date_format(m.promotion_time,'%Y-%m-%d') promotionTime,a.id_card idCard,a.birthday,a.allowance,m.welfare_remarks welfareRemarks,
 	a.certification_authority certificationAuthority, a.residence_province residenceProvince,m.welfare_annex_name welfareAnnexName,
 	a.residence_city residenceCity,a.residence_area residenceArea, a.residence_address residenceAddress,
 	a.native_place_province nativePlaceProvince, a.native_place_city nativePlaceCity,a.now_province nowProvince,
 	a.now_city nowCity,a.now_area nowArea, a.now_address nowAddress,m.welfare_annex_url welfareAnnexUrl
 	from personnel_dossier a left join  admin_level b  on a.jobs=b.jobs and a.star=b.lvl 
 	left join department dep on a.company = dep.id left join personnel_mid m on a.id=m.id
-	left join personnel_entry d on a.id=d.id left join (select id,pd_id,max(create_time)promotion_time,
-	 	promotion_remarks from personnel_promotion group by pd_id) e on a.id=e.pd_id
+	left join personnel_entry d on a.id=d.id  
 	where 1=1
 	and a.id= #{id}
   </select>

+ 44 - 16
src/main/java/com/goafanti/common/task/PatentTask.java

@@ -3,9 +3,11 @@ package com.goafanti.common.task;
 import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -13,6 +15,7 @@ import javax.annotation.Resource;
 import javax.mail.MessagingException;
 
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Controller;
@@ -23,9 +26,12 @@ 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.enums.NoticeStatus;
 import com.goafanti.common.enums.PatentCategoryStatus;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.PatentNew;
 import com.goafanti.common.model.PatentNewLog;
 import com.goafanti.common.utils.LoggerUtils;
@@ -43,6 +49,8 @@ public class PatentTask {
 	private PatentNewService patentNewService;
 	@Resource
 	private AdminService adminService;
+	@Autowired
+	private NoticeMapper	noticeMapper;
 	
 	
 	
@@ -65,6 +73,7 @@ public class PatentTask {
 		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();
@@ -79,18 +88,29 @@ public class PatentTask {
 			 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.setNoticeType(NoticeStatus.ORDER_NO.getCode());
+				n.setCreateTime(new Date());
+				n.setReaded(0);//未读
+				n.setAid("1");
 			 if (count>=0&&count<=90) {
 					 Admin a=adminService.selectByPrimaryKey(p.getAid());
 					 //设置如果找不到用户则提醒
+					 String str2="aid="+p.getAid()+",名称="+p.getName()+",email="+p.getEmail();;
+					 n.setContent(str2);
 					 if(a==null) {
-						 EmailBo emailBo = new EmailBo( "专利提醒失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", "专利提醒失败,aid="+p.getAid());
-							try {
-								SendEmailUtil.getInstance().send(emailBo);
-							} catch (UnsupportedEncodingException | MessagingException e1) {
-								e1.printStackTrace();
-							}
+						 EmailBo emailBo = new EmailBo( "专利提醒失败【账号】",  AFTConstants.ADMIN_EMAIL,"超管", "平台",  "系统",str2 );
+						SendEmailUtil.getInstance().send(emailBo);
+						nlist.add(n);
 							continue;
-					 }
+					 }else if (!SendEmailUtil.isEmail(p.getEmail())) {
+						 EmailBo emailBo = new EmailBo( "专利提醒失败【邮件】",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统",str2);
+						SendEmailUtil.getInstance().send(emailBo);
+						nlist.add(n);
+							continue;
+						
+					}
 					 //计算出年费金额,然后存入数据库
 					 BigDecimal money=countMoney(y,p.getType());
 					 if(StringUtils.isNotBlank(p.getEmail())){
@@ -106,14 +126,19 @@ public class PatentTask {
 					 PatentNewLog pl=new PatentNewLog();
 					 String str=StrToString("专利提醒",p.getEmail(), p.getApplicant(), a.getName(),p.getName(), p.getPatentNo(),
 							 money.toString(), DateFormatUtils.format(ted, "yyyy-MM-dd"));
-					 System.out.println(str.toString());
-					 pl.setContent(str.toString());
+					 pl.setContent(str);
 					 pl.setCreateTime(new Date());
 					 pl.setPid(p.getId());
 					 patentNewService.addPatenNewLog(pl);
-				
+					 n.setAid(p.getAid());
+					 n.setContent(str);
+					 nlist.add(n);
+					 Thread.sleep(2000);
 				}
 		}
+		if (!nlist.isEmpty()) {
+			noticeMapper.insertBatch(nlist);	
+		}
 		List<PatentNew> ls=patentNewService.AllselectEndPatentNew();
 		for (PatentNew p : ls) {
 			Calendar cst =Calendar.getInstance();
@@ -136,11 +161,11 @@ public class PatentTask {
 		} catch (Exception e) {
 			LoggerUtils.debug(getClass(), "=====================专利提醒失败======================");
 			  EmailBo emailBo = new EmailBo( "专利提醒失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", "专利提醒失败");
-				try {
-					SendEmailUtil.getInstance().send(emailBo);
-				} catch (UnsupportedEncodingException | MessagingException e1) {
-					e1.printStackTrace();
-				}
+					try {
+						SendEmailUtil.getInstance().send(emailBo);
+					} catch (UnsupportedEncodingException | MessagingException e1) {
+						e1.printStackTrace();
+					}
 			e.printStackTrace();
 			
 		}
@@ -152,7 +177,6 @@ public class PatentTask {
 	private String StrToString(String name, String email, String applicant,  String adminName, String pantentName,
 		String pantentNo, String money, String format) {
 		StringBuilder str =new StringBuilder("");
-//		str.append("专利提醒+"+p.getEmail()+"+"+ p.getApplicant()+"+"+ "科德集团"+"+"+ a.getName()+"+"+p.getName()+"+"+p.getPatentNo()+"+"+ money.toString()+"+"+ DateFormatUtils.format(ted, "yyyy-MM-dd"));
 		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();
@@ -197,6 +221,10 @@ public class PatentTask {
 		
 		return new BigDecimal(money);
 	}
+	
+	
+
+		
 	/**
          * @param htmlStr
          * @return

+ 8 - 1
src/main/java/com/goafanti/common/utils/SendEmailUtil.java

@@ -19,6 +19,7 @@ import javax.mail.internet.MimeUtility;
 
 
 import com.goafanti.common.bo.EmailBo;
+import com.goafanti.common.constant.AFTConstants;
 import com.sun.mail.util.MailSSLSocketFactory;
 
 public class SendEmailUtil {
@@ -144,7 +145,13 @@ public class SendEmailUtil {
 	
 	
 	public static void main(String[] args) {
-		
+		  EmailBo emailBo = new EmailBo( "专利提醒失败",  "mentos287@dingtalk.com",  "超管", "平台",  "系统", "专利提醒失败");
+				try {
+					SendEmailUtil.getInstance().send(emailBo);
+				} catch (UnsupportedEncodingException | MessagingException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
 	}
 	
 }

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

@@ -5,7 +5,7 @@ jdbc.url=jdbc\:mysql\://localhost\:3306/aft?useUnicode\=true&characterEncoding\=
 jdbc.username=dev
 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://101.37.32.31:3306/aft20200511?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