liupeng 4 years ago
parent
commit
cec6f8616d

+ 9 - 5
code/sapparent/sapservice/src/main/java/org/fouram/core/plugin/weixin/cp/util/WXCpOaUtil.java

@@ -19,6 +19,7 @@ import me.chanjar.weixin.cp.bean.oa.WxCpApprovalInfoQueryFilter;
 import me.chanjar.weixin.cp.bean.oa.WxCpApprovalInfoQueryFilter.KEY;
 import me.chanjar.weixin.cp.bean.oa.WxCpCheckinData;
 import me.chanjar.weixin.cp.bean.oa.WxCpCheckinOption;
+import me.chanjar.weixin.cp.bean.oa.WxCpCheckinOption.CheckinTime;
 import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
 
 /**
@@ -91,10 +92,13 @@ public class WXCpOaUtil {
 	}
 
 	public static void main(String[] args) throws Exception {
-		System.out.println(getApprovalDetailList(DateUtil.sdfTime.parse("2020-04-01 00:00:00"),
-				DateUtil.sdfTime.parse("2020-04-01 23:59:59")));
-
-		System.out.println(getCheckinData(DateUtil.sdfTime.parse("2020-10-16 00:00:00"),
-				DateUtil.sdfTime.parse("2020-10-16 23:59:59"), Lists.newArrayList("1007")));
+		List<Date> datetimes = Lists.newArrayList();
+		datetimes.add(DateUtil.sdfTime.parse("2020-12-29 00:00:00"));
+		for (WxCpCheckinOption option : getCheckinOption(datetimes, Lists.newArrayList("1245", "1242"))) {
+			if (option.getGroup() != null && !option.getGroup().getCheckinDate().isEmpty()) {
+				CheckinTime checkinTime = option.getGroup().getCheckinDate().get(0).getCheckinTime()[0];
+				System.out.println(checkinTime);
+			}
+		}
 	}
 }

+ 7 - 4
code/sapparent/sapservice/src/main/java/org/fouram/service/WxCheckOptionService.java

@@ -14,11 +14,12 @@ import org.springframework.stereotype.Service;
 import com.google.common.collect.Lists;
 
 import me.chanjar.weixin.cp.bean.oa.WxCpCheckinOption;
+import me.chanjar.weixin.cp.bean.oa.WxCpCheckinOption.CheckinDate;
 import me.chanjar.weixin.cp.bean.oa.WxCpCheckinOption.CheckinTime;
 
 @Service
 public class WxCheckOptionService extends BaseService {
-	
+
 	@Autowired
 	private WxUserService wxUserService;
 
@@ -30,9 +31,11 @@ public class WxCheckOptionService extends BaseService {
 		for (String key : map.keySet()) {
 			List<WxCpCheckinOption> options = WXCpOaUtil.getCheckinOption(datetimes, map.get(key));
 			for (WxCpCheckinOption option : options) {
-				if (option.getGroup() != null && !option.getGroup().getCheckinDate().isEmpty()) {
+				List<CheckinDate> checkinDate = option.getGroup().getCheckinDate();
+				if (option.getGroup() != null && !checkinDate.isEmpty()
+						&& checkinDate.get(0).getCheckinTime().length > 0) {
 					SapCheckOption check = new SapCheckOption();
-					CheckinTime checkinTime = option.getGroup().getCheckinDate().get(0).getCheckinTime()[0];
+					CheckinTime checkinTime = checkinDate.get(0).getCheckinTime()[0];
 					check.setUserId(option.getUserId());
 					check.setWorkSec(checkinTime.getWorkSec());
 					check.setOffWorkSec(checkinTime.getOffWorkSec());
@@ -41,7 +44,7 @@ public class WxCheckOptionService extends BaseService {
 			}
 		}
 	}
-	
+
 	public void save(SapCheckOption check) throws Exception {
 		save("SapCheckOptionMapper.save", check);
 	}