From d5304260e81d384e5d1c993cc558bf2c53d1a82e Mon Sep 17 00:00:00 2001 From: xh-pan1 Date: Mon, 13 Nov 2023 22:10:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E6=8C=81=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/CanvasController.java | 5 + .../cereshop/admin/page/permission/MenuButton.java | 29 ++++++ .../cereshop/admin/page/permission/Permission.java | 26 +++++ .../param/permission/PermissionSaveParam.java | 7 ++ .../param/permission/PermissionUpdateParam.java | 8 ++ .../impl/CerePlatformPermissionServiceImpl.java | 43 +++++++- .../mapper/canvas/CerePlatformCanvasDAO.xml | 28 ++++- .../permission/CerePlatformPermissionDAO.xml | 26 +++-- .../app/page/business/PlatformBusiness.java | 44 ++++++++ .../shop/cereshop/app/page/shop/PlatformShop.java | 24 ----- .../cereshop/app/pay/xs/service/XsPayService.java | 11 +- .../app/pay/xs/service/impl/XsPayServiceImpl.java | 63 ++++++++++- .../business/CerePlatformBusinessService.java | 5 + .../impl/CerePlatformBusinessServiceImpl.java | 59 +++++++++++ .../shop/impl/CerePlatformShopServiceImpl.java | 29 +----- .../shop/impl/CereShopEnterpriseServiceImpl.java | 3 + .../CereShopIndividualBusinessesServiceImpl.java | 4 +- .../CereShopOtherOrganizationsServiceImpl.java | 2 + .../shop/impl/CereShopPersonalServiceImpl.java | 1 + .../business/controller/CanvasController.java | 23 ++++- .../business/dao/canvas/CerePlatformCanvasDAO.java | 2 - .../business/dao/product/CereProductMemberDAO.java | 4 + .../page/product/CanvasBusinessProductParam.java | 57 ++++++++++ .../business/page/product/MemberProduct.java | 115 +++++++++++++++++++++ .../impl/CerePlatformPermissionServiceImpl.java | 14 +++ .../service/product/CereProductMemberService.java | 5 + .../product/impl/CereProductMemberServiceImpl.java | 31 ++++++ .../mapper/canvas/CerePlatformCanvasDAO.xml | 33 +++++- .../mapper/product/CereProductMemberDAO.xml | 50 +++++++++ .../commons/domain/canvas/CerePlatformCanvas.java | 6 ++ .../domain/permission/CerePlatformPermission.java | 27 +++++ 31 files changed, 710 insertions(+), 74 deletions(-) create mode 100644 cereshop-app/src/main/java/com/shop/cereshop/app/page/business/PlatformBusiness.java create mode 100644 cereshop-business/src/main/java/com/shop/cereshop/business/page/product/CanvasBusinessProductParam.java create mode 100644 cereshop-business/src/main/java/com/shop/cereshop/business/page/product/MemberProduct.java diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CanvasController.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CanvasController.java index fe9332a..009bbd5 100644 --- a/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CanvasController.java +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CanvasController.java @@ -39,6 +39,7 @@ import com.shop.cereshop.commons.exception.CoBusinessException; import com.shop.cereshop.commons.poi.export.ExcelExportUtils; import com.shop.cereshop.commons.result.Result; import com.shop.cereshop.commons.utils.GsonUtil; +import com.shop.cereshop.commons.utils.ProjectUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -203,6 +204,8 @@ public class CanvasController { public Result saveCanvas(@RequestBody CerePlatformCanvas canvas,HttpServletRequest request) throws CoBusinessException{ //获取当前登录账户 CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); + canvas.setProject(ProjectUtil.DEFAULT_PROJECT); + canvas.setBusinessId(0L); cerePlatformCanvasService.saveCanvas(canvas,user); return new Result(user.getUsername(),"保存画布", GsonUtil.objectToGson(canvas)); } @@ -214,6 +217,8 @@ public class CanvasController { @GetMapping("getCanvas") @ApiOperation(value = "读取画布数据") public Result getCanvas(CerePlatformCanvas canvas) throws CoBusinessException{ + canvas.setProject(ProjectUtil.DEFAULT_PROJECT); + canvas.setBusinessId(0L); canvas=cerePlatformCanvasService.getCanvas(canvas); return new Result(canvas); } diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/MenuButton.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/MenuButton.java index f1476fa..0a2cbc3 100644 --- a/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/MenuButton.java +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/MenuButton.java @@ -5,11 +5,16 @@ */ package com.shop.cereshop.admin.page.permission; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.google.gson.Gson; +import com.shop.cereshop.commons.utils.StringUtils; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; +import java.util.Map; /** * 权限数据 @@ -71,4 +76,28 @@ public class MenuButton { */ @ApiModelProperty(value = "按钮数据") private List buttons; + + /** + * 名称Json + */ + @ApiModelProperty(value = "名称Json") + private String permissionNameJson; + + /** + * 名称Map + */ + @ApiModelProperty(value = "名称Map") + @TableField(exist = false) + private Map permissionNameMap; + + public void initData(){ + Map permissionNameMap = null; + if(StringUtils.isNotEmpty(getPermissionNameJson())){ + permissionNameMap = new Gson().fromJson(getPermissionNameJson(), Map.class); + } + if(CollectionUtils.isEmpty(permissionNameMap)){ + permissionNameMap.put("zh-CN", getPermissionName()); + } + } + } diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/Permission.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/Permission.java index 7b43e6f..69826ef 100644 --- a/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/Permission.java +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/Permission.java @@ -5,11 +5,15 @@ */ package com.shop.cereshop.admin.page.permission; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.google.gson.Gson; +import com.shop.cereshop.commons.utils.StringUtils; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; +import java.util.Map; /** * 权限返回数据实体类 @@ -83,4 +87,26 @@ public class Permission { */ @ApiModelProperty(value = "按钮权限数据") private List buttonPermissions; + + /** + * 名称Json + */ + @ApiModelProperty(value = "名称Json") + private String permissionNameJson; + + /** + * 名称Map + */ + @ApiModelProperty(value = "名称Map") + private Map permissionNameMap; + + public void initData(){ + Map permissionNameMap = null; + if(StringUtils.isNotEmpty(getPermissionNameJson())){ + permissionNameMap = new Gson().fromJson(getPermissionNameJson(), Map.class); + } + if(CollectionUtils.isEmpty(permissionNameMap)){ + permissionNameMap.put("zh-CN", getPermissionName()); + } + } } diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionSaveParam.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionSaveParam.java index 0d4923c..947d82c 100644 --- a/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionSaveParam.java +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionSaveParam.java @@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; +import java.util.Map; /** * 添加权限请求 @@ -73,4 +74,10 @@ public class PermissionSaveParam { */ @ApiModelProperty(value = "权限所属项目") private Integer project; + + /** + * 名称Map + */ + @ApiModelProperty(value = "名称Map") + private Map permissionNameMap; } diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionUpdateParam.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionUpdateParam.java index 67d43ef..c85d829 100644 --- a/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionUpdateParam.java +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionUpdateParam.java @@ -9,6 +9,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Map; + /** * 更新权限请求 */ @@ -75,4 +77,10 @@ public class PermissionUpdateParam { */ @ApiModelProperty(value = "权限所属项目") private Integer project; + + /** + * 名称Map + */ + @ApiModelProperty(value = "名称Map") + private Map permissionNameMap; } diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/permission/impl/CerePlatformPermissionServiceImpl.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/permission/impl/CerePlatformPermissionServiceImpl.java index 6d2f9d2..edb713b 100644 --- a/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/permission/impl/CerePlatformPermissionServiceImpl.java +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/permission/impl/CerePlatformPermissionServiceImpl.java @@ -7,6 +7,7 @@ package com.shop.cereshop.admin.service.permission.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.google.gson.Gson; import com.shop.cereshop.admin.dao.permission.CerePlatformPermissionDAO; import com.shop.cereshop.admin.page.permission.MenuButton; import com.shop.cereshop.admin.page.permission.Meta; @@ -66,6 +67,13 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission permission.setIcon(param.getIcon()); permission.setResourceType(param.getResourceType()); permission.setSort(param.getSort()); + Map permissionNameMap = param.getPermissionNameMap(); + if(permissionNameMap == null || permissionNameMap.isEmpty()){ + permissionNameMap.put("zh-CN", param.getPermissionName()); + } + if(permissionNameMap != null && !permissionNameMap.isEmpty()){ + permission.setPermissionNameJson(new Gson().toJson(permissionNameMap)); + } if(EmptyUtils.isEmpty(permission.getPermissionPid())){ //如果没有父节点id,新增根节点 permission.setPermissionPid(LongEnum.getByName("根节点")); @@ -93,6 +101,13 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission permission.setSort(param.getSort()); permission.setPermissionId(param.getPermissionId()); permission.setUpdateTime(time); + Map permissionNameMap = param.getPermissionNameMap(); + if(permissionNameMap == null || permissionNameMap.isEmpty()){ + permissionNameMap.put("zh-CN", param.getPermissionName()); + } + if(permissionNameMap != null && !permissionNameMap.isEmpty()){ + permission.setPermissionNameJson(new Gson().toJson(permissionNameMap)); + } cerePlatformPermissionDAO.updateByPrimaryKeySelective(permission); //新增日志 cerePlatformLogService.addLog(user,"权限管理","平台端操作","修改权限",String.valueOf(permission.getPermissionId()),time); @@ -111,7 +126,9 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission @Override public CerePlatformPermission getById(Long permissionId) throws CoBusinessException { - return cerePlatformPermissionDAO.getById(permissionId); + CerePlatformPermission cerePlatformPermission = cerePlatformPermissionDAO.getById(permissionId); + cerePlatformPermission.initData(); + return cerePlatformPermission; } @Override @@ -124,7 +141,11 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission if(!EmptyUtils.isEmpty(list)){ Map map=new HashMap<>(); list.forEach((permission -> { - setMenuChildsIndex(permission,childs,map,null); + permission.initData(); + for (Permission child : childs) { + child.initData(); + } + setMenuChildsIndex(permission,childs, map,null); })); } PageInfo pageInfo=new PageInfo<>(list); @@ -142,6 +163,10 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission if(!EmptyUtils.isEmpty(list)){ Map map=new HashMap<>(); list.forEach((permission -> { + permission.initData(); + for (Permission child : childs) { + child.initData(); + } setMenuChildsIndex(permission,childs,map,null); })); } @@ -162,6 +187,13 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission if(!EmptyUtils.isEmpty(list)){ Map map=new HashMap<>(); list.forEach((permission -> { + permission.initData(); + for (MenuButton child : childs) { + child.initData(); + } + for (MenuButton button : buttons) { + button.initData(); + } Meta meta=new Meta(); meta.setTitle(permission.getPermissionName()); meta.setIcon(permission.getIcon()); @@ -183,6 +215,13 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission if(!EmptyUtils.isEmpty(list)){ Map map=new HashMap<>(); list.forEach((permission -> { + permission.initData(); + for (MenuButton child : childs) { + child.initData(); + } + for (MenuButton button : buttons) { + button.initData(); + } Meta meta=new Meta(); meta.setTitle(permission.getPermissionName()); meta.setIcon(permission.getIcon()); diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml index c9b451d..5609abf 100644 --- a/cereshop-admin/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml +++ b/cereshop-admin/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml @@ -7,13 +7,15 @@ + + - canvas_id, terminal, json, type, name, shop_id, custom_id, create_time, update_time + canvas_id, terminal, json, type, name, business_id, shop_id, custom_id, project, create_time, update_time @@ -38,6 +39,9 @@ permission_name, + + permission_name_json, + permission_uri, @@ -73,6 +77,9 @@ #{permissionName,jdbcType=VARCHAR}, + + #{permissionNameJson,jdbcType=VARCHAR}, + #{permissionUri,jdbcType=VARCHAR}, @@ -111,6 +118,9 @@ permission_name = #{permissionName,jdbcType=VARCHAR}, + + permission_name_json = #{permissionNameJson,jdbcType=VARCHAR}, + permission_uri = #{permissionUri,jdbcType=VARCHAR}, @@ -145,6 +155,7 @@ update cere_platform_permission set permission_pid = #{permissionPid,jdbcType=BIGINT}, permission_name = #{permissionName,jdbcType=VARCHAR}, + permission_name_json = #{permissionNameJson,jdbcType=VARCHAR}, permission_uri = #{permissionUri,jdbcType=VARCHAR}, permission = #{permission,jdbcType=VARCHAR}, icon = #{icon,jdbcType=VARCHAR}, @@ -158,11 +169,11 @@ @@ -224,7 +235,7 @@ - insert into cere_platform_permission (permission_id,permission_pid, permission_name, permission_uri, + insert into cere_platform_permission (permission_id,permission_pid, permission_name, permission_name_json, permission_uri, permission, icon, `describe`, resource_type, sort, project, create_time @@ -234,6 +245,7 @@ #{item.permissionId}, #{item.permissionPid}, #{item.permissionName}, + #{item.permissionNameJson}, #{item.permissionUri}, #{item.permission}, #{item.icon}, diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/page/business/PlatformBusiness.java b/cereshop-app/src/main/java/com/shop/cereshop/app/page/business/PlatformBusiness.java new file mode 100644 index 0000000..8ed9552 --- /dev/null +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/page/business/PlatformBusiness.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.app.page.business; + +import com.shop.cereshop.commons.domain.business.*; +import com.shop.cereshop.commons.domain.shop.CereShopReturn; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 店铺信息返回数据实体类 + */ +@Data +@ApiModel(value = "Business", description = "商家信息返回数据实体类") +public class PlatformBusiness extends CerePlatformBusiness { + + /** + * 个人信息 + */ + @ApiModelProperty(value = "个人信息") + private CereShopPersonal personal; + + /** + * 个体工商户信息 + */ + @ApiModelProperty(value = "个体工商户信息") + private CereShopIndividualBusinesses individualBusinesses; + + /** + * 企业信息 + */ + @ApiModelProperty(value = "企业信息") + private CereShopEnterprise enterprise; + + /** + * 其他组织信息 + */ + @ApiModelProperty(value = "其他组织信息") + private CereShopOtherOrganizations otherOrganizations; +} diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/page/shop/PlatformShop.java b/cereshop-app/src/main/java/com/shop/cereshop/app/page/shop/PlatformShop.java index 0ed3139..afafdeb 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/page/shop/PlatformShop.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/page/shop/PlatformShop.java @@ -73,28 +73,4 @@ public class PlatformShop { */ @ApiModelProperty(value = "退货地址信息") private CereShopReturn shopReturn; - - /** - * 个人信息 - */ - @ApiModelProperty(value = "个人信息") - private CereShopPersonal personal; - - /** - * 个体工商户信息 - */ - @ApiModelProperty(value = "个体工商户信息") - private CereShopIndividualBusinesses individualBusinesses; - - /** - * 企业信息 - */ - @ApiModelProperty(value = "企业信息") - private CereShopEnterprise enterprise; - - /** - * 其他组织信息 - */ - @ApiModelProperty(value = "其他组织信息") - private CereShopOtherOrganizations otherOrganizations; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java index 1aa990a..ae77882 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java @@ -4,8 +4,6 @@ import com.shop.cereshop.app.pay.PayService; import com.shop.cereshop.app.pay.xs.domain.XsCallBackRequestVo; import com.shop.cereshop.commons.exception.CoBusinessException; -import java.math.BigDecimal; - public interface XsPayService extends PayService { /** @@ -36,4 +34,13 @@ public interface XsPayService extends PayService { * @throws Exception */ void requestBaoGuan(String orderFormid, String dealId) throws CoBusinessException, Exception; + + /** + * 注册新生账户 + * @param businessId + * @param operationType + * @return + * @throws CoBusinessException + */ + String registerByXs(Long businessId, String operationType) throws CoBusinessException; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java index 61c04a1..d5b21c0 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java @@ -11,6 +11,7 @@ import com.google.gson.Gson; import com.shop.cereshop.app.dao.order.CereOrderProductDAO; import com.shop.cereshop.app.dao.order.CereShopOrderDAO; import com.shop.cereshop.app.dao.shop.CereShopCrossDetailDAO; +import com.shop.cereshop.app.page.business.PlatformBusiness; import com.shop.cereshop.app.pay.xs.domain.XsCallBackRequestVo; import com.shop.cereshop.app.pay.xs.service.XsPayService; import com.shop.cereshop.app.pay.xs.utils.CommonUtils; @@ -19,6 +20,7 @@ import com.shop.cereshop.app.service.buyer.CereBuyerUserService; import com.shop.cereshop.app.service.pay.CerePayLogService; import com.shop.cereshop.app.service.shop.CerePlatformShopService; import com.shop.cereshop.commons.config.XspayConfig; +import com.shop.cereshop.commons.constant.IntegerEnum; import com.shop.cereshop.commons.constant.XsPayEnum; import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; @@ -61,11 +63,11 @@ public class XsPayServiceImpl implements XsPayService { private CerePayLogService cerePayLogService; @Autowired - private CerePlatformShopService cerePlatformShopservice; + private CerePlatformShopService cerePlatformShopService; @Autowired - private CerePlatformBusinessService cerePlatformBusinessservice; + private CerePlatformBusinessService cerePlatformBusinessService; //支付申请服务代码 serCode private static final String PAY_SER_CODE = "101005"; @@ -74,6 +76,11 @@ public class XsPayServiceImpl implements XsPayService { private static final String BAOGUAN_SER_CODE = "101017"; + //支付申请服务代码 serCode + private static final String REGISTER_SHARE_SER_CODE = "101015"; + + private static final String SHARE_GETMONEY_SER_CODE = "101019"; + @Override public Map gotoPay(String orderFormid, BigDecimal money, String openid, String ip, Integer type, Integer huabeiPeriod) throws CoBusinessException, Exception { @@ -250,6 +257,36 @@ public class XsPayServiceImpl implements XsPayService { // return jsonString; // } + + /** + * 注册新生支付信息 + * @param operationType 0-初始化 1-新增 2-修改 + * @return + */ + @Override + public String registerByXs(Long businessId, String operationType) throws CoBusinessException { + //构建请求参数 + Map contentMap = build15ContentMap(businessId, operationType); + try { + String respMsg = XsPayUtils.requestByXs(REGISTER_SHARE_SER_CODE, contentMap); + if(StrUtil.isNotBlank(respMsg)){ + //解析响应报文并验签 + CommonUtils.verifySignRespMsg(REGISTER_SHARE_SER_CODE,respMsg); + LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); + String resMsg = responseMap.get("msg"); + String responeMsg = new String(Base64.getDecoder().decode(resMsg)); + return responeMsg; + } + } catch (CoBusinessException e) { + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new CoBusinessException("10000","注册分账信息出错", ""); + } + + return null; + } + public Map getPayRequestContentMap(String orderFormId, String payerAccount, BigDecimal money, String tradeType, String payType) throws CoBusinessException, Exception { List orderList = null; @@ -291,7 +328,7 @@ public class XsPayServiceImpl implements XsPayService { log.info("cereOrderProductList:" + new Gson().toJson(cereOrderProductList)); List shopIdList = orderList.stream().map(CereShopOrder::getShopId).distinct().collect(Collectors.toList()); - List cerePlatformShopList = cerePlatformShopservice.getByIdList(shopIdList); + List cerePlatformShopList = cerePlatformShopService.getByIdList(shopIdList); // for (CerePlatformShop cerePlatformShop : cerePlatformShopList) { // if(StringUtils.isEmpty(cerePlatformShop.getXsPayId())){ // throw new CoBusinessException("10000","商家" + cerePlatformShop.getShopName() + "未进行支付信息认证,请联系管理员", ""); @@ -299,7 +336,7 @@ public class XsPayServiceImpl implements XsPayService { // } List businessIdList = cerePlatformShopList.stream().map(CerePlatformShop::getBusinessId).distinct().collect(Collectors.toList()); - List cerePlatformBusinessList = cerePlatformBusinessservice.getByIdList(businessIdList); + List cerePlatformBusinessList = cerePlatformBusinessService.getByIdList(businessIdList); for (CerePlatformBusiness cerePlatformBusiness : cerePlatformBusinessList) { if(StringUtils.isEmpty(cerePlatformBusiness.getXsPayId())){ throw new CoBusinessException("10000","商家" + cerePlatformBusiness.getBusinessName() + "未进行支付信息认证,请联系管理员", ""); @@ -314,6 +351,24 @@ public class XsPayServiceImpl implements XsPayService { return contentMap; } + + /** + * 构建content请求参数 + * @param operationType 0-初始化 1-新增 2-修改 + * @return + */ + private Map build15ContentMap(Long businessId, String operationType) throws CoBusinessException { + Map contentMap = new LinkedHashMap<>(); + contentMap.put("subUserId", businessId.toString()); + contentMap.put("operationType", operationType); + contentMap.put("region", "0"); + contentMap.put("resv1", ""); + contentMap.put("resv2", ""); + + contentMap.put("noticeUrl", XspayConfig.BUSINESS_REGISTER_NOTICE_URL); + return contentMap; + } + /** * 构建退款content请求参数 * @return diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/CerePlatformBusinessService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/CerePlatformBusinessService.java index 8b8d389..160f746 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/CerePlatformBusinessService.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/CerePlatformBusinessService.java @@ -5,6 +5,7 @@ */ package com.shop.cereshop.app.service.business; +import com.shop.cereshop.app.page.business.PlatformBusiness; import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; import com.shop.cereshop.commons.exception.CoBusinessException; @@ -14,6 +15,8 @@ public interface CerePlatformBusinessService { CerePlatformBusiness selectByPrimaryKey(Long businessId); + PlatformBusiness getById(Long businessId) throws CoBusinessException; + CerePlatformBusiness findByBusinessName(String businessName); CerePlatformBusiness findByPhone(String businessPhone); @@ -27,4 +30,6 @@ public interface CerePlatformBusinessService { void update(CerePlatformBusiness cerePlatformBusiness) throws CoBusinessException; List getByIdList(List businessIdList); + + void registerByXs(Long businessId) throws CoBusinessException; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/impl/CerePlatformBusinessServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/impl/CerePlatformBusinessServiceImpl.java index e479462..c7d9313 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/impl/CerePlatformBusinessServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/business/impl/CerePlatformBusinessServiceImpl.java @@ -5,16 +5,24 @@ */ package com.shop.cereshop.app.service.business.impl; +import com.alibaba.fastjson.JSONObject; import com.shop.cereshop.app.dao.business.CerePlatformBusinessDAO; +import com.shop.cereshop.app.page.business.PlatformBusiness; +import com.shop.cereshop.app.page.shop.PlatformShop; +import com.shop.cereshop.app.pay.xs.service.XsPayService; import com.shop.cereshop.app.service.business.CerePlatformBusinessService; import com.shop.cereshop.app.service.log.CerePlatformLogService; import com.shop.cereshop.app.service.shop.CereShopEnterpriseService; import com.shop.cereshop.app.service.shop.CereShopIndividualBusinessesService; import com.shop.cereshop.app.service.shop.CereShopOtherOrganizationsService; import com.shop.cereshop.app.service.shop.CereShopPersonalService; +import com.shop.cereshop.commons.constant.IntegerEnum; import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; +import com.shop.cereshop.commons.domain.shop.CereShopReturn; import com.shop.cereshop.commons.exception.CoBusinessException; +import com.shop.cereshop.commons.utils.StringUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -42,12 +50,40 @@ public class CerePlatformBusinessServiceImpl implements CerePlatformBusinessServ @Autowired private CerePlatformLogService cerePlatformLogService; + @Autowired + private XsPayService xsPayService; + @Override public CerePlatformBusiness selectByPrimaryKey(Long businessId) { return cerePlatformBusinessDAO.selectByPrimaryKey(businessId); } @Override + public PlatformBusiness getById(Long businessId) throws CoBusinessException { + CerePlatformBusiness cerePlatformBusiness = cerePlatformBusinessDAO.selectByPrimaryKey(businessId); + PlatformBusiness platformBusiness = null; + if(cerePlatformBusiness!=null){ + platformBusiness = new PlatformBusiness(); + BeanUtils.copyProperties(cerePlatformBusiness, platformBusiness); + //查询认证数据 + if(IntegerEnum.getByName("主体类型-个人").equals(platformBusiness.getAuthenType())){ + //个人认证 + platformBusiness.setPersonal(cereShopPersonalService.findByBusinessId(businessId)); + }else if(IntegerEnum.getByName("主体类型-个体工商户").equals(platformBusiness.getAuthenType())){ + //个体工商户户认证 + platformBusiness.setIndividualBusinesses(cereShopIndividualBusinessesService.findByBusinessId(businessId)); + }else if(IntegerEnum.getByName("主体类型-企业").equals(platformBusiness.getAuthenType())){ + //企业认证 + platformBusiness.setEnterprise(cereShopEnterpriseService.findByBusinessId(businessId)); + }else if(IntegerEnum.getByName("主体类型-其他组织").equals(platformBusiness.getAuthenType())){ + //其他组织认证 + platformBusiness.setOtherOrganizations(cereShopOtherOrganizationsService.findByBusinessId(businessId)); + } + } + return platformBusiness; + } + + @Override public CerePlatformBusiness findByBusinessName(String businessName) { return cerePlatformBusinessDAO.findByBusinessName(businessName); } @@ -81,4 +117,27 @@ public class CerePlatformBusinessServiceImpl implements CerePlatformBusinessServ public List getByIdList(List businessIdList){ return cerePlatformBusinessDAO.getByIdList(businessIdList); } + + @Override + public void registerByXs(Long businessId) throws CoBusinessException { + CerePlatformBusiness shop=cerePlatformBusinessDAO.selectByPrimaryKey(businessId); + + if(StringUtils.isEmpty(shop.getXsPayId())){ + //如果不为空则是之前已经注册了,为空表示需要注册 + try { + String responeMsg = xsPayService.registerByXs(businessId, "0"); + JSONObject jsonObject = JSONObject.parseObject(responeMsg); + String shareParId = jsonObject.getJSONObject("content").getString("shareParId"); + shop.setXsPayId(shareParId); + CerePlatformBusiness cerePlatformBusiness = new CerePlatformBusiness(); + cerePlatformBusiness.setBusinessId(businessId); + cerePlatformBusiness.setXsPayId(shareParId); + cerePlatformBusinessDAO.updateById(cerePlatformBusiness); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CerePlatformShopServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CerePlatformShopServiceImpl.java index 966367d..e017754 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CerePlatformShopServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CerePlatformShopServiceImpl.java @@ -22,7 +22,8 @@ import com.shop.cereshop.app.service.buyer.CereBuyerShopCouponService; import com.shop.cereshop.app.service.collect.CereBuyerCollectService; import com.shop.cereshop.app.service.distributor.CereShopDistributorService; import com.shop.cereshop.app.service.product.CereShopProductService; -import com.shop.cereshop.app.service.shop.*; +import com.shop.cereshop.app.service.shop.CerePlatformShopService; +import com.shop.cereshop.app.service.shop.CereShopReturnService; import com.shop.cereshop.app.utils.AlipayUtil; import com.shop.cereshop.app.utils.WechatUtil; import com.shop.cereshop.commons.cache.product.ProductBo; @@ -71,18 +72,6 @@ public class CerePlatformShopServiceImpl implements CerePlatformShopService { private CereShopReturnService cereShopReturnService; @Autowired - private CereShopOtherOrganizationsService cereShopOtherOrganizationsService; - - @Autowired - private CereShopEnterpriseService cereShopEnterpriseService; - - @Autowired - private CereShopPersonalService cereShopPersonalService; - - @Autowired - private CereShopIndividualBusinessesService cereShopIndividualBusinessesService; - - @Autowired private CereBuyerCollectService cereBuyerCollectService; @Autowired @@ -244,20 +233,6 @@ public class CerePlatformShopServiceImpl implements CerePlatformShopService { //查询店铺退货地址信息 CereShopReturn cereShopReturn=cereShopReturnService.findByShopId(shopId); shop.setShopReturn(cereShopReturn); - //查询认证数据 - if(IntegerEnum.getByName("主体类型-个人").equals(shop.getAuthenType())){ - //个人认证 - shop.setPersonal(cereShopPersonalService.findByBusinessId(shopId)); - }else if(IntegerEnum.getByName("主体类型-个体工商户").equals(shop.getAuthenType())){ - //个体工商户户认证 - shop.setIndividualBusinesses(cereShopIndividualBusinessesService.findByBusinessId(shopId)); - }else if(IntegerEnum.getByName("主体类型-企业").equals(shop.getAuthenType())){ - //企业认证 - shop.setEnterprise(cereShopEnterpriseService.findByBusinessId(shopId)); - }else if(IntegerEnum.getByName("主体类型-其他组织").equals(shop.getAuthenType())){ - //其他组织认证 - shop.setOtherOrganizations(cereShopOtherOrganizationsService.findByBusinessId(shopId)); - } } return shop; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopEnterpriseServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopEnterpriseServiceImpl.java index 717c41a..f9fbfb1 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopEnterpriseServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopEnterpriseServiceImpl.java @@ -132,6 +132,9 @@ public class CereShopEnterpriseServiceImpl implements CereShopEnterpriseService param.setBusinessId(cereBusinessUser.getBusinessId()); cereShopEnterpriseDAO.insertSelective(param); + + cerePlatformBusinessService.registerByXs(cerePlatformBusiness.getBusinessId()); + if(user!=null){ //新增日志 cerePlatformLogService.addLog(user,"入驻申请","客户端操作","提交企业入驻申请",cerePlatformBusiness.getBusinessId(),time); diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopIndividualBusinessesServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopIndividualBusinessesServiceImpl.java index f3fae36..734472d 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopIndividualBusinessesServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopIndividualBusinessesServiceImpl.java @@ -18,8 +18,8 @@ import com.shop.cereshop.commons.constant.IntegerEnum; import com.shop.cereshop.commons.domain.business.CereBusinessUser; import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; -import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.domain.business.CereShopIndividualBusinesses; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.exception.CoBusinessException; import com.shop.cereshop.commons.utils.EncryptUtil; import com.shop.cereshop.commons.utils.TimeUtils; @@ -131,6 +131,8 @@ public class CereShopIndividualBusinessesServiceImpl implements CereShopIndividu param.setCreateTime(time); param.setBusinessId(cereBusinessUser.getBusinessId()); cereShopIndividualBusinessesDAO.insertSelective(param); + + cerePlatformBusinessService.registerByXs(cerePlatformBusiness.getBusinessId()); if(user!=null){ //新增日志 cerePlatformLogService.addLog(user,"入驻申请","客户端操作","提交个个体工商户入驻申请",cerePlatformBusiness.getBusinessId(),time); diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopOtherOrganizationsServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopOtherOrganizationsServiceImpl.java index 294bcab..9ebba41 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopOtherOrganizationsServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopOtherOrganizationsServiceImpl.java @@ -130,6 +130,8 @@ public class CereShopOtherOrganizationsServiceImpl implements CereShopOtherOrgan param.setCreateTime(time); param.setBusinessId(cereBusinessUser.getBusinessId()); cereShopOtherOrganizationsDAO.insertSelective(param); + + cerePlatformBusinessService.registerByXs(cerePlatformBusiness.getBusinessId()); if(user!=null){ //新增日志 cerePlatformLogService.addLog(user,"入驻申请","客户端操作","提交其他组织入驻申请",cerePlatformBusiness.getBusinessId(),time); diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopPersonalServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopPersonalServiceImpl.java index a4bd898..d50cd37 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopPersonalServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopPersonalServiceImpl.java @@ -129,6 +129,7 @@ public class CereShopPersonalServiceImpl implements CereShopPersonalService { param.setBusinessId(cereBusinessUser.getBusinessId()); cereShopPersonalDAO.insertParam(param); + cerePlatformBusinessService.registerByXs(cerePlatformBusiness.getBusinessId()); if(user!=null){ //新增日志 cerePlatformLogService.addLog(user,"入驻申请","客户端操作","提交个人入驻申请",cerePlatformBusiness.getBusinessId(),time); diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java index d43cc36..8e03469 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java @@ -8,6 +8,8 @@ package com.shop.cereshop.business.controller; import com.shop.cereshop.business.annotation.NoRepeatWebLog; import com.shop.cereshop.business.page.canvas.*; import com.shop.cereshop.business.page.price.ShopPriceDetail; +import com.shop.cereshop.business.page.product.CanvasBusinessProductParam; +import com.shop.cereshop.business.page.product.MemberProduct; import com.shop.cereshop.business.param.canvas.CanvasCouponParam; import com.shop.cereshop.business.param.renovation.RenovationParam; import com.shop.cereshop.business.service.activity.CerePlatformActivityService; @@ -15,6 +17,7 @@ import com.shop.cereshop.business.service.canvas.CerePlatformCanvasService; import com.shop.cereshop.business.service.price.CerePriceProductService; import com.shop.cereshop.business.service.price.CereShopPriceService; import com.shop.cereshop.business.service.product.CereProductClassifyService; +import com.shop.cereshop.business.service.product.CereProductMemberService; import com.shop.cereshop.business.service.product.CereShopProductService; import com.shop.cereshop.business.service.tool.CereShopCouponService; import com.shop.cereshop.business.utils.ContextUtil; @@ -69,6 +72,9 @@ public class CanvasController { @Autowired private CereShopPriceService cereShopPriceService; + @Autowired + private CereProductMemberService cereProductMemberService; + /** * 画布选择商品查询 * @param param @@ -147,6 +153,17 @@ public class CanvasController { } /** + * 查询会员商品数据 + * @return + */ + @GetMapping("getMemberProducts") + @ApiOperation(value = "查询会员商品数据") + public Result> getMemberProducts(CanvasBusinessProductParam param) throws CoBusinessException{ + Page page=cereProductMemberService.getMemberProducts(param); + return new Result(page); + } + + /** * 保存画布 * @return */ @@ -156,7 +173,8 @@ public class CanvasController { public Result saveCanvas(@RequestBody CerePlatformCanvas canvas, HttpServletRequest request) throws CoBusinessException{ //获取当前登录账户 CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); - canvas.setShopId(ContextUtil.getBusinessId()); + canvas.setBusinessId(ContextUtil.getBusinessId()); + canvas.setProject(ContextUtil.getProject()); cerePlatformCanvasService.saveCanvas(canvas,user); return new Result(user.getUsername(),"保存画布", GsonUtil.objectToGson(canvas)); } @@ -168,7 +186,8 @@ public class CanvasController { @GetMapping("getCanvas") @ApiOperation(value = "读取画布数据") public Result getCanvas(CerePlatformCanvas canvas) throws CoBusinessException{ - canvas.setShopId(ContextUtil.getBusinessId()); + canvas.setBusinessId(ContextUtil.getBusinessId()); + canvas.setProject(ContextUtil.getProject()); canvas=cerePlatformCanvasService.getCanvas(canvas); return new Result(canvas); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/canvas/CerePlatformCanvasDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/canvas/CerePlatformCanvasDAO.java index 4220e22..3ac62c4 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/canvas/CerePlatformCanvasDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/canvas/CerePlatformCanvasDAO.java @@ -19,8 +19,6 @@ public interface CerePlatformCanvasDAO extends BaseMapper { int updateByPrimaryKeySelective(CerePlatformCanvas record); - int updateByPrimaryKey(CerePlatformCanvas record); - CerePlatformCanvas getCanvas(CerePlatformCanvas canvas); CerePlatformCanvas checkCanvas(CerePlatformCanvas canvas); diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/product/CereProductMemberDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/product/CereProductMemberDAO.java index 2ed82ba..2f05f67 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/product/CereProductMemberDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/product/CereProductMemberDAO.java @@ -7,6 +7,8 @@ package com.shop.cereshop.business.dao.product; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.shop.cereshop.business.page.member.MemberPrice; +import com.shop.cereshop.business.page.product.CanvasBusinessProductParam; +import com.shop.cereshop.business.page.product.MemberProduct; import com.shop.cereshop.commons.domain.product.CereProductMember; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -27,4 +29,6 @@ public interface CereProductMemberDAO extends BaseMapper { void deleteByProductId(@Param("productId") Long productId); void insertBatch(@Param("list") List list); + + List getMemberProducts(CanvasBusinessProductParam param); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/product/CanvasBusinessProductParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/product/CanvasBusinessProductParam.java new file mode 100644 index 0000000..c8d3397 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/product/CanvasBusinessProductParam.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.page.product; + +import com.shop.cereshop.commons.domain.common.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 画布商品数据请求 + */ +@Data +@ApiModel(value = "CanvasAdminProductParam", description = "画布商品数据请求") +public class CanvasBusinessProductParam extends PageParam { + + /** + * 搜索字段 + */ + @ApiModelProperty(value = "搜索字段") + private String search; + + /** + * 是否上架 1-上架 0-不上架 + */ + @ApiModelProperty(value = "是否上架 1-上架 0-不上架") + private String shelveState; + + /** + * 分类id + */ + @ApiModelProperty(value = "分类id") + private Long classifyId; + + /** + * 店铺id + */ + @ApiModelProperty(value = "店铺id") + private Long shopId; + + /** + * 活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动 + */ + @ApiModelProperty(value = "活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动") + private Integer type; + + /** + * 商品id数组 + */ + @ApiModelProperty(value = "商品id数组") + private List ids; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/product/MemberProduct.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/product/MemberProduct.java new file mode 100644 index 0000000..139e6a7 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/product/MemberProduct.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.page.product; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 画布会员商品数据 + */ +@Data +@ApiModel(value = "MemberProduct", description = "画布会员商品数据") +public class MemberProduct { + + /** + * 店铺id + */ + @ApiModelProperty(value = "店铺id") + private Long shopId; + + /** + * 店铺名称 + */ + @ApiModelProperty(value = "店铺名称") + private String shopName; + + /** + * 店铺LOGO + */ + @ApiModelProperty(value = "店铺LOGO") + private String shopLogo; + + /** + * 产品ID + */ + @ApiModelProperty(value = "产品ID") + private Long productId; + + /** + * 优惠方式 1-折扣 2-指定价格 + */ + private Integer mode; + + /** + * 会员等级id + */ + @ApiModelProperty(value = "会员等级id") + private Long memberLevelId; + + /** + * 会员等级名称 + */ + @ApiModelProperty(value = "会员等级名称") + private String memberLevelName; + + /** + * 规格id + */ + @ApiModelProperty(value = "规格id") + private Long skuId; + + /** + * 产品名称 + */ + @ApiModelProperty(value = "产品名称") + private String productName; + + /** + * 产品主图 + */ + @ApiModelProperty(value = "产品主图") + private String image; + + /** + * 商品原价 + */ + @ApiModelProperty(value = "商品原价") + private BigDecimal originalPrice; + + /** + * 商品会员价元/折扣 + */ + @ApiModelProperty(value = "商品会员价元/折扣") + private BigDecimal discount; + + /** + * 售价 + */ + @ApiModelProperty(value = "售价") + private BigDecimal price; + + /** + * 库存 + */ + @ApiModelProperty(value = "库存") + private Integer stockNumber; + + /** + * 销量 + */ + @ApiModelProperty(value = "销量") + private Integer number; + + /** + * 付款人数 + */ + @ApiModelProperty(value = "付款人数") + private Integer users; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/permission/impl/CerePlatformPermissionServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/permission/impl/CerePlatformPermissionServiceImpl.java index 2e3e757..814ceae 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/permission/impl/CerePlatformPermissionServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/permission/impl/CerePlatformPermissionServiceImpl.java @@ -25,6 +25,7 @@ import com.shop.cereshop.commons.domain.permission.CerePlatformPermission; import com.shop.cereshop.commons.exception.CoBusinessException; import com.shop.cereshop.commons.utils.EmptyUtils; import com.shop.cereshop.commons.utils.TimeUtils; +import jodd.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; @@ -161,6 +162,7 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission List childs=cerePlatformPermissionDAO.findAllCatalogByUserIdAndResourceType(user.getBusinessUserId(),StringEnum.MENU.getCode(),user.getBusinessId()); //查询所有按钮权限 List buttons=cerePlatformPermissionDAO.findAllCatalogByUserIdAndResourceType(user.getBusinessUserId(),StringEnum.BUTTON.getCode(),user.getBusinessId()); + if(!EmptyUtils.isEmpty(list)){ Map map=new HashMap<>(); list.forEach((permission -> { @@ -169,6 +171,9 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission meta.setIcon(permission.getIcon()); permission.setMeta(meta); setUserMenuChildsIndex(permission,childs,map,buttons); + if(StringUtil.isNotEmpty(permission.getPath())){ + permission.setPath(permission.getPath().replace("${project}", ContextUtil.getProject())); + } })); } return list; @@ -206,6 +211,12 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission //过滤不是当前菜单的子级按钮 .filter(button -> button.getPermissionPid().equals(sysPermission.getPermissionId())) .collect(Collectors.toList()); + for (MenuButton menuButton : collect) { + if(StringUtil.isNotEmpty(menuButton.getPath())){ + menuButton.setPath(menuButton.getPath().replace("${project}", ContextUtil.getProject())); + } + } + sysPermission.setButtons(collect); } if(parent.getPermissionId().equals(sysPermission.getPermissionPid())){ @@ -217,6 +228,9 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission meta.setTitle(itemPermission.getPermissionName()); meta.setIcon(itemPermission.getIcon()); itemPermission.setMeta(meta); + if(StringUtil.isNotEmpty(itemPermission.getPath())){ + itemPermission.setPath(itemPermission.getPath().replace("${project}", ContextUtil.getProject())); + } childs.add(itemPermission); //判断当前是否回到最高级菜单节点 if(parent.getResourceType().equals(StringEnum.CATALOG.getCode())){ diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/CereProductMemberService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/CereProductMemberService.java index 1c58795..e287fa2 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/CereProductMemberService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/CereProductMemberService.java @@ -7,7 +7,10 @@ package com.shop.cereshop.business.service.product; import com.shop.cereshop.business.page.member.MemberPrice; import com.shop.cereshop.business.page.member.ProductMember; +import com.shop.cereshop.business.page.product.CanvasBusinessProductParam; +import com.shop.cereshop.commons.domain.common.Page; import com.shop.cereshop.commons.domain.product.CereProductMember; +import com.shop.cereshop.commons.exception.CoBusinessException; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -23,4 +26,6 @@ public interface CereProductMemberService { void deleteByProductId(Long productId); void insertBatch(List members); + + Page getMemberProducts(CanvasBusinessProductParam param) throws CoBusinessException; } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductMemberServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductMemberServiceImpl.java index 57448ec..9fe5240 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductMemberServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductMemberServiceImpl.java @@ -5,13 +5,22 @@ */ package com.shop.cereshop.business.service.product.impl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.shop.cereshop.business.dao.product.CereProductMemberDAO; import com.shop.cereshop.business.page.member.MemberPrice; +import com.shop.cereshop.business.page.product.CanvasBusinessProductParam; +import com.shop.cereshop.business.page.product.MemberProduct; import com.shop.cereshop.business.service.product.CereProductMemberService; +import com.shop.cereshop.commons.constant.IntegerEnum; +import com.shop.cereshop.commons.domain.common.Page; import com.shop.cereshop.commons.domain.product.CereProductMember; +import com.shop.cereshop.commons.exception.CoBusinessException; +import com.shop.cereshop.commons.utils.EmptyUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.util.List; @Service @@ -46,4 +55,26 @@ public class CereProductMemberServiceImpl implements CereProductMemberService { public void insertBatch(List members) { cereProductMemberDAO.insertBatch(members); } + + @Override + public Page getMemberProducts(CanvasBusinessProductParam param) throws CoBusinessException { + PageHelper.startPage(param.getPage(),param.getPageSize()); + List list=cereProductMemberDAO.getMemberProducts(param); + if(!EmptyUtils.isEmpty(list)){ + BigDecimal decimal=new BigDecimal(100); + list.forEach(product -> { + //设置会员价格 + if(IntegerEnum.MEMBER_PRODUCT_MODE_DISCOUNT.getCode().equals(product.getMode())){ + //如果是折扣,计算会员价 + BigDecimal discount=product.getDiscount().divide(decimal,2,BigDecimal.ROUND_HALF_UP); + product.setPrice(product.getPrice().multiply(discount).setScale(2,BigDecimal.ROUND_HALF_UP)); + }else { + product.setPrice(product.getDiscount()); + } + }); + } + PageInfo pageInfo=new PageInfo<>(list); + Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); + return page; + } } diff --git a/cereshop-business/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml index ba580c6..0c7c708 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml @@ -7,13 +7,15 @@ + + - canvas_id, terminal, json, type, name, shop_id, custom_id, create_time, update_time + canvas_id, terminal, json, type, name, business_id, shop_id, custom_id, project, create_time, update_time diff --git a/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductMemberDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductMemberDAO.xml index 0d5abb0..39179ec 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductMemberDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductMemberDAO.xml @@ -90,4 +90,54 @@ ) + + diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/canvas/CerePlatformCanvas.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/canvas/CerePlatformCanvas.java index 0444f2c..cefaca7 100644 --- a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/canvas/CerePlatformCanvas.java +++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/canvas/CerePlatformCanvas.java @@ -49,6 +49,12 @@ public class CerePlatformCanvas implements Serializable { private String name; /** + * 商家id + */ + @ApiModelProperty("商家id") + private Long businessId; + + /** * 店铺id */ @ApiModelProperty("店铺id") diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/permission/CerePlatformPermission.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/permission/CerePlatformPermission.java index 7cd74db..cac04a1 100644 --- a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/permission/CerePlatformPermission.java +++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/permission/CerePlatformPermission.java @@ -8,11 +8,15 @@ package com.shop.cereshop.commons.domain.permission; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.google.gson.Gson; +import com.shop.cereshop.commons.utils.StringUtils; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.util.Map; /** * cere_platform_permission 权限实体类 @@ -96,6 +100,29 @@ public class CerePlatformPermission implements Serializable { @ApiModelProperty(value = "更新时间") private String updateTime; + /** + * 名称Json + */ + @ApiModelProperty(value = "名称Json") + private String permissionNameJson; + + /** + * 名称Map + */ + @ApiModelProperty(value = "名称Map") + @TableField(exist = false) + private Map permissionNameMap; + private static final long serialVersionUID = 1L; + public void initData(){ + Map permissionNameMap = null; + if(StringUtils.isNotEmpty(getPermissionNameJson())){ + permissionNameMap = new Gson().fromJson(getPermissionNameJson(), Map.class); + } + if(CollectionUtils.isEmpty(permissionNameMap)){ + permissionNameMap.put("zh-CN", getPermissionName()); + } + } + }