Commit 5a74bbc4 by 范富荣

督导-日报优化-新增字段

1 parent 6121436c
......@@ -2,6 +2,7 @@ package cn.com.glsx.dj.supervisor.dto;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskCourse;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskImage;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskMerchant;
import cn.com.glsx.dj.supervisor.model.SupervisorWeekTaskStaff;
import cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemote;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -135,4 +136,22 @@ public class SupervisorTaskDTO implements Serializable {
@ApiModelProperty(notes = "课程列表")
private List<SupervisorTaskCourse> taskCourseList;
/**
* 后续工作事项
*/
@ApiModelProperty(notes = "后续工作事项")
private String nextWorkItems;
/**
* 需协助事项
*/
@ApiModelProperty(notes = "需协助事项")
private String needAssistItems;
/**
* 门店关联列表
*/
@ApiModelProperty(notes = "门店关联列表")
private List<SupervisorTaskMerchant> taskMerchantList;
}
......@@ -141,4 +141,16 @@ public class SupervisorTaskInfo implements Serializable {
*/
@Column(name = "task_context")
private String taskContext;
/**
* 后续工作事项
*/
@Column(name = "next_work_items")
private String nextWorkItems;
/**
* 需协助事项
*/
@Column(name = "need_assist_items")
private String needAssistItems;
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
@Data
@ToString
@Table(name = "supervisor_task_merchant")
public class SupervisorTaskMerchant implements Serializable {
/**
* 主键ID(自增)
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 关联任务ID(supervisor_task_info.id)
*/
@Column(name = "relation_id")
private Long relationId;
/**
* 门店ID
*/
@ApiModelProperty(notes = "门店ID")
@Column(name = "merchant_id")
private Integer merchantId;
/**
* 门店名称
*/
@ApiModelProperty(notes = "门店名称")
@Column(name = "merchant_name")
private String merchantName;
/**
* 创建人姓名
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新人账户名称
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_date")
private Date updatedDate;
/**
* 删除标识(D:已删除;N:未删除)
*/
@Column(name = "deleted_flag")
private String deletedFlag;
}
package cn.com.glsx.dj.supervisor.mapper;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskMerchant;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface SupervisorTaskMerchantMapper extends OreMapper<SupervisorTaskMerchant> {
}
......@@ -20,6 +20,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
......@@ -39,6 +40,9 @@ public class SupervisorAudioReviewInfoService {
@Autowired
private SupervisorTaskInfoService supervisorTaskInfoService;
@Autowired
private Environment env;
/**
......@@ -145,15 +149,18 @@ public class SupervisorAudioReviewInfoService {
//查询关联任务中其他录音是否全部复盘,若全部复盘,则更新任务状态为已完成
List<SupervisorAudioReviewInfo> list = listByTaskIds(Arrays.asList(info.getRelationId()));
if (CollectionUtils.isNotEmpty(list)) {
//判断是否全部复盘
boolean allReviewed = list.stream().allMatch(item -> ReviewStatusEnum.COMPLETED.getCode().equals(item.getReviewStatus()));
boolean anyReviewed = list.stream().anyMatch(item -> ReviewStatusEnum.COMPLETED.getCode().equals(item.getReviewStatus()));
if (allReviewed) {
//更新任务状态为已完成
supervisorTaskInfoService.updateTaskStatus(info.getRelationId(), TaskStatusEnum.COMPLETED.getCode(), request.getUpdatedBy());
} else if (anyReviewed) {
//更新任务状态为进行中
supervisorTaskInfoService.updateTaskStatus(info.getRelationId(), TaskStatusEnum.IN_PROGRESS.getCode(), request.getUpdatedBy());
//从配置读取复盘完成比例阈值(百分比),默认50
int completeRatio = env.getProperty("supervisor_audio_review_complete_ratio", Integer.class, 50);
long reviewedCount = list.stream().filter(item -> ReviewStatusEnum.COMPLETED.getCode().equals(item.getReviewStatus())).count();
boolean anyReviewed = reviewedCount > 0;
if (anyReviewed) {
if (reviewedCount * 100 >= (long) list.size() * completeRatio) {
//复盘比例>=阈值,更新任务状态为已完成
supervisorTaskInfoService.updateTaskStatus(info.getRelationId(), TaskStatusEnum.COMPLETED.getCode(), request.getUpdatedBy());
} else {
//复盘比例<阈值,更新任务状态为进行中
supervisorTaskInfoService.updateTaskStatus(info.getRelationId(), TaskStatusEnum.IN_PROGRESS.getCode(), request.getUpdatedBy());
}
}
}
return true;
......
......@@ -68,6 +68,9 @@ public class SupervisorTaskInfoService {
private SupervisorWeekTaskStaffService supervisorWeekTaskStaffService;
@Autowired
private SupervisorTaskMerchantService supervisorTaskMerchantService;
@Autowired
private SupervisorAudioReviewInfoService supervisorAudioReviewInfoService;
@Autowired
......@@ -472,6 +475,8 @@ public class SupervisorTaskInfoService {
}
//插入图片列表
supervisorTaskImageService.batchInsertImage(request, date);
//插入门店关联列表
supervisorTaskMerchantService.batchInsert(request, date);
//判断是否是周报
if (TaskTypeEnum.WEEKLY_REPORT.getCode().equals(taskInfo.getTaskType())) {
//插入周任务员工列表
......@@ -511,6 +516,9 @@ public class SupervisorTaskInfoService {
log.error("根据id查询任务信息不存在,id={}", id);
throw new RpcServiceException(DefaultErrorEnum.DATA_NOT_EXIST, "根据id查询任务信息不存在");
}
//查询门店关联列表
List<SupervisorTaskMerchant> taskMerchantList = supervisorTaskMerchantService.selectByRelationId(id);
taskInfo.setTaskMerchantList(taskMerchantList);
if (TaskTypeEnum.WEEKLY_REPORT.getCode().equals(taskInfo.getTaskType())) {
//查询周任务员工列表
List<SupervisorWeekTaskStaff> weekTaskStaffList = supervisorWeekTaskStaffService.selectByRelationId(id);
......
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.mapper.SupervisorTaskMerchantMapper;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskMerchant;
import cn.com.glsx.framework.core.beans.BaseModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.Date;
import java.util.List;
@Service
@Slf4j
public class SupervisorTaskMerchantService {
@Autowired
private SupervisorTaskMerchantMapper supervisorTaskMerchantMapper;
/**
* 批量插入任务门店关联列表
* @param request
* @param date
* @return
*/
public int batchInsert(SupervisorTaskDTO request, Date date) {
List<SupervisorTaskMerchant> taskMerchantList = request.getTaskMerchantList();
if (CollectionUtils.isNotEmpty(taskMerchantList)) {
taskMerchantList.forEach(taskMerchant -> {
taskMerchant.setRelationId(request.getId());
taskMerchant.setCreatedBy(request.getUpdatedBy());
taskMerchant.setCreateTime(date);
taskMerchant.setDeletedFlag(BaseModel.DeletedFlagEnum.N.name());
});
return supervisorTaskMerchantMapper.insertList(taskMerchantList);
}
return 0;
}
/**
* 根据任务ID查询门店关联列表
* @param relationId
* @return
*/
public List<SupervisorTaskMerchant> selectByRelationId(Long relationId) {
Example example = new Example(SupervisorTaskMerchant.class);
example.createCriteria().andEqualTo("relationId", relationId).andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
return supervisorTaskMerchantMapper.selectByExample(example);
}
}
......@@ -24,6 +24,8 @@
<result column="task_desc" property="taskDesc" jdbcType="VARCHAR" />
<result column="store_manager_phone" property="storeManagerPhone" jdbcType="VARCHAR" />
<result column="store_manager_name" property="storeManagerName" jdbcType="VARCHAR" />
<result column="next_work_items" property="nextWorkItems"/>
<result column="need_assist_items" property="needAssistItems"/>
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="cn.com.glsx.dj.supervisor.model.SupervisorTaskInfo" extends="BaseResultMap" >
<!--
......@@ -49,6 +51,8 @@
<result column="store_manager_phone" property="storeManagerPhone" jdbcType="VARCHAR" />
<result column="store_manager_name" property="storeManagerName" jdbcType="VARCHAR" />
<result column="start_date" property="startDate"/>
<result column="next_work_items" property="nextWorkItems"/>
<result column="need_assist_items" property="needAssistItems"/>
<collection property="taskImageList" ofType="cn.com.glsx.dj.supervisor.model.SupervisorTaskImage">
<result column="image_url" property="imageUrl" />
</collection>
......@@ -76,7 +80,7 @@
<select id="getTaskDetailById" resultMap="TaskDetailMap">
select sti.id, sti.task_type, sti.task_status, sti.on_duty_flag, sti.merchant_id, sti.merchant_name, sti.task_desc,sti.task_context,sti.create_time,sti.updated_date,
stim.image_url,sti.store_manager_name,sti.store_manager_phone,sti.updated_by,sti.start_date
stim.image_url,sti.store_manager_name,sti.store_manager_phone,sti.updated_by,sti.start_date,sti.next_work_items,sti.need_assist_items
from supervisor_task_info sti
left join supervisor_task_image stim on stim.relation_id = sti.id and stim.deleted_flag = 'N'
<where>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!