Commit 34c80af4 by 范富荣

优化报表提交接口

1 parent 576a7976
......@@ -68,7 +68,6 @@ public class SupervisorTaskDTO implements Serializable {
/**
* 督导记录(富文本内容)
*/
@NotEmpty(message = "督导记录不能为空")
@ApiModelProperty(notes = "督导记录", required = true)
private String taskContext;
......
......@@ -639,12 +639,18 @@ public class SupervisorTaskInfoService {
} else {
List<StaffBaseInfoDTO> staffList = response.getResult();
if (CollectionUtils.isNotEmpty(staffList)) {
overviewDTO.setStaffCount(staffList.size());
//根据员工手机号去重计算员工个数
Set<String> phoneSet = staffList.stream().map(StaffBaseInfoDTO::getStaffPhone).collect(Collectors.toSet());
overviewDTO.setStaffCount(phoneSet.size());
//查询产值
SceneBaseReq req = new SceneBaseReq();
req.setMerchantIds(merchantIdList);
req.setCycleType(4);
req.setStaffUuids(staffList.stream().map(StaffBaseInfoDTO::getLoginUuid).collect(Collectors.toList()));
//设置指标开始时间,从配置文件中取值
req.setStartTime(env.getProperty("supervisor.output.startTime", String.class, "2021-01-01"));
//设置指标结束时间,固定当前日期
req.setEndTime(DateUtils.formatDate(new Date()));
RpcResponse<SceneOutputResponse> outputResponse = businessSceneAnalysisRemote.querySupervisorOutput(req);
if (outputResponse.hasError()) {
log.error("查询督导团队产值失败,SceneBaseReq={}, error={}, message={}", JSON.toJSONString(req), outputResponse.getError(), outputResponse.getMessage());
......
......@@ -10,7 +10,7 @@
WHERE si.phone_number = #{phoneNumber}
GROUP BY si.phone_number
</select>
<!-- 查询员工调店记录 -->
<select id="getEmployeeStoreTransferRecords" parameterType="map" resultType="cn.com.glsx.dj.supervisor.dto.EmployeeStoreTransferDTO">
SELECT
......@@ -95,7 +95,7 @@
SUM(CASE WHEN clock_in_first_time IS NULL THEN 1 ELSE 0 END) AS absenteeism,
SUM(CASE WHEN dclsqcii.clock_in_abnormal_attire = 1 AND dclsqcii.clock_out_abnormal_attire = 1 THEN 2
WHEN dclsqcii.clock_in_abnormal_attire = 1 OR dclsqcii.clock_out_abnormal_attire = 1 THEN 1 ELSE 0 END) AS warningCount,
SUM(CASE WHEN TIME(clock_in_first_time) &gt; '09:30:00'
SUM(CASE WHEN TIME(clock_in_first_time) &gt; '09:30:00'
THEN TIMESTAMPDIFF(MINUTE, DATE_FORMAT(dclsqcii.clock_in_date,'%Y-%m-%d 09:30:00'), clock_in_first_time) ELSE 0 END) AS lateTime,
SUM(CASE WHEN dclsqcii.clock_in_first_time IS NULL AND dclsqcii.clock_in_last_time IS NOT NULL THEN 1
WHEN dclsqcii.clock_in_first_time IS NOT NULL AND dclsqcii.clock_in_last_time IS NULL THEN 1 ELSE 0 END) AS missCount
......@@ -212,7 +212,7 @@
WHERE t1.merchant_id = #{merchantId}
AND t1.staff_uuid = #{staffUuid}
AND t1.bussiness_type = #{biz}
AND DATE(T1.reception_start_time)&gt;=#{startDate}
AND DATE(T1.reception_start_time)&gt;=#{startDate}
AND DATE(T1.reception_start_time)&lt;=#{endDate}
) AS recordingData
</select>
......
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.smartcarlife.dto.ShopMerchantDirectorConfigDTO;
import cn.com.glsx.dj.smartcarlife.enums.DirectorTypeEnum;
import cn.com.glsx.dj.smartcarlife.remote.ShopMerchantDirectorConfigRemote;
import cn.com.glsx.dj.supervisor.dto.SupervisorManageSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
......@@ -10,14 +13,17 @@ 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 cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Title:
......@@ -30,6 +36,9 @@ public class SupervisorTaskInfoServiceTest extends BaseServiceTest {
@Autowired
private SupervisorTaskInfoService supervisorTaskInfoService;
@Autowired
private ShopMerchantDirectorConfigRemote shopMerchantDirectorConfigRemote;
@Test
public void testGetTaskDetailById() {
SupervisorTaskDTO detail = supervisorTaskInfoService.getTaskDetailById(1L);
......@@ -219,4 +228,26 @@ public class SupervisorTaskInfoServiceTest extends BaseServiceTest {
request.setTaskDesc("督导记录sdhnasuihfasifnasfnassjasidjkioasdasfn");
Long id = supervisorTaskInfoService.createSpecialTask(request);
}
@Test
public void testGetTeamOverview() {
ShopMerchantDirectorConfigDTO dto = new ShopMerchantDirectorConfigDTO();
dto.setDirectorUserId("63c121922cba4956b2aac3f21dacd92f");
dto.setDirectorTypes(Arrays.asList(DirectorTypeEnum.FLIGHT_SUPERVISION.getValue()));
RpcResponse<List<ShopMerchantDirectorConfigDTO>> merchantResponse = shopMerchantDirectorConfigRemote.list(dto);
List<Integer> merchantIdList = new ArrayList<>();
if (merchantResponse.isSuccess() && merchantResponse.getResult() != null) {
List<ShopMerchantDirectorConfigDTO> merchantList = merchantResponse.getResult();
if (CollectionUtils.isNotEmpty(merchantList)) {
merchantIdList = merchantList.stream()
.map(ShopMerchantDirectorConfigDTO::getMerchantId)
.collect(Collectors.toList());
SupervisorTaskQueryDTO request = new SupervisorTaskQueryDTO();
request.setMerchantIdList(merchantIdList);
SupervisorTeamOverviewDTO overview = supervisorTaskInfoService.getTeamOverview(request);
System.out.println(JSON.toJSONString(overview));
}
}
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!