123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- package com.jtgh.qlyg.sync;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.jpa.domain.Specification;
- import org.springframework.stereotype.Component;
- import com.jtgh.qlyg.service.MonitorSuperviseReplyService;
- import com.jtgh.qlyg.service.MonitorSuperviseResultService;
- import com.jtgh.qlyg.service.MonitorSuperviseService;
- import com.jtgh.yjpt.common.Constants;
- import com.jtgh.yjpt.common.GlobalData;
- import com.jtgh.yjpt.common.PredicateModel;
- import com.jtgh.yjpt.common.PredicateModel.Operator;
- import com.jtgh.yjpt.common.SpecificationCreater;
- import com.jtgh.yjpt.controller.BaseController;
- import com.jtgh.yjpt.entity.BaseEntity;
- import com.jtgh.yjpt.entity.qlyg.SuperviseEntity;
- import com.jtgh.yjpt.entity.qlyg.SuperviseReplyEntity;
- import com.jtgh.yjpt.entity.qlyg.SuperviseResultEntity;
- import com.jtgh.yjpt.service.common.AccessoryService;
- import com.jtgh.yjpt.service.qlyg.SuperviseReplyService;
- import com.jtgh.yjpt.service.qlyg.SuperviseResultService;
- import com.jtgh.yjpt.service.qlyg.SuperviseService;
- /**
- * 同步督察督办信息
- *
- * @author liangz
- *
- */
- @Component
- public class QlygSyncSupervise extends BaseController {
- @Autowired
- private SuperviseService superviseService;
- @Autowired
- private SuperviseReplyService replyService;
- @Autowired
- private SuperviseResultService resultService;
- @Autowired
- private MonitorSuperviseService monitorSuperviseService;
- @Autowired
- private MonitorSuperviseReplyService monitorReplyService;
- @Autowired
- private MonitorSuperviseResultService monitorResultService;
- @Autowired
- private AccessoryService accessoryService;
- /**
- * 执行前一天督查督办信息
- */
- public void execute() {
- if (Constants.NO.equals(GlobalData.QLYG_SYNC))
- return;
- logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
- .format(new Date()) + "执行QlygSyncSupervise");
- // Calendar c = Calendar.getInstance();
- // c.set(Calendar.HOUR_OF_DAY, 0);
- // c.set(Calendar.MINUTE, 0);
- // c.set(Calendar.SECOND, 0);
- // c.set(Calendar.MILLISECOND, 0);
- // Date stopTime = c.getTime();
- // c.add(Calendar.DAY_OF_MONTH, -1);
- // Date startTime = c.getTime();
- // 同步督察督办基本信息
- List<PredicateModel> filterListSupervise = new ArrayList<PredicateModel>();
- addNotEmptyModel(filterListSupervise, "recordStatus",
- BaseEntity.RECORD_STATE_COMPLETED, Operator.EQ);
- // addNotEmptyModel(filterListSupervise, "superviseDate", startTime,
- // Operator.GTE);
- // addNotEmptyModel(filterListSupervise, "superviseDate", stopTime,
- // Operator.LT);
- addNotEmptyModel(filterListSupervise, "byzd5", GlobalData.QLYG_RES,
- Operator.NEQ);
- Specification<SuperviseEntity> specSupervise = SpecificationCreater
- .searchByPredicateModels(filterListSupervise);
- List<SuperviseEntity> listSupervise = superviseService
- .findAll(specSupervise);
- if (listSupervise != null) {
- for (SuperviseEntity superviseEntity : listSupervise) {
- monitorSuperviseService.save(superviseEntity, accessoryService
- .findByEntityIdAndEntityTypeAndType(
- superviseEntity.getId(),
- Constants.GGDM_ID_SUPERVISE, null));
- }
- }
- // 同步督办反馈信息
- filterListSupervise.clear();
- addNotEmptyModel(filterListSupervise, "recordStatus",
- BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
- // addNotEmptyModel(filterListSupervise, "replyDate", startTime,
- // Operator.GTE);
- // addNotEmptyModel(filterListSupervise, "replyDate", stopTime,
- // Operator.LT);
- addNotEmptyModel(filterListSupervise, "byzd5", GlobalData.QLYG_RES,
- Operator.NEQ);
- Specification<SuperviseReplyEntity> specReply = SpecificationCreater
- .searchByPredicateModels(filterListSupervise);
- List<SuperviseReplyEntity> listReply = replyService.findAll(specReply);
- for (SuperviseReplyEntity superviseReplyEntity : listReply) {
- monitorReplyService.save(superviseReplyEntity, accessoryService
- .findByEntityIdAndEntityTypeAndType(
- superviseReplyEntity.getId(),
- Constants.GGDM_ID_SUPERVISE_REPLY, null));
- }
- // 同步督办结论信息
- filterListSupervise.clear();
- addNotEmptyModel(filterListSupervise, "recordStatus",
- BaseEntity.RECORD_STATE_COMPLETED, Operator.EQ);
- // addNotEmptyModel(filterListSupervise, "endDate", startTime,
- // Operator.GTE);
- // addNotEmptyModel(filterListSupervise, "endDate", stopTime,
- // Operator.LT);
- addNotEmptyModel(filterListSupervise, "byzd5", GlobalData.QLYG_RES,
- Operator.NEQ);
- Specification<SuperviseResultEntity> specResult = SpecificationCreater
- .searchByPredicateModels(filterListSupervise);
- List<SuperviseResultEntity> listResult = resultService
- .findAll(specResult);
- if (listResult != null) {
- for (SuperviseResultEntity superviseResultEntity : listResult) {
- monitorResultService.saveEntity(superviseResultEntity);
- }
- }
- }
- }
|