Commit 7c01d458 by 徐高华

Merge remote-tracking branch 'origin/master_xgh_加好友队列调整' into developer

Conflicts:
	haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/hm/HmQrcodeController.java
parents 8628e481 4f409ddc
package com.gic.haoban.manage.web.controller.hm; package com.gic.haoban.manage.web.controller.hm;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO; import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil; import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.constants.StatisticsApolloKeyConstant; import com.gic.haoban.manage.api.constants.StatisticsApolloKeyConstant;
import com.gic.haoban.manage.api.dto.hm.*; import com.gic.haoban.manage.api.dto.hm.*;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogSearchQDTO;
import com.gic.haoban.manage.api.dto.statistics.StatisticsDTO; import com.gic.haoban.manage.api.dto.statistics.StatisticsDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.hm.HmClerkRelationApiService; import com.gic.haoban.manage.api.service.hm.HmClerkRelationApiService;
import com.gic.haoban.manage.api.service.hm.HmGroupApiService; import com.gic.haoban.manage.api.service.hm.HmGroupApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService; import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.api.service.hm.WxUserAddLogApiService; import com.gic.haoban.manage.api.service.hm.WxUserAddLogApiService;
import com.gic.haoban.manage.api.util.DataHttpUtil; import com.gic.haoban.manage.api.util.DataHttpUtil;
import com.gic.haoban.manage.web.dto.HmOverviewDTO; import com.gic.haoban.manage.web.dto.HmOverviewDTO;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.hm.HmQrcodeDetailQO; import com.gic.haoban.manage.web.qo.hm.HmQrcodeDetailQO;
import com.gic.haoban.manage.web.qo.hm.HmQrcodeUpdateQO; import com.gic.haoban.manage.web.qo.hm.HmQrcodeUpdateQO;
import com.gic.haoban.manage.web.qo.hm.data.HmDetailClerkListQO; import com.gic.haoban.manage.web.qo.hm.data.HmDetailClerkListQO;
import com.gic.haoban.manage.web.qo.hm.data.HmQrcodeListQO; import com.gic.haoban.manage.web.qo.hm.data.HmQrcodeListQO;
import com.gic.haoban.manage.web.qo.hm.data.HmTrendQO; import com.gic.haoban.manage.web.qo.hm.data.HmTrendQO;
import com.gic.haoban.manage.web.utils.statistics.DataStatisticsParamUtils; import com.gic.haoban.manage.web.utils.statistics.DataStatisticsParamUtils;
import com.gic.haoban.manage.web.utils.statistics.DateUtils; import com.gic.haoban.manage.web.utils.statistics.DateUtils;
import com.gic.haoban.manage.web.vo.hm.HmDetailClerkListVO; import com.gic.haoban.manage.web.vo.hm.HmDetailClerkListVO;
import com.gic.haoban.manage.web.vo.hm.HmTrendVO; import com.gic.haoban.manage.web.vo.hm.HmTrendVO;
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.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 活码(TabHaobanHmQrcode)表控制层 * 活码(TabHaobanHmQrcode)表控制层
* *
* @author mozhu * @author mozhu
* @since 2022-07-04 15:42:20 * @since 2022-07-04 15:42:20
*/ */
@RestController @RestController
@RequestMapping("/hm/qrcode") @RequestMapping("/hm/qrcode")
public class HmQrcodeController { public class HmQrcodeController {
private static org.apache.logging.log4j.Logger logger = LogManager.getLogger(HmQrcodeController.class); private static org.apache.logging.log4j.Logger logger = LogManager.getLogger(HmQrcodeController.class);
@Autowired @Autowired
private HmQrcodeApiService hmQrcodeApiService; private HmQrcodeApiService hmQrcodeApiService;
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired @Autowired
private WxUserAddLogApiService wxUserAddLogApiService; private WxUserAddLogApiService wxUserAddLogApiService;
@Autowired @Autowired
private StaffClerkRelationApiService staffClerkRelationApiService; private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired @Autowired
private HmGroupApiService hmGroupApiService; private HmGroupApiService hmGroupApiService;
@Autowired @Autowired
private HmClerkRelationApiService hmClerkRelationApiService; private HmClerkRelationApiService hmClerkRelationApiService;
/** /**
* 新增 * 新增
* *
* @param hmQrcodeQDTO * @param hmQrcodeQDTO
* @return * @return
*/ */
@RequestMapping(value = "add", method = RequestMethod.POST) @RequestMapping(value = "add", method = RequestMethod.POST)
public RestResponse add(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) { public RestResponse add(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
hmQrcodeQDTO.setCreatorId(loginUser.getClerkId()); hmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
hmQrcodeQDTO.setCreatorName(loginUser.getClerkName()); hmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
hmQrcodeQDTO.setModifierId(loginUser.getClerkId()); hmQrcodeQDTO.setModifierId(loginUser.getClerkId());
hmQrcodeQDTO.setModifierName(loginUser.getClerkName()); hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId()); hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId()); hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeQDTO.setInvokingType(1); hmQrcodeQDTO.setInvokingType(1);
hmQrcodeQDTO.setWebLoginDTO(loginUser); hmQrcodeQDTO.setWebLoginDTO(loginUser);
ServiceResponse serviceResponse = this.hmQrcodeApiService.add(hmQrcodeQDTO); ServiceResponse serviceResponse = this.hmQrcodeApiService.add(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) { if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage());
} }
return RestResponse.successResult(); return RestResponse.successResult();
} }
@RequestMapping(value = "addList", method = RequestMethod.POST) @RequestMapping(value = "addList", method = RequestMethod.POST)
public RestResponse addList(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) { public RestResponse addList(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
hmQrcodeQDTO.setCreatorId(loginUser.getClerkId()); hmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
hmQrcodeQDTO.setCreatorName(loginUser.getClerkName()); hmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
hmQrcodeQDTO.setModifierId(loginUser.getClerkId()); hmQrcodeQDTO.setModifierId(loginUser.getClerkId());
hmQrcodeQDTO.setModifierName(loginUser.getClerkName()); hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId()); hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId()); hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeQDTO.setWebLoginDTO(loginUser); hmQrcodeQDTO.setWebLoginDTO(loginUser);
ServiceResponse serviceResponse = this.hmQrcodeApiService.addList(hmQrcodeQDTO); ServiceResponse serviceResponse = this.hmQrcodeApiService.addList(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) { if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage());
} }
return RestResponse.successResult(); return RestResponse.successResult();
} }
/** /**
* 修改 * 修改
* *
* @param hmQrcodeQDTO * @param hmQrcodeQDTO
* @return * @return
*/ */
@RequestMapping(value = "update", method = RequestMethod.POST) @RequestMapping(value = "update", method = RequestMethod.POST)
public RestResponse update(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) { public RestResponse update(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
hmQrcodeQDTO.setModifierId(loginUser.getClerkId()); hmQrcodeQDTO.setModifierId(loginUser.getClerkId());
hmQrcodeQDTO.setModifierName(loginUser.getClerkName()); hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId()); hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId()); hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeQDTO.setInvokingType(1); hmQrcodeQDTO.setInvokingType(1);
hmQrcodeQDTO.setWebLoginDTO(loginUser); hmQrcodeQDTO.setWebLoginDTO(loginUser);
ServiceResponse serviceResponse = this.hmQrcodeApiService.update(hmQrcodeQDTO); ServiceResponse serviceResponse = this.hmQrcodeApiService.update(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) { if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage());
} }
return RestResponse.successResult(); return RestResponse.successResult();
} }
/** /**
* 列表 * 列表
* *
* @param hmQrcodeListQO * @param hmQrcodeListQO
* @return * @return
*/ */
@RequestMapping(value = "list", method = RequestMethod.POST) @RequestMapping(value = "list", method = RequestMethod.POST)
public RestResponse<StatisticsDTO> list(@RequestBody HmQrcodeListQO hmQrcodeListQO) { public RestResponse<StatisticsDTO> list(@RequestBody HmQrcodeListQO hmQrcodeListQO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
hmQrcodeListQO.getInFields().setEnterpriseId(loginUser.getEnterpriseId()); hmQrcodeListQO.getInFields().setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeListQO.getInFields().setWxEnterpriseId(loginUser.getWxEnterpriseId()); hmQrcodeListQO.getInFields().setWxEnterpriseId(loginUser.getWxEnterpriseId());
List<String> storeList = staffApiService.getHaoBanStoreIdsRolesByClerkId(loginUser.getClerkId(), loginUser.getWxEnterpriseId()); List<String> storeList = staffApiService.getHaoBanStoreIdsRolesByClerkId(loginUser.getClerkId(), loginUser.getWxEnterpriseId());
if (CollectionUtils.isEmpty(storeList)) { if (CollectionUtils.isEmpty(storeList)) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()), HaoBanErrCode.ERR_100007.getMsg()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()), HaoBanErrCode.ERR_100007.getMsg());
} }
if (!storeList.contains("-1")) { if (!storeList.contains("-1")) {
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
storeList.forEach(c -> stringBuffer.append(c).append(",")); storeList.forEach(c -> stringBuffer.append(c).append(","));
hmQrcodeListQO.getInFields().setStoreId(stringBuffer.toString()); hmQrcodeListQO.getInFields().setStoreId(stringBuffer.toString());
} }
Long hmGroupId = hmQrcodeListQO.getInFields().getHmGroupId(); Long hmGroupId = hmQrcodeListQO.getInFields().getHmGroupId();
//-1 代表全部分组 //-1 代表全部分组
if (hmGroupId == -1) { if (hmGroupId == -1) {
hmQrcodeListQO.getInFields().setHmGroupId(null); hmQrcodeListQO.getInFields().setHmGroupId(null);
} }
HmQrcodeListQDTO qdto = EntityUtil.changeEntityByJSON(HmQrcodeListQDTO.class, hmQrcodeListQO.getInFields()); HmQrcodeListQDTO qdto = EntityUtil.changeEntityByJSON(HmQrcodeListQDTO.class, hmQrcodeListQO.getInFields());
if (!storeList.contains("-1")) { if (!storeList.contains("-1")) {
qdto.setStoreId(storeList); qdto.setStoreId(storeList);
} }
ServiceResponse<List<String>> listResp = this.hmQrcodeApiService.listHmIdForIndex(qdto); ServiceResponse<List<String>> listResp = this.hmQrcodeApiService.listHmIdForIndex(qdto);
logger.info("HMid列表={}", JSON.toJSONString(listResp)); logger.info("HMid列表={}", JSON.toJSONString(listResp));
List<String> hmIds = listResp.getResult(); List<String> hmIds = listResp.getResult();
if(CollectionUtils.isEmpty(hmIds)) { if(CollectionUtils.isEmpty(hmIds)) {
return RestResponse.successResult(new StatisticsDTO()) ; return RestResponse.successResult(new StatisticsDTO()) ;
} }
StringBuffer stringBuffer = new StringBuffer(); // 如果是所有门店
hmIds.forEach(c -> stringBuffer.append(c).append(",")); if (!storeList.contains("-1") || null != qdto.getStartTime() || null != qdto.getHmGroupId() ||
hmQrcodeListQO.getInFields().setHmId(stringBuffer.toString()); null != qdto.getHmTypeInt() || null != qdto.getStatusFlagInt() || StringUtils.isNotBlank(qdto.getClerkSelect())
StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO); || StringUtils.isNotBlank(qdto.getStoreSelect()) || StringUtils.isNotBlank(qdto.getHmSelect())) {
List<HmQrcodeListDTO> data = JSON.parseArray(JSON.toJSONString(statisticsDTO.getData()), HmQrcodeListDTO.class); StringBuffer stringBuffer = new StringBuffer();
if (CollectionUtils.isNotEmpty(data)) { hmIds.forEach(c -> stringBuffer.append(c).append(","));
for (HmQrcodeListDTO hmQrcodeListDTO : data) { hmQrcodeListQO.getInFields().setHmId(stringBuffer.toString());
List<HmStoreDTO> storeDTOList = new ArrayList<>(); }
List<HmClerkDTO> clerkDTOList = new ArrayList<>(); StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO);
Long hmId = hmQrcodeListDTO.getHmId(); List<HmQrcodeListDTO> data = JSON.parseArray(JSON.toJSONString(statisticsDTO.getData()), HmQrcodeListDTO.class);
Integer hmType = hmQrcodeListDTO.getHmType(); if (CollectionUtils.isNotEmpty(data)) {
if (hmType == 1) { for (HmQrcodeListDTO hmQrcodeListDTO : data) {
HmClerkDTO clerkDTO = new HmClerkDTO(); List<HmStoreDTO> storeDTOList = new ArrayList<>();
clerkDTO.setClerkName(hmQrcodeListDTO.getClerkName()); List<HmClerkDTO> clerkDTOList = new ArrayList<>();
clerkDTO.setClerkId(hmQrcodeListDTO.getClerkId()); Long hmId = hmQrcodeListDTO.getHmId();
clerkDTO.setClerkCode(hmQrcodeListDTO.getClerkCode()); Integer hmType = hmQrcodeListDTO.getHmType();
clerkDTOList.add(clerkDTO); if (hmType == 1) {
HmClerkDTO clerkDTO = new HmClerkDTO();
HmStoreDTO storeDTO = new HmStoreDTO(); clerkDTO.setClerkName(hmQrcodeListDTO.getClerkName());
storeDTO.setStoreId(hmQrcodeListDTO.getStoreId()); clerkDTO.setClerkId(hmQrcodeListDTO.getClerkId());
storeDTO.setStoreName(hmQrcodeListDTO.getStoreName()); clerkDTO.setClerkCode(hmQrcodeListDTO.getClerkCode());
storeDTO.setStoreCode(hmQrcodeListDTO.getStoreCode()); clerkDTOList.add(clerkDTO);
storeDTOList.add(storeDTO);
} else if (hmType == 2) { HmStoreDTO storeDTO = new HmStoreDTO();
BasePageInfo basePageInfo = new BasePageInfo(); storeDTO.setStoreId(hmQrcodeListDTO.getStoreId());
basePageInfo.setPageNum(1); storeDTO.setStoreName(hmQrcodeListDTO.getStoreName());
basePageInfo.setPageSize(1000); storeDTO.setStoreCode(hmQrcodeListDTO.getStoreCode());
Page<HmClerkRelationDTO> hmClerkByHmId = hmClerkRelationApiService.getHmClerkByHmId(basePageInfo, hmId); storeDTOList.add(storeDTO);
List<HmClerkRelationDTO> hmClerkRelationDTOList = hmClerkByHmId.getResult(); } else if (hmType == 2) {
if (CollectionUtils.isNotEmpty(hmClerkRelationDTOList)) { BasePageInfo basePageInfo = new BasePageInfo();
for (HmClerkRelationDTO hmClerkRelationDTO : hmClerkRelationDTOList) { basePageInfo.setPageNum(1);
HmClerkDTO clerkDTO = new HmClerkDTO(); basePageInfo.setPageSize(1000);
clerkDTO.setClerkName(hmClerkRelationDTO.getClerkName()); Page<HmClerkRelationDTO> hmClerkByHmId = hmClerkRelationApiService.getHmClerkByHmId(basePageInfo, hmId);
clerkDTO.setClerkId(hmClerkRelationDTO.getClerkId()); List<HmClerkRelationDTO> hmClerkRelationDTOList = hmClerkByHmId.getResult();
clerkDTO.setClerkCode(hmClerkRelationDTO.getClerkCode()); if (CollectionUtils.isNotEmpty(hmClerkRelationDTOList)) {
clerkDTOList.add(clerkDTO); for (HmClerkRelationDTO hmClerkRelationDTO : hmClerkRelationDTOList) {
HmClerkDTO clerkDTO = new HmClerkDTO();
HmStoreDTO storeDTO = new HmStoreDTO(); clerkDTO.setClerkName(hmClerkRelationDTO.getClerkName());
storeDTO.setStoreId(hmClerkRelationDTO.getStoreId()); clerkDTO.setClerkId(hmClerkRelationDTO.getClerkId());
storeDTO.setStoreName(hmClerkRelationDTO.getStoreName()); clerkDTO.setClerkCode(hmClerkRelationDTO.getClerkCode());
storeDTO.setStoreCode(hmClerkRelationDTO.getStoreCode()); clerkDTOList.add(clerkDTO);
storeDTOList.add(storeDTO);
} HmStoreDTO storeDTO = new HmStoreDTO();
} storeDTO.setStoreId(hmClerkRelationDTO.getStoreId());
} storeDTO.setStoreName(hmClerkRelationDTO.getStoreName());
storeDTO.setStoreCode(hmClerkRelationDTO.getStoreCode());
ServiceResponse<HmGroupDTO> hmGroupDTOServiceResponse = hmGroupApiService.queryGroupDetail(hmQrcodeListDTO.getHmGroupId()); storeDTOList.add(storeDTO);
HmGroupDTO hmGroupDTO = hmGroupDTOServiceResponse.getResult(); }
if (hmGroupDTO != null) { }
hmQrcodeListDTO.setHmGroupName(hmGroupDTO.getGroupName()); }
}
if (CollectionUtils.isNotEmpty(storeDTOList)) { ServiceResponse<HmGroupDTO> hmGroupDTOServiceResponse = hmGroupApiService.queryGroupDetail(hmQrcodeListDTO.getHmGroupId());
//门店id去重 HmGroupDTO hmGroupDTO = hmGroupDTOServiceResponse.getResult();
storeDTOList = storeDTOList.stream().filter(c-> StringUtils.isNotBlank(c.getStoreId())) if (hmGroupDTO != null) {
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(HmStoreDTO::getStoreId))), ArrayList::new)); hmQrcodeListDTO.setHmGroupName(hmGroupDTO.getGroupName());
} }
hmQrcodeListDTO.setClerkList(clerkDTOList); if (CollectionUtils.isNotEmpty(storeDTOList)) {
hmQrcodeListDTO.setStoreList(storeDTOList); //门店id去重
} storeDTOList = storeDTOList.stream().filter(c-> StringUtils.isNotBlank(c.getStoreId()))
statisticsDTO.setData(data); .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(HmStoreDTO::getStoreId))), ArrayList::new));
} }
return RestResponse.successResult(statisticsDTO); hmQrcodeListDTO.setClerkList(clerkDTOList);
} hmQrcodeListDTO.setStoreList(storeDTOList);
}
/** statisticsDTO.setData(data);
* 详情 }
* return RestResponse.successResult(statisticsDTO);
* @param hmId }
* @return
*/ /**
@RequestMapping(value = "detail", method = RequestMethod.GET) * 详情
public RestResponse detail(Long hmId) { *
HmQrcodeDTO hmQrcodeDTO = this.hmQrcodeApiService.getDetailById(hmId); * @param hmId
return RestResponse.successResult(hmQrcodeDTO); * @return
} */
@RequestMapping(value = "detail", method = RequestMethod.GET)
/** public RestResponse detail(Long hmId) {
* 作废 HmQrcodeDTO hmQrcodeDTO = this.hmQrcodeApiService.getDetailById(hmId);
* return RestResponse.successResult(hmQrcodeDTO);
* @param hmId }
* @return
*/ /**
@RequestMapping(value = "del", method = RequestMethod.DELETE) * 作废
public RestResponse del(Long hmId) { *
ServiceResponse serviceResponse = this.hmQrcodeApiService.delById(hmId,1,AuthWebRequestUtil.getLoginUser()); * @param hmId
if (!"0000".equals(serviceResponse.getCode())) { * @return
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage()); */
} @RequestMapping(value = "del", method = RequestMethod.DELETE)
return RestResponse.successResult(); public RestResponse del(Long hmId) {
} ServiceResponse serviceResponse = this.hmQrcodeApiService.delById(hmId,1,AuthWebRequestUtil.getLoginUser());
if (!"0000".equals(serviceResponse.getCode())) {
/** return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage());
* 数据统计 }
* return RestResponse.successResult();
* @param hmTrendQO }
* @return
*/ /**
@RequestMapping(value = "detail-data-statistics", method = RequestMethod.POST) * 数据统计
public RestResponse detailDataStatistics(@RequestBody HmTrendQO hmTrendQO) throws ParseException { *
Integer type = hmTrendQO.getInFields().getType(); * @param hmTrendQO
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); * @return
hmTrendQO.getInFields().setEnterpriseId(loginUser.getEnterpriseId()); */
StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_overview, hmTrendQO); @RequestMapping(value = "detail-data-statistics", method = RequestMethod.POST)
HmOverviewDTO hmOverviewDTO = JSON.parseObject(JSON.toJSONString(statisticsDTO.getOne()), HmOverviewDTO.class); public RestResponse detailDataStatistics(@RequestBody HmTrendQO hmTrendQO) throws ParseException {
HmTrendVO hmTrendVO = EntityUtil.changeEntityNew(HmTrendVO.class, hmOverviewDTO); Integer type = hmTrendQO.getInFields().getType();
List<Map> list = new ArrayList<>(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (type == 1) { hmTrendQO.getInFields().setEnterpriseId(loginUser.getEnterpriseId());
//天 StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_overview, hmTrendQO);
StatisticsDTO dto = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_trend_d, hmTrendQO); HmOverviewDTO hmOverviewDTO = JSON.parseObject(JSON.toJSONString(statisticsDTO.getOne()), HmOverviewDTO.class);
list = JSON.parseArray(JSON.toJSONString(dto.getData()), Map.class); HmTrendVO hmTrendVO = EntityUtil.changeEntityNew(HmTrendVO.class, hmOverviewDTO);
} else if (type == 2) { List<Map> list = new ArrayList<>();
//月 if (type == 1) {
StatisticsDTO dto = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_trend_m, hmTrendQO); //天
list = JSON.parseArray(JSON.toJSONString(dto.getData()), Map.class); StatisticsDTO dto = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_trend_d, hmTrendQO);
} list = JSON.parseArray(JSON.toJSONString(dto.getData()), Map.class);
if (hmTrendVO == null) { } else if (type == 2) {
hmTrendVO = new HmTrendVO(); //月
hmTrendVO.setAddNum(0); StatisticsDTO dto = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_trend_m, hmTrendQO);
hmTrendVO.setAddNumT(0); list = JSON.parseArray(JSON.toJSONString(dto.getData()), Map.class);
} }
//日期补充 if (hmTrendVO == null) {
List<String> dateList = DateUtils.getDateList(hmTrendQO.getInFields().getStartTime(), hmTrendQO.getInFields().getEndTime(), type); hmTrendVO = new HmTrendVO();
Map<String, Object> trendMap = new HashMap<>(); hmTrendVO.setAddNum(0);
if (CollectionUtils.isNotEmpty(list)) { hmTrendVO.setAddNumT(0);
for (Map temp : list) { }
trendMap.put((String) temp.get("bizDate"), temp.get("addNum")); //日期补充
} List<String> dateList = DateUtils.getDateList(hmTrendQO.getInFields().getStartTime(), hmTrendQO.getInFields().getEndTime(), type);
} Map<String, Object> trendMap = new HashMap<>();
list.clear(); if (CollectionUtils.isNotEmpty(list)) {
for (String date : dateList) { for (Map temp : list) {
Map vo = new HashMap(); trendMap.put((String) temp.get("bizDate"), temp.get("addNum"));
vo.put("bizDate", date); }
Object addNum = trendMap.get(date); }
if (addNum == null) { list.clear();
vo.put("addNum", 0); for (String date : dateList) {
} else { Map vo = new HashMap();
vo.put("addNum", addNum); vo.put("bizDate", date);
} Object addNum = trendMap.get(date);
list.add(vo); if (addNum == null) {
} vo.put("addNum", 0);
hmTrendVO.setDateList(list); } else {
return RestResponse.successResult(hmTrendVO); vo.put("addNum", addNum);
} }
list.add(vo);
/** }
* 使用成员 hmTrendVO.setDateList(list);
* return RestResponse.successResult(hmTrendVO);
* @return }
*/
@RequestMapping(value = "detail-clerk-list", method = RequestMethod.POST) /**
public RestResponse detailClerkList(@RequestBody HmQrcodeDetailQO hmQrcodeDetailQO) { * 使用成员
Long hmId = hmQrcodeDetailQO.getHmId(); *
HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getDetailById(hmId); * @return
if (hmQrcodeDTO == null) { */
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_8.getCode()), HaoBanErrCode.ERR_8.getMsg()); @RequestMapping(value = "detail-clerk-list", method = RequestMethod.POST)
} public RestResponse detailClerkList(@RequestBody HmQrcodeDetailQO hmQrcodeDetailQO) {
Integer hmType = hmQrcodeDTO.getHmType(); Long hmId = hmQrcodeDetailQO.getHmId();
Page page = new Page(); HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getDetailById(hmId);
if (hmType == 1) { if (hmQrcodeDTO == null) {
List<HmDetailClerkListVO> list = new ArrayList<>(); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_8.getCode()), HaoBanErrCode.ERR_8.getMsg());
HmDetailClerkListVO hmDetailClerkListVO = EntityUtil.changeEntityNew(HmDetailClerkListVO.class, hmQrcodeDTO); }
list.add(hmDetailClerkListVO); Integer hmType = hmQrcodeDTO.getHmType();
page.setResult(list); Page page = new Page();
page.setTotalCount(list.size()); if (hmType == 1) {
} else if (hmType == 2) { List<HmDetailClerkListVO> list = new ArrayList<>();
BasePageInfo basePageInfo = new BasePageInfo(); HmDetailClerkListVO hmDetailClerkListVO = EntityUtil.changeEntityNew(HmDetailClerkListVO.class, hmQrcodeDTO);
basePageInfo.setPageNum(hmQrcodeDetailQO.getPageNum()); list.add(hmDetailClerkListVO);
basePageInfo.setPageSize(hmQrcodeDetailQO.getPageSize()); page.setResult(list);
page = hmClerkRelationApiService.getHmClerkByHmId(basePageInfo, hmId); page.setTotalCount(list.size());
} } else if (hmType == 2) {
return RestResponse.successResult(page); BasePageInfo basePageInfo = new BasePageInfo();
} basePageInfo.setPageNum(hmQrcodeDetailQO.getPageNum());
basePageInfo.setPageSize(hmQrcodeDetailQO.getPageSize());
page = hmClerkRelationApiService.getHmClerkByHmId(basePageInfo, hmId);
/** }
* 查看明细列表 return RestResponse.successResult(page);
* }
* @param hmDetailClerkListQO
* @return
*/ /**
@RequestMapping(value = "detail-clerk-list-page", method = RequestMethod.POST) * 查看明细列表
public RestResponse detailClerkListPage(@RequestBody HmDetailClerkListQO hmDetailClerkListQO) { *
hmDetailClerkListQO.getInFields().setEnterpriseId(AuthWebRequestUtil.getLoginUser().getEnterpriseId()); * @param hmDetailClerkListQO
Long hmId = hmDetailClerkListQO.getInFields().getHmId(); * @return
HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getDetailById(hmId); */
if (hmQrcodeDTO == null) { @RequestMapping(value = "detail-clerk-list-page", method = RequestMethod.POST)
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_8.getCode()), HaoBanErrCode.ERR_8.getMsg()); public RestResponse detailClerkListPage(@RequestBody HmDetailClerkListQO hmDetailClerkListQO) {
} hmDetailClerkListQO.getInFields().setEnterpriseId(AuthWebRequestUtil.getLoginUser().getEnterpriseId());
Integer hmType = hmQrcodeDTO.getHmType(); Long hmId = hmDetailClerkListQO.getInFields().getHmId();
StatisticsDTO statisticsDTO = null; HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getDetailById(hmId);
if (hmType == 1) { if (hmQrcodeDTO == null) {
statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_single_detail, hmDetailClerkListQO); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_8.getCode()), HaoBanErrCode.ERR_8.getMsg());
} else if (hmType == 2) { }
statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_many_detail, hmDetailClerkListQO); Integer hmType = hmQrcodeDTO.getHmType();
} StatisticsDTO statisticsDTO = null;
return DataStatisticsParamUtils.responsePage(statisticsDTO); if (hmType == 1) {
} statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_single_detail, hmDetailClerkListQO);
} else if (hmType == 2) {
statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_many_detail, hmDetailClerkListQO);
@RequestMapping(path = "/update/qrcode/group") }
public RestResponse<?> batchUpdateQrcodeGroup(@RequestBody HmQrcodeUpdateQO qrcodeUpdateQo) { return DataStatisticsParamUtils.responsePage(statisticsDTO);
ServiceResponse<Boolean> serviceResponse = hmQrcodeApiService.batchUpdateHmQrcodeGroup(qrcodeUpdateQo.getHmIds(), qrcodeUpdateQo.getGroupId()); }
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
} @RequestMapping(path = "/update/qrcode/group")
return RestResponse.successResult(serviceResponse.getResult()); public RestResponse<?> batchUpdateQrcodeGroup(@RequestBody HmQrcodeUpdateQO qrcodeUpdateQo) {
} ServiceResponse<Boolean> serviceResponse = hmQrcodeApiService.batchUpdateHmQrcodeGroup(qrcodeUpdateQo.getHmIds(), qrcodeUpdateQo.getGroupId());
if (!serviceResponse.isSuccess()) {
/** return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
* 详情-查看记录 }
* return RestResponse.successResult(serviceResponse.getResult());
* @param qdto }
* @return
*/ /**
@RequestMapping(path = "/wxUserAddLog/list") * 详情-查看记录
public RestResponse<?> wxUserAddLogList(@RequestBody WxUserAddLogSearchQDTO qdto) { *
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); * @param qdto
BasePageInfo pageInfo = new BasePageInfo(); * @return
pageInfo.setPageNum(qdto.getPageNum()); */
pageInfo.setPageSize(qdto.getPageSize()); @RequestMapping(path = "/wxUserAddLog/list")
qdto.setEnterpriseId(loginUser.getEnterpriseId()); public RestResponse<?> wxUserAddLogList(@RequestBody WxUserAddLogSearchQDTO qdto) {
qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId()); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
ServiceResponse<Page<WxUserAddLogDTO>> page = wxUserAddLogApiService.page(qdto, pageInfo); BasePageInfo pageInfo = new BasePageInfo();
return RestResponse.successResult(page.getResult()); pageInfo.setPageNum(qdto.getPageNum());
} pageInfo.setPageSize(qdto.getPageSize());
qdto.setEnterpriseId(loginUser.getEnterpriseId());
/** qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId());
* @return ServiceResponse<Page<WxUserAddLogDTO>> page = wxUserAddLogApiService.page(qdto, pageInfo);
* @throws return RestResponse.successResult(page.getResult());
* @Title: getAddCount }
* @Description: 新增全部返回的数量
* @author xugh /**
*/ * @return
@RequestMapping(path = "/getAddCount") * @throws
public RestResponse<?> getAddCount() { * @Title: getAddCount
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); * @Description: 新增全部返回的数量
String enterpriseId = loginUser.getEnterpriseId(); * @author xugh
String wxEnterpriseId = loginUser.getWxEnterpriseId(); */
String clerkId = loginUser.getClerkId(); @RequestMapping(path = "/getAddCount")
int count = this.staffClerkRelationApiService.getCanAddHmCount(wxEnterpriseId, enterpriseId, clerkId); public RestResponse<?> getAddCount() {
return RestResponse.successResult(count); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
} String enterpriseId = loginUser.getEnterpriseId();
} String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkId = loginUser.getClerkId();
int count = this.staffClerkRelationApiService.getCanAddHmCount(wxEnterpriseId, enterpriseId, clerkId);
return RestResponse.successResult(count);
}
}
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