12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package com.jtgh.qlyg.sync;
- import java.math.BigDecimal;
- import java.text.SimpleDateFormat;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.List;
- import org.apache.log4j.Logger;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Component;
- import com.jtgh.qlyg.entity.InfCheckLogEntity;
- import com.jtgh.qlyg.service.InfCheckLogService;
- import com.jtgh.yjpt.common.Constants;
- import com.jtgh.yjpt.common.GlobalData;
- import com.jtgh.yjpt.common.Utils;
- import com.jtgh.yjpt.controller.BaseController;
- import com.jtgh.yjpt.service.common.LogService;
- /**
- * 同步登录信息
- *
- * @author masn
- *
- */
- @Component
- public class QlygSyncCheckLog extends BaseController {
- /** 日志记录 */
- private Logger logger = Logger.getLogger(getClass());
- @Autowired
- private LogService logService;
- @Autowired
- private InfCheckLogService infCheckLogService;
- /**
- * 执行前一天登录情况
- */
- public void execute() {
- if (Constants.NO.equals(GlobalData.QLYG_SYNC))
- return;
- logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
- .format(new Date()) + "执行QlygSyncCheckLog");
- 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<Object[]> logs = logService.findInfCheckLog(startTime, stopTime);
- if (logs != null && logs.size() > 0) {
- for (Object[] log : logs) {
- InfCheckLogEntity checkLog = new InfCheckLogEntity();
- String dept_code = GlobalData.DEPT_CODE;
- if (Utils.getCurrentUser() != null) {
- dept_code = Utils.getCurrentUser().getSzd().getByzd4()
- + "JT";
- }
- checkLog.setCheckId(generateQlygNo(dept_code,
- generateEntityId(Constants.QLYG_SEQ_INF_CHECK_LOG)));
- checkLog.setNo(checkLog.getCheckId());
- checkLog.setCheckPerson((String) log[0]);
- checkLog.setOrgId((String) log[1]);
- checkLog.setCheckDate(c.getTime());
- checkLog.setCheckNumber(((BigDecimal) log[2]).intValue());
- checkLog.setCheckInteger(((BigDecimal) log[3]).intValue());
- checkLog.setCheckType(Constants.QLYG_CHECK_TYPE_APPLY);
- infCheckLogService.save(checkLog);
- }
- }
- }
- }
|