Browse Source

工作日默认初始化明天的

dev
jianjun 3 years ago
parent
commit
1cda42a52b
  1. 7
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ShowApiServiceImpl.java
  2. 8
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/ShowApiUtil.java

7
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ShowApiServiceImpl.java

@ -128,13 +128,16 @@ public class ShowApiServiceImpl implements ShowApiService {
DayDetailResultDTO dayDetailResultDTO = null;
try {
dayDetailResultDTO = ShowApiUtil.queryHolidayV2020(currentDate);
if (dayDetailResultDTO == null){
logger.warn("initWorkDay howApiUtil.queryHolidayV2020 return null");
return;
}
} catch (Exception e) {
logger.error("queryHolidayV2020 exception", e);
return;
}
List<CalenderEntity> list = calenderDao.selectByDay(currentDate);
if(null!=list&&list.size()>0){
if (0 == dayDetailResultDTO.getRet_code()) {
for (CalenderEntity calenderEntity : list) {
calenderEntity.setRetCode(dayDetailResultDTO.getRet_code());
calenderEntity.setWeekday(dayDetailResultDTO.getWeekDay());
@ -155,7 +158,7 @@ public class ShowApiServiceImpl implements ShowApiService {
}
calenderDao.updateById(calenderEntity);
}
}
}else {
calenderDao.insert(getCalenderEntity(dayDetailResultDTO));
}

8
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/ShowApiUtil.java

@ -1,10 +1,13 @@
package com.epmet.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.ShowApiConstant;
import com.epmet.result.DayDetailResultDTO;
import com.epmet.result.HolidayResultDTO;
import com.epmet.result.ShowApiResult;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -51,7 +54,10 @@ public class ShowApiUtil {
JSONObject jsonobject = JSONObject.parseObject(resultStr);
ShowApiResult showApiResult= JSONObject.toJavaObject(jsonobject, ShowApiResult.class);
logger.info(showApiResult.toString());
if (showApiResult.getShowapi_res_code() != NumConstant.ZERO || StringUtils.isBlank(showApiResult.getShowapi_res_body())) {
logger.error("获取工作日失败,result:{}", JSON.toJSONString(showApiResult));
return null;
}
JSONObject holidayJsonObject = JSONObject.parseObject(showApiResult.getShowapi_res_body());
DayDetailResultDTO dayDetailResultDTO= JSONObject.toJavaObject(holidayJsonObject, DayDetailResultDTO.class);
logger.info(String.format("(3)QUERY_HOLIDAY_V2020返参:%s",dayDetailResultDTO.toString()));

Loading…
Cancel
Save