zq-erp/src/main/java/com/matrix/config/TaskScheduleConfig.java
New file @@ -0,0 +1,10 @@ package com.matrix.config; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; @Configuration @EnableScheduling public class TaskScheduleConfig { } zq-erp/src/main/java/com/matrix/system/hive/statistics/StatisticsBusinessDataJob.java
@@ -18,11 +18,9 @@ import static com.matrix.system.hive.statistics.BusinessDataTypeEnum.*; /** * 定时任务测试类 * 业绩统计报表定时任务 * * @author zhangheng * @email 512061637@qq.com * @date 2019年1月15日 * @author jyy */ @Component public class StatisticsBusinessDataJob { @@ -72,7 +70,7 @@ } @Scheduled(cron = "0 0 0 1/1 * ?") @Scheduled(cron = "1 0 0 1/1 * ?") public boolean executeExt() { LogUtil.info("业绩统计定时任务开始运行*******************"); zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java
@@ -27,4 +27,8 @@ * @return */ List<ScoreVipDetail> selectEffectiveScore(@Param("vipId")Long vipId); List<ScoreVipDetail> selectInvalidaVipScore(); int invalidVipScore(); } zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
@@ -42,6 +42,10 @@ * 获取类型(4人工调整) */ public static final int SCORE_VIP_TYPE_USERCHANGE=4; /** * 获取类型(5积分失效) */ public static final int SCORE_OVER_TIME=5; /** 有效*/ public static final int SCORE_STATUS_YX=1; zq-erp/src/main/java/com/matrix/system/score/scheduledJob/ScoreScheduledJob.java
New file @@ -0,0 +1,64 @@ package com.matrix.system.score.scheduledJob; import cn.hutool.core.date.DateTime; import com.matrix.core.tools.LogUtil; import com.matrix.system.common.constance.AppConstance; import com.matrix.system.score.dao.ScoreUseRecordDao; import com.matrix.system.score.dao.ScoreVipDetailDao; import com.matrix.system.score.entity.ScoreUseRecord; import com.matrix.system.score.entity.ScoreVipDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.List; /** * 用户积分相关定时任务 * * @author jyy */ @Component public class ScoreScheduledJob { @Autowired ScoreVipDetailDao scoreVipDetailDao; @Autowired ScoreUseRecordDao scoreUseRecordDao; @Scheduled(cron = "1 0 0 1/1 * ?") public boolean invalidVipScore() { LogUtil.info("计算无效积分定时任务开始运行****************"); //获取所有失效的积分,生成失效记录 List<ScoreVipDetail> invalidavipScoreList = scoreVipDetailDao.selectInvalidaVipScore(); for (ScoreVipDetail scoreVipDetail : invalidavipScoreList) { ScoreUseRecord scoreUseRecord=new ScoreUseRecord(); scoreUseRecord.setCreateBy(AppConstance.SYSTEM_USER); scoreUseRecord.setUpdateBy(AppConstance.SYSTEM_USER); scoreUseRecord.setCreateTime(DateTime.now()); scoreUseRecord.setUpdateTime(DateTime.now()); scoreUseRecord.setNowScore(0); scoreUseRecord.setCompanyId(scoreVipDetail.getCompanyId()); scoreUseRecord.setScoreVipDetailId(scoreVipDetail.getId()); scoreUseRecord.setBusinessId(0L); scoreUseRecord.setRecNum(-scoreVipDetail.getRemainScore()); scoreUseRecord.setType(ScoreVipDetail.SCORE_OVER_TIME); scoreUseRecord.setVipId(scoreVipDetail.getVipId()); scoreUseRecord.setPreScore(scoreVipDetail.getRemainScore()); scoreUseRecord.setRemarks("积分失效"); scoreUseRecordDao.insert(scoreUseRecord); } //更新失效积分记录状态 scoreVipDetailDao.invalidVipScore(); LogUtil.info("计算无效积分定时任务结束*******************"); return true; } } zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityGroupJoinTimeOutQuartz.java
@@ -1,19 +1,15 @@ package com.matrix.system.shopXcx.quartz; import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.WebUtil; import com.matrix.system.hive.plugin.util.CollectionUtils; import com.matrix.system.shopXcx.bean.ShopActivities; import com.matrix.system.shopXcx.bean.ShopActivitiesGroupInfo; import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoin; import com.matrix.system.shopXcx.dao.ShopActivitiesDao; import com.matrix.system.shopXcx.dao.ShopActivitiesGroupJoinDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import java.util.List; @@ -24,7 +20,6 @@ * @author wzy */ @Configuration @EnableScheduling public class ShopActivityGroupJoinTimeOutQuartz { @Autowired zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityPayTimeOutQuartz.java
@@ -1,7 +1,6 @@ package com.matrix.system.shopXcx.quartz; import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.WebUtil; import com.matrix.system.hive.plugin.util.CollectionUtils; import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoin; import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoinUser; @@ -9,11 +8,9 @@ import com.matrix.system.shopXcx.dao.ShopActivitiesGroupJoinDao; import com.matrix.system.shopXcx.dao.ShopActivitiesGroupJoinUserDao; import com.matrix.system.shopXcx.dao.ShopOrderDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import java.util.List; @@ -24,7 +21,6 @@ * @author wzy */ @Configuration @EnableScheduling public class ShopActivityPayTimeOutQuartz { @Autowired zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityTimeOutQuartz.java
@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import java.util.ArrayList; @@ -24,7 +23,6 @@ * @author wzy */ @Configuration @EnableScheduling public class ShopActivityTimeOutQuartz { @Autowired zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopAutomaticReceiveQuartz.java
@@ -1,18 +1,15 @@ package com.matrix.system.shopXcx.quartz; import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.WebUtil; import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil; import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; import com.matrix.system.shopXcx.bean.ShopOrder; import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao; import com.matrix.system.shopXcx.dao.ShopOrderDao; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import java.util.HashMap; @@ -24,7 +21,6 @@ * 15天自动确认收货定时任务 */ @Configuration @EnableScheduling public class ShopAutomaticReceiveQuartz { @Value("${scheduling.enabled}") zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopCouponQuartz.java
@@ -1,13 +1,10 @@ package com.matrix.system.shopXcx.quartz; import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.WebUtil; import com.matrix.system.shopXcx.dao.ShopCouponDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; /** @@ -15,7 +12,6 @@ * 优惠券定时任务 */ @Configuration @EnableScheduling public class ShopCouponQuartz { zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
@@ -19,4 +19,13 @@ </select> <select id="selectInvalidaVipScore" resultType="com.matrix.system.score.entity.ScoreVipDetail"> select * from score_vip_detail where state=1 and remain_score>0 and validite_time <![CDATA[ < now()]]> </select> <update id="invalidVipScore"> update score_vip_detail set state = 2 , remain_score=0 where state=1 and validite_time <![CDATA[ < now()]]> </update> </mapper>