|
@@ -472,6 +472,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
String url = null;
|
|
|
try {
|
|
|
startDateTime = startDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ LocalDate date=startDateTime.toLocalDate();
|
|
|
long startTime = startDateTime.toEpochSecond(ZoneOffset.of("+8"));
|
|
|
endDateTime = endDateTime.withHour(23).withMinute(59).withSecond(0).withNano(0);
|
|
|
long endTime = endDateTime.toEpochSecond(ZoneOffset.of("+8"));
|
|
@@ -500,7 +501,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
int toIndex = (i + 1) * batchSize;
|
|
|
if (toIndex > totalLength) toIndex = totalLength;
|
|
|
Object[] objects = corpwxUserIds.subList(fromIndex, toIndex).toArray(new String[0]);
|
|
|
- reqPunchRecord(corpInfo, startTime, endTime, objects, showLog);
|
|
|
+ reqPunchRecord(corpInfo, startTime, endTime, objects, showLog,userId,date);
|
|
|
}
|
|
|
} catch (Exception exception) {
|
|
|
exception.printStackTrace();
|
|
@@ -509,7 +510,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
- public void reqPunchRecord(WxCorpInfo corpInfo, long startTime, long endTime, Object[] objects, boolean showLog)throws Exception {
|
|
|
+ public void reqPunchRecord(WxCorpInfo corpInfo, long startTime, long endTime, Object[] objects, boolean showLog,String userId,LocalDate date)throws Exception {
|
|
|
DateTimeFormatter mdFormat = DateTimeFormatter.ofPattern("yyyy/M/d");
|
|
|
LocalDateTime needDataTime = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
long dataTime = needDataTime.toEpochSecond(ZoneOffset.of("+8"));
|
|
@@ -585,16 +586,27 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("HH:mm");
|
|
|
userCorpwxTime.setStartTime(LocalTime.parse(minTime,df).plusHours(8).format(df));
|
|
|
userCorpwxTime.setEndTime(LocalTime.parse(maxTime,df).plusHours(8).format(df));
|
|
|
- userCorpwxTime.setCreateDate(LocalDate.now());
|
|
|
userCorpwxTime.setWxCorpid(corpInfo.getCorpid());
|
|
|
- userCorpwxTime.setWeekDay(LocalDate.now().getDayOfWeek().getValue());
|
|
|
+ if(userId!=null){
|
|
|
+ userCorpwxTime.setCreateDate(date);
|
|
|
+ userCorpwxTime.setWeekDay(date.getDayOfWeek().getValue());
|
|
|
+ }else {
|
|
|
+ userCorpwxTime.setCreateDate(LocalDate.now());
|
|
|
+ userCorpwxTime.setWeekDay(LocalDate.now().getDayOfWeek().getValue());
|
|
|
+ }
|
|
|
userCorpwxTime.setWeekDayTxt(DateTimeUtil.getWeekDayTxt(userCorpwxTime.getWeekDay()));
|
|
|
BigDecimal bigDecimal=new BigDecimal(Duration.between(LocalTime.parse(minTime,df).plusHours(8),LocalTime.parse(maxTime,df).plusHours(8)).toMinutes());
|
|
|
bigDecimal=bigDecimal.divide(BigDecimal.valueOf(60),1,BigDecimal.ROUND_HALF_UP).subtract(new BigDecimal(restTime));
|
|
|
userCorpwxTime.setWorkHours(bigDecimal.doubleValue());
|
|
|
System.out.println(userCorpwxTime);
|
|
|
- UserCorpwxTime item = userCorpwxTimeMapper.selectOne(new QueryWrapper<UserCorpwxTime>().eq("corpwx_userid", (String) objects[i])
|
|
|
- .eq("create_date", LocalDate.now()));
|
|
|
+ UserCorpwxTime item;
|
|
|
+ if(userId!=null){
|
|
|
+ item= userCorpwxTimeMapper.selectOne(new QueryWrapper<UserCorpwxTime>().eq("corpwx_userid", (String) objects[i])
|
|
|
+ .eq("create_date", date));
|
|
|
+ }else {
|
|
|
+ item= userCorpwxTimeMapper.selectOne(new QueryWrapper<UserCorpwxTime>().eq("corpwx_userid", (String) objects[i])
|
|
|
+ .eq("create_date", LocalDate.now()));
|
|
|
+ }
|
|
|
if (item != null) {
|
|
|
userCorpwxTime.setId(item.getId());
|
|
|
//已存在记录,进行更新
|