Commit 648b0755 by songyinghui

feat: 周报月报补充导购名称

parent 2e8a1435
......@@ -52,16 +52,16 @@ public class MaterialReportServiceTest {
String eid = "ff8080815dacd3a2015dacd3ef5c0000";
String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
String staffId = "e608b51b267e4943b87e222a343b4f25";
// String staffId = "fb4096b75d524c5e943c036cb4079723";
// String staffId = "e608b51b267e4943b87e222a343b4f25";
String staffId = "fb4096b75d524c5e943c036cb4079723";
String storeId = "ff8080816e216c04016e34294282004a";
String clerkId = "300b60c7f8874ca2b9cc696ad6b6a480";
@Test
public void handlerMaterialWeekReportTest() {
System.setProperty("gic.module.name", "haoban-manage3-service");
materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.WEEK.getCode());
//materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.MONTH.getCode());
//materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.WEEK.getCode());
materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.MONTH.getCode());
}
@Test
......
package com.gic.haoban.manage.web.controller.content;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
......@@ -12,6 +13,7 @@ import com.gic.content.api.qdto.material.ContentMaterialPageFrontQDTO;
import com.gic.content.api.service.ContentMaterialApiService;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.web.controller.content.adaptor.ClerkStoreAdaptor;
import com.gic.haoban.manage.web.controller.content.adaptor.MaterialDataAdaptor;
import com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO;
......@@ -227,14 +229,33 @@ public class MaterialDataStaticsController {
storeIds.add(materialReportQO.getStoreId());
}
ClerkDTO clerkInfo = clerkService.getClerkByClerkId(materialReportQO.getClerkId());
Page<MaterialPersonalUsedDataVO> usedDataVOPage =
materialDataAdaptor.queryMaterialClerkUsedReport(materialReportQO, storeIds);
if (usedDataVOPage == null || CollectionUtils.isEmpty(usedDataVOPage.getResult())) {
return RestResponse.successResult();
DateTime startTime = null;
DateTime endTime = null;
if (MaterialReportType.WEEK.getCode().equals(materialReportQO.getReportType())) {
// 周报
startTime = DateUtil.beginOfWeek(DateUtil.lastWeek());
endTime = DateUtil.endOfWeek(DateUtil.lastWeek());
} else {
startTime = DateUtil.beginOfMonth(DateUtil.lastWeek());
endTime = DateUtil.endOfMonth(DateUtil.lastWeek());
}
MaterialPersonalUsedDataVO temp = new MaterialPersonalUsedDataVO();
temp.setStartTime(startTime);
temp.setEndTime(endTime);
if (clerkInfo != null) {
temp.setClerkId(materialReportQO.getClerkId());
temp.setClerkName(clerkInfo.getClerkName());
temp.setClerkCode(clerkInfo.getClerkCode());
temp.setImageUrl(clerkInfo.getImageUrl());
}
return RestResponse.successResult(temp);
}
MaterialPersonalUsedDataVO materialPersonalUsedDataVO = usedDataVOPage.getResult().get(0);
// 补充导购信息
ClerkDTO clerkInfo = clerkService.getClerkByClerkId(materialReportQO.getClerkId());
if (clerkInfo != null) {
materialPersonalUsedDataVO.setClerkId(materialReportQO.getClerkId());
materialPersonalUsedDataVO.setClerkName(clerkInfo.getClerkName());
......@@ -259,15 +280,33 @@ public class MaterialDataStaticsController {
} else {
storeIds.add(materialReportQO.getStoreId());
}
// 补充导购信息
ClerkDTO clerkInfo = clerkService.getClerkByClerkId(materialReportQO.getClerkId());
Page<MaterialStoreUsedDataVO> usedDataVOPage =
materialDataAdaptor.queryMaterialStoreUseReport(materialReportQO, storeIds);
if (usedDataVOPage == null || CollectionUtils.isEmpty(usedDataVOPage.getResult())) {
return RestResponse.successResult();
MaterialStoreUsedDataVO temp = new MaterialStoreUsedDataVO();
DateTime startTime = null;
DateTime endTime = null;
if (MaterialReportType.WEEK.getCode().equals(materialReportQO.getReportType())) {
// 周报
startTime = DateUtil.beginOfWeek(DateUtil.lastWeek());
endTime = DateUtil.endOfWeek(DateUtil.lastWeek());
} else {
startTime = DateUtil.beginOfMonth(DateUtil.lastWeek());
endTime = DateUtil.endOfMonth(DateUtil.lastWeek());
}
temp.setStartTime(startTime);
temp.setEndTime(endTime);
if (clerkInfo != null) {
temp.setClerkId(materialReportQO.getClerkId());
temp.setClerkName(clerkInfo.getClerkName());
temp.setClerkCode(clerkInfo.getClerkCode());
temp.setImageUrl(clerkInfo.getImageUrl());
}
return RestResponse.successResult(temp);
}
MaterialStoreUsedDataVO materialStoreUsedDataVO = usedDataVOPage.getResult().get(0);
// 补充导购信息
ClerkDTO clerkInfo = clerkService.getClerkByClerkId(materialReportQO.getClerkId());
if (clerkInfo != null) {
materialStoreUsedDataVO.setClerkId(materialReportQO.getClerkId());
materialStoreUsedDataVO.setClerkName(clerkInfo.getClerkName());
......
......@@ -414,11 +414,17 @@ public class MaterialDataAdaptor {
}
Map<String, Object> result = this.doHttp(JSON.toJSONString(params), apolloKey);
if (result.get("data") == null) {
return new MaterialAreaUsedDataVO();
MaterialAreaUsedDataVO materialAreaUsedDataVO = new MaterialAreaUsedDataVO();
materialAreaUsedDataVO.setStartTime(startTime);
materialAreaUsedDataVO.setEndTime(endTime);
return materialAreaUsedDataVO;
}
List<MaterialAreaUsedDataVO> areaUsedDataVOS = JSON.parseArray(JSON.toJSONString(result.get("data")), MaterialAreaUsedDataVO.class);
if (CollectionUtils.isEmpty(areaUsedDataVOS)) {
return new MaterialAreaUsedDataVO();
MaterialAreaUsedDataVO materialAreaUsedDataVO = new MaterialAreaUsedDataVO();
materialAreaUsedDataVO.setStartTime(startTime);
materialAreaUsedDataVO.setEndTime(endTime);
return materialAreaUsedDataVO;
}
MaterialAreaUsedDataVO materialAreaUsedDataVO = areaUsedDataVOS.get(0);
materialAreaUsedDataVO.setStartTime(startTime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment