|
|
@@ -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);
|
|
|
}
|
|
|
|
|
|
}
|