anderx %!s(int64=4) %!d(string=hai) anos
pai
achega
14754d664b

+ 37 - 4
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -21,7 +21,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.userDaysBo;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.enums.NoticeStatus;
+import com.goafanti.common.enums.NoticeTypes;
 import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.AsyncUtils;
@@ -39,6 +41,8 @@ public class ReleaseUserTask {
 	@Resource
 	private UserService userService;
 	@Autowired
+	private NoticeMapper	noticeMapper;
+	@Autowired
 	private AsyncUtils	asyncUtils;
 	@Value(value = "${dev.name}")
 	private String devName=null;
@@ -103,7 +107,7 @@ public class ReleaseUserTask {
 						NoticeStatus.CUSTOMER_PRIVATE_REMINDER.getCode(), str,ub.getUid()));
 			}
 		}
-		asyncUtils.addNoticeBatch(ln);
+		addNoticeBatch(ln);
 		LoggerUtils.debug(getClass(), "==============客户提醒结束============");
 	}
 
@@ -187,7 +191,7 @@ public class ReleaseUserTask {
 		} catch (Exception e) {
 			Notice n = new Notice(UUID.randomUUID().toString(), new Date(), 0, "1",
 					NoticeStatus.TASK_PATENT_ERROR.getCode(), "==============客户释放失败================",null);
-			asyncUtils.addNotice(n);
+			addNotice(n);
 			EmailBo emailBo = new EmailBo("释放客户失败", AFTConstants.ADMIN_EMAIL, "超管", "平台", "系统", devName+"释放客户失败");
 			try {
 				asyncUtils.send(emailBo);
@@ -199,6 +203,31 @@ public class ReleaseUserTask {
 		}
 		LoggerUtils.debug(getClass(), "==============客户释放完成============");
 	}
+	
+	public void addNotice(Notice n ) {
+		n.setType(NoticeTypes.getType(n.getNoticeType()));
+		noticeMapper.insertSelective(n);
+	}
+	
+	public void addNoticeBatch(List<Notice> ln) {
+		List<Notice> newList=new ArrayList<Notice>();
+		if (ln != null && ln.size() > 0) {
+			for (int i = 0; i < ln.size(); i++) {
+				ln.get(i).setType(NoticeTypes.getType(ln.get(i).getNoticeType()));
+				newList.add(ln.get(i));
+				if (50 == newList.size() || i == ln.size() - 1) {
+					if (newList.size() > 0) noticeMapper.insertBatch(newList);
+					newList.clear();
+					try {
+						Thread.sleep(2000);
+					} catch (InterruptedException e) {
+						e.printStackTrace();
+					}
+				}
+			}
+		}
+	}
+
 
 	private void addUserNotice(List<LockingReleaseBo> userTmpList, List<LockingReleaseBo> userTmpList2) {
 		List<Notice> nl=new ArrayList<Notice>();
@@ -214,8 +243,12 @@ public class ReleaseUserTask {
 					String.format("您的%s客户【%s】已经270天未签单,已经自动释放!", "私有", u.getUserName()),
 					u.getUid()));
 		}
-		if(!nl.isEmpty())asyncUtils.addNoticeBatch(nl);
+		if(!nl.isEmpty())addNoticeBatch(nl);
 	}
+	
+	
+	
+	
 
 	private void addChannelNotice(List<userDaysBo> hsList, List<userDaysBo> sfList) {
 		List<Notice> nl=new ArrayList<Notice>();
@@ -232,7 +265,7 @@ public class ReleaseUserTask {
 					String.format("您的%s客户【%s】已经90天未跟进,已经自动释放!", "渠道", sf.getName()),
 					sf.getUid()));
 		}
-		if(!nl.isEmpty())asyncUtils.addNoticeBatch(nl);
+		if(!nl.isEmpty())addNoticeBatch(nl);
 	}
 
 }

+ 16 - 0
src/main/java/com/goafanti/common/utils/excel/NewExcelUtil.java

@@ -165,6 +165,7 @@ public class NewExcelUtil<T> {
 		return new Result().data(1);
 	}
 	
+	
 	/**
 	 * 	导出CXCEL表到指定目录
 	 * @param list 导出数据集合
@@ -220,6 +221,8 @@ public class NewExcelUtil<T> {
 			}
 		}
 	}
+	
+	
 
 
 	private String DateFilename(String sheetName) {
@@ -402,6 +405,19 @@ public class NewExcelUtil<T> {
 		cell.setCellStyle(styles.get("header"));
 		return cell;
 	}
+	
+	/**
+	 * 创建单元格
+	 */
+	public Cell createTotal(String str, Row row, int column) {
+		// 创建列
+		Cell cell = row.createCell(column);
+		// 写入列信息
+		cell.setCellValue(str);
+		sheet.setColumnWidth(column, (int) ((14 + 0.72) * 256));
+		cell.setCellStyle(styles.get("header"));
+		return cell;
+	}
 
 	/**
 	 * 设置单元格信息

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

@@ -2059,9 +2059,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 						}
 						userTransferLogMapper.insertList(list3);
 					}
+					newList.clear();
+					Thread.sleep(2000);
 				}
-				newList.clear();
-				Thread.sleep(2000);
 			}
 
 		}

+ 9 - 0
src/main/java/com/goafanti/order/enums/TaskState.java

@@ -44,6 +44,15 @@ public enum TaskState {
         }
         return  null;
     }
+	
+	public static String getCountStr() {
+		StringBuffer str=new StringBuffer();
+		for (TaskState value : TaskState.values()) {
+			str.append(value.getCode()).append("=").append(value.getDesc()).append(",");
+		}
+		return str.substring(0, str.length()-1);
+		
+	}
 	private Integer	code;
 	private String	desc;
 	public Integer getCode() {