XxlJobHandler
This commit is contained in:
@@ -59,4 +59,7 @@ public interface LineInfoMapper extends Mapper<LineInfoDO> {
|
||||
* @param lineInfoParam
|
||||
*/
|
||||
void insertOrUpdate(@Param("param") LineInfoDO lineInfoParam);
|
||||
|
||||
void toExperiencing(@Param("lineIds") List<Long> lineIds,
|
||||
@Param("code") Integer code);
|
||||
}
|
||||
@@ -19,4 +19,11 @@ public interface TrainingExperienceMapper {
|
||||
LeaseBaseInfoDO selectByLineId(@Param("lineId") Long lineId);
|
||||
|
||||
List<LeaseBaseInfoDO> selectByLineIds(@Param("lineIds") List<Long> lineIds);
|
||||
|
||||
/**
|
||||
* 查询当日的门店体验数据
|
||||
* @return
|
||||
*/
|
||||
List<LeaseBaseInfoDO> selectESTime();
|
||||
|
||||
}
|
||||
|
||||
@@ -280,6 +280,20 @@
|
||||
</if>
|
||||
</trim>
|
||||
</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 * from xfsg_line_info where partner_id = #{partnerId} and deleted = 0
|
||||
|
||||
@@ -88,6 +88,15 @@
|
||||
</if>
|
||||
</where>
|
||||
</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>
|
||||
@@ -48,6 +48,7 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
|
||||
trainingExperienceMapper.insert(leaseBaseInfoDO);
|
||||
LineInfoDO lineInfoDO = new LineInfoDO();
|
||||
lineInfoDO.setWorkflowSubStage(WorkflowSubStageEnum.STORE_EXPERIENCE.getCode());
|
||||
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85.getCode());
|
||||
lineInfoDO.setId(request.getLineId());
|
||||
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
|
||||
return true;
|
||||
|
||||
@@ -1,20 +1,49 @@
|
||||
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.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class XxlJobHandler {
|
||||
|
||||
|
||||
@XxlJob("A")
|
||||
public void A(){
|
||||
@Resource
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user