新增定时任务修改活动状态
This commit is contained in:
parent
b6163c7a3b
commit
1fddd7ad7a
@ -37,6 +37,7 @@ public interface XhpcActivityCashMapper {
|
||||
|
||||
List<Map<String, Object>> selectUserListByParams(@Param("params")Map params);
|
||||
|
||||
|
||||
List<XhpcActivityCashDomain> selectCheckedPassAndAutoReceive();
|
||||
|
||||
int updateStatusByExpireNow();
|
||||
}
|
||||
@ -13,6 +13,8 @@ public interface XhpcActivityDiscountMapper {
|
||||
|
||||
List<XhpcActivityDiscountDomain> selectByTemplateIdAndStatus(@Param("templateId") Integer templateId, @Param("status")Integer status);
|
||||
|
||||
int updateByTemplateIdAndUncheck(@Param("templateId") Integer templateId);
|
||||
|
||||
List<XhpcActivityDiscountDomain> selectByTemplateIdAndDelflag(@Param("templateId") Integer templateId, @Param("delflag")Integer status);
|
||||
|
||||
List<Map<String,Object>> selectNameMapList(@Param("params")Map<String, Object> params);
|
||||
@ -40,4 +42,6 @@ public interface XhpcActivityDiscountMapper {
|
||||
List<Map<String, Object>> selectBUserListByUserIds(@Param("userIds") String userIds);
|
||||
|
||||
List<Map<String, Object>> selectUserListByParams(@Param("params")Map params);
|
||||
|
||||
int updateStatusByExpireNow();
|
||||
}
|
||||
@ -29,4 +29,5 @@ public interface XhpcActivityInternetMapper {
|
||||
|
||||
List<XhpcActivityInternetDomain> selectByDateBetween(@Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||
|
||||
int updateStatusByExpireNow();
|
||||
}
|
||||
@ -63,6 +63,7 @@ public class XhpcActivityTemplateServiceImpl implements XhpcActivityTemplateServ
|
||||
if(domainList.size() > 0){
|
||||
throw new CustomException("存在生效的折扣活动,请先失效使用该模版的折扣活动");
|
||||
}
|
||||
discountMapper.updateByTemplateIdAndUncheck(domain.getActivityTemplateId());
|
||||
}
|
||||
|
||||
return templateMapper.updateStatusByPrimaryKey(domain) > 0;
|
||||
|
||||
@ -2,9 +2,7 @@ package com.xhpc.activity.task;
|
||||
|
||||
import com.xhpc.activity.domain.*;
|
||||
import com.xhpc.activity.enums.ActivityTypeEnum;
|
||||
import com.xhpc.activity.mapper.XhpcActivityCashMapper;
|
||||
import com.xhpc.activity.mapper.XhpcActivityRecordMapper;
|
||||
import com.xhpc.activity.mapper.XhpcUserMapper;
|
||||
import com.xhpc.activity.mapper.*;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -18,10 +16,14 @@ import java.util.List;
|
||||
|
||||
@Component
|
||||
@Transactional
|
||||
public class AutoCashTask {
|
||||
public class AutoActivityTask {
|
||||
|
||||
@Resource
|
||||
XhpcActivityCashMapper cashMapper;
|
||||
@Resource
|
||||
XhpcActivityDiscountMapper discountMapper;
|
||||
@Resource
|
||||
XhpcActivityInternetMapper internetMapper;
|
||||
|
||||
@Resource
|
||||
XhpcUserMapper userMapper;
|
||||
@ -130,6 +132,14 @@ public class AutoCashTask {
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0 1 * * ?")
|
||||
private void updateActivityStatus(){
|
||||
cashMapper.updateStatusByExpireNow();
|
||||
discountMapper.updateStatusByExpireNow();
|
||||
internetMapper.updateStatusByExpireNow();
|
||||
}
|
||||
|
||||
|
||||
private XhpcActivityRecordDomain addRecord(XhpcActivityCashDomain cashDomain, Integer source, String userId) {
|
||||
XhpcActivityRecordDomain recordDomain = new XhpcActivityRecordDomain();
|
||||
recordDomain.setActivityType(ActivityTypeEnum.CASH.getCode());
|
||||
@ -132,7 +132,7 @@
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectAPPUserListByUserIds" resultType="java.util.Map">
|
||||
<select id="selectAPPUserListByUserIds" resultType="java.util.Map">
|
||||
SELECT 'C端用户' as 'userType', phone as 'usreAccount' from xhpc_app_user
|
||||
where del_flag=0 and status=0
|
||||
<if test="userIds!=null and userIds!=''">
|
||||
@ -197,7 +197,11 @@
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_activity_cash
|
||||
where del_flag=0 and status=3 and auto_receive=1 and auto_status=0
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateStatusByExpireNow">
|
||||
update xhpc_activity_cash set status=4 where status=3 and del_flag=0 and end_time <![CDATA[<=]]> now()
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@ -133,11 +133,18 @@
|
||||
<update id="updateStatusByTemplateId">
|
||||
update xhpc_activity_discount
|
||||
set status=#{status}
|
||||
where status = 3
|
||||
where status = 3 and del_flag=0
|
||||
and template_id = #{templateId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateByTemplateIdAndUncheck">
|
||||
update xhpc_activity_discount
|
||||
set status=4
|
||||
where template_id = #{templateId} and del_flag=0 and find_in_set(status, '0,1')
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectAPPUserListByUserIds" resultType="java.util.Map">
|
||||
SELECT 'C端用户' as 'userType', phone as 'usreAccount' from xhpc_app_user
|
||||
where del_flag=0 and status=0
|
||||
@ -203,7 +210,6 @@
|
||||
<include refid="Base_Column_List"/>
|
||||
from xhpc_activity_discount ad
|
||||
where ad.del_flag=0 and ad.status=#{status} and ad.template_id=#{templateId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
@ -213,4 +219,10 @@
|
||||
from xhpc_activity_discount ad
|
||||
where ad.del_flag=#{delflag} and ad.template_id=#{templateId}
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateStatusByExpireNow">
|
||||
update xhpc_activity_discount set status=4 where status=3 and del_flag=0 and end_time <![CDATA[<=]]> now()
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@ -140,4 +140,9 @@
|
||||
where activity_id = #{activityId,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateStatusByExpireNow">
|
||||
update xhpc_activity_internet set status=4 where status=3 and del_flag=0 and end_time <![CDATA[<=]]> now()
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user