Browse Source

Merge branch 'test' of jishutao/kede-server into prod

anderx 5 years ago
parent
commit
fef5901b9d

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

@@ -47,6 +47,8 @@ public enum NoticeStatus {
 	PROJECT_OUTSOURCE_YES(38,"项目外包通过"),
 	PROJECT_OUTSOURCE_NO(39,"项目外包拒绝"),
 	ORDER_ARREARS_DUN(40,"欠款催款信息"),
+	TASK_PATENT_ERROR(41,"定时专利失败"),
+	TASK_PATENT_REMIND(42,"专利缴费提醒"),
 	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>

+ 54 - 9
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,8 +88,35 @@ 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.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.getName()+",email="+p.getEmail();;
+					 n.setContent(str2);
+					 if(a==null) {
+						 EmailBo emailBo = new EmailBo( "专利提醒失败【账号】",  AFTConstants.ADMIN_EMAIL,"超管", "平台",  "系统",str2 );
+						SendEmailUtil.getInstance().send(emailBo);
+						n.setContent(str2+",aid="+p.getAid());
+						nlist.add(n);
+							continue;
+					 }else if (!SendEmailUtil.isEmail(p.getEmail())) {
+						 EmailBo emailBo = new EmailBo( "专利提醒失败【邮件】",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统",str2);
+						SendEmailUtil.getInstance().send(emailBo);
+						n.setContent(str2+",管理员="+a.getName());
+						if (SendEmailUtil.isEmail(a.getEmail())) {
+							emailBo = new EmailBo( "专利提醒失败【邮件】",  a.getEmail(),"超管", "平台",  "系统",str2 );
+							SendEmailUtil.getInstance().send(emailBo);
+						}
+						nlist.add(n);
+							continue;
+						
+					}
 					 //计算出年费金额,然后存入数据库
 					 BigDecimal money=countMoney(y,p.getType());
 					 if(StringUtils.isNotBlank(p.getEmail())){
@@ -96,14 +132,20 @@ 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);
+					 n.setNoticeType(NoticeStatus.TASK_PATENT_REMIND.getCode());
+					 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();
@@ -126,11 +168,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();
 			
 		}
@@ -142,7 +184,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();
@@ -187,6 +228,10 @@ public class PatentTask {
 		
 		return new BigDecimal(money);
 	}
+	
+	
+
+		
 	/**
          * @param htmlStr
          * @return

+ 11 - 6
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -36,6 +36,7 @@ public class ReleaseUserTask {
 	@Scheduled(cron = "0 0 1  * * ?") 
 //	@RequestMapping(value = "/open/updateUser", method = RequestMethod.GET)
 	public void updateUser(){
+		LoggerUtils.debug(getClass(), "==============客户释放开始============");
 		Date releaseTime = new Date();
 		try {
 			List<User> userList = userServiceImpl.selectUserByRoleName("营销员","营销经理");
@@ -43,15 +44,18 @@ public class ReleaseUserTask {
 			List<LockingReleaseBo> lockBusinessList = new ArrayList<LockingReleaseBo>();
 			List<LockingReleaseBo> userTmpList = null;
 			List<LockingReleaseBo> businessTmpList = null;
-			for(User u : userList){
-				if(StringUtils.isNotBlank(u.getId())) {
-					userTmpList = customerServiceImpl.selectWaitReleaseCustomer(u.getId());
+			if (userList!=null&&!userList.isEmpty()) {
+				for(User u : userList){
+					if(StringUtils.isNotBlank(u.getId())) {
+						userTmpList = customerServiceImpl.selectWaitReleaseCustomer(u.getId());
 //					userTmpList = customerServiceImpl.selectWaitReleaseCustomer("1");
-					lockUserList.addAll(userTmpList);
-					businessTmpList = customerServiceImpl.selectWaitReleaseBusiness(u.getId());
+						lockUserList.addAll(userTmpList);
+						businessTmpList = customerServiceImpl.selectWaitReleaseBusiness(u.getId());
 //					businessTmpList = customerServiceImpl.selectWaitReleaseBusiness("1");
-					lockBusinessList.addAll(businessTmpList);
+						lockBusinessList.addAll(businessTmpList);
+					}
 				}
+				
 			}
 		List<LockingReleaseBo> newList=new ArrayList<LockingReleaseBo>();
 			  if (lockUserList.size()>0) {
@@ -91,6 +95,7 @@ public class ReleaseUserTask {
 			LoggerUtils.error(getClass(), "客户释放失败", e);
 			LoggerUtils.error(getClass(), "=============================================");
 		}
+		LoggerUtils.debug(getClass(), "==============客户释放完成============");
 	}
 	
 }

+ 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();
+				}
 	}
 	
 }

+ 5 - 1
src/main/java/com/goafanti/personnel/controller/AdminPersonnelApiController.java

@@ -47,7 +47,11 @@ public class AdminPersonnelApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "姓名", "姓名"));
 			return res;
 		}
-		
+		int x=personnelService.checkDoorId(i.getDoorId());
+		if (x>0) {
+			res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "门禁", "门禁"));
+			return res;
+		}
 		if ( !StringUtils.isBlank(i.getBirthdays())) {
 			try {
 				i.setBirthday(DateUtils.StringToDate(i.getBirthdays(), AFTConstants.YYYYMMDD));

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

@@ -1,13 +1,13 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #本地
-jdbc.url=jdbc\:mysql\://localhost\:3306/aft?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&useSSL\=false
-jdbc.username=dev
-jdbc.password=123456
+#jdbc.url=jdbc\:mysql\://localhost\:3306/aft?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&useSSL\=false
+#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.username=root
-#jdbc.password=aftdev
+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
@@ -15,7 +15,7 @@ jdbc.initialSize=3
 #\u6700\u5927\u8fde\u63a5\u6c60\u6570\u91cf
 jdbc.maxActive=20
 #\u53bb\u6389\uff0c\u914d\u7f6e\u6587\u4ef6\u5bf9\u5e94\u53bb\u6389
-#jdbc.maxIdle=20
+jdbc.maxIdle=20
 #\u914d\u7f6e0,\u5f53\u7ebf\u7a0b\u6c60\u6570\u91cf\u4e0d\u8db3\uff0c\u81ea\u52a8\u8865\u5145\u3002
 jdbc.minIdle=0
 #\u83b7\u53d6\u94fe\u63a5\u8d85\u65f6\u65f6\u95f4\u4e3a1\u5206\u949f\uff0c\u5355\u4f4d\u4e3a\u6beb\u79d2\u3002