Pu Zhibing
14 小时以前 98b09eae533537dc9a5277aa6374bd7d35cfe5c4
修改bug和定时任务
5个文件已修改
34 ■■■■■ 已修改文件
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -191,6 +191,7 @@
             <if test="roleType != null and roleType != ''">roleType,</if>
             <if test="remark != null and remark != ''">remark,</if>
             <if test="objectId != null and objectId != ''">objectId,</if>
            <if test="passWordUpdate != null and passWordUpdate != ''">passWordUpdate,</if>
             create_time
         )values(
             <if test="userId != null and userId != ''">#{userId},</if>
@@ -207,6 +208,7 @@
             <if test="roleType != null and roleType != ''">#{roleType},</if>
             <if test="remark != null and remark != ''">#{remark},</if>
             <if test="objectId != null and objectId != ''">#{objectId},</if>
            <if test="passWordUpdate != null and passWordUpdate != ''">#{passWordUpdate},</if>
             sysdate()
         )
    </insert>
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java
@@ -5,6 +5,8 @@
import com.ruoyi.account.api.model.TAppUserVipDetail;
import com.ruoyi.account.service.TAppUserService;
import com.ruoyi.account.service.TAppUserVipDetailService;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -18,7 +20,7 @@
 * 定时任务工具类
 */
@Component
public class TaskUtil {
public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> {
    
    @Resource
    private TAppUserVipDetailService tAppUserVipDetailService;
@@ -26,12 +28,15 @@
    @Resource
    private TAppUserService appUserService;
    
    private Integer port = null;
    
    /**
     * 每隔一分钟去处理的定时任务
     */
    @Scheduled(fixedRate = 1000 * 60)
    public void sendVipCoupon() {
        if(null != port && port == 5200){
        try {
            //会员优惠次数使用完后重新续次数
            LocalDateTime currentDate = LocalDateTime.now();
@@ -47,12 +52,14 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        }
        
        
    }
    
    @Scheduled(fixedRate = 1000 * 60)
    public void changeVipId() {
        if(null != port && port == 5200){
        LocalDateTime currentDate = LocalDateTime.now();
        List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery()
                .le(TAppUserVipDetail::getStartTime, currentDate)
@@ -65,8 +72,15 @@
                appUserService.updateById(byId);
            }
        }
        }
        
    }
    
    
    @Override
    public void onApplicationEvent(WebServerInitializedEvent event) {
        port = event.getWebServer().getPort();
        System.out.println("端口号:" + port);
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -128,6 +128,7 @@
     * @param number
     * @return
     */
    @Log(title = "【扫一扫】通过桩编号获取电站信息", businessType = BusinessType.OTHER,operatorType = OperatorType.MOBILE)
    @GetMapping("/getSiteInfoByNumber")
    @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"})
    public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java
@@ -11,6 +11,8 @@
import com.ruoyi.order.service.TChargingOrderService;
import org.apache.logging.log4j.core.util.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -30,7 +32,7 @@
 * @date 2023/7/11 8:39
 */
@Component
public class TaskUtil {
public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> {
    @Resource
    private TChargingBillService chargingBillService;
@@ -39,10 +41,13 @@
    @Resource
    private TChargingOrderService chargingOrderService;
    private Integer port = null;
    @Scheduled(cron = "0 0 0 2 * ?")
    public void taskMonth() {
        if(null != port && port == 5400){
        try {
            // 获取上个月的开始和结束日期
            LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1).
@@ -129,10 +134,12 @@
            e.printStackTrace();
        }
    }
    }
    // 每个月最后一天23点执行的定时任务
    @Scheduled(cron = "0 0 23 * * ?")
    public void taskLastDay() {
        if(null != port && port == 5400){
        try {
            // 获取上个月的开始和结束日期
            LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1).
@@ -157,5 +164,11 @@
            e.printStackTrace();
        }
    }
    }
    @Override
    public void onApplicationEvent(WebServerInitializedEvent event) {
        port = event.getWebServer().getPort();
        System.out.println("端口号:" + port);
    }
}