Ver código fonte

修改发邮件时邮箱不正确

anderx 4 anos atrás
pai
commit
3932bafd7e

+ 20 - 15
src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java

@@ -497,30 +497,35 @@ public class PatentNewServiceImpl  extends BaseMybatisDao<PatentNewMapper> imple
 	/** @param type 0 标记已通知 1批量发邮件 2转给营销员
 	   */
 	@Override
-	public Object updateBatch(String ids, Integer type,String aid) {
-		String [] s=ids.split(",");
-		List<String> ls=Arrays.asList(s);
-		addPatentNewLog(type, ls,aid);
-		if(type==1) {
-			List<EmailBo>list =new ArrayList<EmailBo>();
-			List<PatentNew> lp=patentNewMapper.selectByids(ls);
+	public Object updateBatch(String ids, Integer type, String aid) {
+		String[] s = ids.split(",");
+		List<String> ls = Arrays.asList(s);
+		addPatentNewLog(type, ls, aid);
+		List<PatentNew> lp = patentNewMapper.selectByids(ls);
+		List<EmailBo> list = new ArrayList<EmailBo>();
+		for (PatentNew patentNew : lp) {
+			if (patentNew.getStatus() == 0) {
+				throw new BusinessException("专利号[" + patentNew.getPatentNo() + "]未达到距离截止时间90天,不允许发送邮件");
+			}
+			if (!SendEmailUtil.isEmail(patentNew.getEmail())) {
+				throw new BusinessException("专利号[" + patentNew.getPatentNo() + "]的邮箱不正确。");
+			}
+		}
+		if (type == 1) {
 			for (PatentNew patentNew : lp) {
-				if (patentNew.getStatus()==0) {
-					throw new  BusinessException("专利号["+patentNew.getPatentNo()+"]未达到距离截止时间90天,不允许发送邮件");
-				}
 				Admin a = adminMapper.selectByPrimaryKey(patentNew.getAid());
-				String userName=patentNewMapper.selectUserNameByTid(patentNew.getTid());
-				BigDecimal amout= patentNew.getPatentAmount().multiply(new BigDecimal(10000));
+				String userName = patentNewMapper.selectUserNameByTid(patentNew.getTid());
+				BigDecimal amout = patentNew.getPatentAmount().multiply(new BigDecimal(10000));
 				EmailBo emailBo = new EmailBo("专利提醒", patentNew.getEmail().trim(), userName, "科德集团", a.getName(),
-						patentNew.getName(), patentNew.getPatentNo(),amout.stripTrailingZeros().toPlainString(),
+						patentNew.getName(), patentNew.getPatentNo(), amout.stripTrailingZeros().toPlainString(),
 						patentNew.getEndDate());
 				list.add(emailBo);
 			}
 			asyncUtils.sendList(list);
 		}
-		if (type==0||type==1) {
+		if (type == 0 || type == 1) {
 			patentNewMapper.updateBatch(ls);
-		}else if(type==2) {
+		} else if (type == 2) {
 			patentNewMapper.updateBatchByid(ls, null, aid);
 		}
 		return 1;