XxlJobHandler

This commit is contained in:
guohb
2024-04-07 11:26:44 +08:00
parent 7111222ce9
commit eb7b2a39ce
6 changed files with 66 additions and 3 deletions

View File

@@ -59,4 +59,7 @@ public interface LineInfoMapper extends Mapper<LineInfoDO> {
* @param lineInfoParam * @param lineInfoParam
*/ */
void insertOrUpdate(@Param("param") LineInfoDO lineInfoParam); void insertOrUpdate(@Param("param") LineInfoDO lineInfoParam);
void toExperiencing(@Param("lineIds") List<Long> lineIds,
@Param("code") Integer code);
} }

View File

@@ -19,4 +19,11 @@ public interface TrainingExperienceMapper {
LeaseBaseInfoDO selectByLineId(@Param("lineId") Long lineId); LeaseBaseInfoDO selectByLineId(@Param("lineId") Long lineId);
List<LeaseBaseInfoDO> selectByLineIds(@Param("lineIds") List<Long> lineIds); List<LeaseBaseInfoDO> selectByLineIds(@Param("lineIds") List<Long> lineIds);
/**
* 查询当日的门店体验数据
* @return
*/
List<LeaseBaseInfoDO> selectESTime();
} }

View File

@@ -280,6 +280,20 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="toExperiencing">
UPDATE
xfsg_line_info
SET workflow_sub_stage_status = #{code}
WHERE
deleted = 0
AND workflow_sub_stage_status = 85
AND id in
<foreach collection="lineIds" item="lineId" open="(" close=")" separator=",">
#{lineId}
</foreach>
</update>
<select id="getByPartnerId" resultMap="BaseResultMap"> <select id="getByPartnerId" resultMap="BaseResultMap">
select * from xfsg_line_info where partner_id = #{partnerId} and deleted = 0 select * from xfsg_line_info where partner_id = #{partnerId} and deleted = 0

View File

@@ -88,6 +88,15 @@
</if> </if>
</where> </where>
</select> </select>
<select id="selectESTime" resultType="com.cool.store.entity.LeaseBaseInfoDO">
SELECT
<include refid="Base_Column_List"/>
FROM
xfsg_lease_base_info
WHERE
DATE(experience_start_time) = CURDATE()
AND deleted = 0
</select>
</mapper> </mapper>

View File

@@ -48,6 +48,7 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
trainingExperienceMapper.insert(leaseBaseInfoDO); trainingExperienceMapper.insert(leaseBaseInfoDO);
LineInfoDO lineInfoDO = new LineInfoDO(); LineInfoDO lineInfoDO = new LineInfoDO();
lineInfoDO.setWorkflowSubStage(WorkflowSubStageEnum.STORE_EXPERIENCE.getCode()); lineInfoDO.setWorkflowSubStage(WorkflowSubStageEnum.STORE_EXPERIENCE.getCode());
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85.getCode());
lineInfoDO.setId(request.getLineId()); lineInfoDO.setId(request.getLineId());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO); lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
return true; return true;

View File

@@ -1,20 +1,49 @@
package com.cool.store.job; package com.cool.store.job;
import com.cool.store.entity.LeaseBaseInfoDO;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.TrainingExperienceMapper;
import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
public class XxlJobHandler { public class XxlJobHandler {
@XxlJob("A") @Resource
public void A(){ TrainingExperienceMapper trainingExperienceMapper;
@Resource
LineInfoMapper lineInfoMapper;
log.info("A结束"); /**
* 每天都将待体验门店信息变更到体验中
*/
@XxlJob("updateStoreExperience")
public void updateStoreExperience() {
log.info("------实训体验状态变更------");
String param = XxlJobHelper.getJobParam();
String enterpriseId = param;
//查出数据并更新为体验中
List<LeaseBaseInfoDO> leaseBaseInfoDOS = trainingExperienceMapper.selectESTime();
if (CollectionUtils.isEmpty(leaseBaseInfoDOS)) {
log.info("------今日没有待更新数据------");
return;
}
//线索ids
List<Long> lineIds = leaseBaseInfoDOS.stream().map(LeaseBaseInfoDO::getLineId).collect(Collectors.toList());
WorkflowSubStageStatusEnum storeExperience90 = WorkflowSubStageStatusEnum.STORE_EXPERIENCE_90;
lineInfoMapper.toExperiencing(lineIds, storeExperience90.getCode());
log.info("------实训体验状态变更结束------");
XxlJobHelper.handleSuccess(); XxlJobHelper.handleSuccess();
} }
} }