liupeng 3 years ago
parent
commit
a4b703d82e

+ 17 - 1
code/sapparent/sapservice/src/main/java/org/fouram/service/WxCheckService.java

@@ -13,6 +13,8 @@ import org.fouram.entity.SapCheck;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.alibaba.fastjson.JSON;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
@@ -23,6 +25,20 @@ public class WxCheckService extends BaseService {
 
 	@Autowired
 	private WxUserService wxUserService;
+	
+	public static void main(String[] args) {
+		try {
+			Date startDate = DateUtil.sdfTime.parse("2021-05-20 03:00:00");
+			String nextDay = DateUtil.getAfterDay(startDate, 1);
+			Date endDate = DateUtil.sdfTime.parse(nextDay + " 03:00:00");
+
+			List<String> userIds = Lists.newArrayList("1252");
+			List<WxCpCheckinData> checkinDatas = WXCpOaUtil.getCheckinData(startDate, endDate, userIds);
+			System.out.println(JSON.toJSONString(checkinDatas));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
 
 	public void saveCheckInOffOuts(String checkinDay) throws Exception {
 		// 重新生成制定日期范围内的打卡数据
@@ -42,7 +58,7 @@ public class WxCheckService extends BaseService {
 				SapCheck check = new SapCheck();
 				BeanUtils.copyProperties(data, check);
 				check.setCheckinDate(new Date(check.getCheckinTime() * 1000));
-				check.setCheckinDay(DateUtil.getDay(check.getCheckinDate()));
+				check.setCheckinDay(checkinDay);
 				if (data.getCheckinType().equals("上班打卡")) {
 					saveCheckin(check);
 				} else if (data.getCheckinType().equals("下班打卡")) {