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