Commit 25d955dc by guojuxing

pmd规范

parent 837c6158
...@@ -25,7 +25,13 @@ import java.util.ArrayList; ...@@ -25,7 +25,13 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 数据权限工具
* @ClassName: DataAuthUtils

* @Description: 

* @author guojuxing

* @date 2020/9/7 11:43 AM

*/
@Component @Component
public class DataAuthUtils { public class DataAuthUtils {
private static final Logger log = LogManager.getLogger(DataAuthUtils.class); private static final Logger log = LogManager.getLogger(DataAuthUtils.class);
...@@ -117,7 +123,7 @@ public class DataAuthUtils { ...@@ -117,7 +123,7 @@ public class DataAuthUtils {
} }
} }
ArrayList<Long> list = new ArrayList<>(); ArrayList<Long> list = new ArrayList<>();
list.add(-9999l); list.add(-9999L);
return list; return list;
} }
......
package com.gic.cloud.web.auth; package com.gic.cloud.web.auth;
import java.util.List; import java.util.List;
/**
* 上线门店权限
* @ClassName: OnLineAuth

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:34 PM

*/
public class OnLineAuth { public class OnLineAuth {
private boolean hasAuth = false; private boolean hasAuth = false;
private List<OnLineStore> list ; private List<OnLineStore> list ;
......
package com.gic.cloud.web.auth; package com.gic.cloud.web.auth;
import java.util.List; import java.util.List;
/**
* 上线门店
* @ClassName: OnLineStore

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:34 PM

*/
public class OnLineStore { public class OnLineStore {
private Integer channel; private Integer channel;
private List<String> storeIdList; private List<String> storeIdList;
......
package com.gic.cloud.web.auth; package com.gic.cloud.web.auth;
import java.util.List; import java.util.List;
/**
* 门店权限
* @ClassName: StoreAuth

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:34 PM

*/
public class StoreAuth { public class StoreAuth {
private boolean hasAuth = false; private boolean hasAuth = false;
private List<Integer> storeInfoIdList; private List<Integer> storeInfoIdList;
......
package com.gic.cloud.web.constant; package com.gic.cloud.web.constant;
/**
* 数据类型
* @ClassName: DateTypeEnum

* @Description: 

* @author guojuxing

* @date 2020/9/7 11:35 AM

*/
public enum DateTypeEnum { public enum DateTypeEnum {
/**
* 天
*/
DAY(1,"天"), DAY(1,"天"),
/**
* 周
*/
WEEK(2, "周"), WEEK(2, "周"),
/**
* 月
*/
MONTH(3, "月"), MONTH(3, "月"),
/**
* 年
*/
YEAR(4, "年"), YEAR(4, "年"),
/**
* 近三天
*/
L3DAY(5, "近三天"), L3DAY(5, "近三天"),
/**
* 近七天
*/
L7DAY(6, "近七天"); L7DAY(6, "近七天");
private Integer type; private Integer type;
......
package com.gic.cloud.web.constant; package com.gic.cloud.web.constant;
/**
* 错误代码
* @ClassName: ErrorCode

* @Description: 

* @author guojuxing

* @date 2020/9/7 11:35 AM

*/
public enum ErrorCode { public enum ErrorCode {
/**
* 系统错误
*/
SYSTEMERROR("0001", "系统错误"), SYSTEMERROR("0001", "系统错误"),
/**
* 账号不存在
*/
ACCOUNTNOTEXISTS("0002", "账号不存在"); ACCOUNTNOTEXISTS("0002", "账号不存在");
......
package com.gic.cloud.web.constant; package com.gic.cloud.web.constant;
/**
* 门店渠道
* @ClassName: StoreChannelEnum

* @Description: 

* @author guojuxing

* @date 2020/9/7 11:35 AM

*/
public enum StoreChannelEnum { public enum StoreChannelEnum {
/**
* 线下
*/
OFFLINE(1, "线下"), OFFLINE(1, "线下"),
/**
* 达摩微商城
*/
GICMALL(2, "达摩微商城"), GICMALL(2, "达摩微商城"),
/**
* 微盟微商城
*/
WMMALL(3, "微盟微商城"), WMMALL(3, "微盟微商城"),
/**
* 天猫
*/
TIANMAO(4, "天猫"); TIANMAO(4, "天猫");
private Integer channel; private Integer channel;
......
...@@ -29,7 +29,13 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -29,7 +29,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
/**
* 基础业绩
* @ClassName: BaseSalesController

* @Description: 

* @author boom

* @date 2020/9/7 1:37 PM

*/
@RestController @RestController
public class BaseSalesController { public class BaseSalesController {
private Logger log = LogManager.getLogger(BaseSalesController.class); private Logger log = LogManager.getLogger(BaseSalesController.class);
...@@ -45,9 +51,7 @@ public class BaseSalesController { ...@@ -45,9 +51,7 @@ public class BaseSalesController {
@RequestMapping("base-sales") @RequestMapping("base-sales")
public RestResponse baseSales(BaseSalesParamQo qo){ public RestResponse baseSales(BaseSalesParamQo qo){
BaseSalesVo vo = new BaseSalesVo(); BaseSalesVo vo = new BaseSalesVo();
List<Integer> list = this.storeSearchUtils.storeSearch(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
List<String> onLine = this.storeSearchUtils.onLineStoreSearch(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(qo.getUserId(), qo.getEnterpriseId());
Integer maxLevel = 0; Integer maxLevel = 0;
/******线下渠道需要点击下钻,该值只会在线下时才会使用********/ /******线下渠道需要点击下钻,该值只会在线下时才会使用********/
LevelVo levelVo = this.storeSearchUtils.getLevel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON()); LevelVo levelVo = this.storeSearchUtils.getLevel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
...@@ -68,47 +72,39 @@ public class BaseSalesController { ...@@ -68,47 +72,39 @@ public class BaseSalesController {
qo.setChannel(newChannel); qo.setChannel(newChannel);
} }
/***********如果是线下的第一层级或者门店导购层级,需要展示切换层级按钮*************/ /***********如果是线下的第一层级或者门店导购层级,需要展示切换层级按钮*************/
if((qo.getChannel() == StoreChannelEnum.OFFLINE.getChannel() && qo.getLevel() == levelVo.getLevel()) boolean isFirstLevel = (qo.getChannel() == StoreChannelEnum.OFFLINE.getChannel().intValue() && qo.getLevel().intValue() == levelVo.getLevel())
|| (qo.getLevel() == 7 || qo.getLevel() == 8)){ || (qo.getLevel() == 7 || qo.getLevel() == 8);
if(isFirstLevel){
vo.setChangeLevel(1); vo.setChangeLevel(1);
} }
if(qo.getChannel() == null){ if(qo.getChannel() == null){
vo.setLevelName("所有渠道"); vo.setLevelName("所有渠道");
} else if(qo.getChannel() == StoreChannelEnum.OFFLINE.getChannel()){ } else if(qo.getChannel() == StoreChannelEnum.OFFLINE.getChannel().intValue()){
vo.setLevelName(LevelUtil.getLevelName(qo.getLevel())); vo.setLevelName(LevelUtil.getLevelName(qo.getLevel()));
} else { } else {
vo.setLevelName("店铺层级"); vo.setLevelName("店铺层级");
} }
BaseSalesParamsDTO dto = new BaseSalesParamsDTO(); BaseSalesParamsDTO dto = new BaseSalesParamsDTO();
dto.setChannel(qo.getChannel()); setCommonBaseDTO(dto, qo, childrenStoreGroupIdList);
dto.setEnterpriseId(qo.getEnterpriseId());
dto.setStoreInfoIdList(list);
dto.setOnLine(onLine);
dto.setMbrAreaId(StringUtils.isBlank(qo.getMbrAreaId()) ? null : Long.valueOf(qo.getMbrAreaId()));
dto.setMbrAreaIdList(mbrAreaIdList);
dto.setType(qo.getType());
dto.setDate(qo.getDate());
dto.setChildrenStoreGroupIdList(childrenStoreGroupIdList);
dto.setLevel(qo.getLevel());
dto.setSortField(qo.getSortField());
dto.setSortType(qo.getSortType() == null ? 1 : qo.getSortType());
dto.setPageNum(qo.getPageNum());
dto.setPageSize(qo.getPageSize());
ServiceResponse<Page<BaseSalesDTO>> response = this.baseSalesApiService.pageBaseSales(dto); ServiceResponse<Page<BaseSalesDTO>> response = this.baseSalesApiService.pageBaseSales(dto);
log.info("response:{}", JSON.toJSONString(response)); log.info("response:{}", JSON.toJSONString(response));
vo.setPage(this.goDownComponent.parseData(response.getResult(), qo.getChannel(), qo.getEnterpriseId(), qo.getLevel(), maxLevel)); vo.setPage(this.goDownComponent.parseData(response.getResult(), qo.getChannel(), qo.getEnterpriseId(), qo.getLevel(), maxLevel));
dto.setCountType(2);//合计 //合计
dto.setCountType(2);
Integer wgs = storeSearchUtils.isWgs(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON()); Integer wgs = storeSearchUtils.isWgs(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
/**所有渠道或者线下渠道第一层级 合计算上无归属数据**/ /**所有渠道或者线下渠道第一层级 合计算上无归属数据**/
if((qo.getChannel() == null || (qo.getChannel() == StoreChannelEnum.OFFLINE.getChannel() && qo.getLevel() == levelVo.getLevel())) && wgs == 1){ boolean isContainNoOwnership = (qo.getChannel() == null || (qo.getChannel() == StoreChannelEnum.OFFLINE.getChannel().intValue() && qo.getLevel().intValue() == levelVo.getLevel())) && wgs == 1;
if(isContainNoOwnership){
dto.getStoreInfoIdList().add(-1); dto.getStoreInfoIdList().add(-1);
dto.getOnLine().add("-1"); dto.getOnLine().add("-1");
} }
ServiceResponse<Page<BaseSalesDTO>> totalResponse = this.baseSalesApiService.pageBaseSales(dto); ServiceResponse<Page<BaseSalesDTO>> totalResponse = this.baseSalesApiService.pageBaseSales(dto);
log.info("totalResponse:{}", JSON.toJSONString(totalResponse)); log.info("totalResponse:{}", JSON.toJSONString(totalResponse));
this.goDownComponent.parseTotal(totalResponse, vo); this.goDownComponent.parseTotal(totalResponse, vo);
if(qo.getChannel() != null && qo.getChannel() == 1 && qo.getLevel() == levelVo.getLevel() && wgs == 1){ if(qo.getChannel() != null && qo.getChannel() == 1 && qo.getLevel().intValue() == levelVo.getLevel() && wgs == 1){
dto.setCountType(3); //无归属 //无归属
dto.setCountType(3);
dto.setChannel(null); dto.setChannel(null);
dto.getStoreInfoIdList().clear(); dto.getStoreInfoIdList().clear();
dto.getOnLine().clear(); dto.getOnLine().clear();
...@@ -120,4 +116,25 @@ public class BaseSalesController { ...@@ -120,4 +116,25 @@ public class BaseSalesController {
} }
return RestResponse.success(vo); return RestResponse.success(vo);
} }
private void setCommonBaseDTO(BaseSalesParamsDTO dto, BaseSalesParamQo qo, List<Integer> childrenStoreGroupIdList) {
List<Integer> list = this.storeSearchUtils.storeSearch(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
List<String> onLine = this.storeSearchUtils.onLineStoreSearch(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(qo.getUserId(), qo.getEnterpriseId());
dto.setChannel(qo.getChannel());
dto.setEnterpriseId(qo.getEnterpriseId());
dto.setStoreInfoIdList(list);
dto.setOnLine(onLine);
dto.setMbrAreaId(StringUtils.isBlank(qo.getMbrAreaId()) ? null : Long.valueOf(qo.getMbrAreaId()));
dto.setMbrAreaIdList(mbrAreaIdList);
dto.setType(qo.getType());
dto.setDate(qo.getDate());
dto.setChildrenStoreGroupIdList(childrenStoreGroupIdList);
dto.setLevel(qo.getLevel());
dto.setSortField(qo.getSortField());
dto.setSortType(qo.getSortType() == null ? 1 : qo.getSortType());
dto.setPageNum(qo.getPageNum());
dto.setPageSize(qo.getPageSize());
}
} }
...@@ -28,7 +28,13 @@ import com.gic.data.api.service.consumestructure.ConsumeStructureApiService; ...@@ -28,7 +28,13 @@ import com.gic.data.api.service.consumestructure.ConsumeStructureApiService;
import com.gic.enterprise.utils.ResultControllerUtils; import com.gic.enterprise.utils.ResultControllerUtils;
import java.util.List; import java.util.List;
/**
* 业绩构成
* @ClassName: ConsumeStructureController

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:36 PM

*/
@RestController @RestController
public class ConsumeStructureController { public class ConsumeStructureController {
private static final Logger log = LogManager.getLogger(ConsumeStructureController.class); private static final Logger log = LogManager.getLogger(ConsumeStructureController.class);
...@@ -92,7 +98,7 @@ public class ConsumeStructureController { ...@@ -92,7 +98,7 @@ public class ConsumeStructureController {
goDownComponent.setValueTotal(params, levelVo); goDownComponent.setValueTotal(params, levelVo);
ServiceResponse<Page<AgeConsumeAreaDTO>> response1 = consumeStructureApiService.pageAgeConsumeArea(params); ServiceResponse<Page<AgeConsumeAreaDTO>> response1 = consumeStructureApiService.pageAgeConsumeArea(params);
this.goDownComponent.parseTotal(response1, vo); this.goDownComponent.parseTotal(response1, vo);
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel()){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel().intValue() == levelVo.getLevel()){
//无归属 //无归属
params.setCountType(3); params.setCountType(3);
goDownComponent.setValueWgs(params, levelVo); goDownComponent.setValueWgs(params, levelVo);
...@@ -138,7 +144,7 @@ public class ConsumeStructureController { ...@@ -138,7 +144,7 @@ public class ConsumeStructureController {
goDownComponent.setValueTotal(params, levelVo); goDownComponent.setValueTotal(params, levelVo);
ServiceResponse<Page<GradeConsumeAreaDTO>> response1 = consumeStructureApiService.pageGradeConsumeArea(params); ServiceResponse<Page<GradeConsumeAreaDTO>> response1 = consumeStructureApiService.pageGradeConsumeArea(params);
this.goDownComponent.parseTotal(response1, vo); this.goDownComponent.parseTotal(response1, vo);
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel()){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel().intValue() == levelVo.getLevel()){
params.setCountType(3); params.setCountType(3);
//无归属 //无归属
goDownComponent.setValueWgs(params, levelVo); goDownComponent.setValueWgs(params, levelVo);
...@@ -202,7 +208,7 @@ public class ConsumeStructureController { ...@@ -202,7 +208,7 @@ public class ConsumeStructureController {
goDownComponent.setValueTotal(params, levelVo); goDownComponent.setValueTotal(params, levelVo);
ServiceResponse<Page<BirthConsumeAreaDTO>> response1 = consumeStructureApiService.pageBirthConsumeArea(params); ServiceResponse<Page<BirthConsumeAreaDTO>> response1 = consumeStructureApiService.pageBirthConsumeArea(params);
this.goDownComponent.parseTotal(response1, vo); this.goDownComponent.parseTotal(response1, vo);
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel()){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel().intValue() == levelVo.getLevel()){
params.setCountType(3); params.setCountType(3);
//无归属 //无归属
goDownComponent.setValueWgs(params, levelVo); goDownComponent.setValueWgs(params, levelVo);
...@@ -258,7 +264,7 @@ public class ConsumeStructureController { ...@@ -258,7 +264,7 @@ public class ConsumeStructureController {
goDownComponent.setValueTotal(params, levelVo); goDownComponent.setValueTotal(params, levelVo);
ServiceResponse<Page<NewOldConsumeAreaDTO>> response1 = consumeStructureApiService.pageNewOldConsumeArea(params); ServiceResponse<Page<NewOldConsumeAreaDTO>> response1 = consumeStructureApiService.pageNewOldConsumeArea(params);
this.goDownComponent.parseTotal(response1, vo); this.goDownComponent.parseTotal(response1, vo);
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel()){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel().intValue() == levelVo.getLevel()){
params.setCountType(3); params.setCountType(3);
//无归属 //无归属
goDownComponent.setValueWgs(params, levelVo); goDownComponent.setValueWgs(params, levelVo);
...@@ -314,7 +320,7 @@ public class ConsumeStructureController { ...@@ -314,7 +320,7 @@ public class ConsumeStructureController {
goDownComponent.setValueTotal(params, levelVo); goDownComponent.setValueTotal(params, levelVo);
ServiceResponse<Page<WhetherConsumeAreaDTO>> response1 = consumeStructureApiService.pageWhetherConsumeArea(params); ServiceResponse<Page<WhetherConsumeAreaDTO>> response1 = consumeStructureApiService.pageWhetherConsumeArea(params);
this.goDownComponent.parseTotal(response1, vo); this.goDownComponent.parseTotal(response1, vo);
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel()){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel().intValue() == levelVo.getLevel()){
//无归属 //无归属
params.setCountType(3); params.setCountType(3);
goDownComponent.setValueWgs(params, levelVo); goDownComponent.setValueWgs(params, levelVo);
......
...@@ -30,7 +30,13 @@ import java.util.ArrayList; ...@@ -30,7 +30,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 工具
* @ClassName: GoDownComponent

* @Description: 

* @author boom

* @date 2020/9/7 1:39 PM

*/
@Component @Component
public class GoDownComponent { public class GoDownComponent {
private Logger log = LogManager.getLogger(GoDownComponent.class); private Logger log = LogManager.getLogger(GoDownComponent.class);
...@@ -102,13 +108,14 @@ public class GoDownComponent { ...@@ -102,13 +108,14 @@ public class GoDownComponent {
params.setChannel(newChannel); params.setChannel(newChannel);
} }
/***********如果是线下的第一层级,需要展示切换层级按钮*************/ /***********如果是线下的第一层级,需要展示切换层级按钮*************/
if(params.getChannel() == StoreChannelEnum.OFFLINE.getChannel() && params.getLevel() == levelVo.getLevel() boolean isFirstLevel = params.getChannel() == StoreChannelEnum.OFFLINE.getChannel().intValue() && params.getLevel().intValue() == levelVo.getLevel()
|| (params.getLevel() == 7 || params.getLevel() == 8)){ || (params.getLevel() == 7 || params.getLevel() == 8);
if(isFirstLevel){
vo.setChangeLevel(1); vo.setChangeLevel(1);
} }
if(params.getChannel() == null){ if(params.getChannel() == null){
vo.setLevelName("所有渠道"); vo.setLevelName("所有渠道");
} else if(params.getChannel() == StoreChannelEnum.OFFLINE.getChannel()){ } else if(params.getChannel() == StoreChannelEnum.OFFLINE.getChannel().intValue()){
vo.setLevelName(LevelUtil.getLevelName(params.getLevel())); vo.setLevelName(LevelUtil.getLevelName(params.getLevel()));
} else { } else {
vo.setLevelName("店铺层级"); vo.setLevelName("店铺层级");
...@@ -120,7 +127,8 @@ public class GoDownComponent { ...@@ -120,7 +127,8 @@ public class GoDownComponent {
public void setValueTotal(CommonQO params, LevelVo levelVo){ public void setValueTotal(CommonQO params, LevelVo levelVo){
Integer wgs = storeSearchUtils.isWgs(params.getUserId(), params.getEnterpriseId(), params.getSearchJSON()); Integer wgs = storeSearchUtils.isWgs(params.getUserId(), params.getEnterpriseId(), params.getSearchJSON());
/**所有渠道或者线下渠道第一层级 合计算上无归属数据**/ /**所有渠道或者线下渠道第一层级 合计算上无归属数据**/
if((params.getChannel() == null || (params.getChannel() == StoreChannelEnum.OFFLINE.getChannel() && params.getLevel() == levelVo.getLevel())) && wgs == 1){ boolean isContainNoOwnership = (params.getChannel() == null || (params.getChannel() == StoreChannelEnum.OFFLINE.getChannel().intValue() && params.getLevel().intValue() == levelVo.getLevel())) && wgs == 1;
if(isContainNoOwnership){
if (CollectionUtils.isEmpty(params.getStoreInfoIdList())) { if (CollectionUtils.isEmpty(params.getStoreInfoIdList())) {
params.setStoreInfoIdList(new ArrayList<>()); params.setStoreInfoIdList(new ArrayList<>());
} }
...@@ -149,7 +157,7 @@ public class GoDownComponent { ...@@ -149,7 +157,7 @@ public class GoDownComponent {
public void setValueWgs(CommonQO params, LevelVo levelVo){ public void setValueWgs(CommonQO params, LevelVo levelVo){
Integer wgs = storeSearchUtils.isWgs(params.getUserId(), params.getEnterpriseId(), params.getSearchJSON()); Integer wgs = storeSearchUtils.isWgs(params.getUserId(), params.getEnterpriseId(), params.getSearchJSON());
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel() && wgs == 1){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel().intValue() && wgs == 1){
params.setChannel(null); params.setChannel(null);
if (CollectionUtils.isEmpty(params.getStoreInfoIdList())) { if (CollectionUtils.isEmpty(params.getStoreInfoIdList())) {
params.setStoreInfoIdList(new ArrayList<>()); params.setStoreInfoIdList(new ArrayList<>());
...@@ -182,60 +190,17 @@ public class GoDownComponent { ...@@ -182,60 +190,17 @@ public class GoDownComponent {
} }
public Page<?> parseData(Page<?> page , Integer channel, Integer enterpriseId, Integer level, Integer maxLevel){ public Page<?> parseData(Page<?> page , Integer channel, Integer enterpriseId, Integer level, Integer maxLevel){
int clerkLevel = 8;
if(page != null && CollectionUtils.isNotEmpty(page.getResult())){ if(page != null && CollectionUtils.isNotEmpty(page.getResult())){
if(channel == null){ //全渠道 if(channel == null){
page.getResult().stream().forEach(b -> { //全渠道
BaseDTO baseSalesDTO = (BaseDTO) b; allChannel(page, level);
baseSalesDTO.setLevel(level - 1);
if(StoreChannelEnum.OFFLINE.getChannel() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setAreaName(StoreChannelEnum.OFFLINE.getMessage());
baseSalesDTO.setName(StoreChannelEnum.OFFLINE.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.OFFLINE.getChannel());
baseSalesDTO.setHasChildren(1);
}
if(StoreChannelEnum.GICMALL.getChannel() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setName(StoreChannelEnum.GICMALL.getMessage());
baseSalesDTO.setAreaName(StoreChannelEnum.GICMALL.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.GICMALL.getChannel());
baseSalesDTO.setHasChildren(1);
}
if(StoreChannelEnum.WMMALL.getChannel() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setName(StoreChannelEnum.WMMALL.getMessage());
baseSalesDTO.setAreaName(StoreChannelEnum.WMMALL.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.WMMALL.getChannel());
baseSalesDTO.setHasChildren(1);
}
if(StoreChannelEnum.TIANMAO.getChannel() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setName(StoreChannelEnum.TIANMAO.getMessage());
baseSalesDTO.setAreaName(StoreChannelEnum.TIANMAO.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.TIANMAO.getChannel());
baseSalesDTO.setHasChildren(1);
} }
}); if(channel == StoreChannelEnum.GICMALL.getChannel().intValue()){
} gicMall(page, channel, enterpriseId, level);
if(channel == StoreChannelEnum.GICMALL.getChannel()){
List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, null, ShopTypeEnum.MALL_SHOP.getCode()).getResult();
if(CollectionUtils.isNotEmpty(result)){
page.getResult().stream().forEach(b -> {
BaseDTO baseSalesDTO = (BaseDTO) b;
baseSalesDTO.setLevel(level - 1);
for(ShopDTO shopDTO : result){
if(baseSalesDTO instanceof BaseSalesDTO){
if(baseSalesDTO.getId().equals(shopDTO.getId()+"")){
baseSalesDTO.setName(shopDTO.getName());
baseSalesDTO.setChannel(channel);
} }
}else { if(channel == StoreChannelEnum.WMMALL.getChannel().intValue()){
if(baseSalesDTO.getAreaId().equals(shopDTO.getId()+"")){
baseSalesDTO.setAreaName(shopDTO.getName());
baseSalesDTO.setChannel(channel);
}
}
}
});
}
}
if(channel == StoreChannelEnum.WMMALL.getChannel()){
List<WmStoreDTO> result1 = wmStoreApiService.listWmStore(enterpriseId, null).getResult(); List<WmStoreDTO> result1 = wmStoreApiService.listWmStore(enterpriseId, null).getResult();
if(CollectionUtils.isNotEmpty(result1)){ if(CollectionUtils.isNotEmpty(result1)){
page.getResult().stream().forEach(b -> { page.getResult().stream().forEach(b -> {
...@@ -257,9 +222,10 @@ public class GoDownComponent { ...@@ -257,9 +222,10 @@ public class GoDownComponent {
}); });
} }
} }
if(channel == StoreChannelEnum.OFFLINE.getChannel()){ if(channel == StoreChannelEnum.OFFLINE.getChannel().intValue()){
List<ClerkDTO> clerkDTOS = new ArrayList<>(); List<ClerkDTO> clerkDTOS = new ArrayList<>();
if(level.intValue() == 8){
if(level.intValue() == clerkLevel){
List<String> clerkIdList = page.getResult().stream().map(b -> { List<String> clerkIdList = page.getResult().stream().map(b -> {
BaseDTO baseSalesDTO = (BaseDTO) b; BaseDTO baseSalesDTO = (BaseDTO) b;
return baseSalesDTO.getAreaId() == null ? baseSalesDTO.getId() : baseSalesDTO.getAreaId(); return baseSalesDTO.getAreaId() == null ? baseSalesDTO.getId() : baseSalesDTO.getAreaId();
...@@ -275,7 +241,7 @@ public class GoDownComponent { ...@@ -275,7 +241,7 @@ public class GoDownComponent {
baseSalesDTO.setLevel(level); baseSalesDTO.setLevel(level);
baseSalesDTO.setChannel(StoreChannelEnum.OFFLINE.getChannel()); baseSalesDTO.setChannel(StoreChannelEnum.OFFLINE.getChannel());
baseSalesDTO.setHasChildren(level <= maxLevel ? 1 : 0); baseSalesDTO.setHasChildren(level <= maxLevel ? 1 : 0);
if(clerkDTOMap != null && level.intValue() == 8){ if(clerkDTOMap != null && level.intValue() == clerkLevel){
ClerkDTO clerkDTO = clerkDTOMap.get(baseSalesDTO.getAreaId() == null ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId())); ClerkDTO clerkDTO = clerkDTOMap.get(baseSalesDTO.getAreaId() == null ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()));
if(clerkDTO != null){ if(clerkDTO != null){
baseSalesDTO.setName(clerkDTO.getClerkName()); baseSalesDTO.setName(clerkDTO.getClerkName());
...@@ -288,4 +254,58 @@ public class GoDownComponent { ...@@ -288,4 +254,58 @@ public class GoDownComponent {
} }
return page; return page;
} }
private void allChannel(Page<?> page, Integer level) {
page.getResult().stream().forEach(b -> {
BaseDTO baseSalesDTO = (BaseDTO) b;
baseSalesDTO.setLevel(level - 1);
if(StoreChannelEnum.OFFLINE.getChannel().intValue() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setAreaName(StoreChannelEnum.OFFLINE.getMessage());
baseSalesDTO.setName(StoreChannelEnum.OFFLINE.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.OFFLINE.getChannel());
baseSalesDTO.setHasChildren(1);
}
if(StoreChannelEnum.GICMALL.getChannel().intValue() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setName(StoreChannelEnum.GICMALL.getMessage());
baseSalesDTO.setAreaName(StoreChannelEnum.GICMALL.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.GICMALL.getChannel());
baseSalesDTO.setHasChildren(1);
}
if(StoreChannelEnum.WMMALL.getChannel().intValue() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setName(StoreChannelEnum.WMMALL.getMessage());
baseSalesDTO.setAreaName(StoreChannelEnum.WMMALL.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.WMMALL.getChannel());
baseSalesDTO.setHasChildren(1);
}
if(StoreChannelEnum.TIANMAO.getChannel().intValue() == (baseSalesDTO instanceof BaseSalesDTO ? Integer.valueOf(baseSalesDTO.getId()) : Integer.valueOf(baseSalesDTO.getAreaId()))){
baseSalesDTO.setName(StoreChannelEnum.TIANMAO.getMessage());
baseSalesDTO.setAreaName(StoreChannelEnum.TIANMAO.getMessage());
baseSalesDTO.setChannel(StoreChannelEnum.TIANMAO.getChannel());
baseSalesDTO.setHasChildren(1);
}
});
}
private void gicMall(Page<?> page , Integer channel, Integer enterpriseId, Integer level) {
List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, null, ShopTypeEnum.MALL_SHOP.getCode()).getResult();
if(CollectionUtils.isNotEmpty(result)){
page.getResult().stream().forEach(b -> {
BaseDTO baseSalesDTO = (BaseDTO) b;
baseSalesDTO.setLevel(level - 1);
for(ShopDTO shopDTO : result){
if(baseSalesDTO instanceof BaseSalesDTO){
if(baseSalesDTO.getId().equals(shopDTO.getId()+"")){
baseSalesDTO.setName(shopDTO.getName());
baseSalesDTO.setChannel(channel);
}
}else {
if(baseSalesDTO.getAreaId().equals(shopDTO.getId()+"")){
baseSalesDTO.setAreaName(shopDTO.getName());
baseSalesDTO.setChannel(channel);
}
}
}
});
}
}
} }
...@@ -30,7 +30,13 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -30,7 +30,13 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* 字典
* @ClassName: IndexController

* @Description: 

* @author zhiwj

* @date 2020/9/7 1:35 PM

*/
@RestController @RestController
public class IndexController { public class IndexController {
private Logger log = LogManager.getLogger(IndexController.class); private Logger log = LogManager.getLogger(IndexController.class);
......
...@@ -26,7 +26,13 @@ import java.util.ArrayList; ...@@ -26,7 +26,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 登录
* @ClassName: LoginController

* @Description: 

* @author boom

* @date 2020/9/7 1:32 PM

*/
@RestController @RestController
public class LoginController { public class LoginController {
private static final Logger log = LogManager.getLogger(LoginController.class); private static final Logger log = LogManager.getLogger(LoginController.class);
...@@ -60,20 +66,22 @@ public class LoginController { ...@@ -60,20 +66,22 @@ public class LoginController {
userVo.setPhoneNumber(phoneNumber); userVo.setPhoneNumber(phoneNumber);
userVo.setUserId(userDTOList.get(0).getUserId()); userVo.setUserId(userDTOList.get(0).getUserId());
userVo.setUserName(userDTOList.get(0).getUserName()); userVo.setUserName(userDTOList.get(0).getUserName());
//单域
String singleDomainCode = "basic";
enterpriseDTOList.stream().forEach(enterpriseDTO -> { enterpriseDTOList.stream().forEach(enterpriseDTO -> {
if(enterpriseDTO.getEnterpriseId().intValue() == enterpriseId.intValue()){ if(enterpriseDTO.getEnterpriseId().intValue() == enterpriseId.intValue()){
if(phoneNumber.equals(enterpriseDTO.getPhoneNumber())){ if(phoneNumber.equals(enterpriseDTO.getPhoneNumber())){
userVo.setIsAdmin(1); userVo.setIsAdmin(1);
} }
if("basic".equals(enterpriseDTO.getVersionCode())){ if(singleDomainCode.equals(enterpriseDTO.getVersionCode())){
userVo.setIsSingle(1); userVo.setIsSingle(1);
}else { }else {
userVo.setIsSingle(0); userVo.setIsSingle(0);
} }
} }
}); });
RedisUtil.setCache(key, userVo, 5l, TimeUnit.MINUTES); RedisUtil.setCache(key, userVo, 5L, TimeUnit.MINUTES);
//RedisUtil.setCache("userEnterpriseList:"+userVo.getUserId(), enterpriseDTOList);
return RestResponse.success(enterpriseId); return RestResponse.success(enterpriseId);
}else { }else {
return RestResponse.failure(ErrorCode.SYSTEMERROR.getCode(), smsSendResult.getMessage()); return RestResponse.failure(ErrorCode.SYSTEMERROR.getCode(), smsSendResult.getMessage());
......
...@@ -26,7 +26,13 @@ import com.gic.data.api.dto.member.MemberRecruitAreaDTO; ...@@ -26,7 +26,13 @@ import com.gic.data.api.dto.member.MemberRecruitAreaDTO;
import com.gic.data.api.qo.member.*; import com.gic.data.api.qo.member.*;
import com.gic.data.api.service.member.MemberCloudDataApiService; import com.gic.data.api.service.member.MemberCloudDataApiService;
import com.gic.enterprise.utils.ResultControllerUtils; import com.gic.enterprise.utils.ResultControllerUtils;
/**
* 会员数据
* @ClassName: MemberCloudDataController

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:38 PM

*/
@RestController @RestController
public class MemberCloudDataController { public class MemberCloudDataController {
private static final Logger log = LogManager.getLogger(MemberCloudDataController.class); private static final Logger log = LogManager.getLogger(MemberCloudDataController.class);
...@@ -78,7 +84,7 @@ public class MemberCloudDataController { ...@@ -78,7 +84,7 @@ public class MemberCloudDataController {
goDownComponent.setValueTotal(params, levelVo); goDownComponent.setValueTotal(params, levelVo);
ServiceResponse<Page<MemberDistributionAreaDTO>> response1 = memberCloudDataApiService.pageMemberDistributionArea(params); ServiceResponse<Page<MemberDistributionAreaDTO>> response1 = memberCloudDataApiService.pageMemberDistributionArea(params);
this.goDownComponent.parseTotal(response1, vo); this.goDownComponent.parseTotal(response1, vo);
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel()){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel().intValue()){
//无归属 //无归属
params.setCountType(3); params.setCountType(3);
goDownComponent.setValueWgs(params, levelVo); goDownComponent.setValueWgs(params, levelVo);
...@@ -106,7 +112,7 @@ public class MemberCloudDataController { ...@@ -106,7 +112,7 @@ public class MemberCloudDataController {
goDownComponent.setValueTotal(params, levelVo); goDownComponent.setValueTotal(params, levelVo);
ServiceResponse<Page<MemberRecruitAreaDTO>> response1 = memberCloudDataApiService.pageMemberRecruitArea(params); ServiceResponse<Page<MemberRecruitAreaDTO>> response1 = memberCloudDataApiService.pageMemberRecruitArea(params);
this.goDownComponent.parseTotal(response1, vo); this.goDownComponent.parseTotal(response1, vo);
if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel()){ if(params.getChannel() != null && params.getChannel() == 1 && params.getLevel() == levelVo.getLevel().intValue()){
//无归属 //无归属
params.setCountType(3); params.setCountType(3);
goDownComponent.setValueWgs(params, levelVo); goDownComponent.setValueWgs(params, levelVo);
......
...@@ -12,7 +12,13 @@ import com.gic.commons.webapi.reponse.RestResponse; ...@@ -12,7 +12,13 @@ import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.data.api.qo.performanceoverview.PerformanceOverviewQO; import com.gic.data.api.qo.performanceoverview.PerformanceOverviewQO;
import com.gic.data.api.service.performanceoverview.PerformanceOverviewApiService; import com.gic.data.api.service.performanceoverview.PerformanceOverviewApiService;
import com.gic.enterprise.utils.ResultControllerUtils; import com.gic.enterprise.utils.ResultControllerUtils;
/**
* 业绩概况
* @ClassName: PerformanceOverviewController

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:35 PM

*/
@RestController @RestController
public class PerformanceOverviewController { public class PerformanceOverviewController {
private static final Logger log = LogManager.getLogger(PerformanceOverviewController.class); private static final Logger log = LogManager.getLogger(PerformanceOverviewController.class);
......
...@@ -15,7 +15,13 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -15,7 +15,13 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* 关注门店
* @ClassName: StoreAttentionController

* @Description: 

* @author boom

* @date 2020/9/7 11:44 AM

*/
@RestController @RestController
public class StoreAttentionController { public class StoreAttentionController {
@Autowired @Autowired
......
...@@ -37,7 +37,13 @@ import org.springframework.stereotype.Component; ...@@ -37,7 +37,13 @@ import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 门店查询工具
* @ClassName: StoreSearchUtils

* @Description: 

* @author boom

* @date 2020/9/7 1:34 PM

*/
@Component @Component
public class StoreSearchUtils { public class StoreSearchUtils {
private static final Logger log = LogManager.getLogger(StoreSearchUtils.class); private static final Logger log = LogManager.getLogger(StoreSearchUtils.class);
...@@ -132,26 +138,33 @@ public class StoreSearchUtils { ...@@ -132,26 +138,33 @@ public class StoreSearchUtils {
} }
} }
} }
} else {
resultList = storeSearchJsonWhenNull(storeAuth, tempStoreIdListf);
}
if(CollectionUtils.isNotEmpty(resultList)){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
}else { }else {
resultList.add(0);
}
log.info("storeSearchResult:{}", JSON.toJSONString(resultList));
return resultList;
}
private List<Integer> storeSearchJsonWhenNull(StoreAuth storeAuth, final List<Integer> tempStoreIdListf) {
if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){ if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){
resultList = storeAuth.getStoreInfoIdList().stream().filter(s -> { return storeAuth.getStoreInfoIdList().stream().filter(s -> {
if(CollectionUtils.isNotEmpty(tempStoreIdListf)){ if(CollectionUtils.isNotEmpty(tempStoreIdListf)){
if(tempStoreIdListf.contains(s)){ if(tempStoreIdListf.contains(s)){
return false; return false;
}else { }else {
return true; return true;
} }
}else return true; } else {
}).collect(Collectors.toList()); return true;
}
} }
if(CollectionUtils.isNotEmpty(resultList)){ }).collect(Collectors.toList());
RedisUtil.setCache(key, 1, 10l, TimeUnit.MINUTES);
}else {
resultList.add(0);
} }
log.info("storeSearchResult:{}", JSON.toJSONString(resultList)); return new ArrayList<>();
return resultList;
} }
public List<String> onLineStoreSearch(Integer userId, Integer enterpriseId, String searchJson){ public List<String> onLineStoreSearch(Integer userId, Integer enterpriseId, String searchJson){
...@@ -179,7 +192,7 @@ public class StoreSearchUtils { ...@@ -179,7 +192,7 @@ public class StoreSearchUtils {
return vo; return vo;
} }
List<StoreDTO> result = response.getResult().getResult(); List<StoreDTO> result = response.getResult().getResult();
Map<Integer, Integer> map = new HashMap<>(); Map<Integer, Integer> map = new HashMap<>(16);
result.forEach(storeDTO -> { result.forEach(storeDTO -> {
List<Integer> storeGroupIdList = storeDTO.getStoreGroupIdList(); List<Integer> storeGroupIdList = storeDTO.getStoreGroupIdList();
if (CollectionUtils.isNotEmpty(storeGroupIdList)) { if (CollectionUtils.isNotEmpty(storeGroupIdList)) {
...@@ -189,7 +202,7 @@ public class StoreSearchUtils { ...@@ -189,7 +202,7 @@ public class StoreSearchUtils {
} }
}); });
List<StoreGroupDTO> allStoreGroupIdList = this.storeGroupApiService.listStoreGroupByIds(null, enterpriseId).getResult(); List<StoreGroupDTO> allStoreGroupIdList = this.storeGroupApiService.listStoreGroupByIds(null, enterpriseId).getResult();
Map<Integer, Integer> levelMap = new HashMap<>(); Map<Integer, Integer> levelMap = new HashMap<>(16);
allStoreGroupIdList.forEach(storeGroupDTO -> { allStoreGroupIdList.forEach(storeGroupDTO -> {
if(map.containsKey(storeGroupDTO.getStoreGroupId())){ if(map.containsKey(storeGroupDTO.getStoreGroupId())){
levelMap.put(storeGroupDTO.getGroupLevel(), levelMap.get(storeGroupDTO.getGroupLevel())== null ? 1 : levelMap.get(storeGroupDTO.getGroupLevel())+1); levelMap.put(storeGroupDTO.getGroupLevel(), levelMap.get(storeGroupDTO.getGroupLevel())== null ? 1 : levelMap.get(storeGroupDTO.getGroupLevel())+1);
...@@ -221,7 +234,8 @@ public class StoreSearchUtils { ...@@ -221,7 +234,8 @@ public class StoreSearchUtils {
int gicMall = RedisUtil.getCache(gicMallKey) == null ? 0 : 1; int gicMall = RedisUtil.getCache(gicMallKey) == null ? 0 : 1;
int wm = RedisUtil.getCache(wmKey) == null ? 0 : 1; int wm = RedisUtil.getCache(wmKey) == null ? 0 : 1;
int tm = RedisUtil.getCache(tmKey) == null ? 0 : 1; int tm = RedisUtil.getCache(tmKey) == null ? 0 : 1;
if((offline + gicMall + wm + tm) > 1){ //多渠道 if((offline + gicMall + wm + tm) > 1){
//多渠道
return null; return null;
}else if((offline + gicMall + wm + tm) == 1){ }else if((offline + gicMall + wm + tm) == 1){
if(offline == 1){ if(offline == 1){
...@@ -241,7 +255,8 @@ public class StoreSearchUtils { ...@@ -241,7 +255,8 @@ public class StoreSearchUtils {
} }
public List<Integer> getChildrenStoreGroupIdList(Integer enterpriseId, Integer storeGroupId, Integer level){ public List<Integer> getChildrenStoreGroupIdList(Integer enterpriseId, Integer storeGroupId, Integer level){
if(level < 7){ int storeGroupLevel = 7;
if(level < storeGroupLevel){
if(storeGroupId != null){ if(storeGroupId != null){
List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupAndChildren(storeGroupId).getResult(); List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupAndChildren(storeGroupId).getResult();
if(CollectionUtils.isNotEmpty(result)){ if(CollectionUtils.isNotEmpty(result)){
...@@ -268,7 +283,7 @@ public class StoreSearchUtils { ...@@ -268,7 +283,7 @@ public class StoreSearchUtils {
if(searchQo != null){ if(searchQo != null){
if(searchQo.getAll() != 1){ if(searchQo.getAll() != 1){
if(StringUtils.isNotBlank(searchQo.getStoreGroupIds())){ if(StringUtils.isNotBlank(searchQo.getStoreGroupIds())){
RedisUtil.setCache(key, 1, 10l, TimeUnit.MINUTES); RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
list.addAll(Arrays.asList(searchQo.getStoreGroupIds().split(","))); list.addAll(Arrays.asList(searchQo.getStoreGroupIds().split(",")));
} }
} }
...@@ -278,7 +293,7 @@ public class StoreSearchUtils { ...@@ -278,7 +293,7 @@ public class StoreSearchUtils {
onlineStoreAuth.getList().stream().forEach(s -> { onlineStoreAuth.getList().stream().forEach(s -> {
if(s.getChannel() != null && s.getChannel().intValue() == channel.intValue()){ if(s.getChannel() != null && s.getChannel().intValue() == channel.intValue()){
if(CollectionUtils.isNotEmpty(s.getStoreIdList())){ if(CollectionUtils.isNotEmpty(s.getStoreIdList())){
RedisUtil.setCache(key, 1, 10l, TimeUnit.MINUTES); RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
list.addAll(s.getStoreIdList()); list.addAll(s.getStoreIdList());
} }
} }
......
...@@ -31,7 +31,13 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -31,7 +31,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.*;
/**
* 门店权重
* @ClassName: StoreWidgetController

* @Description: 

* @author boom

* @date 2020/9/7 11:44 AM

*/
@RestController @RestController
public class StoreWidgetController { public class StoreWidgetController {
private static final Logger log = LogManager.getLogger(StoreWidgetController.class); private static final Logger log = LogManager.getLogger(StoreWidgetController.class);
...@@ -68,7 +74,8 @@ public class StoreWidgetController { ...@@ -68,7 +74,8 @@ public class StoreWidgetController {
OnLineAuth onlineStoreAuth = dataAuthUtils.getOnlineStore(userId, enterpriseId); OnLineAuth onlineStoreAuth = dataAuthUtils.getOnlineStore(userId, enterpriseId);
log.info("storeWidgetIndex:{},{}", JSON.toJSONString(storeAuth), JSON.toJSONString(onlineStoreAuth)); log.info("storeWidgetIndex:{},{}", JSON.toJSONString(storeAuth), JSON.toJSONString(onlineStoreAuth));
List<IndexItemVo> items = new ArrayList<>(); List<IndexItemVo> items = new ArrayList<>();
if(storeAuth.isHasAuth() && onlineStoreAuth.isHasAuth()){ //线上线下多渠道 //线上线下多渠道
if(storeAuth.isHasAuth() && onlineStoreAuth.isHasAuth()){
IndexItemVo offLine = new IndexItemVo(); IndexItemVo offLine = new IndexItemVo();
offLine.setId("1"); offLine.setId("1");
offLine.setName("线下零售"); offLine.setName("线下零售");
...@@ -76,9 +83,11 @@ public class StoreWidgetController { ...@@ -76,9 +83,11 @@ public class StoreWidgetController {
items.add(offLine); items.add(offLine);
this.getOnlineItems(onlineStoreAuth, items); this.getOnlineItems(onlineStoreAuth, items);
vo.setType(1); vo.setType(1);
} else if(storeAuth.isHasAuth() && !onlineStoreAuth.isHasAuth()){ //线下单渠道 } else if(storeAuth.isHasAuth() && !onlineStoreAuth.isHasAuth()){
//线下单渠道
vo.setType(2); vo.setType(2);
} else if(onlineStoreAuth.getList().size() == 1){ //线上单渠道 } else if(onlineStoreAuth.getList().size() == 1){
//线上单渠道
vo.setType(3); vo.setType(3);
List<OnLineStore> list = onlineStoreAuth.getList(); List<OnLineStore> list = onlineStoreAuth.getList();
OnLineStore onLineStore = list.get(0); OnLineStore onLineStore = list.get(0);
...@@ -169,7 +178,15 @@ public class StoreWidgetController { ...@@ -169,7 +178,15 @@ public class StoreWidgetController {
if(storeAuth.getStoreWidgetId() != null){ if(storeAuth.getStoreWidgetId() != null){
storeColumnSet = this.storeWidgetApiService.getStoreColumnSet(enterpriseId, storeAuth.getStoreWidgetId()).getResult(); storeColumnSet = this.storeWidgetApiService.getStoreColumnSet(enterpriseId, storeAuth.getStoreWidgetId()).getResult();
} }
if(type == 1){ //门店类型 //门店类型
int typeOfStore = 1;
//门店状态
int typeOfStoreStatus = 2;
//门店域
int typeOfStoreRegion = 3;
//门店标签
int typeOfStoreTag = 4;
if(type == typeOfStore){
if(storeColumnSet != null){ if(storeColumnSet != null){
Set<Integer> storeType = storeColumnSet.getStoreType(); Set<Integer> storeType = storeColumnSet.getStoreType();
if(CollectionUtils.isEmpty(storeType)){ if(CollectionUtils.isEmpty(storeType)){
...@@ -182,7 +199,7 @@ public class StoreWidgetController { ...@@ -182,7 +199,7 @@ public class StoreWidgetController {
List<StoreTypeVo> storeTypeVos = this.listStoreTypeOrStatus(enterpriseId, null, 1); List<StoreTypeVo> storeTypeVos = this.listStoreTypeOrStatus(enterpriseId, null, 1);
return RestResponse.success(storeTypeVos); return RestResponse.success(storeTypeVos);
} }
} else if(type == 2){ //门店状态 } else if(type == typeOfStoreStatus){
if(storeColumnSet != null){ if(storeColumnSet != null){
Set<Integer> storeType = storeColumnSet.getErpStatus(); Set<Integer> storeType = storeColumnSet.getErpStatus();
if(CollectionUtils.isEmpty(storeType)){ if(CollectionUtils.isEmpty(storeType)){
...@@ -195,7 +212,7 @@ public class StoreWidgetController { ...@@ -195,7 +212,7 @@ public class StoreWidgetController {
List<StoreTypeVo> storeTypeVos = this.listStoreTypeOrStatus(enterpriseId, null, 2); List<StoreTypeVo> storeTypeVos = this.listStoreTypeOrStatus(enterpriseId, null, 2);
return RestResponse.success(storeTypeVos); return RestResponse.success(storeTypeVos);
} }
} else if(type == 3){ //门店域 } else if(type == typeOfStoreRegion){
if(storeColumnSet != null){ if(storeColumnSet != null){
Set<Integer> region = storeColumnSet.getRegion(); Set<Integer> region = storeColumnSet.getRegion();
if(CollectionUtils.isEmpty(region)){ if(CollectionUtils.isEmpty(region)){
...@@ -208,7 +225,7 @@ public class StoreWidgetController { ...@@ -208,7 +225,7 @@ public class StoreWidgetController {
List<StoreTypeVo> storeTypeVos = this.listRegion(enterpriseId, null); List<StoreTypeVo> storeTypeVos = this.listRegion(enterpriseId, null);
return RestResponse.success(storeTypeVos); return RestResponse.success(storeTypeVos);
} }
}else if(type == 4){ //门店标签 }else if(type == typeOfStoreTag){
List<StoreTagDTO> result = this.storeTagApiService.listByEnterprise(enterpriseId).getResult(); List<StoreTagDTO> result = this.storeTagApiService.listByEnterprise(enterpriseId).getResult();
List<StoreTypeVo> list = new ArrayList<>(); List<StoreTypeVo> list = new ArrayList<>();
if(CollectionUtils.isNotEmpty(result)){ if(CollectionUtils.isNotEmpty(result)){
...@@ -220,13 +237,18 @@ public class StoreWidgetController { ...@@ -220,13 +237,18 @@ public class StoreWidgetController {
} }
} }
return RestResponse.success(list); return RestResponse.success(list);
}else { } else {
return otherType(storeColumnSet);
}
}
private RestResponse otherType(StoreColumnSet storeColumnSet) {
List<StoreTypeVo> list = new ArrayList<>(); List<StoreTypeVo> list = new ArrayList<>();
if(storeColumnSet != null){ if (storeColumnSet != null) {
Set<Integer> status = storeColumnSet.getStatus(); Set<Integer> status = storeColumnSet.getStatus();
if(CollectionUtils.isEmpty(status)){ if (CollectionUtils.isEmpty(status)) {
return RestResponse.success(); return RestResponse.success();
}else { } else {
Iterator<Integer> iterator = status.iterator(); Iterator<Integer> iterator = status.iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
StoreTypeVo storeTypeVo = new StoreTypeVo(); StoreTypeVo storeTypeVo = new StoreTypeVo();
...@@ -239,7 +261,7 @@ public class StoreWidgetController { ...@@ -239,7 +261,7 @@ public class StoreWidgetController {
list.add(storeTypeVo); list.add(storeTypeVo);
} }
} }
}else { } else {
StoreTypeVo storeTypeVo = new StoreTypeVo(); StoreTypeVo storeTypeVo = new StoreTypeVo();
storeTypeVo.setId("1"); storeTypeVo.setId("1");
storeTypeVo.setName("启用"); storeTypeVo.setName("启用");
...@@ -251,7 +273,6 @@ public class StoreWidgetController { ...@@ -251,7 +273,6 @@ public class StoreWidgetController {
} }
return RestResponse.success(list); return RestResponse.success(list);
} }
}
@RequestMapping("on-store-list") @RequestMapping("on-store-list")
public RestResponse onStoreList(Integer userId, Integer enterpriseId, Integer type){ public RestResponse onStoreList(Integer userId, Integer enterpriseId, Integer type){
...@@ -259,7 +280,7 @@ public class StoreWidgetController { ...@@ -259,7 +280,7 @@ public class StoreWidgetController {
if(onlineStore.isHasAuth()){ if(onlineStore.isHasAuth()){
List<OnLineStore> list = onlineStore.getList(); List<OnLineStore> list = onlineStore.getList();
for(OnLineStore store : list){ for(OnLineStore store : list){
if(type == store.getChannel()){ if(type.intValue() == store.getChannel()){
List<OnLineStoreVo> onLineStoreVos = this.listOnLineStore(store.getStoreIdList(), type, enterpriseId); List<OnLineStoreVo> onLineStoreVos = this.listOnLineStore(store.getStoreIdList(), type, enterpriseId);
log.info("on-store-list:{}, {}", JSON.toJSONString(onLineStoreVos), JSON.toJSONString(store.getStoreIdList())); log.info("on-store-list:{}, {}", JSON.toJSONString(onLineStoreVos), JSON.toJSONString(store.getStoreIdList()));
return RestResponse.success(onLineStoreVos); return RestResponse.success(onLineStoreVos);
...@@ -274,7 +295,11 @@ public class StoreWidgetController { ...@@ -274,7 +295,11 @@ public class StoreWidgetController {
Integer pageNum, Integer pageSize){ Integer pageNum, Integer pageSize){
Page<StoreSearchVo> page = new Page<>(pageNum, pageSize); Page<StoreSearchVo> page = new Page<>(pageNum, pageSize);
Map<Integer, StoreGroupVo> map = this.mapStoreGroup(enterpriseId); Map<Integer, StoreGroupVo> map = this.mapStoreGroup(enterpriseId);
if(type == 1){ //门店分组 //门店分组
int typeOfStoreGroup = 1;
//线下门店
int typeOfOfflineStore = 2;
if(type == typeOfStoreGroup){
Page<StoreGroupDTO> result = this.storeGroupApiService.pageStoreGroupByIds(null, enterpriseId, null, search, pageSize, pageNum).getResult(); Page<StoreGroupDTO> result = this.storeGroupApiService.pageStoreGroupByIds(null, enterpriseId, null, search, pageSize, pageNum).getResult();
page.setTotalPage(result.getTotalPage()); page.setTotalPage(result.getTotalPage());
page.setTotalCount(result.getTotalCount()); page.setTotalCount(result.getTotalCount());
...@@ -290,7 +315,7 @@ public class StoreWidgetController { ...@@ -290,7 +315,7 @@ public class StoreWidgetController {
} }
page.setResult(storeSearchVoList); page.setResult(storeSearchVoList);
} }
}else if(type == 2){ //线下门店 }else if(type == typeOfOfflineStore){
StoreAuth storeAuth = this.dataAuthUtils.getStoreAuth(userId, enterpriseId); StoreAuth storeAuth = this.dataAuthUtils.getStoreAuth(userId, enterpriseId);
if(storeAuth.isHasAuth()){ if(storeAuth.isHasAuth()){
StoreSearchDTO storeSearchDTO = new StoreSearchDTO(); StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
...@@ -315,13 +340,22 @@ public class StoreWidgetController { ...@@ -315,13 +340,22 @@ public class StoreWidgetController {
page.setResult(storeSearchVoList); page.setResult(storeSearchVoList);
} }
} }
}else{ //线上店铺 }else{
//线上店铺
onlineStore(page, userId, enterpriseId, search);
}
return RestResponse.success(page);
}
private void onlineStore(Page<StoreSearchVo> page, Integer userId, Integer enterpriseId, String search) {
OnLineAuth onlineStore = this.dataAuthUtils.getOnlineStore(userId, enterpriseId); OnLineAuth onlineStore = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
if(onlineStore.isHasAuth()){ if(onlineStore.isHasAuth()){
List<StoreSearchVo> list = new ArrayList<>(); List<StoreSearchVo> list = new ArrayList<>();
List<OnLineStore> onlineStoreList = onlineStore.getList(); List<OnLineStore> onlineStoreList = onlineStore.getList();
for(OnLineStore onLineStore : onlineStoreList){ for(OnLineStore onLineStore : onlineStoreList){
if(onLineStore.getChannel() == StoreChannelEnum.GICMALL.getChannel()){ if(onLineStore.getChannel() == StoreChannelEnum.GICMALL.getChannel().intValue()){
List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, search, ShopTypeEnum.MALL_SHOP.getCode()).getResult(); List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, search, ShopTypeEnum.MALL_SHOP.getCode()).getResult();
if(CollectionUtils.isNotEmpty(result)){ if(CollectionUtils.isNotEmpty(result)){
for(ShopDTO dto : result){ for(ShopDTO dto : result){
...@@ -338,7 +372,7 @@ public class StoreWidgetController { ...@@ -338,7 +372,7 @@ public class StoreWidgetController {
} }
} }
} }
if(onLineStore.getChannel() == StoreChannelEnum.WMMALL.getChannel()){ if(onLineStore.getChannel() == StoreChannelEnum.WMMALL.getChannel().intValue()){
List<WmStoreDTO> result1 = wmStoreApiService.listWmStore(enterpriseId, search).getResult(); List<WmStoreDTO> result1 = wmStoreApiService.listWmStore(enterpriseId, search).getResult();
if(CollectionUtils.isNotEmpty(result1)){ if(CollectionUtils.isNotEmpty(result1)){
for(WmStoreDTO wmStoreDTO : result1){ for(WmStoreDTO wmStoreDTO : result1){
...@@ -361,8 +395,6 @@ public class StoreWidgetController { ...@@ -361,8 +395,6 @@ public class StoreWidgetController {
page.setTotalPage(1); page.setTotalPage(1);
} }
} }
return RestResponse.success(page);
}
@RequestMapping("get-store-count") @RequestMapping("get-store-count")
public RestResponse getStoreCount(String searchJSON, Integer userId, Integer enterpriseId){ public RestResponse getStoreCount(String searchJSON, Integer userId, Integer enterpriseId){
...@@ -374,7 +406,7 @@ public class StoreWidgetController { ...@@ -374,7 +406,7 @@ public class StoreWidgetController {
private Map<Integer, StoreGroupVo> mapStoreGroup(Integer enterpriseId){ private Map<Integer, StoreGroupVo> mapStoreGroup(Integer enterpriseId){
List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupByIds(null, enterpriseId).getResult(); List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupByIds(null, enterpriseId).getResult();
Map<Integer, StoreGroupVo> map = new HashMap<>(); Map<Integer, StoreGroupVo> map = new HashMap<>(16);
if(CollectionUtils.isNotEmpty(result)){ if(CollectionUtils.isNotEmpty(result)){
this.parseStoreGroup(result, map, 0); this.parseStoreGroup(result, map, 0);
} }
...@@ -398,7 +430,7 @@ public class StoreWidgetController { ...@@ -398,7 +430,7 @@ public class StoreWidgetController {
private List<OnLineStoreVo> listOnLineStore(List<String> storeIdList, Integer type, Integer enterpriseId){ private List<OnLineStoreVo> listOnLineStore(List<String> storeIdList, Integer type, Integer enterpriseId){
List<OnLineStoreVo> list = new ArrayList<>(); List<OnLineStoreVo> list = new ArrayList<>();
if(type == StoreChannelEnum.GICMALL.getChannel()){ if(type == StoreChannelEnum.GICMALL.getChannel().intValue()){
List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, null, ShopTypeEnum.MALL_SHOP.getCode()).getResult(); List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, null, ShopTypeEnum.MALL_SHOP.getCode()).getResult();
if(CollectionUtils.isNotEmpty(result)){ if(CollectionUtils.isNotEmpty(result)){
for(ShopDTO dto : result){ for(ShopDTO dto : result){
...@@ -413,7 +445,7 @@ public class StoreWidgetController { ...@@ -413,7 +445,7 @@ public class StoreWidgetController {
} }
} }
} }
}else if(type == StoreChannelEnum.WMMALL.getChannel()){ }else if(type == StoreChannelEnum.WMMALL.getChannel().intValue()){
List<WmStoreDTO> result = wmStoreApiService.listWmStore(enterpriseId).getResult(); List<WmStoreDTO> result = wmStoreApiService.listWmStore(enterpriseId).getResult();
if(CollectionUtils.isNotEmpty(result)){ if(CollectionUtils.isNotEmpty(result)){
for(WmStoreDTO wmStoreDTO : result){ for(WmStoreDTO wmStoreDTO : result){
...@@ -479,7 +511,7 @@ public class StoreWidgetController { ...@@ -479,7 +511,7 @@ public class StoreWidgetController {
private String getChannelName(Integer channel){ private String getChannelName(Integer channel){
StoreChannelEnum[] values = StoreChannelEnum.values(); StoreChannelEnum[] values = StoreChannelEnum.values();
for(StoreChannelEnum storeChannelEnum : values){ for(StoreChannelEnum storeChannelEnum : values){
if(channel == storeChannelEnum.getChannel()){ if(channel.intValue() == storeChannelEnum.getChannel()){
return storeChannelEnum.getMessage(); return storeChannelEnum.getMessage();
} }
} }
......
package com.gic.cloud.web.qo; package com.gic.cloud.web.qo;
/**
* 基础
* @ClassName: BaseSalesParamQo

* @Description: 

* @author boom

* @date 2020/9/7 1:37 PM

*/
public class BaseSalesParamQo { public class BaseSalesParamQo {
private Integer channel; private Integer channel;
private Integer userId; private Integer userId;
......
package com.gic.cloud.web.qo; package com.gic.cloud.web.qo;
/**
* 日期类型
* @ClassName: DateTypeQo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:35 PM

*/
public class DateTypeQo { public class DateTypeQo {
private Integer type; private Integer type;
private String date; private String date;
......
package com.gic.cloud.web.qo; package com.gic.cloud.web.qo;
/**
* 门店查询
* @ClassName: StoreSearchQo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:35 PM

*/
public class StoreSearchQo { public class StoreSearchQo {
private Integer all = 0; private Integer all = 0;
private String region; private String region;
...@@ -9,9 +15,18 @@ public class StoreSearchQo { ...@@ -9,9 +15,18 @@ public class StoreSearchQo {
private String storeTag; private String storeTag;
private Integer attentionStore = 0; private Integer attentionStore = 0;
private Integer tmpStore = 0; private Integer tmpStore = 0;
private String storeGroupIds; //和线上共享使用,当为线上门店时,该值对应店铺 /**
private String storeIds; //和线上共享使用,当为线上门店时,该值对应店铺下门店id * 和线上共享使用,当为线上门店时,该值对应店铺
private Integer hasWgs = 0; //是否有无归属 */
private String storeGroupIds;
/**
* 和线上共享使用,当为线上门店时,该值对应店铺下门店id
*/
private String storeIds;
/**
* 是否有无归属
*/
private Integer hasWgs = 0;
public Integer getAll() { public Integer getAll() {
return all; return all;
......
...@@ -9,7 +9,13 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert ...@@ -9,7 +9,13 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 数据转化
* @ClassName: BigDecimalConvertUtils

* @Description: 

* @author boom

* @date 2020/9/7 1:39 PM

*/
@Component @Component
public class BigDecimalConvertUtils { public class BigDecimalConvertUtils {
@Bean @Bean
...@@ -26,7 +32,6 @@ public class BigDecimalConvertUtils { ...@@ -26,7 +32,6 @@ public class BigDecimalConvertUtils {
simpleModule.addSerializer(String.class, new StringJsonSeralizer()); simpleModule.addSerializer(String.class, new StringJsonSeralizer());
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
//simpleModule.addSerializer(String.class, new StringJsonSeralizer());
objectMapper.registerModule(simpleModule); objectMapper.registerModule(simpleModule);
jackson2HttpMessageConverter.setObjectMapper(objectMapper); jackson2HttpMessageConverter.setObjectMapper(objectMapper);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
......
...@@ -7,7 +7,13 @@ import com.fasterxml.jackson.databind.SerializerProvider; ...@@ -7,7 +7,13 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 数据转化
* @ClassName: BigDecimalJsonSeralizer

* @Description: 

* @author boom

* @date 2020/9/7 1:39 PM

*/
public class BigDecimalJsonSeralizer extends JsonSerializer<BigDecimal> { public class BigDecimalJsonSeralizer extends JsonSerializer<BigDecimal> {
@Override @Override
......
...@@ -11,6 +11,8 @@ import java.text.DecimalFormat; ...@@ -11,6 +11,8 @@ import java.text.DecimalFormat;
*/ */
public class DataFormatUtils { public class DataFormatUtils {
private static final Integer ONE_HUNDRED_THOUSAND = 100000;
/** /**
* 如果大于十万,则以万为单位,否则就是元作为单位 * 如果大于十万,则以万为单位,否则就是元作为单位
* @param data * @param data
...@@ -20,7 +22,8 @@ public class DataFormatUtils { ...@@ -20,7 +22,8 @@ public class DataFormatUtils {
if (data == null) { if (data == null) {
return "--"; return "--";
} }
if (data >= 100000) {
if (data >= ONE_HUNDRED_THOUSAND) {
return data / 10000 + "万"; return data / 10000 + "万";
} }
return data + ""; return data + "";
......
...@@ -2,7 +2,13 @@ package com.gic.cloud.web.utils; ...@@ -2,7 +2,13 @@ package com.gic.cloud.web.utils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 区域层级
* @ClassName: LevelUtil

* @Description: 

* @author boom

* @date 2020/9/7 1:38 PM

*/
public class LevelUtil { public class LevelUtil {
private static Map<Integer, String> levelMap = new HashMap<>(); private static Map<Integer, String> levelMap = new HashMap<>();
......
...@@ -10,14 +10,21 @@ import java.io.IOException; ...@@ -10,14 +10,21 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/**
* 数据转化
* @ClassName: StringJsonSeralizer

* @Description: 

* @author boom

* @date 2020/9/7 1:38 PM

*/
public class StringJsonSeralizer extends JsonSerializer<String> { public class StringJsonSeralizer extends JsonSerializer<String> {
private static Pattern NUMBER_PATTERN = Pattern.compile("\\d+\\.\\d+$|-\\d+\\.\\d+$");
@Override @Override
public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
if(StringUtils.isNotBlank(value)){ if(StringUtils.isNotBlank(value)){
Pattern pattern = Pattern.compile("\\d+\\.\\d+$|-\\d+\\.\\d+$"); Matcher isNum = NUMBER_PATTERN.matcher(value);
Matcher isNum = pattern.matcher(value);
if(isNum.matches()){ if(isNum.matches()){
BigDecimal decimal = new BigDecimal(value).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal decimal = new BigDecimal(value).setScale(2, BigDecimal.ROUND_HALF_UP);
jsonGenerator.writeString(decimal.toString()); jsonGenerator.writeString(decimal.toString());
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
/**
* 基础类
* @ClassName: BaseSalesVo

* @Description: 

* @author boom

* @date 2020/9/7 1:37 PM

*/
public class BaseSalesVo<T> { public class BaseSalesVo<T> {
private Page<T> page; private Page<T> page;
private T total; private T total;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 信息
* @ClassName: EnterpriseVo

* @Description: 

* @author boom

* @date 2020/9/7 1:39 PM

*/
public class EnterpriseVo { public class EnterpriseVo {
private static final long serialVersionUID = -2344967926907229689L; private static final long serialVersionUID = -2344967926907229689L;
private Integer enterpriseId; private Integer enterpriseId;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
import java.io.Serializable; import java.io.Serializable;
/**
* 指标
* @ClassName: IndexItemVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:31 PM

*/
public class IndexItemVo implements Serializable { public class IndexItemVo implements Serializable {
private String id; private String id;
private String name; private String name;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 区域层级
* @ClassName: LevelNameVo

* @Description: 

* @author boom

* @date 2020/9/7 1:38 PM

*/
public class LevelNameVo { public class LevelNameVo {
private Integer level = 0; private Integer level = 0;
private String levelName; private String levelName;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 分组层级
* @ClassName: LevelVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:37 PM

*/
public class LevelVo { public class LevelVo {
private Integer level = 1; private Integer level = 1;
private Integer maxLevel = 1; private Integer maxLevel = 1;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
import java.io.Serializable; import java.io.Serializable;
/**
* 登录用户
* @ClassName: LoginUserVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 11:45 AM

*/
public class LoginUserVo implements Serializable { public class LoginUserVo implements Serializable {
private Integer userId; private Integer userId;
private Integer enterpriseId; private Integer enterpriseId;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 会员卡
* @ClassName: MbrVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:36 PM

*/
public class MbrVo { public class MbrVo {
private String mbrAreaId; private String mbrAreaId;
private String mbrAreaName; private String mbrAreaName;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 上线门店
* @ClassName: OnLineStoreVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:33 PM

*/
public class OnLineStoreVo { public class OnLineStoreVo {
private String id; private String id;
private String name; private String name;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 关注门店
* @ClassName: StoreAttenttionVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:33 PM

*/
public class StoreAttenttionVo { public class StoreAttenttionVo {
private Integer storeId; private Integer storeId;
private String storeName; private String storeName;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 门店分组
* @ClassName: StoreGroupItemsVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:33 PM

*/
public class StoreGroupItemsVo { public class StoreGroupItemsVo {
private Integer id; private Integer id;
private String name; private String name;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
import java.util.List; import java.util.List;
/**
* 门店分组
* @ClassName: StoreGroupVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:32 PM

*/
public class StoreGroupVo { public class StoreGroupVo {
private Integer storeGroupId; private Integer storeGroupId;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 门店查询条件
* @ClassName: StoreSearchVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:33 PM

*/
public class StoreSearchVo { public class StoreSearchVo {
private String id; private String id;
private String name; private String name;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 门店类型
* @ClassName: StoreTypeVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:32 PM

*/
public class StoreTypeVo { public class StoreTypeVo {
private String id; private String id;
private String name; private String name;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
import java.util.List; import java.util.List;
/**
* 门店
* @ClassName: StoreWidgetIndexVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:31 PM

*/
public class StoreWidgetIndexVo { public class StoreWidgetIndexVo {
/****1多渠道首页 2单渠道线下首页 3单渠道线上首页****/ /****1多渠道首页 2单渠道线下首页 3单渠道线上首页****/
private Integer type; private Integer type;
......
package com.gic.cloud.web.vo; package com.gic.cloud.web.vo;
/**
* 门店选择
* @ClassName: StoreWidgetItemVo

* @Description: 

* @author guojuxing

* @date 2020/9/7 1:34 PM

*/
public class StoreWidgetItemVo { public class StoreWidgetItemVo {
private String id; private String id;
private String name; private String name;
......
package com.gic.cloud.web.vo;
public class T extends Object {
}
package com.gic.cloud.web.vo.index; package com.gic.cloud.web.vo.index;
/**
* 首页
* @ClassName: IndexConsume

* @Description: 

* @author boom

* @date 2020/9/7 1:36 PM

*/
public class IndexConsume { public class IndexConsume {
private String memberRate = "--"; private String memberRate = "--";
private String oldRate = "--"; private String oldRate = "--";
......
package com.gic.cloud.web.vo.index; package com.gic.cloud.web.vo.index;
/**
* 首页
* @ClassName: IndexMemberVo

* @Description: 

* @author boom

* @date 2020/9/7 1:36 PM

*/
public class IndexMemberVo { public class IndexMemberVo {
private String newMember; private String newMember;
private String totalMember; private String totalMember;
......
package com.gic.cloud.web.vo.index; package com.gic.cloud.web.vo.index;
/**
* 首页
* @ClassName: IndexSalesVo

* @Description: 

* @author boom

* @date 2020/9/7 1:36 PM

*/
public class IndexSalesVo { public class IndexSalesVo {
private String totalSales = "0元"; private String totalSales = "0元";
private String perf = "0元"; private String perf = "0元";
......
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