Browse Source

修改支持多语言菜单

multiwx
xh-pan1 1 year ago
parent
commit
d5304260e8
  1. 5
      cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CanvasController.java
  2. 29
      cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/MenuButton.java
  3. 26
      cereshop-admin/src/main/java/com/shop/cereshop/admin/page/permission/Permission.java
  4. 7
      cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionSaveParam.java
  5. 8
      cereshop-admin/src/main/java/com/shop/cereshop/admin/param/permission/PermissionUpdateParam.java
  6. 43
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/permission/impl/CerePlatformPermissionServiceImpl.java
  7. 28
      cereshop-admin/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml
  8. 26
      cereshop-admin/src/main/resources/mybatis/mapper/permission/CerePlatformPermissionDAO.xml
  9. 44
      cereshop-app/src/main/java/com/shop/cereshop/app/page/business/PlatformBusiness.java
  10. 24
      cereshop-app/src/main/java/com/shop/cereshop/app/page/shop/PlatformShop.java
  11. 11
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java
  12. 63
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java
  13. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/business/CerePlatformBusinessService.java
  14. 59
      cereshop-app/src/main/java/com/shop/cereshop/app/service/business/impl/CerePlatformBusinessServiceImpl.java
  15. 29
      cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CerePlatformShopServiceImpl.java
  16. 3
      cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopEnterpriseServiceImpl.java
  17. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopIndividualBusinessesServiceImpl.java
  18. 2
      cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopOtherOrganizationsServiceImpl.java
  19. 1
      cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopPersonalServiceImpl.java
  20. 23
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java
  21. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/canvas/CerePlatformCanvasDAO.java
  22. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/product/CereProductMemberDAO.java
  23. 57
      cereshop-business/src/main/java/com/shop/cereshop/business/page/product/CanvasBusinessProductParam.java
  24. 115
      cereshop-business/src/main/java/com/shop/cereshop/business/page/product/MemberProduct.java
  25. 14
      cereshop-business/src/main/java/com/shop/cereshop/business/service/permission/impl/CerePlatformPermissionServiceImpl.java
  26. 5
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/CereProductMemberService.java
  27. 31
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductMemberServiceImpl.java
  28. 33
      cereshop-business/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml
  29. 50
      cereshop-business/src/main/resources/mybatis/mapper/product/CereProductMemberDAO.xml
  30. 6
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/canvas/CerePlatformCanvas.java
  31. 27
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/permission/CerePlatformPermission.java

5
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);
}

29
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<MenuButton> buttons;
/**
* 名称Json
*/
@ApiModelProperty(value = "名称Json")
private String permissionNameJson;
/**
* 名称Map
*/
@ApiModelProperty(value = "名称Map")
@TableField(exist = false)
private Map<String,String> permissionNameMap;
public void initData(){
Map<String,String> permissionNameMap = null;
if(StringUtils.isNotEmpty(getPermissionNameJson())){
permissionNameMap = new Gson().fromJson(getPermissionNameJson(), Map.class);
}
if(CollectionUtils.isEmpty(permissionNameMap)){
permissionNameMap.put("zh-CN", getPermissionName());
}
}
}

26
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<Permission> buttonPermissions;
/**
* 名称Json
*/
@ApiModelProperty(value = "名称Json")
private String permissionNameJson;
/**
* 名称Map
*/
@ApiModelProperty(value = "名称Map")
private Map<String,String> permissionNameMap;
public void initData(){
Map<String,String> permissionNameMap = null;
if(StringUtils.isNotEmpty(getPermissionNameJson())){
permissionNameMap = new Gson().fromJson(getPermissionNameJson(), Map.class);
}
if(CollectionUtils.isEmpty(permissionNameMap)){
permissionNameMap.put("zh-CN", getPermissionName());
}
}
}

7
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<String,String> permissionNameMap;
}

8
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<String,String> permissionNameMap;
}

43
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<String,String> 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<String,String> 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<String,Integer> 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<Permission> pageInfo=new PageInfo<>(list);
@ -142,6 +163,10 @@ public class CerePlatformPermissionServiceImpl implements CerePlatformPermission
if(!EmptyUtils.isEmpty(list)){
Map<String,Integer> 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<String,Integer> 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<String,Integer> 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());

28
cereshop-admin/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml

@ -7,13 +7,15 @@
<result column="json" jdbcType="VARCHAR" property="json" />
<result column="type" jdbcType="BIT" property="type" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="business_id" jdbcType="BIGINT" property="businessId" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="custom_id" jdbcType="BIGINT" property="customId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="create_time" jdbcType="VARCHAR" property="createTime" />
<result column="update_time" jdbcType="VARCHAR" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
@ -44,12 +46,18 @@
<if test="name != null">
name,
</if>
<if test="businessId != null">
business_id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="customId != null">
custom_id,
</if>
<if test="project != null">
project,
</if>
<if test="createTime != null">
create_time,
</if>
@ -70,12 +78,18 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="businessId != null">
#{businessId,jdbcType=BIGINT},
</if>
<if test="shopId != null">
#{shopId,jdbcType=BIGINT},
</if>
<if test="customId != null">
#{customId,jdbcType=BIGINT},
</if>
<if test="project != null">
#{project,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=VARCHAR},
</if>
@ -99,12 +113,18 @@
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="businessId != null">
business_id = #{businessId,jdbcType=BIGINT},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=BIGINT},
</if>
<if test="customId != null">
custom_id = #{customId,jdbcType=BIGINT},
</if>
<if test="project != null">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=VARCHAR},
</if>
@ -126,12 +146,18 @@
<if test="name != null">
and name = #{name,jdbcType=VARCHAR}
</if>
<if test="businessId != null">
and business_id = #{businessId,jdbcType=BIGINT}
</if>
<if test="shopId != null">
and shop_id = #{shopId,jdbcType=BIGINT}
</if>
<if test="customId != null">
and custom_id = #{customId,jdbcType=BIGINT}
</if>
<if test="project != null">
and project = #{project,jdbcType=VARCHAR}
</if>
<if test="createTime != null">
and create_time = #{createTime,jdbcType=VARCHAR}
</if>

26
cereshop-admin/src/main/resources/mybatis/mapper/permission/CerePlatformPermissionDAO.xml

@ -5,6 +5,7 @@
<id column="permission_id" jdbcType="BIGINT" property="permissionId" />
<result column="permission_pid" jdbcType="BIGINT" property="permissionPid" />
<result column="permission_name" jdbcType="VARCHAR" property="permissionName" />
<result column="permission_name_json" jdbcType="VARCHAR" property="permissionNameJson" />
<result column="permission_uri" jdbcType="VARCHAR" property="permissionUri" />
<result column="permission" jdbcType="VARCHAR" property="permission" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
@ -16,7 +17,7 @@
<result column="update_time" jdbcType="VARCHAR" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
permission_id, permission_pid, permission_name, permission_uri, permission, icon,
permission_id, permission_pid, permission_name, permission_name_json, permission_uri, permission, icon,
`describe`, resource_type, sort, project, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@ -38,6 +39,9 @@
<if test="permissionName != null and permissionName!=''">
permission_name,
</if>
<if test="permissionNameJson != null and permissionNameJson!=''">
permission_name_json,
</if>
<if test="permissionUri != null and permissionUri!=''">
permission_uri,
</if>
@ -73,6 +77,9 @@
<if test="permissionName != null and permissionName!=''">
#{permissionName,jdbcType=VARCHAR},
</if>
<if test="permissionNameJson != null and permissionNameJson!=''">
#{permissionNameJson,jdbcType=VARCHAR},
</if>
<if test="permissionUri != null and permissionUri!=''">
#{permissionUri,jdbcType=VARCHAR},
</if>
@ -111,6 +118,9 @@
<if test="permissionName != null and permissionName!=''">
permission_name = #{permissionName,jdbcType=VARCHAR},
</if>
<if test="permissionNameJson != null and permissionNameJson!=''">
permission_name_json = #{permissionNameJson,jdbcType=VARCHAR},
</if>
<if test="permissionUri != null and permissionUri!=''">
permission_uri = #{permissionUri,jdbcType=VARCHAR},
</if>
@ -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 @@
</update>
<select id="getById" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.permission.CerePlatformPermission">
SELECT permission_id,permission_pid,permission_name,permission_uri,permission,icon,`describe`,resource_type,sort FROM cere_platform_permission where permission_id=#{permissionId}
SELECT permission_id,permission_pid,permission_name, permission_name_json, permission_uri,permission,icon,`describe`,resource_type,sort FROM cere_platform_permission where permission_id=#{permissionId}
</select>
<select id="findAllByResourceType" parameterType="java.lang.Object" resultType="com.shop.cereshop.admin.page.permission.Permission">
SELECT permission_id,permission_pid,permission_name,permission_uri,permission,icon,`describe`,resource_type,sort FROM cere_platform_permission
SELECT permission_id,permission_pid,permission_name, permission_name_json, permission_uri,permission,icon,`describe`,resource_type,sort FROM cere_platform_permission
where project=1 and resource_type=#{resourceType}
<if test="permissionName!=null and permissionName!=''">
and permission_name like concat('%',#{permissionName},'%')
@ -171,7 +182,7 @@
</select>
<select id="findChilds" parameterType="java.lang.Object" resultType="com.shop.cereshop.admin.page.permission.Permission">
SELECT permission_id,permission_pid,permission_name,permission_uri,permission,icon,`describe`,resource_type,sort FROM cere_platform_permission
SELECT permission_id,permission_pid,permission_name,permission_name_json, permission_uri,permission,icon,`describe`,resource_type,sort FROM cere_platform_permission
where project=1 and resource_type in ('menu','button')
<if test="permissionName!=null and permissionName!=''">
and permission_name like concat('%',#{permissionName},'%')
@ -184,7 +195,7 @@
</select>
<select id="findAllCatalogByUserIdAndResourceType" parameterType="java.lang.Object" resultType="com.shop.cereshop.admin.page.permission.MenuButton">
SELECT a.permission_id,a.permission_pid,a.permission_name,a.permission path,a.icon,a.resource_type FROM cere_platform_permission a
SELECT a.permission_id,a.permission_pid,a.permission_name,a.permission_name_json,a.permission path,a.icon,a.resource_type FROM cere_platform_permission a
LEFT JOIN cere_platform_role_permission b ON a.permission_id=b.permission_id
LEFT JOIN cere_platform_user_role c ON b.role_id=c.role_id
where project=1 and resource_type=#{resourceType} and c.platform_user_id=#{platformUserId}
@ -193,7 +204,7 @@
</select>
<select id="findAllCatalogByResourceType" parameterType="java.lang.Object" resultType="com.shop.cereshop.admin.page.permission.MenuButton">
SELECT permission_id,permission_pid,permission_name,permission path,icon,resource_type FROM cere_platform_permission
SELECT permission_id,permission_pid,permission_name,permission_name_json,permission path,icon,resource_type FROM cere_platform_permission
where project=0 and resource_type=#{resourceType}
ORDER BY sort
</select>
@ -224,7 +235,7 @@
</select>
<insert id="insertBatch" parameterType="java.util.ArrayList">
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},

44
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;
}

24
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;
}

11
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;
}

63
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<String, String> 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<String, Object> 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<String,String> responseMap = JSONObject.parseObject(respMsg,new TypeReference<LinkedHashMap<String,String>>(){}, 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<String, Object> getPayRequestContentMap(String orderFormId, String payerAccount, BigDecimal money, String tradeType, String payType) throws CoBusinessException, Exception {
List<CereShopOrder> orderList = null;
@ -291,7 +328,7 @@ public class XsPayServiceImpl implements XsPayService {
log.info("cereOrderProductList:" + new Gson().toJson(cereOrderProductList));
List<Long> shopIdList = orderList.stream().map(CereShopOrder::getShopId).distinct().collect(Collectors.toList());
List<CerePlatformShop> cerePlatformShopList = cerePlatformShopservice.getByIdList(shopIdList);
List<CerePlatformShop> 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<Long> businessIdList = cerePlatformShopList.stream().map(CerePlatformShop::getBusinessId).distinct().collect(Collectors.toList());
List<CerePlatformBusiness> cerePlatformBusinessList = cerePlatformBusinessservice.getByIdList(businessIdList);
List<CerePlatformBusiness> 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<String,Object> build15ContentMap(Long businessId, String operationType) throws CoBusinessException {
Map<String, Object> 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

5
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<CerePlatformBusiness> getByIdList(List<Long> businessIdList);
void registerByXs(Long businessId) throws CoBusinessException;
}

59
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<CerePlatformBusiness> getByIdList(List<Long> 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);
}
}
}
}

29
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;
}

3
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);

4
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);

2
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);

1
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);

23
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<Page<MemberProduct>> 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);
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/canvas/CerePlatformCanvasDAO.java

@ -19,8 +19,6 @@ public interface CerePlatformCanvasDAO extends BaseMapper<CerePlatformCanvas> {
int updateByPrimaryKeySelective(CerePlatformCanvas record);
int updateByPrimaryKey(CerePlatformCanvas record);
CerePlatformCanvas getCanvas(CerePlatformCanvas canvas);
CerePlatformCanvas checkCanvas(CerePlatformCanvas canvas);

4
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<CereProductMember> {
void deleteByProductId(@Param("productId") Long productId);
void insertBatch(@Param("list") List<CereProductMember> list);
List<MemberProduct> getMemberProducts(CanvasBusinessProductParam param);
}

57
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<Long> ids;
}

115
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;
}

14
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<MenuButton> childs=cerePlatformPermissionDAO.findAllCatalogByUserIdAndResourceType(user.getBusinessUserId(),StringEnum.MENU.getCode(),user.getBusinessId());
//查询所有按钮权限
List<MenuButton> buttons=cerePlatformPermissionDAO.findAllCatalogByUserIdAndResourceType(user.getBusinessUserId(),StringEnum.BUTTON.getCode(),user.getBusinessId());
if(!EmptyUtils.isEmpty(list)){
Map<String,Integer> 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())){

5
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<CereProductMember> members);
Page getMemberProducts(CanvasBusinessProductParam param) throws CoBusinessException;
}

31
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<CereProductMember> members) {
cereProductMemberDAO.insertBatch(members);
}
@Override
public Page getMemberProducts(CanvasBusinessProductParam param) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
List<MemberProduct> 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<MemberProduct> pageInfo=new PageInfo<>(list);
Page page=new Page(pageInfo.getList(),pageInfo.getTotal());
return page;
}
}

33
cereshop-business/src/main/resources/mybatis/mapper/canvas/CerePlatformCanvasDAO.xml

@ -7,13 +7,15 @@
<result column="json" jdbcType="VARCHAR" property="json" />
<result column="type" jdbcType="BIT" property="type" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="business_id" jdbcType="BIGINT" property="businessId" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="custom_id" jdbcType="BIGINT" property="customId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="create_time" jdbcType="VARCHAR" property="createTime" />
<result column="update_time" jdbcType="VARCHAR" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
@ -40,12 +42,18 @@
<if test="name != null">
name,
</if>
<if test="businessId != null">
business_id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="customId != null">
custom_id,
</if>
<if test="project != null">
project,
</if>
<if test="createTime != null">
create_time,
</if>
@ -66,12 +74,18 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="businessId != null">
#{businessId,jdbcType=BIGINT},
</if>
<if test="shopId != null">
#{shopId,jdbcType=BIGINT},
</if>
<if test="customId != null">
#{customId,jdbcType=BIGINT},
</if>
<if test="project != null">
#{project,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=VARCHAR},
</if>
@ -95,12 +109,18 @@
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="businessId != null">
business_id = #{businessId,jdbcType=BIGINT},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=BIGINT},
</if>
<if test="customId != null">
custom_id = #{customId,jdbcType=BIGINT},
</if>
<if test="project != null">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=VARCHAR},
</if>
@ -122,12 +142,18 @@
<if test="name != null">
and name = #{name,jdbcType=VARCHAR}
</if>
<if test="businessId != null">
and business_id = #{businessId,jdbcType=BIGINT}
</if>
<if test="shopId != null">
and shop_id = #{shopId,jdbcType=BIGINT}
</if>
<if test="customId != null">
and custom_id = #{customId,jdbcType=BIGINT}
</if>
<if test="project != null">
and project = #{project,jdbcType=VARCHAR}
</if>
<if test="createTime != null">
and create_time = #{createTime,jdbcType=VARCHAR}
</if>
@ -138,6 +164,9 @@
</select>
<select id="checkCanvas" parameterType="com.shop.cereshop.commons.domain.canvas.CerePlatformCanvas" resultType="com.shop.cereshop.commons.domain.canvas.CerePlatformCanvas">
SELECT * FROM cere_platform_canvas where terminal=#{terminal} and type=#{type} and shop_id=#{shopId}
SELECT * FROM cere_platform_canvas
where
terminal=#{terminal}
and type=#{type} and shop_id=#{shopId}
</select>
</mapper>

50
cereshop-business/src/main/resources/mybatis/mapper/product/CereProductMemberDAO.xml

@ -90,4 +90,54 @@
)
</foreach>
</insert>
<select id="getMemberProducts" parameterType="com.shop.cereshop.business.page.product.CanvasBusinessProductParam"
resultType="com.shop.cereshop.business.page.product.MemberProduct">
SELECT
d.shop_id,
d.shop_name,
a.product_id,
s.product_name,
a.mode,
x.users,
d.shop_logo,
IF(h.image IS NULL OR h.image='',c.product_image,h.image) image,a.member_level_id,y.member_level_name,
MIN(a.price) discount,b.price,b.sku_id,b.original_price,IF(f.number IS NULL,0,f.number) number,b.stock_number from cere_product_member a
LEFT JOIN cere_shop_product s ON a.product_id=s.product_id
LEFT JOIN cere_product_sku b ON a.sku_id=b.sku_id
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b
where a.product_id=b.product_id GROUP BY a.product_id) c ON a.product_id=c.product_id
LEFT JOIN cere_platform_shop d ON s.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON s.classify_id=e.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON a.sku_id=f.sku_id
LEFT JOIN cere_shop_order g ON f.order_id=g.order_id and g.state in (2,3,4)
LEFT JOIN (SELECT a.sku_id,a.image from cere_sku_name a,cere_product_sku b where a.sku_id=b.sku_id LIMIT 1) h ON a.sku_id=h.sku_id
LEFT JOIN (SELECT COUNT(a.buyer_user_id) users,a.product_id FROM (SELECT b.buyer_user_id,a.product_id FROM cere_order_product a,cere_shop_order b
where a.order_id=b.order_id and b.state in (2,3,4) GROUP BY a.product_id,b.buyer_user_id) a GROUP BY a.product_id) x ON a.product_id=x.product_id
LEFT JOIN cere_platform_member_level y ON a.member_level_id=y.member_level_id
where s.shelve_state=1
<if test="shopId!=null">
and s.shop_id=#{shopId}
</if>
<if test="search!=null and search!=''">
and (d.shop_name like concat('%',#{search},'%') OR
a.product_id like concat('%',#{search},'%') OR
s.product_name like concat('%',#{search},'%'))
</if>
<if test="shelveState!=null">
and s.shelve_state=#{shelveState}
</if>
<if test="classifyId!=null">
and (s.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<if test="ids!=null and ids.size()>0">
and a.product_id in (
<foreach collection="ids" item="id" index="index" separator=",">
#{id}
</foreach>
)
</if>
GROUP BY a.product_id
ORDER BY number DESC
</select>
</mapper>

6
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")

27
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<String,String> permissionNameMap;
private static final long serialVersionUID = 1L;
public void initData(){
Map<String,String> permissionNameMap = null;
if(StringUtils.isNotEmpty(getPermissionNameJson())){
permissionNameMap = new Gson().fromJson(getPermissionNameJson(), Map.class);
}
if(CollectionUtils.isEmpty(permissionNameMap)){
permissionNameMap.put("zh-CN", getPermissionName());
}
}
}
Loading…
Cancel
Save