| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- package cn.com.goldenwater.dcproj.task;
- import cn.com.goldenwater.dcproj.dao.TacInspYearBatchGroupPersDao;
- import cn.com.goldenwater.dcproj.dao.TacNoticeReceiptDao;
- import cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers;
- import cn.com.goldenwater.dcproj.model.TacNoticeReceipt;
- import cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam;
- import cn.com.goldenwater.dcproj.param.TacNoticeReceiptParam;
- import cn.com.goldenwater.dcproj.utils.DateUtils;
- import org.apache.commons.lang3.StringUtils;
- import org.quartz.DisallowConcurrentExecution;
- import org.quartz.Job;
- import org.quartz.JobExecutionContext;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import java.util.Date;
- import java.util.List;
- @DisallowConcurrentExecution
- public class TaskChangeTacJoinService implements Job {
- @Value("${api.url}")
- private String apiUrl;
- private Logger log = LoggerFactory.getLogger(getClass());
- @Autowired
- private TacNoticeReceiptDao tacNoticeReceiptDao;
- @Autowired
- private TacInspYearBatchGroupPersDao tacInspYearBatchGroupPersDao;
- /**
- * 要处理的 PROCESS_STATUS
- */
- private final static String PROCESS_STATUS = "1";
- @Override
- public void execute(JobExecutionContext arg0) {
- log.info("通过实时同步的稽察通知短信回执信息改变稽察人员参与情况:TaskChangeTacJoinService.execute()...");
- // 查询24小时内通知并发送短信成功的稽察人员无回复,则删除该稽察分组人员的信息
- TacInspYearBatchGroupPersParam sqlGroupPers = new TacInspYearBatchGroupPersParam();
- sqlGroupPers.setIsSms("1");
- sqlGroupPers.setIsNotice("1");
- sqlGroupPers.setIsJoin("0");
- sqlGroupPers.setEntm("24");//结束时间范围为24小时
- //24小时无回复的将人员信息删除。
- List<TacInspYearBatchGroupPers> getNoReplytacInspYearBatchGroupPers = tacInspYearBatchGroupPersDao.getNoReply(sqlGroupPers);
- for (TacInspYearBatchGroupPers getNoReplytacInspYearBatchGroupPer : getNoReplytacInspYearBatchGroupPers) {
- getNoReplytacInspYearBatchGroupPer.setIsJoin("3");//24小时未该表isjoin的值则默认未回复
- getNoReplytacInspYearBatchGroupPer.setUpTm(new Date());
- tacInspYearBatchGroupPersDao.update(getNoReplytacInspYearBatchGroupPer);
- }
- List<TacInspYearBatchGroupPers> tacInspYearBatchGroupPers = tacInspYearBatchGroupPersDao.confirmerGroupPers(sqlGroupPers);
- for (TacInspYearBatchGroupPers tacInspYearBatchGroupPer : tacInspYearBatchGroupPers) {
- String phone = tacInspYearBatchGroupPer.getPhone();
- TacNoticeReceiptParam tacNoticeReceiptParam = new TacNoticeReceiptParam();
- tacNoticeReceiptParam.setPhoneNumber(phone);
- tacNoticeReceiptParam.setSttm(DateUtils.Date2Str(tacInspYearBatchGroupPer.getSendsmsTm(), "yyyy-MM-dd HH:mm:ss"));
- tacNoticeReceiptParam.setProcessStatus("0");
- List<TacNoticeReceipt> list = tacNoticeReceiptDao.findList(tacNoticeReceiptParam);
- if (list != null && list.size() > 0) {//同一个号码回复短信多条记录则按照最后一条修改人员状态
- TacNoticeReceipt tacNoticeReceipt = list.get(0);
- String content = tacNoticeReceipt.getContent();
- if (StringUtils.isNotBlank(content)) {//回复内容
- if ("1".equals(content)) {
- tacInspYearBatchGroupPer.setIsJoin("1");
- tacInspYearBatchGroupPer.setUpTm(new Date());
- tacInspYearBatchGroupPersDao.update(tacInspYearBatchGroupPer);
- } else {
- tacInspYearBatchGroupPer.setIsJoin("2");//回复非1则为回复不参加
- tacInspYearBatchGroupPer.setUpTm(new Date());
- tacInspYearBatchGroupPersDao.update(tacInspYearBatchGroupPer);
- }
- } else {//回复内容为空,则默认不参加删除分组人员数据
- tacInspYearBatchGroupPer.setIsJoin("2");//回复非1则为回复不参加
- tacInspYearBatchGroupPer.setUpTm(new Date());
- tacInspYearBatchGroupPersDao.update(tacInspYearBatchGroupPer);
- }
- //处理过的短信回复将处理标识改变
- for (TacNoticeReceipt noticeReceipt : list) {
- noticeReceipt.setProcessStatus(PROCESS_STATUS);
- tacNoticeReceiptDao.update(noticeReceipt);
- }
- }
- }
- }
- }
|