Commit 6e4b2d3b by 范富荣

修改查询督导任务管理模块接口

1 parent b71f8f67
......@@ -37,12 +37,11 @@ public class SupervisorTaskDTO implements Serializable {
@ApiModelProperty(notes = "在岗标识 0-在岗 1-调休(日报)")
private Integer onDutyFlag;
@NotNull(groups = {SupervisorTaskInfoRemote.SubmitDayTask.class}, message = "门店ID不能为空")
@ApiModelProperty(notes = "门店ID")
private Integer merchantId;
@NotEmpty(groups = {SupervisorTaskInfoRemote.SubmitDayTask.class}, message = "门店名称不能为空")
@ApiModelProperty(notes = "门店名称")
private String merchantName;
......@@ -110,7 +109,7 @@ public class SupervisorTaskDTO implements Serializable {
@ApiModelProperty(notes = "周任务人员列表")
private List<SupervisorWeekTaskStaff> weekTaskStaffList;
@NotEmpty(groups = {SupervisorTaskInfoRemote.SubmitDayTask.class, SupervisorTaskInfoRemote.SubmitWeekTask.class}, message = "照片图片列表不能为空")
@NotEmpty(groups = {SupervisorTaskInfoRemote.SubmitWeekTask.class}, message = "照片图片列表不能为空")
@ApiModelProperty(notes = "照片图片列表")
private List<SupervisorTaskImage> taskImageList;
......
......@@ -13,7 +13,7 @@ public class SupervisorTaskSummaryDTO implements Serializable {
/**
* 总人数
*/
@ApiModelProperty(notes = "总人数")
@ApiModelProperty(notes = "督导总人数")
private Integer totalCount;
/**
......
......@@ -145,31 +145,18 @@ public class SupervisorTaskInfoService {
summary.setTotalCount(0);
summary.setManagedStoreCount(0);
summary.setMonthlyOutput(java.math.BigDecimal.ZERO);
// 1. 查询全部督导列表
//查询在职督导总人数
List<MerchantStaffResponse> supervisorList = listAllSupervisors();
if (CollectionUtils.isEmpty(supervisorList)) {
log.info("督导列表为空,返回默认汇总");
return summary;
}
List<String> phoneList = supervisorList.stream()
.map(MerchantStaffResponse::getStaffPhone)
.filter(phone -> phone != null && !phone.isEmpty())
.distinct()
.collect(Collectors.toList());
// 2. 批量查询北森信息,统计在职人数
int onlineCount = 0;
if (!phoneList.isEmpty()) {
List<BeiSenEmployeeListResonseDTO> beisenList = supervisorLearningCenterService.listEmployeeInfoByStaffPhone(phoneList);
if (beisenList != null) {
onlineCount = (int) beisenList.stream()
.filter(emp -> Integer.valueOf(1).equals(emp.getZzStatus())) // 注意这里的值跟数据库中的是反的
.count();
}
}
summary.setTotalCount(onlineCount);
summary.setTotalCount(getEffectiveSupervisors(phoneList));
// 3. 查询 director_config 表,统计所有督导负责的门店(director_type=6,平台中飞行督导)
List<Integer> merchantIdList = supervisorTaskInfoMapper.queryMerchantBySupervisorPhone(phoneList);
......@@ -185,6 +172,25 @@ public class SupervisorTaskInfoService {
}
/**
* 查询在职督导总人数
* @return
*/
public int getEffectiveSupervisors(List<String> phoneList) {
// 1. 查询全部督导列表
int onlineCount = 0;
// 2. 批量查询北森信息,统计在职人数
if (!phoneList.isEmpty()) {
List<BeiSenEmployeeListResonseDTO> beisenList = supervisorLearningCenterService.listEmployeeInfoByStaffPhone(phoneList);
if (beisenList != null) {
onlineCount = (int) beisenList.stream()
.filter(emp -> Integer.valueOf(1).equals(emp.getZzStatus())) // 注意这里的值跟数据库中的是反的
.count();
}
}
return onlineCount;
}
/**
* 查询所有飞行督导人员
* @return
*/
......@@ -306,7 +312,12 @@ public class SupervisorTaskInfoService {
//查询所有飞行督导员工列表
List<MerchantStaffResponse> merchantStaffResponses = listAllSupervisors();
if (CollectionUtils.isNotEmpty(merchantStaffResponses)) {
res.setTotalCount(merchantStaffResponses.size());
List<String> phoneList = merchantStaffResponses.stream()
.map(MerchantStaffResponse::getStaffPhone)
.filter(phone -> phone != null && !phone.isEmpty())
.distinct()
.collect(Collectors.toList());
res.setTotalCount(getEffectiveSupervisors(phoneList));
}
//根据条件,调用分页查询任务 接口,根据返回的数据,去重计算提交任务人数,提交任务数
List<SupervisorTaskDTO> taskList = supervisorTaskInfoMapper.listTask(request);
......
......@@ -40,6 +40,7 @@ public class SupervisorWarningBaselineConfigService {
// 新增
config.getConfigList().stream().forEach(item -> {
item.setIndicatorCode(config.getIndicatorCode());
item.setIndicatorName(config.getIndicatorName());
item.setTimeDimension(config.getTimeDimension());
item.setDeletedFlag(BaseModel.DeletedFlagEnum.N.name());
item.setCreatedBy(config.getUpdatedBy());
......@@ -77,7 +78,7 @@ public class SupervisorWarningBaselineConfigService {
}
criteria.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
//根据更新时间降序
example.setOrderByClause("updatedDate desc");
example.setOrderByClause("updated_date desc");
return supervisorWarningBaselineConfigMapper.selectByExample(example);
}
......
......@@ -100,6 +100,9 @@
<if test="taskStatus != null">
and sti.task_status = #{taskStatus}
</if>
<if test="updatedBy != null and updatedBy != ''">
and sti.updated_by like concat('%', #{updatedBy}, '%')
</if>
</where>
order by sti.task_status asc, sti.create_time desc
</select>
......
......@@ -27,7 +27,7 @@
</sql>
<update id="batchUpdate">
UPDATE t_warning_baseline_config
UPDATE supervisor_warning_baseline_config
SET
min_value = CASE
<foreach collection="list" item="item" separator="">
......
......@@ -2,13 +2,20 @@ package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.SupervisorManageSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskSummaryDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskCourse;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskImage;
import cn.com.glsx.dj.supervisor.model.SupervisorWeekTaskStaff;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @Title:
......@@ -61,4 +68,130 @@ public class SupervisorTaskInfoServiceTest extends BaseServiceTest {
SupervisorManageSummaryDTO manageSummary = supervisorTaskInfoService.getManageSummary();
System.out.println(JSON.toJSONString(manageSummary));
}
@Test
public void testGenerateDayTask() {
String startTimeStr = "2026-03-11";
supervisorTaskInfoService.generateDayTask(startTimeStr);
}
/**
* 测试生成周报任务
*/
@Test
public void testGenerateWeekTask() {
String startTimeStr = "2026-03-09";
String endTimeStr = "2026-03-15";
supervisorTaskInfoService.generateWeekTask(startTimeStr, endTimeStr);
}
/**
* 测试生成月报任务
*/
@Test
public void testGenerateMonthTask() {
String startTimeStr = "2026-03-01";
String endTimeStr = "2026-03-31";
supervisorTaskInfoService.generateMonthTask(startTimeStr, endTimeStr);
}
/**
* 测试提交周报任务
*/
@Test
public void testSubmitWeekTask() {
SupervisorTaskDTO request = new SupervisorTaskDTO();
request.setId(6L);
// 设置其他全部参数
request.setTaskContext("督导周报记录");
List<SupervisorTaskImage> taskImageList = new ArrayList<>();
SupervisorTaskImage image = new SupervisorTaskImage();
image.setImageUrl("http://oss.glsx.com/123456.jpg");
taskImageList.add(image);
request.setTaskImageList(taskImageList);
request.setUpdatedBy("周敏");
request.setUpdatedPhone("18682474862");
List<SupervisorWeekTaskStaff> weekTaskStaffList = new ArrayList<>();
SupervisorWeekTaskStaff staff = new SupervisorWeekTaskStaff();
staff.setStaffName("测试");
staff.setStaffPhone("16666666666");
weekTaskStaffList.add(staff);
request.setWeekTaskStaffList(weekTaskStaffList);
supervisorTaskInfoService.submitDayTask(request);
}
/**
* 测试提交日报任务
*
*/
@Test
public void testSubmitDayTask() {
SupervisorTaskDTO request = new SupervisorTaskDTO();
request.setId(3L);
// 设置其他全部参数
request.setMerchantId(43423334);
request.setMerchantName("萨达梵蒂冈");
request.setOnDutyFlag(0);
request.setTaskContext("督导日报记录");
List<SupervisorTaskImage> taskImageList = new ArrayList<>();
SupervisorTaskImage image = new SupervisorTaskImage();
image.setImageUrl("http://oss.glsx.com/123456.jpg");
taskImageList.add(image);
request.setTaskImageList(taskImageList);
request.setUpdatedBy("周敏");
request.setUpdatedPhone("18682474862");
supervisorTaskInfoService.submitDayTask(request);
}
/**
* 测试提交月报任务
*/
@Test
public void testSubmitMonthTask() {
SupervisorTaskDTO request = new SupervisorTaskDTO();
request.setId(9L);
// 设置其他全部参数
request.setTaskContext("督导月报记录");
request.setUpdatedBy("周敏");
request.setUpdatedPhone("18682474862");
supervisorTaskInfoService.submitMonthTask(request);
}
@Test
public void testPageTask() {
RpcPagination<SupervisorTaskQueryDTO> request = new RpcPagination<>();
SupervisorTaskQueryDTO queryDTO = new SupervisorTaskQueryDTO();
queryDTO.setSupervisorPhone("18682474862");
request.setCondition(queryDTO);
List<Integer> typeList = Arrays.asList(0, 3, 5);
queryDTO.setTaskTypeList(typeList);
request.setPageSize(10);
request.setPageNum(1);
Page<SupervisorTaskDTO> supervisorTaskDTOS = supervisorTaskInfoService.pageTask(request);
System.out.println(JSON.toJSONString(supervisorTaskDTOS));
}
/**
* 根据ID查询督导任务详情
*/
@Test
public void testGetTaskDetail() {
Long id = 6L;
SupervisorTaskDTO taskDetail = supervisorTaskInfoService.getTaskDetailById(id);
System.out.println(JSON.toJSONString(taskDetail));
}
/**
* 测试查询督导任务汇总信息
*/
@Test
public void testGetTaskSummary() {
SupervisorTaskQueryDTO queryDTO = new SupervisorTaskQueryDTO();
queryDTO.setStartDate("2026-03-01");
queryDTO.setEndDate("2026-03-31");
queryDTO.setTaskTypeList(Arrays.asList(0, 3, 5));
SupervisorTaskSummaryDTO summary = supervisorTaskInfoService.getTaskSummary(queryDTO);
System.out.println(JSON.toJSONString(summary));
}
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.WarningBaselineConfigDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorWarningBaselineConfig;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.util.List;
import static org.junit.Assert.assertTrue;
public class SupervisorWarningBaselineConfigServiceTest extends BaseServiceTest {
@Autowired
private SupervisorWarningBaselineConfigService supervisorWarningBaselineConfigService;
/**
* 创建或修改预警基线配置
*/
@Test
public void testCreateOrUpdateWarningBaselineConfig() {
WarningBaselineConfigDTO config = new WarningBaselineConfigDTO();
config.setIndicatorCode("A036");
config.setIndicatorName("个人产值");
config.setTimeDimension(2);
List<SupervisorWarningBaselineConfig> configList = new java.util.ArrayList<>();
SupervisorWarningBaselineConfig redItem = new SupervisorWarningBaselineConfig();
redItem.setMinValue(new BigDecimal(0));
redItem.setMaxValue(new BigDecimal(1200));
redItem.setMaxValueInf(0);
redItem.setWarningLevel(0);
redItem.setId(4L);
configList.add(redItem);
SupervisorWarningBaselineConfig yellowItem = new SupervisorWarningBaselineConfig();
yellowItem.setMinValue(new BigDecimal(1200));
yellowItem.setMaxValue(new BigDecimal(4000));
yellowItem.setMaxValueInf(0);
yellowItem.setWarningLevel(1);
yellowItem.setId(5L);
configList.add(yellowItem);
SupervisorWarningBaselineConfig greenItem = new SupervisorWarningBaselineConfig();
greenItem.setMinValue(new BigDecimal(4000));
greenItem.setMaxValue(new BigDecimal(6000));
greenItem.setMaxValueInf(0);
greenItem.setWarningLevel(2);
greenItem.setId(6L);
configList.add(greenItem);
config.setConfigList(configList);
config.setUpdatedBy("system");
Boolean result = supervisorWarningBaselineConfigService.createOrUpdateWarningBaselineConfig(config);
assertTrue(result);
}
/**
* 查询所有预警基线配置
*/
@Test
public void testListAllWarningBaselineConfig() {
List<WarningBaselineConfigDTO> configList = supervisorWarningBaselineConfigService.listAllWarningBaselineConfig();
assertTrue(configList.size() > 0);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!