iws中i8工程项目每日定时器编写
This commit is contained in:
parent
6e438a67e8
commit
27f44676f4
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.push.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.push.domain.ConsProjectLeaseMoneyBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -32,4 +33,8 @@ public interface ConsProjectLeaseMoneyMapper {
|
|||
List<ConsProjectLeaseMoneyBean> getRepairMoney(ConsProjectLeaseMoneyBean o);
|
||||
|
||||
int insertProjectMonthCosts(@Param("list") List<ConsProjectLeaseMoneyBean> total);
|
||||
|
||||
List<BmProject> getIwsProjectList();
|
||||
|
||||
void updateIwsProject(@Param("list") List<BmProject> list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,6 @@ public interface RentalCostsService {
|
|||
|
||||
|
||||
void calcMonthInfo();
|
||||
|
||||
void iwsProjectCycle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
|
|||
import com.bonus.common.biz.config.DateTimeHelper;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.push.domain.AccProjectLeaseMoneyBean;
|
||||
import com.bonus.material.push.domain.ConsProjectLeaseMoneyBean;
|
||||
import com.bonus.material.push.domain.IwsCostPushBean;
|
||||
|
|
@ -77,6 +78,20 @@ public class RentalCostsServiceImpl implements RentalCostsService {
|
|||
calcMonthInfoDetails(list, startTime, endTime, taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void iwsProjectCycle() {
|
||||
//查找iws的工程数据
|
||||
List<BmProject> list = consDao.getIwsProjectList();
|
||||
//修正bns_cloud_material数据
|
||||
if (list != null && list.size() > 0) {
|
||||
consDao.updateIwsProject(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void calcMonthInfoDetails(List<ConsProjectLeaseMoneyBean> list, String startTime, String endTime, String taskId) {
|
||||
int res;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.remind;
|
||||
|
||||
import com.bonus.common.biz.config.DateTimeHelper;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.push.service.RentalCostsService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -51,4 +52,35 @@ public class InformMonthly {
|
|||
System.err.println("定时任务获取时间报错:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务注解,用于配置任务的执行周期。
|
||||
* 该任务被安排在每天晚上十二点执行。
|
||||
* cron表达式解释:
|
||||
* - "0 0 0 * * ?" 表示在每天的0点0分0秒执行。
|
||||
* - 分钟(0):表示分钟,这里指定为0分钟。
|
||||
* - 小时(0):表示小时,这里指定为0点。
|
||||
* - 日期(*):表示日期,这里使用通配符*表示所有日期。
|
||||
* - 月份(*):表示月份,这里使用通配符*表示所有月份。
|
||||
* - 星期(?):表示星期,由于日期字段已使用*,因此使用?表示不指定星期。
|
||||
* - 年份(空):不指定年份,表示每年都执行。
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void iwsProjectCycle() {
|
||||
System.out.println("使用SpringMVC框架配置定时任务");
|
||||
try {
|
||||
System.out.println("执行每天晚上十二点的定时任务...执行时间:" + DateTimeHelper.currentDateTime());
|
||||
} catch (Exception e) {
|
||||
System.err.println("定时任务获取时间报错:" + e.getMessage());
|
||||
}
|
||||
|
||||
service.iwsProjectCycle();
|
||||
|
||||
try {
|
||||
System.out.println("当天的定时任务已结束:" + DateTimeHelper.currentDateTime());
|
||||
} catch (Exception e) {
|
||||
System.err.println("定时任务获取时间报错:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.push.mapper.ConsProjectLeaseMoneyMapper">
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getRealtionList" resultType="com.bonus.material.push.domain.ConsProjectLeaseMoneyBean">
|
||||
select
|
||||
bai.agreement_id as agreementId
|
||||
|
|
@ -200,4 +196,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getIwsProjectList" resultType="com.bonus.material.basic.domain.BmProject">
|
||||
select
|
||||
dfs.id as externalId,
|
||||
dfs.project_status as proStatus,
|
||||
dfs.real_end_date as actualEndDate
|
||||
from data_center.dx_fb_son dfs
|
||||
</select>
|
||||
|
||||
<update id="updateIwsProject">
|
||||
<foreach collection="list" item="item" separator=";">
|
||||
UPDATE bm_project
|
||||
SET
|
||||
pro_status = #{item.proStatus},
|
||||
actual_end_date = #{item.actualEndDate}
|
||||
WHERE external_id = #{item.externalId}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue