123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- package com.jtgh.qlyg.sync;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import org.apache.log4j.Logger;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.jpa.domain.Specification;
- import org.springframework.stereotype.Component;
- import com.jtgh.qlyg.service.InfApplyProcessService;
- import com.jtgh.qlyg.service.InfApplyResultService;
- import com.jtgh.qlyg.service.InfApplyService;
- 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.ApplyEntity;
- import com.jtgh.yjpt.entity.qlyg.ApplyProcessEntity;
- import com.jtgh.yjpt.entity.qlyg.ApplyResultEntity;
- import com.jtgh.yjpt.service.qlyg.ApplyProcessService;
- import com.jtgh.yjpt.service.qlyg.ApplyResultService;
- import com.jtgh.yjpt.service.qlyg.ApplyService;
- /**
- * 同步办件信息
- *
- * @author masn
- *
- */
- @Component
- public class QlygSyncApply extends BaseController {
- /** 日志记录 */
- private Logger logger = Logger.getLogger(getClass());
- @Autowired
- private ApplyService applyService;
- @Autowired
- private ApplyProcessService applyProcessService;
- @Autowired
- private ApplyResultService applyResultService;
- @Autowired
- private InfApplyService infApplyService;
- @Autowired
- private InfApplyProcessService infApplyProcessService;
- @Autowired
- private InfApplyResultService infApplyResultService;
- /**
- * 执行前一天办件情况
- */
- public void execute() {
- if (Constants.NO.equals(GlobalData.QLYG_SYNC))
- return;
- logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
- .format(new Date()) + "执行QlygSyncApply");
- // 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> filterListApply = new ArrayList<PredicateModel>();
- addNotEmptyModel(filterListApply, "recordStatus",
- BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
- // addNotEmptyModel(filterListApply, "createDate", startTime,
- // Operator.GTE);
- // addNotEmptyModel(filterListApply, "createDate", stopTime,
- // Operator.LT);
- addNotEmptyModel(filterListApply, "byzd5", GlobalData.QLYG_RES,
- Operator.NEQ);
- Specification<ApplyEntity> specApply = SpecificationCreater
- .searchByPredicateModels(filterListApply);
- List<ApplyEntity> listApply = applyService.findAll(specApply);
- if (listApply != null && listApply.size() > 0) {
- for (ApplyEntity apply : listApply) {
- // 保存办件基本信息
- infApplyService.save(apply);
- }
- }
- // 同步办件过程信息
- List<PredicateModel> filterListApplyProcess = new ArrayList<PredicateModel>();
- addNotEmptyModel(filterListApplyProcess, "recordStatus",
- BaseEntity.RECORD_STATE_COMPLETED, Operator.EQ);
- // addNotEmptyModel(filterListApplyProcess, "createDate", startTime,
- // Operator.GTE);
- // addNotEmptyModel(filterListApplyProcess, "createDate", stopTime,
- // Operator.LT);
- addNotEmptyModel(filterListApply, "byzd5", GlobalData.QLYG_RES,
- Operator.NEQ);
- Specification<ApplyProcessEntity> specApplyProcess = SpecificationCreater
- .searchByPredicateModels(filterListApplyProcess);
- List<ApplyProcessEntity> listApplyProcess = applyProcessService
- .findAll(specApplyProcess);
- if (listApplyProcess != null && listApplyProcess.size() > 0) {
- for (ApplyProcessEntity applyProcess : listApplyProcess) {
- // 保存办件过程 保存到权力阳光库
- infApplyProcessService.save(applyProcess);
- }
- }
- // 同步办件过程信息
- List<PredicateModel> filterListApplyResult = new ArrayList<PredicateModel>();
- addNotEmptyModel(filterListApplyResult, "recordStatus",
- BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
- // addNotEmptyModel(filterListApplyResult, "createDate", startTime,
- // Operator.GTE);
- // addNotEmptyModel(filterListApplyResult, "createDate", stopTime,
- // Operator.LT);
- addNotEmptyModel(filterListApply, "byzd5", GlobalData.QLYG_RES,
- Operator.NEQ);
- Specification<ApplyResultEntity> specApplyResult = SpecificationCreater
- .searchByPredicateModels(filterListApplyResult);
- List<ApplyResultEntity> listApplyResult = applyResultService
- .findAll(specApplyResult);
- if (listApplyResult != null && listApplyResult.size() > 0) {
- for (ApplyResultEntity applyResult : listApplyResult) {
- // 保存办件过程
- infApplyResultService.save(applyResult);
- }
- }
- }
- }
|