QlygSyncSupinfo.java 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package com.jtgh.qlyg.sync;
  2. import java.text.SimpleDateFormat;
  3. import java.util.ArrayList;
  4. import java.util.Date;
  5. import java.util.List;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.data.jpa.domain.Specification;
  8. import org.springframework.stereotype.Component;
  9. import com.jtgh.qlyg.service.SupinfoBackService;
  10. import com.jtgh.yjpt.common.Constants;
  11. import com.jtgh.yjpt.common.GlobalData;
  12. import com.jtgh.yjpt.common.PredicateModel;
  13. import com.jtgh.yjpt.common.PredicateModel.Operator;
  14. import com.jtgh.yjpt.common.SpecificationCreater;
  15. import com.jtgh.yjpt.controller.BaseController;
  16. import com.jtgh.yjpt.entity.BaseEntity;
  17. import com.jtgh.yjpt.entity.qlyg.SupbackEntity;
  18. import com.jtgh.yjpt.service.common.AccessoryService;
  19. import com.jtgh.yjpt.service.qlyg.SupBackService;
  20. /**
  21. * 同步反馈信息
  22. *
  23. * @author liangz
  24. *
  25. */
  26. @Component
  27. public class QlygSyncSupinfo extends BaseController {
  28. @Autowired
  29. private SupinfoBackService backService;
  30. @Autowired
  31. private SupBackService supBackService;
  32. @Autowired
  33. private AccessoryService accessoryService;
  34. /**
  35. * 执行前一天督查督办信息
  36. */
  37. public void execute() {
  38. if (Constants.NO.equals(GlobalData.QLYG_SYNC))
  39. return;
  40. logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
  41. .format(new Date()) + "执行QlygSyncSupinfo");
  42. // Calendar c = Calendar.getInstance();
  43. // c.set(Calendar.HOUR_OF_DAY, 0);
  44. // c.set(Calendar.MINUTE, 0);
  45. // c.set(Calendar.SECOND, 0);
  46. // c.set(Calendar.MILLISECOND, 0);
  47. // Date stopTime = c.getTime();
  48. // c.add(Calendar.DAY_OF_MONTH, -1);
  49. // Date startTime = c.getTime();
  50. // 同步反馈信息
  51. List<PredicateModel> filterListSupervise = new ArrayList<PredicateModel>();
  52. addNotEmptyModel(filterListSupervise, "recordStatus",
  53. BaseEntity.RECORD_STATE_COMPLETED, Operator.EQ);
  54. // addNotEmptyModel(filterListSupervise, "receiptdate", startTime,
  55. // Operator.GTE);
  56. // addNotEmptyModel(filterListSupervise, "receiptdate", stopTime,
  57. // Operator.LT);
  58. addNotEmptyModel(filterListSupervise, "byzd5", GlobalData.QLYG_RES,
  59. Operator.NEQ);
  60. Specification<SupbackEntity> specSupinfoback = SpecificationCreater
  61. .searchByPredicateModels(filterListSupervise);
  62. List<SupbackEntity> listSuinfo = supBackService
  63. .findAll(specSupinfoback);
  64. if (listSuinfo != null) {
  65. for (SupbackEntity supbackEntity : listSuinfo) {
  66. backService.saveEntity(supbackEntity, accessoryService
  67. .findByEntityIdAndEntityTypeAndType(
  68. supbackEntity.getId(),
  69. Constants.GGDM_ID_SUPINFOBACK, null));
  70. }
  71. }
  72. }
  73. }