Commit e738673e by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !45
parents 314b354e 9711b374
......@@ -2,6 +2,7 @@ package com.gic.enterprise.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 自定义菜单
......@@ -82,6 +83,11 @@ public class AppletWechatMenuDTO implements Serializable{
*/
private Date updateTime;
/***********************/
private List<AppletWechatMenuDTO> secondMenuList;
private boolean isFirstLevel;
public Integer getMenuId() {
return menuId;
}
......@@ -193,4 +199,22 @@ public class AppletWechatMenuDTO implements Serializable{
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public List<AppletWechatMenuDTO> getSecondMenuList() {
return secondMenuList;
}
public AppletWechatMenuDTO setSecondMenuList(List<AppletWechatMenuDTO> secondMenuList) {
this.secondMenuList = secondMenuList;
return this;
}
public boolean isFirstLevel() {
return isFirstLevel;
}
public AppletWechatMenuDTO setFirstLevel(boolean firstLevel) {
isFirstLevel = firstLevel;
return this;
}
}
......@@ -23,9 +23,22 @@ public interface AppletWechatMenuApiService {
* @param dto

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>


 */
@Deprecated
ServiceResponse<Integer> save(AppletWechatMenuDTO dto) throws Exception;
/**
* 新增(校验参数之后)
* @Title: saveOfHasValid

* @Description:

* @author guojuxing
* @param dto

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>


*/
ServiceResponse<Integer> saveOfHasValid(AppletWechatMenuDTO dto);
ServiceResponse<Void> deleteWechatMenu(Integer enterpriseId, String appKey);
/**
* 编辑
* @Title: edit

* @Description:
......@@ -34,6 +47,7 @@ public interface AppletWechatMenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>

* @throws

 */
@Deprecated
ServiceResponse<String> edit(AppletWechatMenuDTO dto) throws Exception;
/**
......@@ -44,6 +58,7 @@ public interface AppletWechatMenuApiService {
* @param menuId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


 */
@Deprecated
ServiceResponse<String> deleteByMenuId(Integer menuId);
/**
......@@ -55,6 +70,7 @@ public interface AppletWechatMenuApiService {
* @param sort

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


 */
@Deprecated
ServiceResponse<String> sort(Integer menuId, Integer sort);
/**
......
......@@ -9,6 +9,28 @@ public interface DataConfigApiService {
ServiceResponse<Void> configWechatMember(DataWechatMemberConfigDTO dto);
/**
* 新增会员卡,通知
* @Title: newWechatMember

* @Description:

* @author guojuxing
* @param enterpriseId
* @param memberCardArea

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> newWechatMember(Integer enterpriseId, Long memberCardArea);
/**
* 删除会员卡,通知
* @Title: deleteWechatMember

* @Description:

* @author guojuxing
* @param enterpriseId
* @param memberCardArea

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> deleteWechatMember(Integer enterpriseId, Long memberCardArea);
ServiceResponse<List<DataWechatMemberConfigDTO>> listWechatMemberConfig(Integer enterpriseId);
/**
* 会员消费配置
......
......@@ -206,6 +206,11 @@
<artifactId>widget-screening-api</artifactId>
<version>${widget-screening-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-data-cloud-api</artifactId>
<version>${gic-data-cloud-api}</version>
</dependency>
</dependencies>
<build>
......
......@@ -90,4 +90,6 @@ public interface TabAppletWechatMenuMapper {
* @return java.util.List<com.gic.enterprise.entity.TabAppletWechatMenu>


 */
List<TabAppletWechatMenu> listAll(@Param("enterpriseId") Integer enterpriseId, @Param("appKey") String appKey);
void deleteWechatMenu(@Param("enterpriseId") Integer enterpriseId, @Param("appKey") String appKey);
}
\ No newline at end of file
......@@ -82,4 +82,6 @@ public interface AppletWechatMenuService {
* @return java.util.List<com.gic.enterprise.entity.TabAppletWechatMenu>


 */
List<TabAppletWechatMenu> listAll(Integer enterpriseId, String appKey);
void deleteWechatMenu(Integer enterpriseId, String appKey);
}
......@@ -73,4 +73,9 @@ public class AppletWechatMenuServiceImpl implements AppletWechatMenuService{
public List<TabAppletWechatMenu> listAll(Integer enterpriseId, String appKey) {
return tabAppletWechatMenuMapper.listAll(enterpriseId, appKey);
}
@Override
public void deleteWechatMenu(Integer enterpriseId, String appKey) {
tabAppletWechatMenuMapper.deleteWechatMenu(enterpriseId, appKey);
}
}
......@@ -110,6 +110,18 @@ public class AppletWechatMenuApiServiceImpl implements AppletWechatMenuApiServic
}
@Override
public ServiceResponse<Integer> saveOfHasValid(AppletWechatMenuDTO dto){
Integer menuId = appletWechatMenuService.save(dto);
return ServiceResponse.success(menuId);
}
@Override
public ServiceResponse<Void> deleteWechatMenu(Integer enterpriseId, String appKey) {
appletWechatMenuService.deleteWechatMenu(enterpriseId, appKey);
return ServiceResponse.success();
}
@Override
public ServiceResponse<String> edit(AppletWechatMenuDTO dto) throws Exception {
//参数校验
TabAppletWechatMenu record = appletWechatMenuService.getById(dto.getMenuId());
......
......@@ -48,13 +48,6 @@ public class DataConfigApiServiceImpl implements DataConfigApiService {
if (result == null) {
dataWechatMemberConfigService.saveWechatMemberConfig(dto);
} else {
if (isRefresh) {
if (result.getValidSave() == 1) {
//配置过了,不允许编辑
return ServiceResponse.success();
}
}
//配置过的
dto.setWechatMemberConfigId(result.getWechatMemberConfigId());
dataWechatMemberConfigService.editWechatMemberConfig(dto);
}
......@@ -62,6 +55,25 @@ public class DataConfigApiServiceImpl implements DataConfigApiService {
}
@Override
public ServiceResponse<Void> newWechatMember(Integer enterpriseId, Long memberCardArea) {
return configWechatMember(new DataWechatMemberConfigDTO().setEnterpriseId(enterpriseId).setMemberCardArea(memberCardArea.toString()).setValidRefresh(1));
}
@Override
public ServiceResponse<Void> deleteWechatMember(Integer enterpriseId, Long memberCardArea) {
if (memberCardArea == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "会员卡域不能为空");
}
TabDataWechatMemberConfig result = dataWechatMemberConfigService.getByMemberCardId(enterpriseId, memberCardArea.toString());
if (result != null) {
dataWechatMemberConfigService.editWechatMemberConfig(new DataWechatMemberConfigDTO()
.setWechatMemberConfigId(result.getWechatMemberConfigId())
.setStatus(0));
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<List<DataWechatMemberConfigDTO>> listWechatMemberConfig(Integer enterpriseId) {
return ServiceResponse.success(Optional
.ofNullable(EntityUtil.changeEntityListNew(DataWechatMemberConfigDTO.class, dataWechatMemberConfigService
......
......@@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.gic.cloud.service.IndexDescApiService;
import com.gic.commons.util.CollectionUtil;
import com.gic.enterprise.constant.BillingAuditStatusEnum;
import com.gic.enterprise.dto.market.ServeLicenseDTO;
......@@ -96,6 +97,8 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
private SmsSendApiService smsSendApiService;
@Autowired
private EnterpriseLicenseApiService enterpriseLicenseApiService;
@Autowired
private IndexDescApiService indexDescApiService;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -166,6 +169,9 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
//年龄段配置
dataConfigApiService.initGenerationConfig(enterpriseId);
//观云台字典初始化
indexDescApiService.init(enterpriseId);
UserDTO userDTO = EntityUtil.changeEntityNew(UserDTO.class, enterpriseDTO);
//新增超级管理员
userDTO.setEnterpriseId(enterpriseId);
......@@ -449,24 +455,20 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
List<com.gic.enterprise.dto.market.OrderBuyLicenseDTO> orderBuyLicenseDTOList = basicParams.getLicenseList();
List<OrderBuyLicenseDTO> licenseListParams = EntityUtil.changeEntityListNew(OrderBuyLicenseDTO.class,
orderBuyLicenseDTOList);
// if (basicParams.getOrderType() != null && basicParams.getOrderType().intValue() == 4
// && CollectionUtils.isEmpty(licenseListParams)) {
// //扩容
// if (!basicParams.isCommitFlag()) {
// //获取基本数据信息
// List<EnterpriseLicenseDTO> gicLicenseList = enterpriseLicenseService
// .listByEnterpriseId(basicParams.getEnterpriseId().intValue());
// if (CollectionUtils.isNotEmpty(gicLicenseList)) {
// licenseListParams = new ArrayList<>();
// for (EnterpriseLicenseDTO licenseDTO : gicLicenseList) {
// OrderBuyLicenseDTO temp = new OrderBuyLicenseDTO();
// temp.setLicenseId(licenseDTO.getLicenseId());
// temp.setNum(licenseDTO.getUpperLimit());
// licenseListParams.add(temp);
// }
// }
// }
// }
//是否是服务开通操作
boolean isOpenService = basicParams.getOrderType() != null && basicParams.getOrderType() == 1;
if (isOpenService && !hasGoodsAuth) {
//没有商品权限
Long goodsLicenseId = getGoodsLicenseId(basicParams.getEnterpriseId(), basicParams.getOrderType());
if (goodsLicenseId != null) {
//有商品license,给一个默认的商品license 9个
OrderBuyLicenseDTO orderBuyLicenseDTO = new OrderBuyLicenseDTO();
orderBuyLicenseDTO.setNum(9);
orderBuyLicenseDTO.setLicenseId(goodsLicenseId);
licenseListParams.add(orderBuyLicenseDTO);
}
}
ServiceResponse<OrderCheckDTO> result = orderPurchaseApiService.buyForGic(basicParams.getEnterpriseId(),
basicParams.getName(), basicParams.getSkuId(), basicParams.getCouponLogId(), basicParams.getOrderType(),
......@@ -694,4 +696,28 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
return id.toString();
}
private Long getGoodsLicenseId(Long enterpriseId, Integer orderType) {
ServiceResponse<OrderCheckDTO> result = orderPurchaseApiService.buyForGic(enterpriseId,
null, null,null, orderType,
null, null,false, null);
if (result.isSuccess()) {
OrderCheckDTO orderClerk = result.getResult();
OrderDTO orderDTO = orderClerk.getOrderDTO();
if (orderClerk.getCanBuy().intValue() == 0) {
return null;
}
List<OrderItemDTO> orderItemList = orderDTO.getOrderItemList();
for (OrderItemDTO orderItem : orderItemList) {
Integer serviceType = orderItem.getServeType();
if (serviceType == 2) {
//license
if (LicenseUtils.isGoodsLicense(orderItem.getLicenseDetail().getLicenseCode())) {
return orderItem.getServeId();
}
}
}
}
return null;
}
}
......@@ -146,4 +146,5 @@
<dubbo:reference interface="com.gic.open.api.service.EnterpriseLicenseApiService" id="enterpriseLicenseApiService" timeout="6000" />
<dubbo:reference interface="com.gic.widget.screening.api.service.EsScreeningEnterpriseInitService" id="esScreeningEnterpriseInitService" timeout="6000" />
<dubbo:reference interface="com.gic.cloud.service.IndexDescApiService" id="indexDescApiService" timeout="6000" />
</beans>
......@@ -229,4 +229,11 @@
order by sort
</select>
<update id="deleteWechatMenu" >
update tab_applet_wechat_menu set status = 0
where status = 1
and enterprise_id = #{enterpriseId}
and app_key = #{appKey}
</update>
</mapper>
\ No newline at end of file
package com.gic.enterprise.web.controller;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.gic.enterprise.service.EnterpriseInitApiService;
import com.gic.enterprise.ano.IgnoreLogin;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -21,6 +23,7 @@ import com.gic.download.utils.OperationResultUtils;
import com.gic.enterprise.dto.data.*;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.DataConfigApiService;
import com.gic.enterprise.service.EnterpriseInitApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.enterprise.web.vo.MemberCardVO;
......@@ -61,8 +64,8 @@ public class DataConfigController {
List<AppletsConfigSimpleOutputDTO> list = result.getResult();
if (CollectionUtils.isNotEmpty(list)) {
return RestResponse.success(list.stream()
//3:正常 5:异常
.filter(e -> e.getStatusFlag() != null && (e.getStatusFlag() == 3 || e.getStatusFlag() == 5))
//2:正常 4:异常
.filter(e -> e.getStatusFlag() != null && (e.getStatusFlag() == 2 || e.getStatusFlag() == 4))
.collect(Collectors.toList()));
}
}
......@@ -91,19 +94,62 @@ public class DataConfigController {
return ResultControllerUtils.commonResult(result, MemberCardVO.class);
}
@IgnoreLogin
@RequestMapping("/init-actually-data-config")
public RestResponse initActuallyDataConfig(Integer enterpriseId) {
return ResultControllerUtils.commonResult(dataConfigApiService.initActuallyPaidData(enterpriseId));
}
@RequestMapping("config-wechat-member")
public RestResponse configWechatMember(DataWechatMemberConfigDTO dto) {
dto.setValidRefresh(2);
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
initMemberWechat(enterpriseId);
dto.setEnterpriseId(enterpriseId);
return ResultControllerUtils.commonResult(dataConfigApiService
.configWechatMember(dto));
ServiceResponse<Void> response = dataConfigApiService
.configWechatMember(dto);
if (response.isSuccess()) {
configWechatMember(enterpriseId);
}
return ResultControllerUtils.commonResult(response);
}
private void initMemberWechat(Integer enterpriseId) {
ServiceResponse<List<OwnerMemberCardDTO>> result = memberCardApiService.getAll(enterpriseId);
if (result.isSuccess()) {
List<OwnerMemberCardDTO> list = result.getResult();
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(e -> {
dataConfigApiService.configWechatMember(new DataWechatMemberConfigDTO()
.setEnterpriseId(enterpriseId)
.setMemberCardArea(e.getCardConfigId().toString())
.setValidRefresh(1));
});
}
}
}
private void configWechatMember(Integer enterpriseId) {
ServiceResponse<List<DataWechatMemberConfigDTO>> all = dataConfigApiService
.listWechatMemberConfig(UserDetailUtils.getUserDetail().getEnterpriseId());
if (all.isSuccess()) {
List<DataWechatMemberConfigDTO> allList = all.getResult();
if (CollectionUtils.isNotEmpty(allList)) {
if (allList.stream().allMatch(e -> StringUtils.isNotBlank(e.getRelateService()) && StringUtils.isNotBlank(e.getRelateWechat()))) {
//所有的卡都配置,则初始化
enterpriseInitApiService.configWechatMember(enterpriseId);
}
}
}
}
@RequestMapping("refresh-wechat-member-config")
public RestResponse refreshWechatMemberConfig() {
//
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
initMemberWechat(enterpriseId);
ServiceResponse<List<DigitalConfigDTO>> response = enterpriseConfigApiService
.getDigitalConfigByEnterpriseId(enterpriseId);
LOGGER.info("刷新数字会员配置:{}", JSON.toJSONString(response));
......@@ -118,18 +164,8 @@ public class DataConfigController {
.setRelateWechat(listToString(e.getAppletsIds()))
.setValidRefresh(1));
});
configWechatMember(enterpriseId);
ServiceResponse<List<OwnerMemberCardDTO>> result = memberCardApiService.getAll(UserDetailUtils.getUserDetail().getEnterpriseId());
if (result.isSuccess()) {
List<OwnerMemberCardDTO> memberCardList = result.getResult();
if (CollectionUtils.isNotEmpty(memberCardList)) {
final Set<String> memberCardSet = memberCardList.stream().map(e -> e.getCardConfigId().toString()).collect(Collectors.toSet());
if (list.stream().allMatch(e -> memberCardSet.contains(e.getCardConfigId().toString()))) {
//所有的卡都配置,则初始化
enterpriseInitApiService.configWechatMember(enterpriseId);
}
}
}
}
}
return RestResponse.success();
......@@ -151,6 +187,7 @@ public class DataConfigController {
@RequestMapping("list-wechat-member-config")
public RestResponse listWechatMemberConfig() {
initMemberWechat(UserDetailUtils.getUserDetail().getEnterpriseId());
ServiceResponse<List<DataWechatMemberConfigDTO>> response = dataConfigApiService
.listWechatMemberConfig(UserDetailUtils.getUserDetail().getEnterpriseId());
......
package com.gic.enterprise.web.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.alibaba.fastjson.JSON;
import com.gic.download.utils.log.LogUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.EnterpriseInitApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.wechat.business.api.service.fwh.WeixinMenuFunService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -40,6 +39,7 @@ public class WechatMenuController {
@Autowired
private EnterpriseInitApiService enterpriseInitApiService;
@Deprecated
@RequestMapping("/save")
public RestResponse saveMenu(AppletWechatMenuDTO dto) throws Exception {
dto.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
......@@ -47,12 +47,105 @@ public class WechatMenuController {
OperationResultUtils.LOG_NEW + "自定义菜单", dto.getMenuName());
}
@RequestMapping("/save-all")
public RestResponse saveAllMenu(String jsonArr) throws Exception {
LOGGER.info("公众号菜单保存参数:{}", jsonArr);
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
if (StringUtils.isBlank(jsonArr)) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "参数不能为空");
}
List<AppletWechatMenuDTO> list = JSON.parseArray(jsonArr, AppletWechatMenuDTO.class);
List<AppletWechatMenuDTO> listOfHasValid = new ArrayList<>(list.size());
//主菜单不能超过3个
if (list.size() >= 3) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "主菜单不能超过3个");
}
//菜单名称重复
Set<String> menuNameSet = new HashSet<>();
int saveItemCount = list.size();
//校验
for (AppletWechatMenuDTO first : list) {
first.setEnterpriseId(enterpriseId);
first.setFirstLevel(true);
menuNameSet.add(first.getMenuName());
RestResponse response = validParams(first);
if (!"0000".equals(response.getCode())) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
//校验填充后可以保存的实体类
AppletWechatMenuDTO hasValidOfFirst = (AppletWechatMenuDTO) response.getResult();
List<AppletWechatMenuDTO> secondList = first.getSecondMenuList();
if (CollectionUtils.isNotEmpty(secondList)) {
saveItemCount += secondList.size();
List<AppletWechatMenuDTO> listSecondOfHasValid = new ArrayList<>(secondList.size());
//子菜单不超过5个
if (secondList.size() >= 5) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "子菜单不能超过5个");
}
for (AppletWechatMenuDTO second : secondList) {
second.setFirstLevel(false);
second.setEnterpriseId(enterpriseId);
menuNameSet.add(second.getMenuName());
RestResponse responseOfSecond = validParams(second);
if (!"0000".equals(responseOfSecond.getCode())) {
return RestResponse.failure(responseOfSecond.getCode(), responseOfSecond.getMessage());
}
//校验填充后可以保存的实体类
listSecondOfHasValid.add((AppletWechatMenuDTO) responseOfSecond.getResult());
}
hasValidOfFirst.setSecondMenuList(listSecondOfHasValid);
}
listOfHasValid.add(hasValidOfFirst);
}
if (saveItemCount != menuNameSet.size()) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "菜单名称重复");
}
//校验通过,批量新增
//先删除
String appKey = listOfHasValid.get(0).getAppKey();
appletWechatMenuApiService.deleteWechatMenu(enterpriseId, appKey);
for (int i = 0, len = listOfHasValid.size(); i < len; i ++) {
AppletWechatMenuDTO temp = listOfHasValid.get(i);
temp.setSort(i + 1);
ServiceResponse<Integer> response = appletWechatMenuApiService.saveOfHasValid(temp);
Integer parentId = response.getResult();
List<AppletWechatMenuDTO> tempSecond = temp.getSecondMenuList();
if (CollectionUtils.isNotEmpty(tempSecond)) {
for (int j = 0, length = tempSecond.size(); j < length; j ++) {
AppletWechatMenuDTO tempOfSecond = tempSecond.get(j);
tempOfSecond.setParentMenuId(parentId);
tempOfSecond.setSort(j + 1);
appletWechatMenuApiService.saveOfHasValid(tempOfSecond);
}
}
}
LogUtils.createLog(OperationResultUtils.LOG_NEW + "自定义菜单", appKey);
return RestResponse.success();
}
@Deprecated
@RequestMapping("/edit")
public RestResponse edit(AppletWechatMenuDTO dto) throws Exception {
return OperationResultUtils.operationResult(appletWechatMenuApiService.edit(dto),
OperationResultUtils.LOG_EDIT + "自定义菜单", dto.getMenuName());
}
@Deprecated
@RequestMapping("/delete")
public RestResponse delete(Integer menuId) throws Exception {
ServiceResponse<String> result = appletWechatMenuApiService.deleteByMenuId(menuId);
......@@ -60,6 +153,7 @@ public class WechatMenuController {
OperationResultUtils.getOperationObject(result));
}
@Deprecated
@RequestMapping("/sort")
public RestResponse sort(Integer menuId, Integer sort) throws Exception {
ServiceResponse<String> result = appletWechatMenuApiService.sort(menuId, sort);
......@@ -143,4 +237,55 @@ public class WechatMenuController {
}
return result;
}
private RestResponse validParams(AppletWechatMenuDTO dto) throws Exception{
//参数校验
if (dto.getEnterpriseId() == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户ID不能为空");
}
//是否是主菜单
boolean isMainMenu = dto.isFirstLevel();
String menuName = dto.getMenuName();
boolean isNotRightMenuName;
//菜单标题,不超过16个字节,子菜单不超过60个字节
if (isMainMenu) {
isNotRightMenuName = StringUtils.isBlank(menuName) || menuName.getBytes("UTF-8").length > 16;
} else {
isNotRightMenuName = StringUtils.isBlank(menuName) || menuName.getBytes("UTF-8").length > 60;
}
if (isNotRightMenuName) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "菜单名称为空或者过长");
}
if (!WeChatMenuTypeEnum.isRightCode(dto.getMenuType())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "菜单内容错误");
}
if (WeChatMenuTypeEnum.isNeedMenuCode(dto.getMenuType()) && StringUtils.isBlank(dto.getMenuCode())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "链接配置不能为空");
}
if (WeChatMenuTypeEnum.OUT_LINK.getCode() == dto.getMenuType().intValue()) {
if (StringUtils.isBlank(dto.getMenuUrl())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "外链网址不能为空");
}
}
if (WeChatMenuTypeEnum.APPLET_LINK.getCode() == dto.getMenuType().intValue()
&& StringUtils.isBlank(dto.getMenuUrlPara())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "小程序appId不能为空");
}
//todo edit
//暂时只能外链和小程序
if (dto.getMenuType().intValue() != WeChatMenuTypeEnum.OUT_LINK.getCode()
&& dto.getMenuType().intValue() != WeChatMenuTypeEnum.APPLET_LINK.getCode()) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "一期只能选择"
+ WeChatMenuTypeEnum.OUT_LINK.getMessage() + "和" + WeChatMenuTypeEnum.APPLET_LINK.getMessage());
}
if (StringUtils.isBlank(dto.getAppKey())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "公众号key不能为空");
}
//填充字段值
if (isMainMenu) {
//主菜单父级ID统一0
dto.setParentMenuId(0);
}
return RestResponse.success(dto);
}
}
......@@ -33,6 +33,36 @@ public class WechatMenuVO implements Serializable{
*/
private Integer parentMenuId;
/**
* 菜单类型(1:消息,2:外链,3:内链 4:小程序链接)
*/
private Integer menuType;
/**
* 菜单编码,用于解析出URL
*/
private String menuCode;
/**
* 链接地址
*/
private String menuUrl;
/**
* 指定菜单对应的参数,针对门店活动、卡券展架、门店导航等选择指定门店的参数信息
*/
private String menuUrlPara;
/**
* 消息对接字段
*/
private String content;
/**
* 公众号key
*/
private String appKey;
private List<WechatMenuVO> child;
......@@ -40,39 +70,98 @@ public class WechatMenuVO implements Serializable{
return menuId;
}
public void setMenuId(Integer menuId) {
public WechatMenuVO setMenuId(Integer menuId) {
this.menuId = menuId;
return this;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
public WechatMenuVO setSort(Integer sort) {
this.sort = sort;
return this;
}
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName) {
public WechatMenuVO setMenuName(String menuName) {
this.menuName = menuName;
return this;
}
public List<WechatMenuVO> getChild() {
return child;
public Integer getParentMenuId() {
return parentMenuId;
}
public void setChild(List<WechatMenuVO> child) {
this.child = child;
public WechatMenuVO setParentMenuId(Integer parentMenuId) {
this.parentMenuId = parentMenuId;
return this;
}
public Integer getParentMenuId() {
return parentMenuId;
public Integer getMenuType() {
return menuType;
}
public void setParentMenuId(Integer parentMenuId) {
this.parentMenuId = parentMenuId;
public WechatMenuVO setMenuType(Integer menuType) {
this.menuType = menuType;
return this;
}
public String getMenuCode() {
return menuCode;
}
public WechatMenuVO setMenuCode(String menuCode) {
this.menuCode = menuCode;
return this;
}
public String getMenuUrl() {
return menuUrl;
}
public WechatMenuVO setMenuUrl(String menuUrl) {
this.menuUrl = menuUrl;
return this;
}
public String getMenuUrlPara() {
return menuUrlPara;
}
public WechatMenuVO setMenuUrlPara(String menuUrlPara) {
this.menuUrlPara = menuUrlPara;
return this;
}
public String getContent() {
return content;
}
public WechatMenuVO setContent(String content) {
this.content = content;
return this;
}
public String getAppKey() {
return appKey;
}
public WechatMenuVO setAppKey(String appKey) {
this.appKey = appKey;
return this;
}
public List<WechatMenuVO> getChild() {
return child;
}
public WechatMenuVO setChild(List<WechatMenuVO> child) {
this.child = child;
return this;
}
}
......@@ -110,7 +110,7 @@ public class LoginController {
UserDetailsVO userDetailsVO = UserUtils.getUser();
String phone = userDetailsVO.getUserMobile();
//运营人员国内,默认数据
ServiceResponse<UserDTO> userResult = userApiService.listUserByPhoneNumber(Constants.NATION_CODE, phone, enterpriseId);
ServiceResponse<UserDTO> userResult = userApiService.getUserByPhoneNumber(Constants.NATION_CODE, phone, enterpriseId);
if (userResult.isSuccess()) {
//获取运营实施信息
UserDTO user = userResult.getResult();
......
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