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.SupinfoBackService; 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.SupbackEntity; import com.jtgh.yjpt.service.common.AccessoryService; import com.jtgh.yjpt.service.qlyg.SupBackService; /** * 同步反馈信息 * * @author liangz * */ @Component public class QlygSyncSupinfo extends BaseController { @Autowired private SupinfoBackService backService; @Autowired private SupBackService supBackService; @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()) + "执行QlygSyncSupinfo"); // 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 filterListSupervise = new ArrayList(); addNotEmptyModel(filterListSupervise, "recordStatus", BaseEntity.RECORD_STATE_COMPLETED, Operator.EQ); // addNotEmptyModel(filterListSupervise, "receiptdate", startTime, // Operator.GTE); // addNotEmptyModel(filterListSupervise, "receiptdate", stopTime, // Operator.LT); addNotEmptyModel(filterListSupervise, "byzd5", GlobalData.QLYG_RES, Operator.NEQ); Specification specSupinfoback = SpecificationCreater .searchByPredicateModels(filterListSupervise); List listSuinfo = supBackService .findAll(specSupinfoback); if (listSuinfo != null) { for (SupbackEntity supbackEntity : listSuinfo) { backService.saveEntity(supbackEntity, accessoryService .findByEntityIdAndEntityTypeAndType( supbackEntity.getId(), Constants.GGDM_ID_SUPINFOBACK, null)); } } } }