|
|
@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.text.Format; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Calendar; |
|
|
@ -66,7 +65,7 @@ public class ShowApiServiceImpl implements ShowApiService { |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
logger.error("method exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -103,7 +102,7 @@ public class ShowApiServiceImpl implements ShowApiService { |
|
|
|
logger.info("无需更新"); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
logger.error("method exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -119,7 +118,7 @@ public class ShowApiServiceImpl implements ShowApiService { |
|
|
|
calenderDao.updateHoliday(holidayDetail); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
logger.error("method exception", e); |
|
|
|
throw new RenException("根据年份查询当年的节假日列表API【https://route.showapi.com/894-4】查询异常"); |
|
|
|
} |
|
|
|
} |
|
|
@ -129,33 +128,37 @@ 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) { |
|
|
|
e.printStackTrace(); |
|
|
|
logger.error("queryHolidayV2020 exception", e); |
|
|
|
return; |
|
|
|
} |
|
|
|
List<CalenderEntity> list = calenderDao.selectByDay(currentDate); |
|
|
|
if(null!=list&&list.size()>0){ |
|
|
|
if (null != dayDetailResultDTO && 0 == dayDetailResultDTO.getRet_code()) { |
|
|
|
for (CalenderEntity calenderEntity : list) { |
|
|
|
calenderEntity.setRetCode(dayDetailResultDTO.getRet_code()); |
|
|
|
calenderEntity.setWeekday(dayDetailResultDTO.getWeekDay()); |
|
|
|
calenderEntity.setBegin(dayDetailResultDTO.getBegin()); |
|
|
|
calenderEntity.setEnd(dayDetailResultDTO.getEnd()); |
|
|
|
calenderEntity.setHoliday(dayDetailResultDTO.getHoliday()); |
|
|
|
calenderEntity.setHolidayRemark(dayDetailResultDTO.getHoliday_remark()); |
|
|
|
calenderEntity.setEn(dayDetailResultDTO.getEn()); |
|
|
|
calenderEntity.setCn(dayDetailResultDTO.getCn()); |
|
|
|
calenderEntity.setType(dayDetailResultDTO.getType()); |
|
|
|
//1为工作日,2为周末,3为节假日
|
|
|
|
if ("1".equals(dayDetailResultDTO.getType())) { |
|
|
|
calenderEntity.setTypeName("工作日"); |
|
|
|
} else if ("2".equals(dayDetailResultDTO.getType())) { |
|
|
|
calenderEntity.setTypeName("周末"); |
|
|
|
} else if ("3".equals(dayDetailResultDTO.getType())) { |
|
|
|
calenderEntity.setTypeName("节假日"); |
|
|
|
} |
|
|
|
calenderDao.updateById(calenderEntity); |
|
|
|
for (CalenderEntity calenderEntity : list) { |
|
|
|
calenderEntity.setRetCode(dayDetailResultDTO.getRet_code()); |
|
|
|
calenderEntity.setWeekday(dayDetailResultDTO.getWeekDay()); |
|
|
|
calenderEntity.setBegin(dayDetailResultDTO.getBegin()); |
|
|
|
calenderEntity.setEnd(dayDetailResultDTO.getEnd()); |
|
|
|
calenderEntity.setHoliday(dayDetailResultDTO.getHoliday()); |
|
|
|
calenderEntity.setHolidayRemark(dayDetailResultDTO.getHoliday_remark()); |
|
|
|
calenderEntity.setEn(dayDetailResultDTO.getEn()); |
|
|
|
calenderEntity.setCn(dayDetailResultDTO.getCn()); |
|
|
|
calenderEntity.setType(dayDetailResultDTO.getType()); |
|
|
|
//1为工作日,2为周末,3为节假日
|
|
|
|
if ("1".equals(dayDetailResultDTO.getType())) { |
|
|
|
calenderEntity.setTypeName("工作日"); |
|
|
|
} else if ("2".equals(dayDetailResultDTO.getType())) { |
|
|
|
calenderEntity.setTypeName("周末"); |
|
|
|
} else if ("3".equals(dayDetailResultDTO.getType())) { |
|
|
|
calenderEntity.setTypeName("节假日"); |
|
|
|
} |
|
|
|
calenderDao.updateById(calenderEntity); |
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
calenderDao.insert(getCalenderEntity(dayDetailResultDTO)); |
|
|
|
} |
|
|
@ -169,7 +172,6 @@ public class ShowApiServiceImpl implements ShowApiService { |
|
|
|
calenderEntity.setQueryDate(queryDate); |
|
|
|
} catch (ParseException e) { |
|
|
|
logger.error("QUERY_DATE 赋值 错误"); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
calenderEntity.setRetCode(dayDetailResultDTO.getRet_code()); |
|
|
|
calenderEntity.setWeekday(dayDetailResultDTO.getWeekDay()); |
|
|
@ -217,7 +219,7 @@ public class ShowApiServiceImpl implements ShowApiService { |
|
|
|
date = dateFormat.parse(datetime); |
|
|
|
cal.setTime(date); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
logger.error("method exception", e); |
|
|
|
} |
|
|
|
int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
|
|
|
return weekDays[w]; |
|
|
@ -238,7 +240,7 @@ public class ShowApiServiceImpl implements ShowApiService { |
|
|
|
date = dateFormat.parse(datetime); |
|
|
|
cal.setTime(date); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
logger.error("method exception", e); |
|
|
|
} |
|
|
|
int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
|
|
|
return weekDays[w]; |
|
|
@ -259,7 +261,7 @@ public class ShowApiServiceImpl implements ShowApiService { |
|
|
|
date = dateFormat.parse(datetime); |
|
|
|
cal.setTime(date); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
logger.error("method exception", e); |
|
|
|
} |
|
|
|
int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
|
|
|
return weekDays[w]; |
|
|
|