Commit eb70c748 by 王祖波

周报月报修改

parent fd048d8b
package com.gic.haoban.manage.api.dto.content.report; package com.gic.haoban.manage.api.dto.content.report;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @Author MUSI * @Author MUSI
...@@ -28,6 +29,11 @@ public class MaterialReportDTO implements Serializable { ...@@ -28,6 +29,11 @@ public class MaterialReportDTO implements Serializable {
*/ */
private Integer reportType; private Integer reportType;
/**
* 周报内容
*/
private List<String> rightMenuCodeList;
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
} }
...@@ -51,4 +57,12 @@ public class MaterialReportDTO implements Serializable { ...@@ -51,4 +57,12 @@ public class MaterialReportDTO implements Serializable {
public void setReportType(Integer reportType) { public void setReportType(Integer reportType) {
this.reportType = reportType; this.reportType = reportType;
} }
public List<String> getRightMenuCodeList() {
return rightMenuCodeList;
}
public void setRightMenuCodeList(List<String> rightMenuCodeList) {
this.rightMenuCodeList = rightMenuCodeList;
}
} }
...@@ -15,6 +15,7 @@ public enum NoticeMessageCategoryTypeEnum { ...@@ -15,6 +15,7 @@ public enum NoticeMessageCategoryTypeEnum {
MATERIAL(6, "素材相关"), MATERIAL(6, "素材相关"),
POTENTIAL_CUSTOMER(7, "销售线索"), POTENTIAL_CUSTOMER(7, "销售线索"),
AUTHORIZED(8, "授权登陆"), AUTHORIZED(8, "授权登陆"),
WEEK_MONTH(9, "周报月报"),
OTHER(3, "其它"),; OTHER(3, "其它"),;
private int type; private int type;
private String name; private String name;
......
...@@ -91,9 +91,9 @@ public enum NoticeMessageTypeEnum { ...@@ -91,9 +91,9 @@ public enum NoticeMessageTypeEnum {
// //
MATERIAL_NEW_NOTIFY(6001, "素材上新通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_new_notify", "/pages/route/index?pageType=", "hbapp_material_center", "materialsNotice", "clerkMaterialsNotice"), MATERIAL_NEW_NOTIFY(6001, "素材上新通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_new_notify", "/pages/route/index?pageType=", "hbapp_material_center", "materialsNotice", "clerkMaterialsNotice"),
MATERIAL_REPORT_NOTIFY_WEEK(6002, "素材周报通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_week_notify", "/pages/route/index?pageType=", "hbapp_mate_report", "materialWeek", "clerkMaterialsReport"), MATERIAL_REPORT_NOTIFY_WEEK(6002, "周报通知", NoticeMessageCategoryTypeEnum.WEEK_MONTH.getType(), "material_week_notify", "/pages/route/index?pageType=", "hbapp_mate_report", "materialWeek", "clerkMaterialsReport"),
POTENTIAL_CUSTOMER_NOTIFY(6003, "销售线索通知", NoticeMessageCategoryTypeEnum.POTENTIAL_CUSTOMER.getType(), "potential_customer_notify", "/pages/route/index?pageType=", "hbapp_sales_clue_center", "salesLeadNotice", "haobanNotice"), POTENTIAL_CUSTOMER_NOTIFY(6003, "销售线索通知", NoticeMessageCategoryTypeEnum.POTENTIAL_CUSTOMER.getType(), "potential_customer_notify", "/pages/route/index?pageType=", "hbapp_sales_clue_center", "salesLeadNotice", "haobanNotice"),
MATERIAL_REPORT_NOTIFY_MONTH(6004, "素材月报通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_month_notify", "/pages/route/index?pageType=", "hbapp_mate_report", "materialMonth", "clerkMaterialsReport"), MATERIAL_REPORT_NOTIFY_MONTH(6004, "月报通知", NoticeMessageCategoryTypeEnum.WEEK_MONTH.getType(), "material_month_notify", "/pages/route/index?pageType=", "hbapp_mate_report", "materialMonth", "clerkMaterialsReport"),
CLERK_COMMISSION_NOTIFY(6005, "客户下单通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "clerk_commission_notify", "/pages/route/index?pageType=", "hbapp_withdraw_list", "clerkCommissionNotify", "haobanNotice"), CLERK_COMMISSION_NOTIFY(6005, "客户下单通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "clerk_commission_notify", "/pages/route/index?pageType=", "hbapp_withdraw_list", "clerkCommissionNotify", "haobanNotice"),
MATERIAL_AUDIT_NOTIFY(6006, "素材审核通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_audit_notify", "/pages/route/index?pageType=", "hbapp_create_center", "materialAuditNotify", "haobanNotice"), MATERIAL_AUDIT_NOTIFY(6006, "素材审核通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_audit_notify", "/pages/route/index?pageType=", "hbapp_create_center", "materialAuditNotify", "haobanNotice"),
KNOWLEDGE_NEW_NOTIFY(6007, "知识库上新通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "knowledge_new_notify", "/pages/route/index?pageType=", "hbapp_guide_knowledge", "knowledgeNewNotify", "clerkMaterialsNotice"), KNOWLEDGE_NEW_NOTIFY(6007, "知识库上新通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "knowledge_new_notify", "/pages/route/index?pageType=", "hbapp_guide_knowledge", "knowledgeNewNotify", "clerkMaterialsNotice"),
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime; ...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum; import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.content.MaterialReportType; import com.gic.haoban.manage.api.enums.content.MaterialReportType;
...@@ -32,8 +33,8 @@ import java.util.stream.Collectors; ...@@ -32,8 +33,8 @@ import java.util.stream.Collectors;
@Builder @Builder
public class MaterialReportContext { public class MaterialReportContext {
private static final String week_title = "素材使用周报"; private static final String week_title = "%s周报";
private static final String month_title = "素材使用月报"; private static final String month_title = "%s月报";
private static final String week_desc = "%s~%s的素材使用周报已生成,请查收"; private static final String week_desc = "%s~%s的素材使用周报已生成,请查收";
private static final String month_desc = "%s~%s的素材使用月报已生成,请查收"; private static final String month_desc = "%s~%s的素材使用月报已生成,请查收";
...@@ -48,6 +49,11 @@ public class MaterialReportContext { ...@@ -48,6 +49,11 @@ public class MaterialReportContext {
private Integer reportType; private Integer reportType;
/** /**
* 周报内容
*/
private List<String> rightMenuCodeList;
/**
* 成员id * 成员id
*/ */
private String staffId; private String staffId;
...@@ -134,10 +140,18 @@ public class MaterialReportContext { ...@@ -134,10 +140,18 @@ public class MaterialReportContext {
} }
public String getMessageTitle() { public String getMessageTitle() {
String title = "素材使用";
if (CollectionUtils.isNotEmpty(rightMenuCodeList)) {
if (rightMenuCodeList.size() > 1) {
title = "门店";
}else if (rightMenuCodeList.contains(EnterpriseServiceEnum.CONTENT.getRightMenuCode())){
title = "潜客雷达";
}
}
if (MaterialReportType.WEEK.getCode().equals(this.reportType)) { if (MaterialReportType.WEEK.getCode().equals(this.reportType)) {
return week_title; return String.format(week_title, title);
} }
return month_title; return String.format(month_title, title);
} }
public String getMessageDesc() { public String getMessageDesc() {
......
...@@ -4,6 +4,7 @@ import com.gic.haoban.manage.service.pojo.bo.content.GroupMessageInfoBo; ...@@ -4,6 +4,7 @@ import com.gic.haoban.manage.service.pojo.bo.content.GroupMessageInfoBo;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialEnterpriseAdaptor; import com.gic.haoban.manage.service.service.content.adaptor.MaterialEnterpriseAdaptor;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Author MUSI * @Author MUSI
...@@ -28,4 +29,10 @@ public interface GroupMessageService { ...@@ -28,4 +29,10 @@ public interface GroupMessageService {
* @return * @return
*/ */
List<String> hasMaterialRightEnterprise(Integer level); List<String> hasMaterialRightEnterprise(Integer level);
/**
* 查询发送周报月报企业
* @return
*/
Map<String,List<String>> weekMonthEnterprise();
} }
package com.gic.haoban.manage.service.service.content; package com.gic.haoban.manage.service.service.content;
import com.gic.haoban.manage.api.dto.content.report.MaterialReportDTO;
/** /**
* @Author MUSI * @Author MUSI
* @Date 2023/3/24 3:58 PM * @Date 2023/3/24 3:58 PM
...@@ -17,5 +19,5 @@ public interface MaterialReportService { ...@@ -17,5 +19,5 @@ public interface MaterialReportService {
* @see com.gic.haoban.manage.api.enums.content.MaterialReportType * @see com.gic.haoban.manage.api.enums.content.MaterialReportType
* @param reportType * @param reportType
*/ */
void handlerMaterialReport(String enterpriseId, String staffId, Integer reportType); void handlerMaterialReport(MaterialReportDTO materialReportDTO);
} }
package com.gic.haoban.manage.service.service.content.adaptor; package com.gic.haoban.manage.service.service.content.adaptor;
import cn.hutool.core.lang.Pair;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum; import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
...@@ -14,9 +15,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -14,9 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Collections; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -65,6 +64,38 @@ public class MaterialEnterpriseAdaptor { ...@@ -65,6 +64,38 @@ public class MaterialEnterpriseAdaptor {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
public Map<String, List<String>> getWeekMonthEid() {
ServiceResponse<List<EnterpriseUsingStatusDTO>> serviceResponse1 =
enterpriseUseForbidService.getUseEnterpriseByCode(EnterpriseServiceEnum.CONTENT.getRightMenuCode(), null);
ServiceResponse<List<EnterpriseUsingStatusDTO>> serviceResponse2 =
enterpriseUseForbidService.getUseEnterpriseByCode(EnterpriseServiceEnum.APPOINTMENT.getRightMenuCode(), null);
if (!serviceResponse1.isSuccess() || !serviceResponse2.isSuccess()) {
return Collections.emptyMap();
}
Map<String, List<String>> map = new HashMap<>();
// 处理内容相关企业ID
Optional.ofNullable(serviceResponse1.getResult()).orElse(Collections.emptyList())
.stream()
.filter(item -> item.getVersion() != null && item.getVersion() >= MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode())
.filter(item -> Boolean.TRUE.equals(item.getVaild()))
.map(EnterpriseUsingStatusDTO::getEnterpriseId)
.forEach(eid -> map.computeIfAbsent(eid, k -> new ArrayList<>())
.add(EnterpriseServiceEnum.CONTENT.getRightMenuCode()));
// 处理潜客相关企业ID
Optional.ofNullable(serviceResponse2.getResult()).orElse(Collections.emptyList())
.stream()
.filter(item -> Boolean.TRUE.equals(item.getVaild()))
.map(EnterpriseUsingStatusDTO::getEnterpriseId)
.forEach(eid -> map.computeIfAbsent(eid, k -> new ArrayList<>())
.add(EnterpriseServiceEnum.APPOINTMENT.getRightMenuCode()));
return map;
}
/** /**
* 校验企业是否有内容权限 * 校验企业是否有内容权限
* @param enterpriseId * @param enterpriseId
......
package com.gic.haoban.manage.service.service.content.adaptor; package com.gic.haoban.manage.service.service.content.adaptor;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
...@@ -9,14 +8,17 @@ import com.gic.commons.util.DateUtil; ...@@ -9,14 +8,17 @@ import com.gic.commons.util.DateUtil;
import com.gic.content.api.dto.material.ContentMaterialBaseDTO; import com.gic.content.api.dto.material.ContentMaterialBaseDTO;
import com.gic.content.api.enums.MaterialPurposeEnum; import com.gic.content.api.enums.MaterialPurposeEnum;
import com.gic.content.api.service.ContentMaterialApiService; import com.gic.content.api.service.ContentMaterialApiService;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.haoban.manage.api.enums.content.MaterialReportType; import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.service.pojo.bo.content.context.MaterialReportContext;
import com.gic.haoban.manage.service.util.DataTargetHttpUtils; import com.gic.haoban.manage.service.util.DataTargetHttpUtils;
import com.gic.haoban.manage.service.util.DrawImageUtils;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -38,7 +40,7 @@ import java.util.Optional; ...@@ -38,7 +40,7 @@ import java.util.Optional;
**/ **/
@Slf4j @Slf4j
@Component @Component
public class MaterialDataAdaptor { public class WeekMonthDataAdaptor {
/** /**
...@@ -59,6 +61,18 @@ public class MaterialDataAdaptor { ...@@ -59,6 +61,18 @@ public class MaterialDataAdaptor {
* 区经 月报 * 区经 月报
*/ */
private static final String AREA_MONTH_DATA = "data_cms_store_month_report_total"; private static final String AREA_MONTH_DATA = "data_cms_store_month_report_total";
/**
* 潜客雷达 周报
*/
private static final String POTENTIAL_WEEK_DATA = "data_cms_clerk_week_report_list";
/**
* 潜客雷达 月报
*/
private static final String POTENTIAL_MONTH_DATA = "data_cms_store_month_report_total";
@Autowired @Autowired
private ContentMaterialApiService contentMaterialApiService; private ContentMaterialApiService contentMaterialApiService;
...@@ -82,15 +96,55 @@ public class MaterialDataAdaptor { ...@@ -82,15 +96,55 @@ public class MaterialDataAdaptor {
private String storeId; private String storeId;
} }
public MaterialDataResult queryClerkReportData(MaterialReportContext context,String storeId,String bizDate) {
String enterpriseId = context.getEnterpriseId();
String clerkId = context.getClerkId();
Integer reportType = context.getReportType();
List<String> rightMenuCodeList = context.getRightMenuCodeList();
if (CollectionUtils.isEmpty(rightMenuCodeList)) {
return MaterialDataResult.buildEmpty();
}
if (rightMenuCodeList.size() > 1) {
MaterialDataResult contentResult = queryClerkReportDataContent(enterpriseId, clerkId, storeId, reportType, bizDate);
MaterialDataResult potentialResult = queryReportDataPotential(enterpriseId, clerkId, Lists.newArrayList(storeId), reportType, bizDate);
return new MaterialDataResult(potentialResult.getFirstValue(),contentResult.getSecondValue());
} else if (rightMenuCodeList.contains(EnterpriseServiceEnum.APPOINTMENT.getRightMenuCode())) {
return queryReportDataPotential(enterpriseId, clerkId, Lists.newArrayList(storeId), reportType, bizDate);
} else if (rightMenuCodeList.contains(EnterpriseServiceEnum.CONTENT.getRightMenuCode())) {
return queryClerkReportDataContent(enterpriseId, clerkId, storeId, reportType, bizDate);
}
return MaterialDataResult.buildEmpty();
}
public MaterialDataResult queryAreaReportData(MaterialReportContext context,List<String> storeIds,String bizDate) {
String enterpriseId = context.getEnterpriseId();
String clerkId = context.getClerkId();
Integer reportType = context.getReportType();
List<String> rightMenuCodeList = context.getRightMenuCodeList();
if (CollectionUtils.isEmpty(rightMenuCodeList)) {
return MaterialDataResult.buildEmpty();
}
if (rightMenuCodeList.size() > 1) {
MaterialDataResult contentResult = queryAreaReportDataContent(enterpriseId, clerkId, storeIds, reportType, bizDate);
MaterialDataResult potentialResult = queryReportDataPotential(enterpriseId, clerkId, storeIds, reportType, bizDate);
return new MaterialDataResult(potentialResult.getFirstValue(),contentResult.getSecondValue());
} else if (rightMenuCodeList.contains(EnterpriseServiceEnum.APPOINTMENT.getRightMenuCode())) {
return queryReportDataPotential(enterpriseId, clerkId, storeIds, reportType, bizDate);
} else if (rightMenuCodeList.contains(EnterpriseServiceEnum.CONTENT.getRightMenuCode())) {
return queryAreaReportDataContent(enterpriseId, clerkId, storeIds, reportType, bizDate);
}
return MaterialDataResult.buildEmpty();
}
/** /**
* 查询导购/店长的数据 * 查询导购/店长的数据 素材
* @param enterpriseId * @param enterpriseId
* @param clerkId * @param clerkId
* @param storeId * @param storeId
* @param reportType * @param reportType
* @return * @return
*/ */
public MaterialDataResult queryClerkReportData(String enterpriseId, String clerkId, String storeId, Integer reportType, String bizDate) { public MaterialDataResult queryClerkReportDataContent(String enterpriseId, String clerkId, String storeId, Integer reportType, String bizDate) {
String apolloKey = CLERK_WEEK_DATA; String apolloKey = CLERK_WEEK_DATA;
if (MaterialReportType.MONTH.getCode().equals(reportType)) { if (MaterialReportType.MONTH.getCode().equals(reportType)) {
...@@ -128,14 +182,14 @@ public class MaterialDataAdaptor { ...@@ -128,14 +182,14 @@ public class MaterialDataAdaptor {
/** /**
* 区经 * 区经 素材
* @param enterpriseId * @param enterpriseId
* @param clerkId * @param clerkId
* @param storeIds * @param storeIds
* @param reportType * @param reportType
* @return * @return
*/ */
public MaterialDataResult queryAreaReportData(String enterpriseId, String clerkId, List<String> storeIds, Integer reportType, String bizDate) { public MaterialDataResult queryAreaReportDataContent(String enterpriseId, String clerkId, List<String> storeIds, Integer reportType, String bizDate) {
String apolloKey = AREA_WEEK_DATA; String apolloKey = AREA_WEEK_DATA;
if (MaterialReportType.MONTH.getCode().equals(reportType)) { if (MaterialReportType.MONTH.getCode().equals(reportType)) {
...@@ -176,6 +230,53 @@ public class MaterialDataAdaptor { ...@@ -176,6 +230,53 @@ public class MaterialDataAdaptor {
return new MaterialDataResult(numFormat, (formatAmount + amountUnit)); return new MaterialDataResult(numFormat, (formatAmount + amountUnit));
} }
/**
* 查询数据 潜客雷达 todo 对接数据
* @param enterpriseId
* @param clerkId
* @param storeIds
* @param reportType
* @return
*/
public MaterialDataResult queryReportDataPotential(String enterpriseId, String clerkId, List<String> storeIds, Integer reportType, String bizDate) {
String apolloKey = POTENTIAL_WEEK_DATA;
if (MaterialReportType.MONTH.getCode().equals(reportType)) {
apolloKey = POTENTIAL_MONTH_DATA;
}
Map<String, Object> inlineParams = new HashMap<>();
if (org.apache.commons.lang3.StringUtils.isNotBlank(clerkId)) {
inlineParams.put("clerkId", clerkId);
}
if (CollectionUtils.isNotEmpty(storeIds)) {
inlineParams.put("storeId", StringUtils.join(storeIds, ","));
}
inlineParams.put("enterpriseId", enterpriseId);
inlineParams.put("bizDate", bizDate);
inlineParams.put("orderByFields", 2);
inlineParams.put("orderByType", 1);
Map<String, Object> result = DataApiUtils.http(JSON.toJSONString(inlineParams), apolloKey);
if (result.get("data") == null) {
return null;
}
JSONObject jsonObject = DataApiUtils.getPageOne(result);
if (jsonObject.isEmpty()) {
return null;
}
int useMatlNum = jsonObject.getIntValue("useMatlNum");
BigDecimal convSalesAmt = Optional.ofNullable(jsonObject.getBigDecimal("omniConvSalesAmt")).orElse(BigDecimal.ZERO);
String amountUnit = "";
if (convSalesAmt.compareTo(new BigDecimal(10000)) >= 0) {
convSalesAmt = convSalesAmt.divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
amountUnit = "万";
}
DecimalFormat decimalFormat = new DecimalFormat("#,###,###.##");
String formatAmount = decimalFormat.format(convSalesAmt);
String numFormat = decimalFormat.format(useMatlNum);
return new MaterialDataResult(numFormat, (formatAmount + amountUnit));
}
private Map<String, Object> doHttp(String jsonParam, String apolloKey) { private Map<String, Object> doHttp(String jsonParam, String apolloKey) {
try { try {
log.info("调用接口 apolloKey:{}, 参数:{}", apolloKey, jsonParam); log.info("调用接口 apolloKey:{}, 参数:{}", apolloKey, jsonParam);
......
package com.gic.haoban.manage.service.service.content.adaptor; package com.gic.haoban.manage.service.service.content.adaptor;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum; import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
...@@ -23,7 +23,6 @@ import org.apache.commons.lang3.StringUtils; ...@@ -23,7 +23,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -37,13 +36,13 @@ import java.util.Optional; ...@@ -37,13 +36,13 @@ import java.util.Optional;
@Slf4j @Slf4j
@Component @Component
public class MaterialReportBuilder { public class WeekMonthReportBuilder {
@Autowired @Autowired
private StaffClerkRelationService staffClerkRelationService; private StaffClerkRelationService staffClerkRelationService;
@Autowired @Autowired
private ClerkMainStoreRelatedService clerkMainStoreRelatedService; private ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Autowired @Autowired
private MaterialDataAdaptor materialDataAdaptor; private WeekMonthDataAdaptor weekMonthDataAdaptor;
@Autowired @Autowired
private Config config; private Config config;
@Autowired @Autowired
...@@ -123,41 +122,52 @@ public class MaterialReportBuilder { ...@@ -123,41 +122,52 @@ public class MaterialReportBuilder {
} }
String clerkId = context.getClerkId(); String clerkId = context.getClerkId();
String enterpriseId = context.getEnterpriseId(); String enterpriseId = context.getEnterpriseId();
MaterialDataAdaptor.MaterialDataResult materialDataResult; WeekMonthDataAdaptor.MaterialDataResult materialDataResult;
String bizDate = this.calcBizDate(context.getReportType()); String bizDate = this.calcBizDate(context.getReportType());
context.setBizDate(bizDate); context.setBizDate(bizDate);
// todo 潜客雷达数据
if (StringUtils.isBlank(context.getMainStoreId())) { if (StringUtils.isBlank(context.getMainStoreId())) {
// 区经 // 区经
List<String> storeIds = this.queryClerkStoreIds(clerkId, context.getStaffInfo().getWxEnterpriseId()); List<String> storeIds = this.queryClerkStoreIds(clerkId, context.getStaffInfo().getWxEnterpriseId());
materialDataResult = materialDataAdaptor.queryAreaReportData(enterpriseId, clerkId, storeIds, context.getReportType(), bizDate); materialDataResult = weekMonthDataAdaptor.queryAreaReportData(context, storeIds, bizDate);
} else { } else {
String mainStoreId = context.getMainStoreId(); String mainStoreId = context.getMainStoreId();
materialDataResult = materialDataAdaptor.queryClerkReportData(enterpriseId, clerkId, mainStoreId, context.getReportType(), bizDate); materialDataResult = weekMonthDataAdaptor.queryClerkReportData(context, mainStoreId, bizDate);
} }
log.info("获取成员海报数据 clerkId:{}, data: {}", clerkId, JSON.toJSONString(materialDataResult)); log.info("获取成员海报数据 clerkId:{}, data: {}", clerkId, JSON.toJSONString(materialDataResult));
if (materialDataResult == null) { if (materialDataResult == null) {
materialDataResult = MaterialDataAdaptor.MaterialDataResult.buildEmpty(); materialDataResult = WeekMonthDataAdaptor.MaterialDataResult.buildEmpty();
}
DrawImageUtils.DrawBkgImg templatePath = null;
if (MaterialReportType.WEEK.getCode().equals(context.getReportType())) {
if (StringUtils.isBlank(context.getMainStoreId())) {
templatePath = DrawImageUtils.DrawBkgImg.AREA_WEEK_BKG;
} else {
templatePath = DrawImageUtils.DrawBkgImg.CLERK_WEEK_BKG;
}
} else {
if (StringUtils.isBlank(context.getMainStoreId())) {
templatePath = DrawImageUtils.DrawBkgImg.AREA_MONTH_BKG;
} else {
templatePath = DrawImageUtils.DrawBkgImg.CLERK_MONTH_BKG;
} }
DrawImageUtils.DrawBkgImg templatePath = getDrawBkgImg(context);
if (templatePath == null) {
return;
} }
// 生成图片地址 // 生成图片地址
String url = DrawImageUtils.drawImage(context.getFactoryCode(), materialDataResult.getFirstValue(), materialDataResult.getSecondValue(), templatePath); String url = DrawImageUtils.drawImage(context.getFactoryCode(), materialDataResult.getFirstValue(), materialDataResult.getSecondValue(), templatePath);
context.setMaterialReportUrl(url); context.setMaterialReportUrl(url);
} }
private static DrawImageUtils.DrawBkgImg getDrawBkgImg(MaterialReportContext context) {
boolean isWeek = MaterialReportType.WEEK.getCode().equals(context.getReportType());
boolean hasMainStore = StringUtils.isNotBlank(context.getMainStoreId());
List<String> rightMenuCodeList = context.getRightMenuCodeList();
if (rightMenuCodeList.size() > 1) {
String key = (hasMainStore ? "CLERK" : "AREA") + (isWeek ? "_WEEK" : "_MONTH");
return DrawImageUtils.templateMap.get(key);
}
else if (rightMenuCodeList.contains(EnterpriseServiceEnum.APPOINTMENT.getRightMenuCode())) {
String key = "POTENTIAL_" + (hasMainStore ? "CLERK" : "AREA") + (isWeek ? "_WEEK" : "_MONTH");
return DrawImageUtils.templateMap.get(key);
}
else if (rightMenuCodeList.contains(EnterpriseServiceEnum.CONTENT.getRightMenuCode())) {
String key = "CONTENT_" + (hasMainStore ? "CLERK" : "AREA") + (isWeek ? "_WEEK" : "_MONTH");
return DrawImageUtils.templateMap.get(key);
}
return null;
}
/** /**
* 计算素材周报的周期 * 计算素材周报的周期
* yyyy-biz * yyyy-biz
......
...@@ -617,4 +617,9 @@ public class GroupMessageServiceImpl implements GroupMessageService { ...@@ -617,4 +617,9 @@ public class GroupMessageServiceImpl implements GroupMessageService {
log.info("有权限的企业信息 level:{}, enterpriseIds:{}", level, JSON.toJSONString(enterpriseIds)); log.info("有权限的企业信息 level:{}, enterpriseIds:{}", level, JSON.toJSONString(enterpriseIds));
return enterpriseIds; return enterpriseIds;
} }
@Override
public Map<String, List<String>> weekMonthEnterprise() {
return materialEnterpriseAdaptor.getWeekMonthEid();
}
} }
...@@ -7,9 +7,9 @@ import com.gic.commons.util.UniqueIdUtils; ...@@ -7,9 +7,9 @@ import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.content.report.MaterialReportDTO;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum; import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.content.MaterialReportType; import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO; import com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO;
...@@ -17,7 +17,7 @@ import com.gic.haoban.manage.service.pojo.bo.content.context.MaterialReportConte ...@@ -17,7 +17,7 @@ import com.gic.haoban.manage.service.pojo.bo.content.context.MaterialReportConte
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.content.MaterialReportService; import com.gic.haoban.manage.service.service.content.MaterialReportService;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialReportBuilder; import com.gic.haoban.manage.service.service.content.adaptor.WeekMonthReportBuilder;
import com.gic.haoban.manage.service.service.message.NoticeMessageHandler; import com.gic.haoban.manage.service.service.message.NoticeMessageHandler;
import com.gic.haoban.manage.service.service.notify.NoticeMessageService; import com.gic.haoban.manage.service.service.notify.NoticeMessageService;
import com.gic.haoban.manage.service.util.ApolloUtils; import com.gic.haoban.manage.service.util.ApolloUtils;
...@@ -52,7 +52,7 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -52,7 +52,7 @@ public class MaterialReportServiceImpl implements MaterialReportService {
@Autowired @Autowired
private NoticeMessageService noticeMessageService; private NoticeMessageService noticeMessageService;
@Autowired @Autowired
private MaterialReportBuilder materialReportBuilder; private WeekMonthReportBuilder weekMonthReportBuilder;
@Autowired @Autowired
private QywxSuiteApiService qywxSuiteApiService; private QywxSuiteApiService qywxSuiteApiService;
@Autowired @Autowired
...@@ -74,7 +74,11 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -74,7 +74,11 @@ public class MaterialReportServiceImpl implements MaterialReportService {
* @param enterpriseId * @param enterpriseId
*/ */
@Override @Override
public void handlerMaterialReport(String enterpriseId, String staffId, Integer reportType) { public void handlerMaterialReport(MaterialReportDTO materialReportDTO) {
String enterpriseId = materialReportDTO.getEnterpriseId();
String staffId = materialReportDTO.getStaffId();
Integer reportType = materialReportDTO.getReportType();
List<String> rightMenuCodeList = materialReportDTO.getRightMenuCodeList();
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId); EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
if (enterpriseDTO == null) { if (enterpriseDTO == null) {
...@@ -92,17 +96,18 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -92,17 +96,18 @@ public class MaterialReportServiceImpl implements MaterialReportService {
.staffId(staffId) .staffId(staffId)
.staffInfo(staffInfo) .staffInfo(staffInfo)
.reportType(reportType) .reportType(reportType)
.rightMenuCodeList(rightMenuCodeList)
.build(); .build();
// 获取成员关联的导购 // 获取成员关联的导购
materialReportBuilder.buildStaffRelationClerk(context); weekMonthReportBuilder.buildStaffRelationClerk(context);
if (CollectionUtils.isEmpty(context.getStaffClerkRelations())) { if (CollectionUtils.isEmpty(context.getStaffClerkRelations())) {
log.info("处理成员周报月报数据, 成员{}未绑定导购", staffId); log.info("处理成员周报月报数据, 成员{}未绑定导购", staffId);
return; return;
} }
// 判断是区经还是 店长/导购 填充主门店 // 判断是区经还是 店长/导购 填充主门店
materialReportBuilder.fillMainStore(context); weekMonthReportBuilder.fillMainStore(context);
// 获取素材数据 // 获取素材数据
materialReportBuilder.buildMaterialReportData(context); weekMonthReportBuilder.buildMaterialReportData(context);
// 保存小程序消息 // 保存小程序消息
List<NoticeMessageBO> noticeMessageBos = context.buildNotifyMessageBos(); List<NoticeMessageBO> noticeMessageBos = context.buildNotifyMessageBos();
...@@ -125,7 +130,7 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -125,7 +130,7 @@ public class MaterialReportServiceImpl implements MaterialReportService {
// 发送企微消息 // 发送企微消息
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId()); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId());
QywxNewsSendMessageDTO newsSendMessageDTO = materialReportBuilder.buildQywxNewsMessage(context, qwDTO); QywxNewsSendMessageDTO newsSendMessageDTO = weekMonthReportBuilder.buildQywxNewsMessage(context, qwDTO);
if (newsSendMessageDTO == null) { if (newsSendMessageDTO == null) {
log.info("构建企业应用消息异常 clerkId:{}m staffId: {}", context.getClerkId(), context.getStaffId()); log.info("构建企业应用消息异常 clerkId:{}m staffId: {}", context.getClerkId(), context.getStaffId());
return; return;
......
package com.gic.haoban.manage.service.service.out.impl.content; package com.gic.haoban.manage.service.service.out.impl.content;
import cn.hutool.db.DaoTemplate;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
...@@ -25,13 +24,9 @@ import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO; ...@@ -25,13 +24,9 @@ import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.OrderEventMqBO; import com.gic.haoban.manage.service.pojo.bo.content.OrderEventMqBO;
import com.gic.haoban.manage.service.pojo.bo.content.binlog.MemberOrderBo; import com.gic.haoban.manage.service.pojo.bo.content.binlog.MemberOrderBo;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO; import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialDataAdaptor; import com.gic.haoban.manage.service.service.content.adaptor.WeekMonthDataAdaptor;
import com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService; import com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService;
import com.gic.haoban.manage.service.task.KafkaMessageServiceImpl; import com.gic.haoban.manage.service.task.KafkaMessageServiceImpl;
import com.gic.order.api.dto.OrderDTO;
import com.gic.order.api.dto.req.MemberOrderOptional;
import com.gic.order.api.service.member.MemberOrderReadApiService;
import com.gic.orderecommerce.api.service.EcommerceOrderOutputApiService;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -59,7 +54,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang ...@@ -59,7 +54,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
@Autowired @Autowired
InteractRecordMessageService interactRecordMessageService; InteractRecordMessageService interactRecordMessageService;
@Autowired @Autowired
private MaterialDataAdaptor materialDataAdaptor; private WeekMonthDataAdaptor weekMonthDataAdaptor;
@Autowired @Autowired
private EnterpriseUseForbidService enterpriseUseForbidService; private EnterpriseUseForbidService enterpriseUseForbidService;
@Autowired @Autowired
...@@ -251,7 +246,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang ...@@ -251,7 +246,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
InteractRecordMessageBO interactRecordMessageBO = new InteractRecordMessageBO(); InteractRecordMessageBO interactRecordMessageBO = new InteractRecordMessageBO();
interactRecordMessageBO.setEnterpriseId(enterpriseId); interactRecordMessageBO.setEnterpriseId(enterpriseId);
interactRecordMessageBO.setMemberId(memberId); interactRecordMessageBO.setMemberId(memberId);
MaterialDataAdaptor.MaterialBizInfo materialBizInfo = null; WeekMonthDataAdaptor.MaterialBizInfo materialBizInfo = null;
MemberBuryPointOrderQDTO memberBuryPointOrderQDTO = new MemberBuryPointOrderQDTO(); MemberBuryPointOrderQDTO memberBuryPointOrderQDTO = new MemberBuryPointOrderQDTO();
memberBuryPointOrderQDTO.setEnterpriseId(enterpriseId); memberBuryPointOrderQDTO.setEnterpriseId(enterpriseId);
memberBuryPointOrderQDTO.setOrderCreateTime(orderTime); memberBuryPointOrderQDTO.setOrderCreateTime(orderTime);
...@@ -262,7 +257,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang ...@@ -262,7 +257,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
ServiceResponse<ContentMemberBuryPointDTO> buryPointResponse = contentMemberBuryPointApiService.queryMemberBuryPoint(memberBuryPointOrderQDTO); ServiceResponse<ContentMemberBuryPointDTO> buryPointResponse = contentMemberBuryPointApiService.queryMemberBuryPoint(memberBuryPointOrderQDTO);
if (buryPointResponse.isSuccess() && buryPointResponse.getResult() != null) { if (buryPointResponse.isSuccess() && buryPointResponse.getResult() != null) {
ContentMemberBuryPointDTO result = buryPointResponse.getResult(); ContentMemberBuryPointDTO result = buryPointResponse.getResult();
materialBizInfo = new MaterialDataAdaptor.MaterialBizInfo(result.getClerkId(), String.valueOf(result.getContentMaterialId()), result.getStoreId()); materialBizInfo = new WeekMonthDataAdaptor.MaterialBizInfo(result.getClerkId(), String.valueOf(result.getContentMaterialId()), result.getStoreId());
} }
// MaterialDataAdaptor.MaterialBizInfo materialBizInfo = materialDataAdaptor.queryMaterialBizInfo(enterpriseId, memberId, orderTime, null); // MaterialDataAdaptor.MaterialBizInfo materialBizInfo = materialDataAdaptor.queryMaterialBizInfo(enterpriseId, memberId, orderTime, null);
if (materialBizInfo == null) { if (materialBizInfo == null) {
......
package com.gic.haoban.manage.service.service.out.impl.content.task; package com.gic.haoban.manage.service.service.out.impl.content.task;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.Week; import cn.hutool.core.date.Week;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy; import com.alibaba.fastjson.PropertyNamingStrategy;
...@@ -36,7 +36,7 @@ import com.gic.haoban.manage.service.service.WxEnterpriseService; ...@@ -36,7 +36,7 @@ import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.content.GroupMessageService; import com.gic.haoban.manage.service.service.content.GroupMessageService;
import com.gic.haoban.manage.service.service.content.MaterialReportService; import com.gic.haoban.manage.service.service.content.MaterialReportService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService; import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialDataAdaptor; import com.gic.haoban.manage.service.service.content.adaptor.WeekMonthDataAdaptor;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialEnterpriseAdaptor; import com.gic.haoban.manage.service.service.content.adaptor.MaterialEnterpriseAdaptor;
import com.gic.haoban.manage.service.task.KafkaMessageServiceImpl; import com.gic.haoban.manage.service.task.KafkaMessageServiceImpl;
import com.gic.haoban.manage.service.task.RouterConstant; import com.gic.haoban.manage.service.task.RouterConstant;
...@@ -96,7 +96,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -96,7 +96,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
@Autowired @Autowired
private ClerkService clerkService; private ClerkService clerkService;
@Autowired @Autowired
private MaterialDataAdaptor materialDataAdaptor; private WeekMonthDataAdaptor weekMonthDataAdaptor;
@Autowired @Autowired
EnterpriseUseForbidService enterpriseUseForbidService; EnterpriseUseForbidService enterpriseUseForbidService;
...@@ -189,11 +189,13 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -189,11 +189,13 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
* @return * @return
*/ */
private ServiceResponse<Void> doHandlerReportInner(Integer reportType, String params) { private ServiceResponse<Void> doHandlerReportInner(Integer reportType, String params) {
List<String> enterpriseIds = groupMessageService.hasMaterialRightEnterprise(MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode()); Map<String, List<String>> weekMonthEnterprise = groupMessageService.weekMonthEnterprise();
if (CollectionUtils.isEmpty(enterpriseIds)) { if (MapUtil.isEmpty(weekMonthEnterprise)) {
return ServiceResponse.success(); return ServiceResponse.success();
} }
for (String enterpriseId : enterpriseIds) { for (Map.Entry<String, List<String>> map : weekMonthEnterprise.entrySet()) {
String enterpriseId = map.getKey();
List<String> rightMenuCodeList = map.getValue();
if (StringUtils.isNotBlank(params) && !StringUtils.equals("-1", params)) { if (StringUtils.isNotBlank(params) && !StringUtils.equals("-1", params)) {
log.info("执行指定企业的数据 {}", params); log.info("执行指定企业的数据 {}", params);
...@@ -217,6 +219,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -217,6 +219,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
temp.setStaffId(staffId); temp.setStaffId(staffId);
temp.setEnterpriseId(enterpriseId); temp.setEnterpriseId(enterpriseId);
temp.setReportType(reportType); temp.setReportType(reportType);
temp.setRightMenuCodeList(rightMenuCodeList);
boolean sendMQResult = this.sendMaterialReportMQ(temp); boolean sendMQResult = this.sendMaterialReportMQ(temp);
log.info("发送企业{}, 成员id: {}, 结果: {}", enterpriseId, staffId, sendMQResult); log.info("发送企业{}, 成员id: {}, 结果: {}", enterpriseId, staffId, sendMQResult);
} }
...@@ -239,7 +242,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -239,7 +242,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
log.info("参数异常 {}", params); log.info("参数异常 {}", params);
return ServiceResponse.success(); return ServiceResponse.success();
} }
materialReportService.handlerMaterialReport(materialReportDTO.getEnterpriseId(), materialReportDTO.getStaffId(), materialReportDTO.getReportType()); materialReportService.handlerMaterialReport(materialReportDTO);
return ServiceResponse.success(); return ServiceResponse.success();
} }
...@@ -469,7 +472,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -469,7 +472,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
orderHoloBo.setCreateTime(DateUtil.dateToStr(orderDTO.getCreateTime(), DateUtil.FORMAT_DATETIME_19)); orderHoloBo.setCreateTime(DateUtil.dateToStr(orderDTO.getCreateTime(), DateUtil.FORMAT_DATETIME_19));
orderHoloBo.setUpdateTime(DateUtil.dateToStr(orderDTO.getCreateTime(), DateUtil.FORMAT_DATETIME_19)); orderHoloBo.setUpdateTime(DateUtil.dateToStr(orderDTO.getCreateTime(), DateUtil.FORMAT_DATETIME_19));
orderHoloBo.setDeleteFlag(0); orderHoloBo.setDeleteFlag(0);
MaterialDataAdaptor.MaterialBizInfo materialBizInfo = materialDataAdaptor.queryMaterialBizInfo(orderDTO.getEnterpriseId(), orderDTO.getMemberId(), orderDTO.getOrderTime(), null); WeekMonthDataAdaptor.MaterialBizInfo materialBizInfo = weekMonthDataAdaptor.queryMaterialBizInfo(orderDTO.getEnterpriseId(), orderDTO.getMemberId(), orderDTO.getOrderTime(), null);
if (materialBizInfo != null) { if (materialBizInfo != null) {
orderHoloBo.setContentMaterialId(Long.parseLong(materialBizInfo.getBizId())); orderHoloBo.setContentMaterialId(Long.parseLong(materialBizInfo.getBizId()));
orderHoloBo.setShareClerkId(materialBizInfo.getClerkId()); orderHoloBo.setShareClerkId(materialBizInfo.getClerkId());
...@@ -500,11 +503,11 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -500,11 +503,11 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
orderItemHoloBo.setUpdateTime(orderItemHoloBo.getUpdateTime()); orderItemHoloBo.setUpdateTime(orderItemHoloBo.getUpdateTime());
orderItemHoloBo.setDeleteFlag(0); orderItemHoloBo.setDeleteFlag(0);
MaterialDataAdaptor.MaterialBizInfo tempMaterialInfo WeekMonthDataAdaptor.MaterialBizInfo tempMaterialInfo
= materialDataAdaptor.queryMaterialBizInfo(orderItemHoloBo.getEnterpriseId(), item.getMemberId(), orderDTO.getOrderTime(), item.getProductCode()); = weekMonthDataAdaptor.queryMaterialBizInfo(orderItemHoloBo.getEnterpriseId(), item.getMemberId(), orderDTO.getOrderTime(), item.getProductCode());
if (tempMaterialInfo != null) { if (tempMaterialInfo != null) {
orderItemHoloBo.setContentMaterialId(Long.parseLong(tempMaterialInfo.getBizId())); orderItemHoloBo.setContentMaterialId(Long.parseLong(tempMaterialInfo.getBizId()));
Long materialBaseId = materialDataAdaptor.queryMaterialBaseId(orderItemHoloBo.getEnterpriseId(), orderItemHoloBo.getContentMaterialId()); Long materialBaseId = weekMonthDataAdaptor.queryMaterialBaseId(orderItemHoloBo.getEnterpriseId(), orderItemHoloBo.getContentMaterialId());
orderItemHoloBo.setAuditMaterialId(materialBaseId); orderItemHoloBo.setAuditMaterialId(materialBaseId);
} }
return orderItemHoloBo; return orderItemHoloBo;
...@@ -544,10 +547,10 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -544,10 +547,10 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
orderHoloBo.setCreateTime(DateUtil.dateToStr(eorderDTO.getCreateTime(), DateUtil.FORMAT_DATETIME_19)); orderHoloBo.setCreateTime(DateUtil.dateToStr(eorderDTO.getCreateTime(), DateUtil.FORMAT_DATETIME_19));
orderHoloBo.setUpdateTime(DateUtil.dateToStr(eorderDTO.getUpdateTime(), DateUtil.FORMAT_DATETIME_19)); orderHoloBo.setUpdateTime(DateUtil.dateToStr(eorderDTO.getUpdateTime(), DateUtil.FORMAT_DATETIME_19));
orderHoloBo.setDeleteFlag(0); orderHoloBo.setDeleteFlag(0);
MaterialDataAdaptor.MaterialBizInfo materialBizInfo = materialDataAdaptor.queryMaterialBizInfo(eorderDTO.getEnterpriseId(), eorderDTO.getMemberId(), eorderDTO.getOrderCreateTime(), null); WeekMonthDataAdaptor.MaterialBizInfo materialBizInfo = weekMonthDataAdaptor.queryMaterialBizInfo(eorderDTO.getEnterpriseId(), eorderDTO.getMemberId(), eorderDTO.getOrderCreateTime(), null);
if (materialBizInfo != null) { if (materialBizInfo != null) {
orderHoloBo.setContentMaterialId(Long.parseLong(materialBizInfo.getBizId())); orderHoloBo.setContentMaterialId(Long.parseLong(materialBizInfo.getBizId()));
Long materialBaseId = materialDataAdaptor.queryMaterialBaseId(eorderDTO.getEnterpriseId(), orderHoloBo.getContentMaterialId()); Long materialBaseId = weekMonthDataAdaptor.queryMaterialBaseId(eorderDTO.getEnterpriseId(), orderHoloBo.getContentMaterialId());
orderHoloBo.setAuditMaterialId(materialBaseId); orderHoloBo.setAuditMaterialId(materialBaseId);
orderHoloBo.setShareClerkId(materialBizInfo.getClerkId()); orderHoloBo.setShareClerkId(materialBizInfo.getClerkId());
orderHoloBo.setShareStoreId(materialBizInfo.getStoreId()); orderHoloBo.setShareStoreId(materialBizInfo.getStoreId());
...@@ -581,11 +584,11 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -581,11 +584,11 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
orderItemHoloBo.setUpdateTime(DateUtil.dateToStr(eorderDTO.getUpdateTime(), DateUtil.FORMAT_DATETIME_19)); orderItemHoloBo.setUpdateTime(DateUtil.dateToStr(eorderDTO.getUpdateTime(), DateUtil.FORMAT_DATETIME_19));
orderItemHoloBo.setDeleteFlag(0); orderItemHoloBo.setDeleteFlag(0);
MaterialDataAdaptor.MaterialBizInfo tempMaterialInfo WeekMonthDataAdaptor.MaterialBizInfo tempMaterialInfo
= materialDataAdaptor.queryMaterialBizInfo(item.getEnterpriseId(), item.getMemberId(), eorderDTO.getOrderCreateTime(), item.getGoodsCode()); = weekMonthDataAdaptor.queryMaterialBizInfo(item.getEnterpriseId(), item.getMemberId(), eorderDTO.getOrderCreateTime(), item.getGoodsCode());
if (tempMaterialInfo != null) { if (tempMaterialInfo != null) {
orderItemHoloBo.setContentMaterialId(Long.parseLong(tempMaterialInfo.getBizId())); orderItemHoloBo.setContentMaterialId(Long.parseLong(tempMaterialInfo.getBizId()));
Long materialBaseId = materialDataAdaptor.queryMaterialBaseId(eorderDTO.getEnterpriseId(), orderItemHoloBo.getContentMaterialId()); Long materialBaseId = weekMonthDataAdaptor.queryMaterialBaseId(eorderDTO.getEnterpriseId(), orderItemHoloBo.getContentMaterialId());
orderItemHoloBo.setAuditMaterialId(materialBaseId); orderItemHoloBo.setAuditMaterialId(materialBaseId);
} }
return orderItemHoloBo; return orderItemHoloBo;
......
...@@ -14,6 +14,7 @@ import java.awt.*; ...@@ -14,6 +14,7 @@ import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap;
import java.util.Random; import java.util.Random;
/** /**
...@@ -28,10 +29,21 @@ public class DrawImageUtils { ...@@ -28,10 +29,21 @@ public class DrawImageUtils {
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum DrawBkgImg { public enum DrawBkgImg {
AREA_WEEK_BKG("template/area_week_bkg.png", "区经周报背景图", 352, 416, 320),
AREA_MONTH_BKG("template/area_month_bkg.png", "区经月报背景图", 352, 416, 320), CONTENT_AREA_WEEK_BKG("template/content_area_week_bkg.png", "素材区经周报背景图", 352, 416, 320),
CLERK_WEEK_BKG("template/week_bkg.png", "导购/店长周报背景图", 260, 320, 353), CONTENT_AREA_MONTH_BKG("template/content_area_month_bkg.png", "素材区经月报背景图", 352, 416, 320),
CLERK_MONTH_BKG("template/month_bkg.png", "导购/店长月报背景图", 260, 320, 353), CONTENT_CLERK_WEEK_BKG("template/content_week_bkg.png", "素材导购/店长周报背景图", 260, 320, 353),
CONTENT_CLERK_MONTH_BKG("template/content_month_bkg.png", "素材导购/店长月报背景图", 260, 320, 353),
POTENTIAL_AREA_WEEK_BKG("template/potential_week_bkg.png", "潜客雷达区经周报背景图", 260, 320, 353),
POTENTIAL_AREA_MONTH_BKG("template/potential_month_bkg.png", "潜客雷达区经月报背景图", 260, 320, 353),
POTENTIAL_CLERK_WEEK_BKG("template/potential_week_bkg.png", "潜客雷达导购/店长周报背景图", 260, 320, 353),
POTENTIAL_CLERK_MONTH_BKG("template/potential_month_bkg.png", "潜客雷达导购/店长月报背景图", 260, 320, 353),
AREA_WEEK_BKG("template/week_bkg.png", "门店增长区经周报背景图", 352, 416, 320),
AREA_MONTH_BKG("template/month_bkg.png", "门店增长区经月报背景图", 352, 416, 320),
CLERK_WEEK_BKG("template/week_bkg.png", "门店增长导购/店长周报背景图", 352, 416, 320),
CLERK_MONTH_BKG("template/month_bkg.png", "门店增长导购/店长月报背景图", 352, 416, 320),
; ;
private String path; private String path;
private String desc; private String desc;
...@@ -49,7 +61,27 @@ public class DrawImageUtils { ...@@ -49,7 +61,27 @@ public class DrawImageUtils {
*/ */
private int amountWidth; private int amountWidth;
}
public static final HashMap<String, DrawImageUtils.DrawBkgImg> templateMap = new HashMap<>();
static {
// 区域+周/月
templateMap.put("AREA_WEEK", DrawImageUtils.DrawBkgImg.AREA_WEEK_BKG);
templateMap.put("AREA_MONTH", DrawImageUtils.DrawBkgImg.AREA_MONTH_BKG);
// 导购+周/月
templateMap.put("CLERK_WEEK", DrawImageUtils.DrawBkgImg.CLERK_WEEK_BKG);
templateMap.put("CLERK_MONTH", DrawImageUtils.DrawBkgImg.CLERK_MONTH_BKG);
// 预约 + 区域/导购 + 周/月
templateMap.put("POTENTIAL_AREA_WEEK", DrawImageUtils.DrawBkgImg.POTENTIAL_AREA_WEEK_BKG);
templateMap.put("POTENTIAL_CLERK_WEEK", DrawImageUtils.DrawBkgImg.POTENTIAL_CLERK_WEEK_BKG);
templateMap.put("POTENTIAL_AREA_MONTH", DrawImageUtils.DrawBkgImg.POTENTIAL_AREA_MONTH_BKG);
templateMap.put("POTENTIAL_CLERK_MONTH", DrawImageUtils.DrawBkgImg.POTENTIAL_CLERK_MONTH_BKG);
// 内容 + 区域/导购 + 周/月
templateMap.put("CONTENT_AREA_WEEK", DrawImageUtils.DrawBkgImg.CONTENT_AREA_WEEK_BKG);
templateMap.put("CONTENT_CLERK_WEEK", DrawImageUtils.DrawBkgImg.CONTENT_CLERK_WEEK_BKG);
templateMap.put("CONTENT_AREA_MONTH", DrawImageUtils.DrawBkgImg.CONTENT_AREA_MONTH_BKG);
templateMap.put("CONTENT_CLERK_MONTH", DrawImageUtils.DrawBkgImg.CONTENT_CLERK_MONTH_BKG);
} }
/** /**
......
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.haoban.manage.api.dto.content.report.MaterialReportDTO;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum; import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.content.MaterialReportType; import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService; import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService;
...@@ -10,14 +12,14 @@ import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord; ...@@ -10,14 +12,14 @@ import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.service.MemberQueryService; import com.gic.haoban.manage.service.service.MemberQueryService;
import com.gic.haoban.manage.service.service.content.GroupMessageService; import com.gic.haoban.manage.service.service.content.GroupMessageService;
import com.gic.haoban.manage.service.service.content.MaterialReportService; import com.gic.haoban.manage.service.service.content.MaterialReportService;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialDataAdaptor; import com.gic.haoban.manage.service.service.content.adaptor.WeekMonthDataAdaptor;
import com.gic.member.api.dto.es.MemberDataDTO; import com.gic.member.api.dto.es.MemberDataDTO;
import com.gic.search.engine.api.constant.MemberDataEnum; import com.gic.search.engine.api.constant.MemberDataEnum;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
...@@ -47,7 +49,7 @@ public class MaterialReportServiceTest { ...@@ -47,7 +49,7 @@ public class MaterialReportServiceTest {
@Autowired @Autowired
private TabHaobanInteractRecordMapper interactRecordMapper; private TabHaobanInteractRecordMapper interactRecordMapper;
@Autowired @Autowired
private MaterialDataAdaptor materialDataAdaptor; private WeekMonthDataAdaptor weekMonthDataAdaptor;
@Autowired @Autowired
private MemberQueryService memberQueryService; private MemberQueryService memberQueryService;
...@@ -61,8 +63,14 @@ public class MaterialReportServiceTest { ...@@ -61,8 +63,14 @@ public class MaterialReportServiceTest {
@Test @Test
public void handlerMaterialWeekReportTest() { public void handlerMaterialWeekReportTest() {
System.setProperty("gic.module.name", "haoban-manage3-service"); System.setProperty("gic.module.name", "haoban-manage3-service");
materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.WEEK.getCode()); MaterialReportDTO materialReportDTO = new MaterialReportDTO();
materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.MONTH.getCode()); materialReportDTO.setEnterpriseId(eid);
materialReportDTO.setStaffId(staffId);
materialReportDTO.setReportType(MaterialReportType.WEEK.getCode());
materialReportDTO.setRightMenuCodeList(Lists.newArrayList(EnterpriseServiceEnum.CONTENT.getRightMenuCode()));
materialReportService.handlerMaterialReport(materialReportDTO);
materialReportDTO.setReportType(MaterialReportType.MONTH.getCode());
materialReportService.handlerMaterialReport(materialReportDTO);
} }
@Test @Test
...@@ -111,7 +119,7 @@ public class MaterialReportServiceTest { ...@@ -111,7 +119,7 @@ public class MaterialReportServiceTest {
@Test @Test
public void queryData(){ public void queryData(){
MaterialDataAdaptor.MaterialDataResult materialDataResult = materialDataAdaptor.queryClerkReportData(eid, clerkId, storeId, MaterialReportType.MONTH.getCode(), "2023-14"); WeekMonthDataAdaptor.MaterialDataResult materialDataResult = weekMonthDataAdaptor.queryClerkReportDataContent(eid, clerkId, storeId, MaterialReportType.MONTH.getCode(), "2023-14");
System.out.println(JSON.toJSONString(materialDataResult)); System.out.println(JSON.toJSONString(materialDataResult));
} }
......
...@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
* 潜客雷达-跟进记录 * 潜客雷达-数据
*/ */
@RestController @RestController
@RequestMapping() @RequestMapping()
......
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