diff --git a/Cpop-Common/src/main/java/com/cpop/common/utils/JsonUtils.java b/Cpop-Common/src/main/java/com/cpop/common/utils/JsonUtils.java new file mode 100644 index 0000000..b40f920 --- /dev/null +++ b/Cpop-Common/src/main/java/com/cpop/common/utils/JsonUtils.java @@ -0,0 +1,29 @@ +package com.cpop.common.utils; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * @author Binary Wang + */ +public class JsonUtils { + private static final ObjectMapper JSON = new ObjectMapper(); + + static { + JSON.setSerializationInclusion(Include.NON_NULL); + JSON.configure(SerializationFeature.INDENT_OUTPUT, Boolean.TRUE); + } + + public static String toJson(Object obj) { + try { + return JSON.writeValueAsString(obj); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + + return null; + } +} + diff --git a/Cpop-Common/src/main/java/com/cpop/common/utils/ServletUtils.java b/Cpop-Common/src/main/java/com/cpop/common/utils/ServletUtils.java index 3d3fc8f..8a847d9 100644 --- a/Cpop-Common/src/main/java/com/cpop/common/utils/ServletUtils.java +++ b/Cpop-Common/src/main/java/com/cpop/common/utils/ServletUtils.java @@ -2,6 +2,7 @@ package com.cpop.common.utils; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.text.Convert; +import com.sun.xml.internal.ws.util.UtilException; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -56,7 +57,7 @@ public class ServletUtils { } parameter = json.getString(name); } catch (IOException e) { - throw new RuntimeException(e); + throw new UtilException("获取分页参数失败!"); } } return Convert.toInt(parameter); diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/enums/OrderSource.java b/Cpop-Core/src/main/java/com/cpop/core/base/enums/OrderSource.java new file mode 100644 index 0000000..18791b7 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/base/enums/OrderSource.java @@ -0,0 +1,36 @@ +package com.cpop.core.base.enums; + +import lombok.Getter; +import lombok.Setter; + +/** + * 订单来源 + */ +@Getter +public enum OrderSource { + + /** + * 商城 + */ + MALL("Mall",0.06); + + OrderSource(String name, Double rate) { + this.rate = rate; + this.name = name; + } + + /** + * 分账比例 + */ + private Double rate; + + private String name; + + public void setRate(Double rate) { + this.rate = rate; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java b/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java index 2822efa..66b82fd 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java @@ -86,7 +86,7 @@ public class SysUser extends BaseEntity implements Serializable { /** * 用户类型 */ - private UserType userType; + private String userType; /** * 逻辑删除(0否1是) diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniUserLoginInfoBuild.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniUserLoginInfoBuild.java index 1be508f..f9b1456 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniUserLoginInfoBuild.java +++ b/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniUserLoginInfoBuild.java @@ -93,7 +93,7 @@ public class MiniUserLoginInfoBuild extends AbstractLoginInfoBuild { .and("cmu.app_id = ?",credentials.get("appId")) .and("cmu.open_id = ?",credentials.get("openId")) //用户来源 - .and("cmu.source_type = ?",sourceType) + .and("cmu.source_type = ?",sourceType.toString()) .and("cmu.is_delete = 0") .one(); if (row == null) { @@ -110,7 +110,7 @@ public class MiniUserLoginInfoBuild extends AbstractLoginInfoBuild { //保存小程序用户信息 LocalDateTime now = LocalDateTime.now(); RowKey snowFlakeId = RowKey.SNOW_FLAKE_ID; - DbChain.table("cp_mini_user") + boolean save = DbChain.table("cp_mini_user") .setId(snowFlakeId) .set("user_id", loginInfo.getUserId()) .set("open_id", credentials.get("openId")) @@ -118,20 +118,22 @@ public class MiniUserLoginInfoBuild extends AbstractLoginInfoBuild { .set("brand_id", brand.getString("id")) .set("nick_name", credentials.get("nickName")) .set("avatar", credentials.get("avatar")) - .set("source_type", sourceType) + .set("source_type", sourceType.toString()) .set("create_time", now) .set("update_time", now) .set("create_user_id", 1) .set("update_user_id", 1) .save(); - loginInfo.setOpenId((String) credentials.get("openId")) - .setAppId((String) credentials.get("appId")) - .setUserId(loginInfo.getUserId()) - .setBrandId(brand.getString("id")) - .setNickName((String) credentials.get("nickName")) - .setAvatar((String) credentials.get("avatar")) - .setId(snowFlakeId.getValue()) - .setSourceType(sourceType); + if (save){ + loginInfo.setOpenId((String) credentials.get("openId")) + .setAppId((String) credentials.get("appId")) + .setUserId(loginInfo.getUserId()) + .setBrandId(brand.getString("id")) + .setNickName((String) credentials.get("nickName")) + .setAvatar((String) credentials.get("avatar")) + .setId(snowFlakeId.getValue()) + .setSourceType(sourceType); + } } else { loginInfo.setOpenId(row.getString("openId")) .setAppId(row.getString("appId")) diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysLoginInfoBuild.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysLoginInfoBuild.java index f8e67ac..8f5fab4 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysLoginInfoBuild.java +++ b/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysLoginInfoBuild.java @@ -8,6 +8,7 @@ import com.cpop.core.base.entity.Permission; import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo; import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; import com.cpop.core.base.enums.SourceType; +import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.CpopAuthenticationException; import com.cpop.core.base.table.SysUser; import com.mybatisflex.core.row.DbChain; @@ -29,7 +30,7 @@ public class SysLoginInfoBuild extends AbstractLoginInfoBuild { @Override public LoginUser buildLoginUser(SysUser sysUser, Map credentials) { - switch (sysUser.getUserType()) { + switch (UserType.valueOf(sysUser.getUserType())) { case OAM_USER: return getOamStaffLoginInfo(sysUser); case MALL_USER: diff --git a/Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java b/Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java index e083c5e..47f693b 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java +++ b/Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java @@ -32,7 +32,7 @@ public interface CoreMapper { * @Author DB * @Date: 2023/8/27 23:39 */ - SysUser getSysUserByUsername(@Param("username") String username, @Param("userType") UserType userType); + SysUser getSysUserByUsername(@Param("username") String username, @Param("userType") String userType); /** * @Description: 更新登录地址 @@ -42,7 +42,7 @@ public interface CoreMapper { * @author DB * @Date: 2023/8/28 0028 13:49 */ - void updateSysUserLoginIp(String ipAddr, String username, UserType userType); + void updateSysUserLoginIp(String ipAddr, String username, String userType); /** * @Description: 加载参数缓存数据 @@ -129,5 +129,5 @@ public interface CoreMapper { * @Author: DB * @Date: 2023/8/27 23:37 */ - SysUser getSysUserByPhone(@Param("phoneNumber") String phoneNumber, @Param("userType") UserType userType); + SysUser getSysUserByPhone(@Param("phoneNumber") String phoneNumber, @Param("userType") String userType); } diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/RedisService.java b/Cpop-Core/src/main/java/com/cpop/core/service/RedisService.java index 0a3a566..b5abafe 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/service/RedisService.java +++ b/Cpop-Core/src/main/java/com/cpop/core/service/RedisService.java @@ -177,6 +177,13 @@ public interface RedisService { */ Collection keys(final String pattern); + /** + * 原子类递增减 + * @param key 键 + * @param stock 值 + */ + Long longIncrement(final String key, Long stock); + /** * @param key * @return diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java index c770306..56f92be 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java +++ b/Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java @@ -94,7 +94,7 @@ public class CoreServiceImpl implements CoreService { */ @Override public SysUser getSysUserByUsername(String username, UserType userType) { - return coreMapper.getSysUserByUsername(username, userType); + return coreMapper.getSysUserByUsername(username, userType.toString()); } /** @@ -106,7 +106,7 @@ public class CoreServiceImpl implements CoreService { */ @Override public void updateSysUserLoginIp(String ipAddr, String username, UserType userType) { - coreMapper.updateSysUserLoginIp(ipAddr, username, userType); + coreMapper.updateSysUserLoginIp(ipAddr, username, userType.toString()); } /** @@ -244,7 +244,7 @@ public class CoreServiceImpl implements CoreService { .setUserName(phoneNumber) .setPhoneNumber(phoneNumber) .setStatus(true) - .setUserType(userType) + .setUserType(userType.toString()) .setCreateUserId("1"); sysUser.setUpdateUserId("1"); this.coreMapper.insertSysUser(sysUser); @@ -272,6 +272,6 @@ public class CoreServiceImpl implements CoreService { */ @Override public SysUser getSysUserByPhone(String phoneNumber, UserType userType) { - return coreMapper.getSysUserByPhone(phoneNumber, userType); + return coreMapper.getSysUserByPhone(phoneNumber, userType.toString()); } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java index 170eeda..10f8cbe 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java +++ b/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java @@ -134,6 +134,11 @@ public class RedisServiceImpl implements RedisService { return redisTemplate.keys(pattern); } + @Override + public Long longIncrement(final String key, Long stock) { + return redisTemplate.opsForValue().increment(key, stock); + } + /** * @Description: 分布式锁 * @param key diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java index dd3f01d..f8ca5ce 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java @@ -39,7 +39,8 @@ public class SecurityUtils { **/ public LoginUser getLoginUser() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication == null) { + //匿名用户 + if (authentication.getPrincipal() == "anonymousUser") { return null; } if (null != authentication.getCredentials()) { @@ -58,6 +59,10 @@ public class SecurityUtils { public JSONObject getLoginUserInfo() { //获取当前登录用户信息 LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); + //系统内部进行程序没有用户 + if (loginUser == null) { + return null; + } //获取缓存信息 JSONObject jsonObject = SpringUtils.getBean(RedisService.class).getCacheObject(loginUser.getUserType().getKey() + loginUser.getIdentification()); return jsonObject.getJSONObject("user"); diff --git a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java index 93a032f..f79a6c4 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -25,8 +25,8 @@ public class CpopGenerator { /** * 数据库 URL */ - private static final String URL = "jdbc:mysql://localhost:3306/cpop-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"; - + // private static final String URL = "jdbc:mysql://localhost:3306/cpop-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"; + private static final String URL = "jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"; /** * 数据库用户名 */ @@ -34,22 +34,23 @@ public class CpopGenerator { /** * 数据库密码 */ - private static final String PASSWORD = "root"; + //private static final String PASSWORD = "root"; + private static final String PASSWORD = "Customer0401"; /** * 输出路径 */ - private static final String EXPORT_URL = "/Cpop-Mall"; + private static final String EXPORT_URL = "/Cpop-System"; /** * 模块 */ - private static final String EXPORT_ITEM = "mall"; + private static final String EXPORT_ITEM = "system"; /** * 表前缀 */ - private static final String TABLE_PREFIX = "cp_mall_"; + private static final String TABLE_PREFIX = "cp_sys_"; /** * 主入口 diff --git a/Cpop-Jambox/pom.xml b/Cpop-Jambox/pom.xml index 7d276b0..baea947 100644 --- a/Cpop-Jambox/pom.xml +++ b/Cpop-Jambox/pom.xml @@ -18,10 +18,6 @@ com.cpop Cpop-Core - - com.cpop - Cpop-Sdk - diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandBo.java deleted file mode 100644 index 34dd05d..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandBo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.cpop.jambox.business.bo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 品牌表Bo - * - * @author DB.lost - * @since 2023-06-01 - */ -@Data -@Accessors(chain = true) -@ApiModel(value = "Brand对象", description = "品牌表") -public class BrandBo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @ApiModelProperty("主键") - private String id; - - /** - * 品牌名 - */ - @NotBlank(message = "品牌名不能为空") - @ApiModelProperty(value = "品牌名",required = true) - private String name; - - /** - * 背景地址 - */ - @ApiModelProperty("背景地址") - private String backgroundUrl; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffBo.java deleted file mode 100644 index 489f981..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffBo.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.cpop.jambox.business.bo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; -import java.util.List; - -/** - * 品牌管理员表Bo - * - * @author DB.lost - * @since 2023-06-02 - */ -@Data -@Accessors(chain = true) -@ApiModel(value = "BrandStaff对象", description = "品牌管理员新增信息") -public class BrandStaffBo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @ApiModelProperty("主键") - private String id; - - /** - * 姓名 - */ - @NotBlank(message = "不能为空") - @ApiModelProperty("姓名") - private String name; - - /** - * 身份(定位) - */ - @ApiModelProperty("身份(定位)") - private String position = "管理员"; - - /** - * 手机号 - */ - @NotBlank(message = "不能为空") - @ApiModelProperty("手机号") - private String phoneNumber; - - /** - * 品牌id - */ - @ApiModelProperty("品牌id") - private List brandIds; - - /** - * 校区id - */ - @ApiModelProperty("校区id") - private List campusIds; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffPageBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffPageBo.java deleted file mode 100644 index 125ced2..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffPageBo.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.cpop.jambox.business.bo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * Description: - * date: 2023/6/2 11:59 - * - * @Author ST - */ -@Data -@Accessors(chain = true) -@ApiModel(value = "BrandManagementStaff分页对象", description = "品牌管理员表") -public class BrandStaffPageBo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 姓名 - */ - @ApiModelProperty("姓名") - private String name; - - /** - * 手机号 - */ - @ApiModelProperty("手机号") - private String phoneNumber; - - /** - * 品牌名 - */ - @ApiModelProperty("品牌名") - private String brandName; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusBo.java deleted file mode 100644 index dd85b6d..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusBo.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.cpop.jambox.business.bo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 校区表Bo - * - * @author DB.lost - * @since 2023-06-07 - */ -@Data -@Accessors(chain = true) -@ApiModel(value = "Campus对象", description = "校区表") -public class CampusBo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @ApiModelProperty("主键") - private String id; - - /** - * 品牌id - */ - @ApiModelProperty(value = "品牌id") - private String brandId; - - /** - * 校区名 - */ - @NotBlank(message = "校区名不能为空") - @ApiModelProperty(value = "校区名",required = true) - private String name; - - /** - * 负责人 - */ - @NotBlank(message = "负责人不能为空") - @ApiModelProperty(value = "负责人",required = true) - private String responsiblePerson; - - /** - * 负责人手机号 - */ - @NotBlank(message = "负责人手机号不能为空") - @ApiModelProperty(value = "负责人手机号",required = true) - private String responsiblePersonPhone; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusListByBrandBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusListByBrandBo.java deleted file mode 100644 index c0da08c..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusListByBrandBo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.cpop.jambox.business.bo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** - * @author: DB - * @Date: 2023/07/04/18:06 - * @Description: - */ -@Data -@Accessors(chain = true) -@ApiModel(value = "CampusListByBrandBo对象") -public class CampusListByBrandBo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 品牌id集合 - */ - @ApiModelProperty("品牌id集合") - private List brandIds; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusPageBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusPageBo.java deleted file mode 100644 index d27a68f..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusPageBo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.cpop.jambox.business.bo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * @author: Administrator - * @Date: 2023/06/07/10:16 - * @Description: - */@Data -@Accessors(chain = true) -@ApiModel(value = "Campus分页list对象", description = "校区表") -public class CampusPageBo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 校区名 - */ - @ApiModelProperty("校区名") - private String name; -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateListBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateListBo.java deleted file mode 100644 index 6b436ee..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateListBo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.cpop.jambox.business.bo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * @author DB - * @createTime 2023/09/27 17:00 - * @description - */ -@Data -@Accessors(chain = true) -public class CardTemplateListBo implements Serializable { - - /** - * 云品牌id - */ - @ApiModelProperty(value = "云品牌id") - private String cloudBrandId; - - /** - * 云校区id - */ - @ApiModelProperty(value = "云校区id") - private String cloudCampusId; -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java deleted file mode 100644 index b15a9d2..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.cpop.jambox.business.bo; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.cpop.core.annontation.StringArrayConvert; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.math.BigDecimal; -import java.sql.Date; - -/** - * @author: DB - * @Date: 2023/08/31/11:18 - * @Description: - */ -@Data -@ApiModel(value = "课卡模板整合bo") -public class CardTemplateUnionBo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @ApiModelProperty("主键") - private String id; - - /** - * 课卡模板名 - */ - @NotBlank(message = "课卡模板名不能为空") - @ApiModelProperty(value = "课卡模板名",required = true) - private String name; - - /** - * 云校区id - */ - @ApiModelProperty("云校区id") - private String cloudCampusId; - - /** - * 云品牌id - */ - @ApiModelProperty("云品牌id") - private String cloudBrandId; - - /** - * 使用范围 - */ - @NotBlank(message = "使用范围不能为空") - @ApiModelProperty(value = "使用范围(少儿,成人...)", required = true) - private String scopeUse; - - /** - * 模板类型(0:课时卡,1:时限卡,2:储值卡) - */ - @NotBlank(message = "模板类型不能为空") - @ApiModelProperty(value = "模板类型(0:课时卡,1:时限卡,2:储值卡)",required = true) - private String templateType; - - /** - * 有效日期数 - */ - @ApiModelProperty(value = "有效日期数") - private Integer validDay; - - /** - * 结束时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") - @ApiModelProperty(value = "结束日期") - private Date endDate; - - /** - * 价格 - */ - @NotNull(message = "价格不能为空") - @ApiModelProperty(value = "价格",required = true) - private BigDecimal price; - - /** - * 周预约次数 - */ - @ApiModelProperty(value = "周预约次数") - private Integer weekAppointment; - - /** - * 日预约次数 - */ - @ApiModelProperty(value = "日预约次数") - private Integer dayAppointment; - - /** - * 缓冲天数 - */ - @ApiModelProperty(value = "缓冲天数") - private Integer bufferDay; - - /** - * 支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付) - */ - @StringArrayConvert - @NotBlank(message = "支付类型不能为空") - @ApiModelProperty(value = "支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付;4:线下支付)",required = true) - private String payType; - - /** - * 课时(课时卡必穿) - */ - @ApiModelProperty("课时(课时卡必穿)") - private Integer classNumber; - - /** - * 是否是会员(0否1是) - */ - @ApiModelProperty("是否是会员(0否1是)") - private Boolean isMember; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CardTemplateController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CardTemplateController.java index f7eb892..0ec2687 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CardTemplateController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CardTemplateController.java @@ -2,8 +2,6 @@ package com.cpop.jambox.business.controller; import com.mybatisflex.core.paginate.Page; import com.cpop.core.base.R; -import com.cpop.jambox.business.bo.CardTemplateListBo; -import com.cpop.jambox.business.bo.CardTemplateUnionBo; import com.cpop.jambox.business.entity.CardTemplate; import com.cpop.jambox.business.service.CardTemplateService; import com.cpop.jambox.business.vo.CardTemplateListVo; @@ -30,80 +28,4 @@ public class CardTemplateController { @Autowired private CardTemplateService cardTemplateService; - /** - * @descriptions 根据品牌或校区获取模板 - * @author DB - * @date 2023/09/27 17:03 - * @param bo 请求参数 - * @return com.cpop.core.base.R> - */ - @GetMapping("/getListByBrandOrCampus") - @ApiOperation("根据品牌或校区获取模板") - public R> getListByBrandOrCampus(CardTemplateListBo bo) { - List list = cardTemplateService.getListByBrandOrCampus(bo); - return R.ok(list); - } - - /** - * @descriptions 保存课卡模板 - * @author DB - * @date 2023/09/27 17:37 - * @param bo 请求参数 - * @return com.cpop.core.base.R - */ - @PostMapping("saveUnionCardTemplate") - @ApiOperation("保存课卡模板") - public R saveUnionCardTemplate(@RequestBody @ApiParam("果酱-课卡模板整合bo") CardTemplateUnionBo bo) { - cardTemplateService.saveUnionCardTemplate(bo); - return R.ok(); - } - - /** - * 根据主键删除果酱-课卡模板。 - * - * @param id 主键 - * @return {@code true} 删除成功,{@code false} 删除失败 - */ - @DeleteMapping("remove/{id}") - @ApiOperation("根据主键果酱-课卡模板") - public boolean remove(@PathVariable @ApiParam("果酱-课卡模板主键") Serializable id) { - return cardTemplateService.removeById(id); - } - - /** - * 根据主键更新果酱-课卡模板。 - * - * @param cardTemplate 果酱-课卡模板 - * @return {@code true} 更新成功,{@code false} 更新失败 - */ - @PutMapping("update") - @ApiOperation("根据主键更新果酱-课卡模板") - public boolean update(@RequestBody @ApiParam("果酱-课卡模板主键") CardTemplate cardTemplate) { - return cardTemplateService.updateById(cardTemplate); - } - - /** - * 根据果酱-课卡模板主键获取详细信息。 - * - * @param id 果酱-课卡模板主键 - * @return 果酱-课卡模板详情 - */ - @GetMapping("getInfo/{id}") - @ApiOperation("根据主键获取果酱-课卡模板") - public CardTemplate getInfo(@PathVariable @ApiParam("果酱-课卡模板主键") Serializable id) { - return cardTemplateService.getById(id); - } - - /** - * 分页查询果酱-课卡模板。 - * - * @param page 分页对象 - * @return 分页对象 - */ - @GetMapping("page") - @ApiOperation("分页查询果酱-课卡模板") - public Page page(@ApiParam("分页信息") Page page) { - return cardTemplateService.page(page); - } - } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaff.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaff.java deleted file mode 100644 index d70f0cc..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaff.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.cpop.jambox.business.entity; - -import com.mybatisflex.annotation.Column; -import com.mybatisflex.annotation.Id; -import com.mybatisflex.annotation.Table; -import com.cpop.core.base.entity.BaseEntity; -import com.cpop.core.base.entity.BaseInsertListener; -import com.cpop.core.base.entity.BaseUpdateListener; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 品牌管理员表 实体类。 - * - * @author DB - * @since 2023-09-13 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@Table(value = "cp_j_brand_staff", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class BrandStaff extends BaseEntity implements Serializable { - - /** - * 主键 - */ - @Id - private String id; - - /** - * 云id - */ - private String brandStaffCloudId; - - /** - * 姓名 - */ - private String name; - - /** - * 手机号 - */ - private String phoneNumber; - - /** - * 身份(定位) - */ - private String position; - - - - - - /** - * 是否删除(0否1是) - */ - @Column(isLogicDelete = true) - private Boolean isDelete; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaffMidCampus.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaffMidCampus.java deleted file mode 100644 index 0563919..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaffMidCampus.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.cpop.jambox.business.entity; - -import com.mybatisflex.annotation.Table; -import com.cpop.core.base.entity.BaseEntity; -import com.cpop.core.base.entity.BaseInsertListener; -import com.cpop.core.base.entity.BaseUpdateListener; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 管理员-品牌-校区表 实体类。 - * - * @author DB - * @since 2023-09-13 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@Table(value = "cp_j_brand_staff_mid_campus", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class BrandStaffMidCampus extends BaseEntity implements Serializable { - - /** - * 品牌管理员id - */ - private String brandStaffId; - - /** - * 品牌id - */ - private String brandId; - - /** - * 校区id - */ - private String campusId; - - - - - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Campus.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Campus.java deleted file mode 100644 index e40a26f..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Campus.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.cpop.jambox.business.entity; - -import com.mybatisflex.annotation.Column; -import com.mybatisflex.annotation.Id; -import com.mybatisflex.annotation.Table; -import com.cpop.core.base.entity.BaseEntity; -import com.cpop.core.base.entity.BaseInsertListener; -import com.cpop.core.base.entity.BaseUpdateListener; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 校区表 实体类。 - * - * @author DB - * @since 2023-09-13 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@Table(value = "cp_j_campus", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class Campus extends BaseEntity implements Serializable { - - /** - * 主键 - */ - @Id - private String id; - - /** - * 云校区id - */ - private String campusCloudId; - - /** - * 品牌id - */ - private String brandId; - - /** - * 校区名 - */ - private String name; - - /** - * 负责人 - */ - private String responsiblePerson; - - /** - * 负责人手机号 - */ - private String responsiblePersonPhone; - - /** - * 地址 - */ - private String address; - - /** - * openId - */ - private String openId; - - /** - * 到期时间 - */ - private LocalDateTime expire; - - - - - - /** - * 是否删除(0否1是) - */ - @Column(isLogicDelete = true) - private Boolean isDelete; - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMapper.java deleted file mode 100644 index 8683b64..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.jambox.business.mapper; - -import com.mybatisflex.core.BaseMapper; -import com.cpop.jambox.business.entity.BrandStaff; - -/** - * 品牌管理员表 映射层。 - * - * @author DB - * @since 2023-09-13 - */ -public interface BrandStaffMapper extends BaseMapper { - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMidCampusMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMidCampusMapper.java deleted file mode 100644 index 8f1c35f..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMidCampusMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.jambox.business.mapper; - -import com.mybatisflex.core.BaseMapper; -import com.cpop.jambox.business.entity.BrandStaffMidCampus; - -/** - * 管理员-品牌-校区表 映射层。 - * - * @author DB - * @since 2023-09-13 - */ -public interface BrandStaffMidCampusMapper extends BaseMapper { - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CampusMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CampusMapper.java deleted file mode 100644 index 970e1f3..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CampusMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.jambox.business.mapper; - -import com.mybatisflex.core.BaseMapper; -import com.cpop.jambox.business.entity.Campus; - -/** - * 校区表 映射层。 - * - * @author DB - * @since 2023-09-13 - */ -public interface CampusMapper extends BaseMapper { - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffMidCampusService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffMidCampusService.java deleted file mode 100644 index 4d8d44c..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffMidCampusService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.jambox.business.service; - -import com.mybatisflex.core.service.IService; -import com.cpop.jambox.business.entity.BrandStaffMidCampus; - -/** - * 管理员-品牌-校区表 服务层。 - * - * @author DB - * @since 2023-09-13 - */ -public interface BrandStaffMidCampusService extends IService { - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffService.java deleted file mode 100644 index bae2d43..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.cpop.jambox.business.service; - -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.service.IService; -import com.cpop.jambox.business.bo.BrandStaffBo; -import com.cpop.jambox.business.bo.BrandStaffPageBo; -import com.cpop.jambox.business.entity.BrandStaff; -import com.cpop.jambox.business.vo.BrandStaffPageVo; - -/** - * 品牌管理员表 服务层。 - * - * @author DB - * @since 2023-09-13 - */ -public interface BrandStaffService extends IService { - - /** - * @Description: 查询品牌管理员分页列表 - * @param bo 请求参数 - * @return: R> - * @Author: DB - * @Date: 2023/6/2 14:01 - **/ - Page getBrandStaffPage(BrandStaffPageBo bo); - - /** - * @descriptions 新增品牌管理员 - * @author DB - * @date 2023/09/14 16:54 - * @param bo 请求参数 - */ - void insertBrandStaff(BrandStaffBo bo); - - /** - * @Description: 删除品牌管理员 - * @param id 主键 - * @return: R - * @Author: DB - * @Date: 2023/6/5 10:03 - **/ - void removeBrandStaffById(String id); -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CampusService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CampusService.java deleted file mode 100644 index 4582a70..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CampusService.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.cpop.jambox.business.service; - -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.service.IService; -import com.cpop.jambox.business.bo.CampusBo; -import com.cpop.jambox.business.bo.CampusPageBo; -import com.cpop.jambox.business.entity.Campus; -import com.cpop.jambox.business.vo.CampusPageVo; - -/** - * 校区表 服务层。 - * - * @author DB - * @since 2023-09-13 - */ -public interface CampusService extends IService { - - /** - * @Description: 查询校区分页列表 - * @param bo 请求参数 - * @return R> - * @Author Administrator - * @Date: 2023/6/7 0007 10:18 - */ - Page getCampusPage(CampusPageBo bo); - - /** - * @descriptions 修改校区 - * @author DB - * @date 2023/09/14 11:40 - * @param bo 请求参数 - */ - void updateCampus(CampusBo bo); -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java index 3d5c76b..e3eb10f 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java @@ -1,8 +1,6 @@ package com.cpop.jambox.business.service; import com.mybatisflex.core.service.IService; -import com.cpop.jambox.business.bo.CardTemplateListBo; -import com.cpop.jambox.business.bo.CardTemplateUnionBo; import com.cpop.jambox.business.entity.CardTemplate; import com.cpop.jambox.business.vo.CardTemplateListVo; @@ -16,21 +14,4 @@ import java.util.List; */ public interface CardTemplateService extends IService { - /** - * @descriptions 根据品牌或校区获取模板 - * @author DB - * @date 2023/09/27 17:02 - * @param bo 请求参数 - * @return java.util.List - */ - List getListByBrandOrCampus(CardTemplateListBo bo); - - /** - * @descriptions 保存课卡模板 - * @author DB - * @date 2023/09/27 18:00 - * @param bo 请求参数 - * @return: void - */ - void saveUnionCardTemplate(CardTemplateUnionBo bo); } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffMidCampusServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffMidCampusServiceImpl.java deleted file mode 100644 index 76ae8c0..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffMidCampusServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.cpop.jambox.business.service.impl; - -import com.mybatisflex.spring.service.impl.ServiceImpl; -import com.cpop.jambox.business.entity.BrandStaffMidCampus; -import com.cpop.jambox.business.mapper.BrandStaffMidCampusMapper; -import com.cpop.jambox.business.service.BrandStaffMidCampusService; -import org.springframework.stereotype.Service; - -/** - * 管理员-品牌-校区表 服务层实现。 - * - * @author DB - * @since 2023-09-13 - */ -@Service("brandStaffMidCampusService") -public class BrandStaffMidCampusServiceImpl extends ServiceImpl implements BrandStaffMidCampusService { - -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffServiceImpl.java deleted file mode 100644 index cb625c9..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffServiceImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.cpop.jambox.business.service.impl; - -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.spring.service.impl.ServiceImpl; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SpringUtils; -import com.cpop.jambox.business.bo.BrandStaffBo; -import com.cpop.jambox.business.bo.BrandStaffPageBo; -import com.cpop.jambox.business.entity.BrandStaff; -import com.cpop.jambox.business.entity.BrandStaffMidCampus; -import com.cpop.jambox.business.entity.Campus; -import com.cpop.jambox.business.mapper.BrandStaffMapper; -import com.cpop.jambox.business.service.BrandStaffMidCampusService; -import com.cpop.jambox.business.service.BrandStaffService; -import com.cpop.jambox.business.service.CampusService; -import com.cpop.jambox.business.vo.BrandStaffPageVo; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -import static com.cpop.jambox.business.entity.table.BrandStaffMidCampusTableDef.BRAND_STAFF_MID_CAMPUS; -import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; - -/** - * 品牌管理员表 服务层实现。 - * - * @author DB - * @since 2023-09-13 - */ -@Service("brandStaffService") -public class BrandStaffServiceImpl extends ServiceImpl implements BrandStaffService { - - /** - * @Description: 查询品牌管理员分页列表 - * @param bo 请求参数 - * @return: R> - * @Author: DB - * @Date: 2023/6/2 14:01 - **/ - @Override - public Page getBrandStaffPage(BrandStaffPageBo bo) { - /*PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); - return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), - QueryWrapper.create() - .select(BRAND_STAFF.ID,BRAND_STAFF.NAME,BRAND_STAFF.PHONE_NUMBER,BRAND_STAFF.CREATE_TIME) - .select(groupConcat(distinct(BRAND_STAFF_MID_CAMPUS.BRAND_ID)).as(BrandStaffPageVo::getBrandId), groupConcat(distinct(BRAND_STAFF_MID_CAMPUS.CAMPUS_ID)).as(BrandStaffPageVo::getCampusId)) - .select(groupConcat(distinct(BRAND.NAME)).as(BrandStaffPageVo::getBrandName)) - .select(groupConcat(distinct(CAMPUS.NAME)).as(BrandStaffPageVo::getCampusName)) - //管理员表 - .from(BRAND_STAFF) - //中间表 - .leftJoin(BRAND_STAFF_MID_CAMPUS).on(BRAND_STAFF_MID_CAMPUS.BRAND_STAFF_ID.eq(BRAND_STAFF.ID)) - //品牌表 - .leftJoin(BRAND).on(BRAND.ID.eq(BRAND_STAFF_MID_CAMPUS.BRAND_ID)) - //校区表 - .leftJoin(CAMPUS).on(CAMPUS.ID.eq(BRAND_STAFF_MID_CAMPUS.CAMPUS_ID)) - .and(BRAND_STAFF.NAME.like(bo.getName())) - .and(BRAND_STAFF.PHONE_NUMBER.eq(bo.getPhoneNumber())) - .and(BRAND.NAME.like(bo.getBrandName())) - .groupBy(BRAND_STAFF.ID), - BrandStaffPageVo.class);*/ - return null; - } - - /** - * @descriptions 新增品牌管理员 - * @author DB - * @date 2023/09/14 16:54 - * @param bo 请求参数 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void insertBrandStaff(BrandStaffBo bo) { - BrandStaff brandStaff = BeanUtils.mapToClass(bo, BrandStaff.class); - List list = new ArrayList<>(); - //是否有校区ids - if (bo.getCampusIds().isEmpty()){ - //只有品牌 - if (bo.getBrandIds().isEmpty()) { - throw new ServiceException("品牌与校区都不存在,添加失败"); - } else { - //TODO:向云库添加管理员数据 - this.save(brandStaff); - bo.getBrandIds().forEach(item -> { - //中间表只有品牌信息 - BrandStaffMidCampus brandStaffMidCampus = new BrandStaffMidCampus(); - brandStaffMidCampus.setBrandStaffId(brandStaff.getId()); - brandStaffMidCampus.setBrandId(item); - list.add(brandStaffMidCampus); - }); - } - } else { - //先查询校区关联的品牌是否全包含在传入的品牌中 - List campusList = SpringUtils.getBean(CampusService.class).list(QueryWrapper.create().where(CAMPUS.ID.in(bo.getCampusIds()))); - Set campusBrandIds = campusList - .stream().map(Campus::getBrandId).collect(Collectors.toSet()); - Set filterBrandIds = bo.getBrandIds().stream().filter(s -> !campusBrandIds.contains(s)).collect(Collectors.toSet()); - //存在只有品牌没有校区的数据 - if (!filterBrandIds.isEmpty()) { - filterBrandIds.forEach(item -> { - BrandStaffMidCampus brandStaffMidCampus = new BrandStaffMidCampus(); - brandStaffMidCampus.setBrandStaffId(brandStaff.getId()); - brandStaffMidCampus.setBrandId(item); - list.add(brandStaffMidCampus); - }); - } - campusList.forEach(item -> { - //中间表只有品牌信息 - BrandStaffMidCampus brandStaffMidCampus = new BrandStaffMidCampus(); - brandStaffMidCampus.setBrandStaffId(brandStaff.getId()); - brandStaffMidCampus.setBrandId(item.getBrandId()); - brandStaffMidCampus.setCampusId(item.getId()); - list.add(brandStaffMidCampus); - }); - } - //添加到中间表 - SpringUtils.getBean(BrandStaffMidCampusService.class).saveBatch(list); - } - - /** - * @Description: 删除品牌管理员 - * @param id 主键 - * @return: R - * @Author: DB - * @Date: 2023/6/5 10:03 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void removeBrandStaffById(String id) { - //删除中间表 - SpringUtils.getBean(BrandStaffMidCampusService.class).remove(QueryWrapper.create().where(BRAND_STAFF_MID_CAMPUS.BRAND_STAFF_ID.eq(id))); - //删除数据 - this.removeById(id); - //TODO:通知到云库 - } -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CampusServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CampusServiceImpl.java deleted file mode 100644 index e5cdc11..0000000 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CampusServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.cpop.jambox.business.service.impl; - -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.spring.service.impl.ServiceImpl; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.jambox.business.bo.CampusBo; -import com.cpop.jambox.business.bo.CampusPageBo; -import com.cpop.jambox.business.entity.Campus; -import com.cpop.jambox.business.mapper.CampusMapper; -import com.cpop.jambox.business.service.CampusService; -import com.cpop.jambox.business.vo.CampusPageVo; -import org.springframework.stereotype.Service; - -/** - * 校区表 服务层实现。 - * - * @author DB - * @since 2023-09-13 - */ -@Service("campusService") -public class CampusServiceImpl extends ServiceImpl implements CampusService { - - /** - * @Description: 查询校区分页列表 - * @param bo 请求参数 - * @return R> - * @Author Administrator - * @Date: 2023/6/7 0007 10:18 - */ - @Override - public Page getCampusPage(CampusPageBo bo) { - /*PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); - return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), - QueryWrapper.create() - .select(CAMPUS.ALL_COLUMNS) - .select(BRAND.NAME.as(CampusPageVo::getBrandName)) - .leftJoin(BRAND).on(BRAND.ID.eq(CAMPUS.BRAND_ID)) - .and(CAMPUS.NAME.like(bo.getName())), - CampusPageVo.class);*/ - return null; - } - - /** - * @descriptions 修改校区 - * @author DB - * @date 2023/09/14 11:40 - * @param bo 请求参数 - */ - @Override - public void updateCampus(CampusBo bo) { - this.updateById(BeanUtils.mapToClass(bo, Campus.class)); - //TODO:通知到云库 - } -} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java index 72de680..1827780 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java @@ -1,20 +1,9 @@ package com.cpop.jambox.business.service.impl; -import cn.binarywang.wx.miniapp.api.WxMaService; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SpringUtils; -import com.cpop.jambox.business.bo.CardTemplateListBo; -import com.cpop.jambox.business.bo.CardTemplateUnionBo; import com.cpop.jambox.business.entity.CardTemplate; import com.cpop.jambox.business.mapper.CardTemplateMapper; import com.cpop.jambox.business.service.CardTemplateService; -import com.cpop.jambox.business.vo.CardTemplateListVo; -import com.cpop.sdk.framework.handler.qCloudCos.QCloudCosHandler; -import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; -import me.chanjar.weixin.common.error.WxErrorException; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.File; @@ -31,68 +20,4 @@ import static com.cpop.jambox.business.entity.table.CardTemplateTableDef.CARD_TE @Service("cardTemplateService") public class CardTemplateServiceImpl extends ServiceImpl implements CardTemplateService { - @Autowired - private WxMaService wxMaService; - - @Autowired - private QCloudCosHandler qCloudCosHandler; - - /** - * 小程序模板调整路径 - */ - private final String TEMPLATE_URL = "pages/pay/pay"; - - /** - * @descriptions 根据品牌或校区获取模板 - * @author DB - * @date 2023/09/27 17:02 - * @param bo 请求参数 - * @return java.util.List - */ - @Override - public List getListByBrandOrCampus(CardTemplateListBo bo) { - return this.listAs(QueryWrapper.create() - .and(CARD_TEMPLATE.CLOUD_BRAND_ID.eq(bo.getCloudBrandId())) - .and(CARD_TEMPLATE.CLOUD_CAMPUS_ID.eq(bo.getCloudCampusId())) - .orderBy(CARD_TEMPLATE.CREATE_TIME.asc()), - CardTemplateListVo.class); - } - - /** - * @descriptions 保存课卡模板 - * @author DB - * @date 2023/09/27 18:00 - * @param bo 请求参数 - * @return: void - */ - @Override - public void saveUnionCardTemplate(CardTemplateUnionBo bo) { - CardTemplate cardTemplate = BeanUtils.mapToClass(bo, CardTemplate.class); - this.save(cardTemplate); - //生成太阳码 - try { - File file = wxMaService.getQrcodeService().createWxaCodeUnlimit(cardTemplate.getId(), - TEMPLATE_URL, true, SpringUtils.getActiveProfile(), 300, true, null, true); - String cdnUrl = qCloudCosHandler.upload(file); - this.updateChain().set(CARD_TEMPLATE.QR_CODE, cdnUrl).where(CARD_TEMPLATE.ID.eq(cardTemplate.getId())).update(); - } catch (WxErrorException e) { - throw new ServiceException(e.getMessage()); - } - } - - /** - * 获取小程序环境 - * @param env 当前环境 - * @return 小程序码环境 - */ - private String getQrCodeEnv(String env) { - switch (env) { - case "prod": - return "release"; - case "dev": - case "test": - default: - return "trial"; - } - } } diff --git a/Cpop-Jambox/src/main/resources/mapper/BrandStaffMapper.xml b/Cpop-Jambox/src/main/resources/mapper/BrandStaffMapper.xml deleted file mode 100644 index 2b68c95..0000000 --- a/Cpop-Jambox/src/main/resources/mapper/BrandStaffMapper.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Cpop-Jambox/src/main/resources/mapper/BrandStaffMidCampusMapper.xml b/Cpop-Jambox/src/main/resources/mapper/BrandStaffMidCampusMapper.xml deleted file mode 100644 index 26cbb7a..0000000 --- a/Cpop-Jambox/src/main/resources/mapper/BrandStaffMidCampusMapper.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml index da63733..95ac6ca 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml @@ -95,4 +95,14 @@ knife4j: group-name: System api-rule: package api-rule-resources: - - com.cpop.system \ No newline at end of file + - com.cpop.system + +logging: + level: + com.github.binarywang.wxpay: debug + +#微信支付 +wx: + pay: + #通知地址 + notifyUrl: https://frp-oak.top:11899/Cpop-Mall/wxPay/callback/notify/order \ No newline at end of file diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml index 9258a57..5fe3a7e 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml @@ -50,6 +50,10 @@ server: servlet: context-path: /Cpop-Mall +# springdoc-openapi项目配置 +knife4j: + enable: false + #Mybatis-Flex mybatis-flex: configuration: @@ -62,4 +66,14 @@ mybatis-flex: jambox: url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_association?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: Customer0401 \ No newline at end of file + password: Customer0401 + +logging: + level: + com.github.binarywang.wxpay: error + +#微信支付 +wx: + pay: + #通知地址 + notifyUrl: \ No newline at end of file diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml index 3a09102..2fdb75a 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml @@ -1,17 +1,18 @@ # 项目相关配置 cpop: # 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPath,Linux配置 /home/baseFramework/uploadPath) - profile: /root/jambox-union/jambox-oam/uploadPath/upload + #profile: /root/jambox-union/jambox-oam/uploadPath/upload + profile: E:/Cpop/uploadPath jwt: #白名单 - whiteList: /login,/miniLogin,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/* + whiteList: /login,/miniLogin,/wxPay/callback/notify/**,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/* #拦截 gateway: rsa-keypair: # 公钥文件 - publicKeyFile: D:\WorkSpace\Cpop\Cpop-Union\Cpop-Mall\Cpop-Mall-Web\src\main\resources\static\keyPair\publicKey + publicKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\publicKey # 公钥文件 - privateKeyFile: D:\WorkSpace\Cpop\Cpop-Union\Cpop-Mall\Cpop-Mall-Web\src\main\resources\static\keyPair\privateKey + privateKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\privateKey # DataSource Config spring: @@ -89,4 +90,14 @@ knife4j: group-name: System api-rule: package api-rule-resources: - - com.cpop.system \ No newline at end of file + - com.cpop.system + +logging: + level: + com.github.binarywang.wxpay: debug + +#微信支付 +wx: + pay: + #通知地址 + notifyUrl: https://frp-oak.top:11899/Cpop-Mall/wxPay/callback/notify/order \ No newline at end of file diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application.yml index 4df2e6c..dc90df2 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application.yml @@ -31,7 +31,7 @@ spring: max-file-size: 1024MB max-request-size: 300MB profiles: - active: test,mall,system,jambox,sdk + active: test,mall,system datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver @@ -130,7 +130,6 @@ logging: wx: #微信支付 pay: - #服务商模式 #微信公众号或者小程序等的appid appId: wx1eb0e5fb7dac3c05 #微信支付商户号 diff --git a/Cpop-Mall/pom.xml b/Cpop-Mall/pom.xml index a79fb39..9b45910 100644 --- a/Cpop-Mall/pom.xml +++ b/Cpop-Mall/pom.xml @@ -27,6 +27,11 @@ com.cpop Cpop-Jambox + + + com.github.binarywang + weixin-java-pay + diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/OrderRefundPageBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/OrderRefundPageBo.java new file mode 100644 index 0000000..028413c --- /dev/null +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/OrderRefundPageBo.java @@ -0,0 +1,43 @@ +package com.cpop.mall.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @author DB + * @createTime 2023/10/27 17:33 + * @description + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "商城订单退款分页请求对象") +public class OrderRefundPageBo implements Serializable { + + /** + * 商品名 + */ + @ApiModelProperty("商品名") + private String productName; + + /** + * 支付用户 + */ + @ApiModelProperty("支付用户") + private String payUserName; + + /** + * 支付用户手机号 + */ + @ApiModelProperty("支付用户手机号") + private String payUserPhone; + + /** + * 退款状态(0:申请中;1:通过;2:驳回) + */ + @ApiModelProperty("退款状态(0:申请中;1:通过;2:驳回)") + private Integer refundStatus; +} diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/PlaceOrderBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/PlaceOrderBo.java index 2ca8e7c..2e84a82 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/PlaceOrderBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/PlaceOrderBo.java @@ -53,7 +53,7 @@ public class PlaceOrderBo implements Serializable { * 店铺(校区)id */ @NotBlank(message = "店铺(校区)id不能为空") - @ApiModelProperty("店铺(校区)id") + @ApiModelProperty(value = "店铺(校区)id",required = true) private String storeId; /** @@ -89,6 +89,13 @@ public class PlaceOrderBo implements Serializable { @ApiModelProperty(value = "备注") private String remarks; + /** + * 支付类型 + */ + @NotNull(message = "支付类型不能为空") + @ApiModelProperty(value = "支付方式(0:微信支付;1:积分支付)",required = true) + private Integer payType; + /** * 订单详情 */ diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java index f4622a0..762de30 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java @@ -47,6 +47,12 @@ public class ProductBo implements Serializable { @ApiModelProperty("品牌id") private String brandId; + /** + * 支付方式(微信支付:0;积分支付:1) + */ + @ApiModelProperty("支付方式(微信支付:0;积分支付:1)") + private Integer payType; + /** * 商店(校区)集合 */ diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductPageBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductPageBo.java index d80f952..1315cac 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductPageBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductPageBo.java @@ -43,4 +43,16 @@ public class ProductPageBo implements Serializable { @ApiModelProperty("价格排序(false:从低到高;true:从高到低)") private Boolean priceOrder; + /** + * 支付方式(0:微信支付;1:积分支付) + */ + @ApiModelProperty("支付方式(0:微信支付;1:积分支付)") + private Integer payType; + + /** + * 产品id + */ + @ApiModelProperty("产品id") + private String productId; + } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java index f37b356..d2e9b8f 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java @@ -104,7 +104,7 @@ public class BackstageMallRoleController { @PreAuthorize("@aps.hasPermission('system:role:remove')") @ApiOperation("删除商城角色") @DeleteMapping("/removeMallRole/{id}") - public R removeMallRole(@PathVariable String id) { + public R removeMallRole(@PathVariable("id") String id) { roleBrandService.removeMallRole(id); return R.ok(); } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java index f91d153..910f79b 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java @@ -1,7 +1,11 @@ package com.cpop.mall.business.controller.backstage; import com.cpop.core.base.R; +import com.cpop.mall.business.bo.OrderRefundPageBo; import com.cpop.mall.business.bo.OrderRejectRefundBo; +import com.cpop.mall.business.bo.ProductPageBo; +import com.cpop.mall.business.vo.OrderRefundPageVo; +import com.cpop.mall.business.vo.ProductPageVo; import com.mybatisflex.core.paginate.Page; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,6 +39,20 @@ public class BackstageOrderRefundController { @Autowired private OrderRefundService orderRefundService; + /** + * @descriptions 商城退款列表 + * @author DB + * @date 2023/10/27 17:33 + * @param bo 请求参数 + * @return: com.cpop.core.base.R> + */ + @GetMapping("/getOrderRefundPage") + @ApiOperation("分页查询商城-退款列表") + public R> getOrderRefundPage(@RequestBody @ApiParam("分页参数") OrderRefundPageBo bo) { + Page page = orderRefundService.getOrderRefundPage(bo); + return R.ok(page); + } + /** * @descriptions 同意退款 * @author DB @@ -44,7 +62,7 @@ public class BackstageOrderRefundController { */ @PutMapping("/agreeRefund/{id}") @ApiOperation("同意退款") - public R agreeRefund(@PathVariable String id) { + public R agreeRefund(@PathVariable("id") String id) { orderRefundService.agreeRefund(id); return R.ok(); } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java index d5cd865..d4758c6 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java @@ -11,6 +11,7 @@ import com.cpop.mall.business.service.ProductSpecificationService; import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.StoreListVo; import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.If; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -24,6 +25,7 @@ import java.util.List; import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD; import static com.cpop.mall.business.entity.table.ProductSpecificationTableDef.PRODUCT_SPECIFICATION; +import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT; /** * 商城-商品表 控制层。 @@ -116,7 +118,7 @@ public class BackstageProductController { */ @PutMapping("/resetProduct/{id}") @ApiOperation("根据主键重置商城商品") - public R update(@PathVariable String id) { + public R update(@PathVariable("id") String id) { productService.resetProduct(id); return R.ok(); } @@ -144,7 +146,7 @@ public class BackstageProductController { @DeleteMapping("/removeById/{id}") @ApiOperation("根据主键商城-商品表") @Transactional(rollbackFor = Exception.class) - public R removeById(@PathVariable @ApiParam("商城-商品主键") Serializable id) { + public R removeById(@PathVariable("id") @ApiParam("商城-商品主键") Serializable id) { productService.removeById(id); //删规格 ProductSpecificationService productSpecificationService = SpringUtils.getBean(ProductSpecificationService.class); @@ -155,6 +157,18 @@ public class BackstageProductController { return R.ok(); } - + /** + * @descriptions 商城商品上架 + * @author DB + * @date 2023/10/23 12:15 + * @param productId 商城-商品id + * @return: com.cpop.core.base.R + */ + @PutMapping("/productUpOrDown") + @ApiOperation("商城商品上下架") + public R productUpOrDown(@RequestParam("productId") @ApiParam(value = "商城-商品Id",required = true) String productId) { + productService.updateChain().setRaw(PRODUCT.IS_UP, "if(is_up = 0, 1, 0)").where(PRODUCT.ID.eq(productId)).update(); + return R.ok(); + } } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/callback/WxPayCallbackController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/callback/WxPayCallbackController.java new file mode 100644 index 0000000..4730a60 --- /dev/null +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/callback/WxPayCallbackController.java @@ -0,0 +1,55 @@ +package com.cpop.mall.business.controller.callback; + +import com.cpop.mall.business.service.OrderRefundService; +import com.cpop.mall.business.service.OrderService; +import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; +import com.github.binarywang.wxpay.service.WxPayService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author DB + * @createTime 2023/10/27 15:57 + * @description + */ +@RestController +@RequestMapping("/wxPay/callback") +public class WxPayCallbackController { + + @Autowired + private OrderRefundService orderRefundService; + + @Autowired + private OrderService orderService; + + /** + * @descriptions 微信支付订单通知 + * @author DB + * @date 2023/10/27 16:04 + * @param xmlData 数据 + * @return: java.lang.String + */ + @PostMapping("/notify/order") + public String parseOrderNotifyResult(@RequestBody String xmlData){ + orderService.wxPayNotifyOrder(xmlData); + return WxPayNotifyResponse.success("成功"); + } + + /** + * @descriptions 退款回调通知处理 + * @author DB + * @date 2023/10/27 18:21 + * @param xmlData 数据 + * @return: java.lang.String + */ + @PostMapping("/notify/refund") + public String parseRefundNotifyResult(@RequestBody String xmlData){ + orderRefundService.wxPayNotifyRefund(xmlData); + return WxPayNotifyResponse.success("成功"); + } + +} diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java index 6892dbb..e35a8c1 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java @@ -8,7 +8,6 @@ import com.cpop.mall.business.entity.OrderEvaluate; import com.cpop.mall.business.service.OrderEvaluateService; import com.cpop.mall.business.service.OrderService; import com.cpop.mall.business.vo.OrderPageVo; -import com.cpop.mall.business.vo.ProductPageVo; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -56,9 +55,8 @@ public class MiniOrderController { */ @PostMapping("/placeOrder") @ApiOperation("商城-订单-下单") - public R placeOrder(@RequestBody @Validated @ApiParam("商城-订单") PlaceOrderBo bo) { - orderService.placeOrder(bo); - return R.ok(); + public R placeOrder(@RequestBody @Validated @ApiParam("商城-订单") PlaceOrderBo bo) { + return R.ok(orderService.placeOrder(bo)); } /** @@ -93,4 +91,18 @@ public class MiniOrderController { return R.ok(); } + /** + * @descriptions 取消订单 + * @author DB + * @date 2023/10/27 17:16 + * @param orderId 商城-订单Id + * @return: com.cpop.core.base.R + */ + @PutMapping("/cancelOrder") + @ApiOperation("取消订单") + public R cancelOrder(@RequestParam("orderId") @ApiParam("商城-订单Id") String orderId) { + orderService.cancelOrder(orderId); + return R.ok(); + } + } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java index 67c9b81..fa7eaf7 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java @@ -3,6 +3,7 @@ package com.cpop.mall.business.controller.mini; import com.cpop.core.base.R; import com.cpop.mall.business.bo.ProductPageBo; import com.cpop.mall.business.service.ProductService; +import com.cpop.mall.business.vo.MiniProductPageVo; import com.cpop.mall.business.vo.ProductEvaluateVo; import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.StoreListVo; @@ -39,10 +40,10 @@ public class MiniProductController { * @param bo 分页参数 * @return: com.cpop.core.base.R> */ - @GetMapping("/getProductPage") + @GetMapping("/getMiniProductPage") @ApiOperation("分页查询商城-商品") - public R> getProductPage(@ApiParam("分页参数") ProductPageBo bo) { - Page page = productService.getProductPage(bo); + public R> getMiniProductPage(@ApiParam("分页参数") ProductPageBo bo) { + Page page = productService.getMiniProductPage(bo); return R.ok(page); } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/dto/WxPayGoodsDetailDto.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/dto/WxPayGoodsDetailDto.java new file mode 100644 index 0000000..b8f33bc --- /dev/null +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/dto/WxPayGoodsDetailDto.java @@ -0,0 +1,35 @@ +package com.cpop.mall.business.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author DB + * @createTime 2023/10/27 15:36 + * @description 微信支付商品详情dto + */ +@Data +public class WxPayGoodsDetailDto implements Serializable { + + /** + * 商品编码 + */ + @JSONField(name = "goods_id") + private String productRecordId; + + /** + * 商品单价 + */ + @JSONField(name = "price") + private BigDecimal amount; + + /** + * 商品数量 + */ + @JSONField(name = "quantity") + private Integer number; + +} diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Order.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Order.java index 3ca70c9..edd4e73 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Order.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Order.java @@ -105,6 +105,11 @@ public class Order extends BaseEntity implements Serializable { */ private String logisticsOrder; + /** + * 支付方式(0:微信支付;1:积分支付) + */ + private Integer payType; + /** * 备注 */ diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/OrderRefund.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/OrderRefund.java index 52a61d8..e36a9f3 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/OrderRefund.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/OrderRefund.java @@ -39,6 +39,11 @@ public class OrderRefund extends BaseEntity implements Serializable { */ private String orderId; + /** + * 外部退款订单号 + */ + private String outRefundId; + /** * 退款状态(0:申请中;1:通过;2:驳回) */ @@ -54,10 +59,6 @@ public class OrderRefund extends BaseEntity implements Serializable { */ private String rejectReason; - - - - /** * 逻辑删除(0否1是) */ diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Product.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Product.java index 6094bf0..6a0144d 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Product.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Product.java @@ -65,6 +65,11 @@ public class Product extends BaseEntity implements Serializable { */ private String picUrl; + /** + * 商品详情图地址 + */ + private String picDetailUrl; + /** * 购买限制(0:会员限制;1:新客限定;2:用户限购) */ @@ -76,7 +81,7 @@ public class Product extends BaseEntity implements Serializable { private Integer limitNum; /** - * 支付方式 + * 支付方式(0:微信支付;1:积分支付) */ private Integer payType; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/ProductRecord.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/ProductRecord.java index 2cc21f0..80f8bf0 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/ProductRecord.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/ProductRecord.java @@ -58,6 +58,12 @@ public class ProductRecord extends BaseEntity implements Serializable { */ private Integer recordPoints; + /** + * 乐观锁标识 + */ + @Column(version = true) + private Integer version; + /** * 逻辑删除(0否1是) */ diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Staff.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Staff.java index c417a2f..879cf72 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Staff.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Staff.java @@ -49,7 +49,7 @@ public class Staff extends BaseEntity implements Serializable { /** * 用户来源 */ - private SourceType sourceType; + private String sourceType; /** * 角色-品牌-id diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderRefundService.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderRefundService.java index 9b338b9..6ed5ad3 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderRefundService.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderRefundService.java @@ -1,6 +1,9 @@ package com.cpop.mall.business.service; +import com.cpop.mall.business.bo.OrderRefundPageBo; import com.cpop.mall.business.bo.OrderRejectRefundBo; +import com.cpop.mall.business.vo.OrderRefundPageVo; +import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.service.IService; import com.cpop.mall.business.entity.OrderRefund; @@ -29,4 +32,22 @@ public interface OrderRefundService extends IService { * @return: void */ void rejectRefund(OrderRejectRefundBo bo); + + /** + * @descriptions 商城退款列表 + * @author DB + * @date 2023/10/27 17:34 + * @param bo 请求参数 + * @return: com.mybatisflex.core.paginate.Page + */ + Page getOrderRefundPage(OrderRefundPageBo bo); + + /** + * @descriptions 退款回调通知处理 + * @author DB + * @date 2023/10/27 18:22 + * @param xmlData 请求数据 + * @return: void + */ + void wxPayNotifyRefund(String xmlData); } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderService.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderService.java index 0275f0b..e6e9a7a 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderService.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/OrderService.java @@ -32,7 +32,7 @@ public interface OrderService extends IService { * @param bo 下单请求对象 * @return: void */ - void placeOrder(PlaceOrderBo bo); + Object placeOrder(PlaceOrderBo bo); /** * @descriptions 申请退款 @@ -42,4 +42,24 @@ public interface OrderService extends IService { * @return: void */ void applyRefund(OrderApplyRefundBo bo); + + /** + * @descriptions 微信支付订单通知 + * @author DB + * @date 2023/10/27 16:04 + * @param xmlData 加密数据 + * @return: void + */ + void wxPayNotifyOrder(String xmlData); + + /** + * @descriptions 取消订单 + * @author DB + * @date 2023/10/27 17:17 + * @param orderId 订单id + * @return: void + */ + void cancelOrder(String orderId); + + } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/ProductService.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/ProductService.java index 54818d9..247b038 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/ProductService.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/ProductService.java @@ -4,6 +4,7 @@ import com.cpop.jambox.business.vo.CardTemplateListVo; import com.cpop.mall.business.bo.ProductBo; import com.cpop.mall.business.bo.ProductPageBo; import com.cpop.mall.business.entity.Product; +import com.cpop.mall.business.vo.MiniProductPageVo; import com.cpop.mall.business.vo.ProductEvaluateVo; import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.StoreListVo; @@ -29,6 +30,15 @@ public interface ProductService extends IService { */ Page getProductPage(ProductPageBo bo); + /** + * @descriptions 分页查询商城-商品 + * @author DB + * @date 2023/10/27 13:41 + * @param bo 请求参数 + * @return: com.mybatisflex.core.paginate.Page + */ + Page getMiniProductPage(ProductPageBo bo); + /** * @descriptions 创建规格 * @author DB @@ -90,4 +100,5 @@ public interface ProductService extends IService { * @return: com.mybatisflex.core.paginate.Page */ Page getOrderEvaluatePage(String productId); + } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java index 76b40d1..1e31f3c 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java @@ -1,13 +1,40 @@ package com.cpop.mall.business.service.impl; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.base.enums.OrderSource; +import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.utils.SpringUtils; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.mall.business.bo.OrderRefundPageBo; import com.cpop.mall.business.bo.OrderRejectRefundBo; +import com.cpop.mall.business.entity.Order; +import com.cpop.mall.business.service.OrderService; +import com.cpop.mall.business.vo.OrderRefundPageVo; +import com.cpop.mall.framework.handler.WxPayHandler; +import com.cpop.system.business.entity.ProfitSharing; +import com.cpop.system.business.service.ProfitSharingService; +import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; +import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReturnRequest; +import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReturnResult; +import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request; +import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; import com.cpop.mall.business.entity.OrderRefund; import com.cpop.mall.business.mapper.OrderRefundMapper; import com.cpop.mall.business.service.OrderRefundService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; import static com.cpop.mall.business.entity.table.OrderRefundTableDef.ORDER_REFUND; +import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER; +import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.system.business.entity.table.ProfitSharingTableDef.PROFIT_SHARING; +import static com.cpop.system.business.entity.table.StoreTableDef.STORE; /** * 商城订单退款记录表 服务层实现。 @@ -18,6 +45,9 @@ import static com.cpop.mall.business.entity.table.OrderRefundTableDef.ORDER_REFU @Service("orderRefundService") public class OrderRefundServiceImpl extends ServiceImpl implements OrderRefundService { + @Autowired + private WxPayHandler wxPayHandler; + /** * @descriptions 同意退款 * @author DB @@ -27,8 +57,38 @@ public class OrderRefundServiceImpl extends ServiceImpl + */ + @Override + public Page getOrderRefundPage(OrderRefundPageBo bo) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), + QueryWrapper.create().select(ORDER_REFUND.REFUND_STATUS,ORDER_REFUND.REFUND_REASON,ORDER_REFUND.ID,ORDER_REFUND.ORDER_ID,ORDER_REFUND.CREATE_TIME) + //订单相关参数 + .select(ORDER.ORDER_STATUS,ORDER.OUT_ORDER_NO,ORDER.PRODUCT_NAMES,ORDER.TOTAL_AMOUNT,ORDER.PAY_USER_NAME,ORDER.BRAND_ID, + ORDER.STORE_ID,ORDER.RECEIVE_PHONE,ORDER.RECEIVE_ADDRESS,ORDER.LOGISTICS_ORDER,ORDER.REMARKS) + //品牌/店铺或校区 + .select(BRAND.BRAND_NAME,STORE.STORE_NAME) + .from(ORDER_REFUND) + .leftJoin(ORDER).on(ORDER.ID.eq(ORDER_REFUND.ORDER_ID)) + .leftJoin(SYS_USER).on(SYS_USER.ID.eq(ORDER.PAY_USER_ID)) + .leftJoin(BRAND).on(BRAND.ID.eq(ORDER.BRAND_ID)) + .leftJoin(STORE).on(STORE.ID.eq(ORDER.STORE_ID)) + .and(ORDER.PRODUCT_NAMES.like(bo.getProductName())) + .and(ORDER.PAY_USER_NAME.like(bo.getPayUserName())) + .and(SYS_USER.PHONE_NUMBER.eq(bo.getPayUserPhone())) + .and(ORDER_REFUND.REFUND_STATUS.eq(bo.getRefundStatus())), + OrderRefundPageVo.class); + } + + /** + * @descriptions 退款回调通知处理 + * @author DB + * @date 2023/10/27 18:22 + * @param xmlData 请求数据 + * @return: void + */ + @Override + public void wxPayNotifyRefund(String xmlData) { + try { + WxPayRefundNotifyResult result = wxPayHandler.getWxPayService().parseRefundNotifyResult(xmlData); + WxPayRefundNotifyResult.ReqInfo reqInfo = result.getReqInfo(); + this.updateChain().set(ORDER_REFUND.REFUND_STATUS, 1) + .set(ORDER_REFUND.OUT_REFUND_ID, reqInfo.getRefundId()) + .where(ORDER_REFUND.ID.eq(reqInfo.getOutRefundNo())).update(); + } catch (WxPayException e) { + throw new ServiceException(e.getMessage()); + } + } } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java index 57cc5ad..40dd4b7 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java @@ -3,8 +3,11 @@ package com.cpop.mall.business.service.impl; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.common.utils.ip.IpUtils; import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.base.enums.OrderSource; import com.cpop.core.base.enums.UserType; +import com.cpop.core.base.exception.ServiceException; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; @@ -12,31 +15,42 @@ import com.cpop.core.utils.sql.SqlUtils; import com.cpop.mall.business.bo.OrderApplyRefundBo; import com.cpop.mall.business.bo.OrderPageBo; import com.cpop.mall.business.bo.PlaceOrderBo; -import com.cpop.mall.business.entity.OrderDetail; -import com.cpop.mall.business.entity.OrderRefund; -import com.cpop.mall.business.entity.Product; -import com.cpop.mall.business.service.OrderDetailService; -import com.cpop.mall.business.service.OrderRefundService; -import com.cpop.mall.business.service.ProductService; +import com.cpop.mall.business.dto.WxPayGoodsDetailDto; +import com.cpop.mall.business.entity.*; +import com.cpop.mall.business.service.*; import com.cpop.mall.business.vo.OrderPageVo; +import com.cpop.mall.framework.handler.WxPayHandler; import com.cpop.mall.framework.constant.MallRedisConstant; +import com.cpop.system.business.entity.ProfitSharing; +import com.cpop.system.business.service.ProfitSharingService; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; +import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReceiver; +import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingRequest; +import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingResult; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; -import com.cpop.mall.business.entity.Order; import com.cpop.mall.business.mapper.OrderMapper; -import com.cpop.mall.business.service.OrderService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; +import static com.cpop.mall.business.entity.table.OrderDetailTableDef.ORDER_DETAIL; import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER; import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD; import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT; +import static com.cpop.system.business.entity.table.ProfitSharingTableDef.PROFIT_SHARING; /** @@ -48,6 +62,9 @@ import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT; @Service("orderService") public class OrderServiceImpl extends ServiceImpl implements OrderService { + @Autowired + private WxPayHandler wxPayHandler; + /** * @descriptions 分页查询商城-订单 * @author DB @@ -72,7 +89,7 @@ public class OrderServiceImpl extends ServiceImpl implements queryWrapper.where(ORDER.PAY_USER_ID.eq(loginUserInfo.getString("userId"))); } PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); - return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(), + return this.mapper.paginateWithRelationsAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()), queryWrapper .select(ORDER.ALL_COLUMNS) .from(ORDER) @@ -95,49 +112,118 @@ public class OrderServiceImpl extends ServiceImpl implements */ @Override @Transactional(rollbackFor = Exception.class) - public void placeOrder(PlaceOrderBo bo) { - Order order = BeanUtils.mapToClass(bo, Order.class); - List orderDetails = BeanUtils.mapToList(bo.getPlaceOrderDetailList(), OrderDetail.class); - //规格记录ids - Set recordIds = orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet()); - //获取涉及到的商品 - ProductService productService = SpringUtils.getBean(ProductService.class); - List productList = productService.queryChain() - .select(PRODUCT.ID, PRODUCT.PRODUCT_NAME) - .from(PRODUCT) - .leftJoin(PRODUCT_RECORD).on(PRODUCT_RECORD.PRODUCT_ID.eq(PRODUCT.ID)) - .where(PRODUCT_RECORD.ID.in(recordIds)) - .list(); - //获取当前下单用户信息 - JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo(); - //设置待付款 - order.setOrderStatus(0) - .setProductNames(productList.stream().map(Product::getProductName).collect(Collectors.joining(","))) - .setPayUserId(loginStaffInfo.getString("userId")); - if (StringUtils.isBlank(bo.getPayUserName())) { - order.setPayUserName(loginStaffInfo.getString("nickName")); + public Object placeOrder(PlaceOrderBo bo) { + //检查库存 + Map recordNumIsEnough = recordNumIsEnough(bo.getPlaceOrderDetailList()); + try { + Order order = BeanUtils.mapToClass(bo, Order.class); + List orderDetails = BeanUtils.mapToList(bo.getPlaceOrderDetailList(), OrderDetail.class); + //规格记录ids + Set recordIds = orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet()); + //获取涉及到的商品 + ProductService productService = SpringUtils.getBean(ProductService.class); + List productList = productService.queryChain() + .select(PRODUCT.ID, PRODUCT.PRODUCT_NAME, PRODUCT.DESCRIPTION) + .from(PRODUCT) + .leftJoin(PRODUCT_RECORD).on(PRODUCT_RECORD.PRODUCT_ID.eq(PRODUCT.ID)) + .where(PRODUCT_RECORD.ID.in(recordIds)) + .list(); + //获取当前下单用户信息 + JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo(); + //设置待付款 + order.setOrderStatus(0) + .setProductNames(productList.stream().map(Product::getProductName).collect(Collectors.joining(","))) + .setPayUserId(loginStaffInfo.getString("userId")); + if (StringUtils.isBlank(bo.getPayUserName())) { + order.setPayUserName(loginStaffInfo.getString("nickName")); + } + this.save(order); + //保存订单详情 + orderDetails.forEach(item -> { + item.setOrderId(order.getId()); + }); + SpringUtils.getBean(OrderDetailService.class).saveBatch(orderDetails); + //微信支付 + if (bo.getPayType() == 0) { + WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest(); + //需要分账 + orderRequest.setProfitSharing("Y") + .setSpbillCreateIp(IpUtils.getHostIp()) + .setSubOpenid(loginStaffInfo.getString("openId")) + //商品描述 + .setBody(productList.stream().map(Product::getDescription).collect(Collectors.joining(","))) + //商品详情 + .setDetail(JSONObject.toJSONString(BeanUtils.mapToList(bo.getPlaceOrderDetailList(), WxPayGoodsDetailDto.class))) + .setOutTradeNo(order.getId()) + //元转分 + .setTotalFee(bo.getTotalAmount().scaleByPowerOfTen(2).intValue()) + .setTradeType("JSAPI"); + //微信支付统一下单 + WxPayService wxPayService = wxPayHandler.getWxPayService(); + return wxPayService.createOrder(orderRequest); + } else { + //TODO:积分支付直接扣库存 + return null; + } + } catch (Exception e){ + //回滚库存 + RedisService redisService = SpringUtils.getBean(RedisService.class); + recordNumIsEnough.forEach((key, value) -> { + redisService.longIncrement(MallRedisConstant.STOCK_RECORD_NUM + key, value.longValue()); + }); + throw new ServiceException(e.getMessage()); } - this.save(order); - //保存订单详情 - orderDetails.forEach(item -> { - item.setOrderId(order.getId()); + } + + private void pointPay(Map recordNumIsEnough){ + /*List productRecords = productRecordService.listByIds(orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet())); + productRecords.forEach(item -> { + item.setRecordNum(item.getRecordNum() - orderNumMap.get(item.getId())); }); - SpringUtils.getBean(OrderDetailService.class).saveBatch(orderDetails); + productRecordService.updateBatch(productRecords);*/ } /** * @descriptions 库存是否足够 * @author DB * @date 2023/10/25 10:18 - * @param recordId 规格记录id - * @param num 下单数量 - * @return: java.lang.Boolean + * @param list 订单详情 + * @return: Map 预库存记录 */ - private Boolean recordNumIsEnough(String recordId,Integer num) { + private Map recordNumIsEnough(List list) { RedisService redisService = SpringUtils.getBean(RedisService.class); - //库存 - Integer stockNum = redisService.getCacheObject(MallRedisConstant.STOCK_RECORD_NUM + recordId); - return stockNum - num >= 0; + Map stockNumMap = new HashMap<>(); + //遍历库存 + list.forEach(item -> { + Integer stockNum = redisService.getCacheObject(MallRedisConstant.STOCK_RECORD_NUM + item.getProductRecordId()); + ProductRecord record = null; + //从数据库中获取库存信息然后放入缓存 + if (stockNum == null) { + record = SpringUtils.getBean(ProductRecordService.class).getById(item.getProductRecordId()); + stockNum = record.getRecordNum(); + redisService.setCacheObject(MallRedisConstant.STOCK_RECORD_NUM + item.getProductRecordId(), stockNum); + } + //剩余库存 + Long surplusStock = redisService.longIncrement(MallRedisConstant.STOCK_RECORD_NUM + item.getProductRecordId(), -item.getNumber().longValue()); + boolean isEnough = surplusStock >= 0; + if (!isEnough) { + if (record == null) { + record = SpringUtils.getBean(ProductRecordService.class).getById(item.getProductRecordId()); + } + //回滚库存 + if (!stockNumMap.isEmpty()){ + stockNumMap.forEach((key, value) -> { + redisService.longIncrement(MallRedisConstant.STOCK_RECORD_NUM + key, value.longValue()); + }); + } + redisService.longIncrement(MallRedisConstant.STOCK_RECORD_NUM + item.getProductRecordId(), item.getNumber().longValue()); + throw new ServiceException("您购买的商品" + record.getRecordNames() + "库存不足,请联系客服并重新下单!"); + } else { + //此处录入预库存信息 + stockNumMap.put(item.getProductRecordId(), item.getNumber()); + } + }); + return stockNumMap; } /** @@ -155,4 +241,83 @@ public class OrderServiceImpl extends ServiceImpl implements //修改订单状态 this.updateChain().set(ORDER.ORDER_STATUS, 3).where(ORDER.ID.eq(bo.getOrderId())).update(); } + + /** + * @descriptions 微信支付订单通知 + * @author DB + * @date 2023/10/27 16:04 + * @param xmlData 加密数据 + * @return: void + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void wxPayNotifyOrder(String xmlData) { + try { + WxPayService wxPayService = wxPayHandler.getWxPayService(); + WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData); + String orderId = notifyResult.getOutTradeNo(); + //修改订单状态 + this.updateChain() + .set(ORDER.OUT_ORDER_NO, notifyResult.getTransactionId()) + .set(ORDER.ORDER_STATUS, 1).where(ORDER.ID.eq(orderId)).update(); + //支付成功减库存 + List orderDetails = SpringUtils.getBean(OrderDetailService.class).queryChain() + .where(ORDER_DETAIL.ORDER_ID.eq(orderId)).list(); + //订单数量集合 + Map orderNumMap = orderDetails.stream().collect(Collectors.toMap(OrderDetail::getProductRecordId, OrderDetail::getNumber)); + ProductRecordService productRecordService = SpringUtils.getBean(ProductRecordService.class); + List productRecords = productRecordService.listByIds(orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet())); + productRecords.forEach(item -> { + item.setRecordNum(item.getRecordNum() - orderNumMap.get(item.getId())); + }); + productRecordService.updateBatch(productRecords); + //TODO:分账先注释 + /*ProfitSharing profitSharing = new ProfitSharing(); + profitSharing.setOrderId(orderId) + .setProfitSharingStatus(0) + .setOrderSource(OrderSource.MALL.toString()); + ProfitSharingService profitSharingService = SpringUtils.getBean(ProfitSharingService.class); + profitSharingService.save(profitSharing); + ProfitSharingRequest sharingRequest = new ProfitSharingRequest(); + ProfitSharingReceiver profitSharingReceiver = new ProfitSharingReceiver(); + Double ceil = Math.ceil(notifyResult.getTotalFee() * OrderSource.MALL.getRate()); + profitSharingReceiver.setAmount(ceil.longValue()); + profitSharingReceiver.setDescription("向服务商分账"); + profitSharingReceiver.setType("MERCHANT_ID"); + profitSharingReceiver.setRelationType("SERVICE_PROVIDER"); + profitSharingReceiver.setAccount("1618436087"); + sharingRequest.setTransactionId(notifyResult.getTransactionId()); + sharingRequest.setOutOrderNo(profitSharing.getOrderId()); + //分账结束 + sharingRequest.setUnfreezeUnsplit(true); + ProfitSharingResult profitSharingResult = wxPayService.getProfitSharingV3Service().profitSharing(sharingRequest); + //更新分账订单 + profitSharingService.updateChain().set(PROFIT_SHARING.OUT_PROFIT_SHARING_ID,profitSharingResult.getOrderId()) + .set(PROFIT_SHARING.AMOUNT,ceil.longValue()).set(PROFIT_SHARING.PROFIT_SHARING_STATUS,1).set(PROFIT_SHARING.PAY_ACCOUNT,"1618436087") + .where(PROFIT_SHARING.ID.eq(profitSharing.getId())).update();*/ + } catch (WxPayException e) { + throw new ServiceException(e.getMessage()); + } + } + + /** + * @descriptions 取消订单 + * @author DB + * @date 2023/10/27 17:17 + * @param orderId 订单id + * @return: void + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void cancelOrder(String orderId) { + this.updateChain().set(ORDER.ORDER_STATUS, 5).where(ORDER.ID.eq(orderId)).update(); + //获取订单详情 + List orderDetails = SpringUtils.getBean(OrderDetailService.class).queryChain().where(ORDER_DETAIL.ORDER_ID.eq(orderId)).list(); + Map orderReturnMap = orderDetails.stream().collect(Collectors.toMap(OrderDetail::getProductRecordId, OrderDetail::getNumber)); + //redis库存回滚 + RedisService redisService = SpringUtils.getBean(RedisService.class); + orderReturnMap.forEach((key, value) -> { + redisService.longIncrement(MallRedisConstant.STOCK_RECORD_NUM + key, value.longValue()); + }); + } } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java index ce2bdd4..abd8c53 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java @@ -1,10 +1,12 @@ package com.cpop.mall.business.service.impl; import com.alibaba.fastjson.JSONObject; +import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.enums.SourceType; +import com.cpop.core.base.enums.UserType; import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.sql.SqlUtils; @@ -13,6 +15,7 @@ import com.cpop.jambox.business.service.BrandExtendService; import com.cpop.jambox.business.vo.CardTemplateListVo; import com.cpop.mall.business.bo.ProductBo; import com.cpop.mall.business.bo.ProductPageBo; +import com.cpop.mall.business.bo.ProductRecordBo; import com.cpop.mall.business.entity.Product; import com.cpop.mall.business.entity.ProductRecord; import com.cpop.mall.business.entity.ProductSpecification; @@ -21,6 +24,7 @@ import com.cpop.mall.business.service.OrderEvaluateService; import com.cpop.mall.business.service.ProductRecordService; import com.cpop.mall.business.service.ProductService; import com.cpop.mall.business.service.ProductSpecificationService; +import com.cpop.mall.business.vo.MiniProductPageVo; import com.cpop.mall.business.vo.ProductEvaluateVo; import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.StoreListVo; @@ -35,11 +39,14 @@ import com.mybatisflex.spring.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import static com.cpop.jambox.business.entity.table.BrandExtendTableDef.BRAND_EXTEND; import static com.cpop.jambox.business.entity.table.StoreExtendTableDef.STORE_EXTEND; +import static com.cpop.mall.business.entity.table.OrderDetailTableDef.ORDER_DETAIL; import static com.cpop.mall.business.entity.table.OrderEvaluateTableDef.ORDER_EVALUATE; import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER; import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD; @@ -47,6 +54,7 @@ import static com.cpop.mall.business.entity.table.ProductSpecificationTableDef.P import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT; import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; import static com.cpop.system.business.entity.table.StoreTableDef.STORE; +import static com.mybatisflex.core.query.QueryMethods.sum; /** * 商城-商品表 服务层实现。 @@ -67,9 +75,10 @@ public class ProductServiceImpl extends ServiceImpl impl @Override public Page getProductPage(ProductPageBo bo) { //获取当前用户品牌 - JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo(); + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); QueryWrapper queryWrapper = QueryWrapper.create(); + //价格排序 if (null != bo.getPriceOrder()){ if (bo.getPriceOrder()) { queryWrapper.orderBy(PRODUCT.MAX_PRICE.desc()); @@ -77,14 +86,62 @@ public class ProductServiceImpl extends ServiceImpl impl queryWrapper.orderBy(PRODUCT.MIN_PRICE.asc()); } } - return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(), - queryWrapper - .where(PRODUCT.BRAND_ID.eq(loginStaffInfo.getString("brandId"))) + return this.mapper.paginateWithRelationsAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()), + queryWrapper.select(PRODUCT.ALL_COLUMNS) + .from(PRODUCT) + .where(PRODUCT.BRAND_ID.eq(loginUserInfo.getString("brandId"))) .and(PRODUCT.PRODUCT_NAME.like(bo.getProductName())) .and(PRODUCT.PRODUCT_TYPE.eq(bo.getProductType())) .and(PRODUCT.BUY_RESTRICT.eq(bo.getBuyRestrict())) .orderBy(pageDomain.getOrderByColumn()), - ProductPageVo.class); + ProductPageVo.class, + //子查询 + item -> item.field(ProductPageVo::getTradeInfo) + .queryWrapper(tradeInfo-> queryChain() + //交易金额;交易数量 + .select(sum(ORDER_DETAIL.NUMBER).as(ProductPageVo.ProductTradeInfo::getTradeNum), sum(ORDER_DETAIL.AMOUNT).as(ProductPageVo.ProductTradeInfo::getTradePrice)) + .from(ORDER_DETAIL) + .leftJoin(PRODUCT_RECORD).on(PRODUCT_RECORD.ID.eq(ORDER_DETAIL.PRODUCT_RECORD_ID)) + .leftJoin(ORDER).on(ORDER.ID.eq(ORDER_DETAIL.ORDER_ID)) + .where(PRODUCT_RECORD.PRODUCT_ID.eq(tradeInfo.getId())) + //只能统计已完成 + .and(ORDER.ORDER_STATUS.eq(3)))); + } + + /** + * @descriptions 分页查询商城-商品 + * @author DB + * @date 2023/10/27 13:41 + * @param bo 请求参数 + * @return: com.mybatisflex.core.paginate.Page + */ + @Override + public Page getMiniProductPage(ProductPageBo bo) { + //获取当前用户品牌 + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + QueryWrapper queryWrapper = QueryWrapper.create(); + //价格排序 + if (null != bo.getPriceOrder()){ + if (bo.getPriceOrder()) { + queryWrapper.orderBy(PRODUCT.MAX_PRICE.desc()); + } else { + queryWrapper.orderBy(PRODUCT.MIN_PRICE.asc()); + } + } + if (null != bo.getProductType()){ + queryWrapper.and(PRODUCT.PRODUCT_TYPE.eq(bo.getProductType())); + queryWrapper.and(PRODUCT.ID.ne(bo.getProductId())); + } + return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(), + queryWrapper + .where(PRODUCT.BRAND_ID.eq(loginUserInfo.getString("brandId"))) + .and(PRODUCT.IS_UP.eq(true)) + .and(PRODUCT.PRODUCT_NAME.like(bo.getProductName())) + .and(PRODUCT.BUY_RESTRICT.eq(bo.getBuyRestrict())) + .and(PRODUCT.PAY_TYPE.eq(bo.getPayType())) + .orderBy(pageDomain.getOrderByColumn()), + MiniProductPageVo.class); } /** @@ -139,6 +196,10 @@ public class ProductServiceImpl extends ServiceImpl impl JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo(); product.setBrandId(loginStaffInfo.getString("brandId")); } + //计算最高最低价 + BigDecimal maxPrice = bo.getRecordList().stream().map(ProductRecordBo::getRecordPrice).max(Comparator.comparing(x -> x)).orElse(null); + BigDecimal minPrice = bo.getRecordList().stream().map(ProductRecordBo::getRecordPrice).min(Comparator.comparing(x -> x)).orElse(null); + product.setMaxPrice(maxPrice).setMinPrice(minPrice); this.save(product); //保存规格 ProductSpecificationService productSpecificationService = SpringUtils.getBean(ProductSpecificationService.class); @@ -167,6 +228,10 @@ public class ProductServiceImpl extends ServiceImpl impl @Transactional(rollbackFor = Exception.class) public void updateProduct(ProductBo bo) { Product product = BeanUtils.mapToClass(bo, Product.class); + //计算最高最低价 + BigDecimal maxPrice = bo.getRecordList().stream().map(ProductRecordBo::getRecordPrice).max(Comparator.comparing(x -> x)).orElse(null); + BigDecimal minPrice = bo.getRecordList().stream().map(ProductRecordBo::getRecordPrice).min(Comparator.comparing(x -> x)).orElse(null); + product.setMaxPrice(maxPrice).setMinPrice(minPrice); this.updateById(product); //保存规格 ProductSpecificationService productSpecificationService = SpringUtils.getBean(ProductSpecificationService.class); diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java index eb93a46..8fd92f5 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java @@ -111,7 +111,7 @@ public class StaffServiceImpl extends ServiceImpl implements LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); sysUser.setCreateUserId(loginUser.getUserId()); sysUser.setUpdateUserId(loginUser.getUserId()); - sysUser.setUserType(UserType.MALL_USER); + sysUser.setUserType(UserType.MALL_USER.toString()); SpringUtils.getBean(CoreService.class).insertSysUser(sysUser); } //再添加员工信息 diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/ProductRecordSyncStockTask.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/task/ProductRecordSyncStockTask.java new file mode 100644 index 0000000..9107951 --- /dev/null +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/task/ProductRecordSyncStockTask.java @@ -0,0 +1,9 @@ +package com.cpop.mall.business.task; + +/** + * @author DB + * @createTime 2023/10/27 17:26 + * @description 凌晨同步库存任务 + */ +public class ProductRecordSyncStockTask { +} diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MiniProductPageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MiniProductPageVo.java new file mode 100644 index 0000000..fedfbfc --- /dev/null +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MiniProductPageVo.java @@ -0,0 +1,111 @@ +package com.cpop.mall.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mybatisflex.annotation.RelationOneToMany; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author DB + * @createTime 2023/10/27 13:39 + * @description + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "商城商品分页返回对象") +public class MiniProductPageVo implements Serializable { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 商品名 + */ + @ApiModelProperty("商品名") + private String productName; + + /** + * 产品类型(0:课卡;1:周边;2:优惠卷:3:其他) + */ + @ApiModelProperty("产品类型(0:课卡;1:周边;2:优惠卷:3:其他)") + private Integer productType; + + /** + * 商店(校区)集合 + */ + @ApiModelProperty("商店(校区)集合") + private String storeIds; + + /** + * 描述 + */ + @ApiModelProperty("描述") + private String description; + + /** + * 商品图地址 + */ + @ApiModelProperty("商品图地址") + private String picUrl; + + /** + * 商品详情图地址 + */ + @ApiModelProperty("商品详情图地址") + private String picDetailUrl; + + /** + * 购买限制(0:会员限制;1:新客限定;2:用户限购) + */ + @ApiModelProperty("购买限制(0:会员限制;1:新客限定;2:用户限购)") + private Integer buyRestrict; + + /** + * 最高价 + */ + @ApiModelProperty("最高价") + private BigDecimal maxPrice; + + /** + * 最低价 + */ + @ApiModelProperty("最低价") + private BigDecimal minPrice; + + /** + * 支付方式(微信支付:0;积分支付:1) + */ + @ApiModelProperty("支付方式(微信支付:0;积分支付:1)") + private Integer payType; + + /** + * 产品规格 + */ + @RelationOneToMany(selfField = "id", targetField = "productId",targetTable = "cp_mall_product_specification") + @ApiModelProperty("产品规格") + private List productSpecificationVos; + + /** + * 产品规格记录 + */ + @RelationOneToMany(selfField = "id", targetField = "productId",targetTable = "cp_mall_product_record") + @ApiModelProperty("产品规格记录") + private List productRecordVos; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @ApiModelProperty("创建时间") + private LocalDateTime createTime; +} diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderDetailVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderDetailVo.java index b77df37..dad31c1 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderDetailVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderDetailVo.java @@ -18,6 +18,12 @@ import java.math.BigDecimal; @ApiModel(value = "商城订单详情返回对象") public class OrderDetailVo implements Serializable { + /** + * 订单id + */ + @ApiModelProperty("订单id") + private String orderId; + /** * 商品记录id */ diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderPageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderPageVo.java index 2fe38ec..9b684c2 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderPageVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderPageVo.java @@ -2,6 +2,7 @@ package com.cpop.mall.business.vo; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.RelationOneToMany; +import com.mybatisflex.annotation.RelationOneToOne; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -111,9 +112,6 @@ public class OrderPageVo implements Serializable { @ApiModelProperty("订单详情") @RelationOneToMany(selfField = "id", targetField = "orderId", - targetTable = "cp_mall_order_detail", - joinTable = "cp_mall_product_record", - joinSelfColumn = "product_record_id", - joinTargetColumn = "id") + targetTable = "cp_mall_order_detail") private List detailList; } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderRefundPageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderRefundPageVo.java new file mode 100644 index 0000000..155ba8f --- /dev/null +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/OrderRefundPageVo.java @@ -0,0 +1,143 @@ +package com.cpop.mall.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author DB + * @createTime 2023/10/27 17:34 + * @description + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "商城退款分页返回对象") +public class OrderRefundPageVo implements Serializable { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 订单id + */ + @ApiModelProperty("订单id") + private String orderId; + + /** + * 订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中) + */ + @ApiModelProperty("订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)") + private Integer orderStatus; + + /** + * 外部订单号 + */ + @ApiModelProperty("外部订单号") + private String outOrderNo; + + /** + * 商品名 + */ + @ApiModelProperty("商品名") + private String productNames; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 总积分 + */ + @ApiModelProperty("总积分") + private Long totalPoint; + + /** + * 品牌id + */ + @ApiModelProperty("品牌id") + private String brandId; + + /** + * 店铺(校区)id + */ + @ApiModelProperty("店铺(校区)id") + private String storeId; + + /** + * 品牌名 + */ + @ApiModelProperty("品牌名") + private String brandName; + + /** + * 店铺(校区)名 + */ + @ApiModelProperty("店铺(校区)名") + private String storeName; + + /** + * 下单用户id + */ + @ApiModelProperty("下单用户id") + private String payUserId; + + /** + * 收货人名 + */ + @ApiModelProperty("收货人名") + private String receiveName; + + /** + * 收货人电话 + */ + @ApiModelProperty("收货人电话") + private String receivePhone; + + /** + * 收货地址 + */ + @ApiModelProperty("收货地址") + private String receiveAddress; + + /** + * 物流订单号 + */ + @ApiModelProperty("物流订单号") + private String logisticsOrder; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String remarks; + + /** + * 下单时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @ApiModelProperty("下单时间") + private LocalDateTime createTime; + + /** + * 退款原因 + */ + @ApiModelProperty("退款原因") + private String refundReason; + + /** + * 退款状态 + */ + @ApiModelProperty("退款状态") + private Integer refundStatus; +} diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java index 1f79e26..611c40a 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java @@ -89,6 +89,18 @@ public class ProductPageVo implements Serializable { @ApiModelProperty("最低价") private BigDecimal minPrice; + /** + * 支付方式(微信支付:0;积分支付:1) + */ + @ApiModelProperty("支付方式(微信支付:0;积分支付:1)") + private Integer payType; + + /** + * 商品交易成功信息 + */ + @ApiModelProperty("商品交易成功信息") + private ProductTradeInfo tradeInfo; + /** * 产品规格 */ @@ -109,4 +121,23 @@ public class ProductPageVo implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") @ApiModelProperty("创建时间") private LocalDateTime createTime; + + /** + * 商品交易成功信息 + */ + @Data + @ApiModel("商品交易成功信息") + public static class ProductTradeInfo implements Serializable{ + /** + * 交易数量 + */ + @ApiModelProperty("交易数量") + private Long tradeNum; + + /** + * 交易金额 + */ + @ApiModelProperty("交易金额") + private BigDecimal tradePrice; + } } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayConfiguration.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayConfiguration.java index 761a8a5..16a6fbe 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayConfiguration.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayConfiguration.java @@ -36,6 +36,8 @@ public class WxPayConfiguration { payConfig.setKeyPath(this.properties.getKeyPath()); payConfig.setPrivateKeyPath(this.properties.getPrivateKeyPath()); payConfig.setPrivateCertPath(this.properties.getPrivateCertPath()); + //通知地址 + payConfig.setNotifyUrl(this.properties.getNotifyUrl()); // 可以指定是否使用沙箱环境 payConfig.setUseSandboxEnv(false); WxPayService wxPayService = new WxPayServiceImpl(); @@ -43,24 +45,4 @@ public class WxPayConfiguration { return wxPayService; } - /** - * @descriptions 根据商户appid或商户号获取对应微信支付接口 - * @author DB - * @date 2023/10/18 10:34 - * @param subAppId 子商户appid - * @param subMchId 子商户id - * @return: com.github.binarywang.wxpay.service.WxPayService - */ - public WxPayService getWxService(String subAppId, String subMchId) { - WxPayService wxPayService = wxService(); - WxPayConfig payConfig = wxPayService.getConfig(); - //子商户信息 - payConfig.setSubAppId(StringUtils.trimToNull(subAppId)); - payConfig.setSubMchId(StringUtils.trimToNull(subMchId)); - // 可以指定是否使用沙箱环境 - payConfig.setUseSandboxEnv(false); - wxPayService.setConfig(payConfig); - return wxPayService; - } - } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayProperties.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayProperties.java index 6fc1188..3916d82 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayProperties.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/config/wxPay/WxPayProperties.java @@ -60,4 +60,9 @@ public class WxPayProperties { * apiV3 证书序列号值 */ private String certSerialNo; + + /** + * 通知地址 + */ + private String notifyUrl; } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/framework/handler/WxPayHandler.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/handler/WxPayHandler.java new file mode 100644 index 0000000..ba35471 --- /dev/null +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/handler/WxPayHandler.java @@ -0,0 +1,67 @@ +package com.cpop.mall.framework.handler; + +import com.alibaba.fastjson.JSONObject; +import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.SecurityUtils; +import com.cpop.core.utils.SpringUtils; +import com.cpop.system.business.entity.Brand; +import com.cpop.system.business.service.BrandService; +import com.github.binarywang.wxpay.config.WxPayConfig; +import com.github.binarywang.wxpay.service.WxPayService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author DB + * @createTime 2023/10/27 15:47 + * @description + */ +@Component +public class WxPayHandler { + + @Autowired + private WxPayService wxPayService; + + /** + * @descriptions 获取微信支付service + * @author DB + * @date 2023/10/27 15:53 + * @return: com.github.binarywang.wxpay.service.WxPayService + */ + public WxPayService getWxPayService(){ + //查询当前登陆用户所在品牌的商户id + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); + if (loginUserInfo == null) { + //直接返回 + return wxPayService; + } + String brandId = loginUserInfo.getString("brandId"); + Brand brand = SpringUtils.getBean(BrandService.class).getById(brandId); + WxPayConfig payConfig = wxPayService.getConfig(); + //子商户信息 + payConfig.setSubMchId(StringUtils.trimToNull(brand.getWxMchId())); + // 可以指定是否使用沙箱环境 + payConfig.setUseSandboxEnv(false); + wxPayService.setConfig(payConfig); + return wxPayService; + } + + /** + * @descriptions 根据商户appid或商户号获取对应微信支付接口 + * @author DB + * @date 2023/10/18 10:34 + * @param subAppId 子商户appid + * @param subMchId 子商户id + * @return: com.github.binarywang.wxpay.service.WxPayService + */ + public WxPayService getWxPayService(String subAppId, String subMchId) { + WxPayConfig payConfig = wxPayService.getConfig(); + //子商户信息 + payConfig.setSubAppId(StringUtils.trimToNull(subAppId)); + payConfig.setSubMchId(StringUtils.trimToNull(subMchId)); + // 可以指定是否使用沙箱环境 + payConfig.setUseSandboxEnv(false); + wxPayService.setConfig(payConfig); + return wxPayService; + } +} diff --git a/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java b/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java index e43a776..d979225 100644 --- a/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java +++ b/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java @@ -3,6 +3,7 @@ package com.cpop.mini.business.entity; import com.cpop.core.base.entity.BaseEntity; import com.cpop.core.base.entity.BaseInsertListener; import com.cpop.core.base.entity.BaseUpdateListener; +import com.cpop.core.base.enums.SourceType; import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Table; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java index 7d8f480..1ab9f6b 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java @@ -278,7 +278,7 @@ public class CpopWxCpTests { sysUser.setPassword("$2a$10$6CA0M3iyO8u8zSVtmufYGO3KfLvjaE5fxdHCqTQ2NpxYH/Dxi/fBu") .setNickName(item.getAlias()) .setStatus(item.getStatus()) - .setUserType(UserType.OAM_USER); + .setUserType(UserType.OAM_USER.toString()); sysUser.setCreateUserId(loginUser == null ? "1" : loginUser.getUserId()); sysUser.setUpdateUserId(loginUser == null ? "1" : loginUser.getUserId()); sysUserList.add(sysUser); diff --git a/Cpop-Oam/pom.xml b/Cpop-Oam/pom.xml index e2f9a31..f798430 100644 --- a/Cpop-Oam/pom.xml +++ b/Cpop-Oam/pom.xml @@ -31,6 +31,16 @@ com.cpop Cpop-System + + + com.github.binarywang + weixin-java-cp + + + + com.github.binarywang + weixin-java-open + diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/BrandStaffController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/BrandStaffController.java deleted file mode 100644 index 3212092..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/BrandStaffController.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.cpop.oam.business.controller; - -import com.cpop.system.business.service.BrandService; -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.query.QueryWrapper; -import com.cpop.core.base.R; -import com.cpop.jambox.business.bo.BrandStaffBo; -import com.cpop.jambox.business.bo.BrandStaffPageBo; -import com.cpop.jambox.business.bo.CampusListByBrandBo; -import com.cpop.jambox.business.service.BrandStaffService; -import com.cpop.jambox.business.service.CampusService; -import com.cpop.jambox.business.vo.BrandListVo; -import com.cpop.jambox.business.vo.BrandStaffPageVo; -import com.cpop.jambox.business.vo.CampusListByBrandVo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; - -/** - * 品牌管理员表 控制层。 - * - * @author DB - * @since 2023-09-13 - */ -@RestController -@Api(tags = "品牌管理员表接口") -@RequestMapping("/brandStaff") -public class BrandStaffController { - - @Autowired - private BrandStaffService brandStaffService; - - @Autowired - private BrandService brandService; - - @Autowired - private CampusService campusService; - - /** - * @Description: 查询品牌管理员分页列表 - * @param bo 请求参数 - * @return: R> - * @Author: DB - * @Date: 2023/6/2 14:01 - **/ - @PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:list')") - @ApiOperation("查询品牌管理员分页列表") - @GetMapping("/getBrandStaffPage") - public R> getBrandStaffPage(BrandStaffPageBo bo) { - Page pageVo = brandStaffService.getBrandStaffPage(bo); - return R.ok(pageVo); - } - - /** - * @descriptions 查询品牌列表 - * @author DB - * @date 2023/09/13 17:55 - * @return com.cpop.core.base.R> - */ - @ApiOperation("查询品牌列表") - @GetMapping("/getBrandList") - public R> getBrandList() { - List pageVo = brandService.listAs(QueryWrapper.create(), BrandListVo.class); - return R.ok(pageVo); - } - - /** - * @Description: 根据品牌查询校区列表 - * @return: R> - * @Author: DB - * @Date: 2023/6/2 17:37 - **/ - @ApiOperation("根据品牌查询校区列表") - @PostMapping("/getCampusListByBrand") - public R> getCampusListByBrand(@RequestBody CampusListByBrandBo bo) { - List list = campusService.listAs(QueryWrapper.create() - .select(CAMPUS.ID,CAMPUS.NAME,CAMPUS.BRAND_ID) - .and(CAMPUS.BRAND_ID.in(bo.getBrandIds())), - CampusListByBrandVo.class); - return R.ok(list); - } - - /** - * @descriptions 新增品牌管理员 - * @author DB - * @date 2023/09/14 16:54 - * @param bo 请求参数 - * @return com.cpop.core.base.R - */ - @PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:insert')") - @ApiOperation("新增品牌管理员") - @PostMapping("/insertBrandStaff") - public R insertBrandStaff(@RequestBody BrandStaffBo bo) { - brandStaffService.insertBrandStaff(bo); - return R.ok(); - } - - /** - * @Description: 删除品牌管理员 - * @param id 主键 - * @return: R - * @Author: DB - * @Date: 2023/6/5 10:03 - **/ - @PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:remove')") - @ApiOperation("删除品牌管理员") - @DeleteMapping("/removeBrandStaffById/{id}") - public R removeBrandStaffById(@PathVariable String id) { - brandStaffService.removeBrandStaffById(id); - //TODO:通知到云库 - return R.ok(); - } - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/TaskWorkOrderController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/TaskWorkOrderController.java index 12c0356..426d0d2 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/TaskWorkOrderController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/TaskWorkOrderController.java @@ -71,7 +71,7 @@ public class TaskWorkOrderController { @PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')") @ApiOperation("任务管理模块-工单记录") @GetMapping("/getWorkOrderRecordList/{workRecordId}") - public R> getWorkOrderRecordList(@PathVariable String workRecordId) { + public R> getWorkOrderRecordList(@PathVariable("workRecordId") String workRecordId) { List list = taskWorkOrderService.getWorkOrderRecordList(workRecordId); return R.ok(list); } @@ -100,7 +100,7 @@ public class TaskWorkOrderController { @PreAuthorize("@aps.hasPermission('oamTask:workOrder:update')") @ApiOperation("工单办结") @PutMapping("/concludeWorkOrder/{id}") - public R concludeWorkOrder(@PathVariable String id) { + public R concludeWorkOrder(@PathVariable("id") String id) { taskWorkOrderService.concludeWorkOrder(id); return R.ok(); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxCpPortalController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxCpPortalController.java index 89297fe..22df6ee 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxCpPortalController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxCpPortalController.java @@ -1,8 +1,8 @@ package com.cpop.oam.business.controller; +import com.cpop.common.utils.JsonUtils; import com.cpop.common.utils.StringUtils; import com.cpop.oam.framework.config.wxCp.WxCpConfiguration; -import com.cpop.sdk.framework.utils.JsonUtils; import io.swagger.annotations.Api; import me.chanjar.weixin.cp.api.WxCpService; import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java index 87ce0de..b741224 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/WxOpenController.java @@ -10,8 +10,8 @@ import com.cpop.oam.business.bo.WxOpenMaCodeCommitBo; import com.cpop.oam.business.bo.WxOpenMaTrialQrCodeBo; import com.cpop.oam.business.service.WxOpenMiniService; import com.cpop.oam.business.vo.WxOpenMiniVo; -import com.cpop.sdk.framework.config.wxOpen.WxOpenProperties; -import com.cpop.sdk.framework.handler.wxOpen.WxOpenService; +import com.cpop.oam.framework.config.wxOpen.WxOpenProperties; +import com.cpop.oam.framework.handler.wxOpen.WxOpenService; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/LoginServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/LoginServiceImpl.java index 2672f31..a6635dc 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/LoginServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/LoginServiceImpl.java @@ -56,7 +56,6 @@ public class LoginServiceImpl implements LoginService { .setUsername(loginUser.getUsername()) .setRealName(staffInfo.getName()) .setAvatar(staffInfo.getAvatar()) - //TODO:不同用户根页面不一样,可能后面调整 .setHomePath(""); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java index 1f33c96..9031da8 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java @@ -117,7 +117,7 @@ public class StaffServiceImpl extends ServiceImpl implements LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); sysUser.setCreateUserId(loginUser.getUserId()); sysUser.setUpdateUserId(loginUser.getUserId()); - sysUser.setUserType(UserType.OAM_USER); + sysUser.setUserType(UserType.OAM_USER.toString()); SpringUtils.getBean(CoreService.class).insertSysUser(sysUser); } //再添加员工信息 @@ -139,8 +139,6 @@ public class StaffServiceImpl extends ServiceImpl implements .where(SYS_USER.USER_NAME.eq(bo.getUserName())) //手机号 .or(SYS_USER.PHONE_NUMBER.eq(bo.getPhoneNumber())) - //TODO:邮箱暂时不做校验 - //.or(SYS_USER.EMAIL.eq(bo.getEmail())) .from(SYS_USER)); if (StringUtils.isNotBlank(bo.getUserId())) { return count > 1; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java index 5872c6b..868d5b6 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java @@ -33,11 +33,11 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; import static com.cpop.oam.business.entity.table.TaskDemandTableDef.TASK_DEMAND; import static com.cpop.oam.business.entity.table.TaskTableDef.TASK; import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.system.business.entity.table.StoreTableDef.STORE; /** * OAM-任务-需求表 服务层实现。 @@ -73,21 +73,21 @@ public class TaskDemandServiceImpl extends ServiceImplBinary Wang diff --git a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxCp/SubscribeHandler.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxCp/SubscribeHandler.java similarity index 94% rename from Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxCp/SubscribeHandler.java rename to Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxCp/SubscribeHandler.java index 03d1c1f..4691160 100644 --- a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxCp/SubscribeHandler.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxCp/SubscribeHandler.java @@ -1,6 +1,6 @@ -package com.cpop.sdk.framework.handler.wxCp; +package com.cpop.oam.framework.handler.wxCp; -import com.cpop.sdk.framework.builder.wxCp.TextBuilder; +import com.cpop.oam.framework.builder.wxCp.TextBuilder; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.cp.api.WxCpService; diff --git a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxCp/UnsubscribeHandler.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxCp/UnsubscribeHandler.java similarity index 94% rename from Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxCp/UnsubscribeHandler.java rename to Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxCp/UnsubscribeHandler.java index bf0f528..9bb5aa4 100644 --- a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxCp/UnsubscribeHandler.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxCp/UnsubscribeHandler.java @@ -1,4 +1,4 @@ -package com.cpop.sdk.framework.handler.wxCp; +package com.cpop.oam.framework.handler.wxCp; import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.cp.api.WxCpService; diff --git a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxOpen/WxOpenService.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxOpen/WxOpenService.java similarity index 93% rename from Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxOpen/WxOpenService.java rename to Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxOpen/WxOpenService.java index b19a60a..fc11c1d 100644 --- a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/wxOpen/WxOpenService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxOpen/WxOpenService.java @@ -1,6 +1,6 @@ -package com.cpop.sdk.framework.handler.wxOpen; +package com.cpop.oam.framework.handler.wxOpen; -import com.cpop.sdk.framework.config.wxOpen.WxOpenProperties; +import com.cpop.oam.framework.config.wxOpen.WxOpenProperties; import me.chanjar.weixin.open.api.impl.WxOpenInRedisTemplateConfigStorage; import me.chanjar.weixin.open.api.impl.WxOpenMessageRouter; import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl; @@ -15,7 +15,7 @@ import javax.annotation.PostConstruct; /** * @author DB - * @createTime 2023/10/10 11:29 + * @createTime 2023/10/27 9:30 * @description */ @Service @@ -51,3 +51,4 @@ public class WxOpenService extends WxOpenServiceImpl { return wxOpenMessageRouter; } } + diff --git a/Cpop-Sdk/pom.xml b/Cpop-Sdk/pom.xml deleted file mode 100644 index ba10955..0000000 --- a/Cpop-Sdk/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - com.cpop - Cpop-Union - 1.0.0 - ../pom.xml - - Cpop-Sdk - Cpop-Sdk - Cpop-Sdk - - - - - com.cpop - Cpop-Core - - - - com.github.binarywang - weixin-java-open - - - - com.github.binarywang - weixin-java-miniapp - - - - com.github.binarywang - weixin-java-cp - - - - com.github.binarywang - weixin-java-pay - - - - com.qcloud - cos_api - - - - org.bouncycastle - bcprov-jdk15on - - - - diff --git a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/config/wxMa/WxMaConfiguration.java b/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/config/wxMa/WxMaConfiguration.java deleted file mode 100644 index 9eb8863..0000000 --- a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/config/wxMa/WxMaConfiguration.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.cpop.sdk.framework.config.wxMa; - -import cn.binarywang.wx.miniapp.api.WxMaService; -import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; -import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; -import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; -import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; -import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; -import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; -import lombok.extern.slf4j.Slf4j; -import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; -import me.chanjar.weixin.common.error.WxErrorException; -import me.chanjar.weixin.common.error.WxRuntimeException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.io.File; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author Binary Wang - */ -@Slf4j -@Configuration -@EnableConfigurationProperties(WxMaProperties.class) -public class WxMaConfiguration { - private final WxMaProperties properties; - - @Autowired - public WxMaConfiguration(WxMaProperties properties) { - this.properties = properties; - } - - @Bean - public WxMaService wxMaService() { - List configs = this.properties.getConfigs(); - if (configs == null) { - throw new WxRuntimeException("未配置WechatMiniApp"); - } - WxMaService maService = new WxMaServiceImpl(); - maService.setMultiConfigs( - configs.stream() - .map(a -> { - WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); - //WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool()); - // 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常 - config.setAppid(a.getAppid()); - config.setSecret(a.getSecret()); - config.setToken(a.getToken()); - config.setAesKey(a.getAesKey()); - config.setMsgDataFormat(a.getMsgDataFormat()); - return config; - }).collect(Collectors.toMap(WxMaDefaultConfigImpl::getAppid, a -> a, (o, n) -> o))); - return maService; - } - - @Bean - public WxMaMessageRouter wxMaMessageRouter(WxMaService wxMaService) { - final WxMaMessageRouter router = new WxMaMessageRouter(wxMaService); - router - .rule().handler(logHandler).next() - .rule().async(false).content("订阅消息").handler(subscribeMsgHandler).end() - .rule().async(false).content("文本").handler(textHandler).end() - .rule().async(false).content("图片").handler(picHandler).end() - .rule().async(false).content("二维码").handler(qrcodeHandler).end(); - return router; - } - - private final WxMaMessageHandler subscribeMsgHandler = (wxMessage, context, service, sessionManager) -> { - service.getMsgService().sendSubscribeMsg(WxMaSubscribeMessage.builder() - .templateId("此处更换为自己的模板id") - .data(Arrays.asList(new WxMaSubscribeMessage.MsgData("keyword1", "339208499"))) - .toUser(wxMessage.getFromUser()) - .build()); - return null; - }; - - private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> { - log.info("收到消息:" + wxMessage.toString()); - service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson()) - .toUser(wxMessage.getFromUser()).build()); - return null; - }; - - private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> { - service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息") - .toUser(wxMessage.getFromUser()).build()); - return null; - }; - - private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> { - try { - WxMediaUploadResult uploadResult = service.getMediaService() - .uploadMedia("image", "png", - ClassLoader.getSystemResourceAsStream("tmp.png")); - service.getMsgService().sendKefuMsg( - WxMaKefuMessage - .newImageBuilder() - .mediaId(uploadResult.getMediaId()) - .toUser(wxMessage.getFromUser()) - .build()); - } catch (WxErrorException e) { - e.printStackTrace(); - } - - return null; - }; - - private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> { - try { - final File file = service.getQrcodeService().createQrcode("123", 430); - WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file); - service.getMsgService().sendKefuMsg( - WxMaKefuMessage - .newImageBuilder() - .mediaId(uploadResult.getMediaId()) - .toUser(wxMessage.getFromUser()) - .build()); - } catch (WxErrorException e) { - e.printStackTrace(); - } - - return null; - }; - -} diff --git a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/config/wxMa/WxMaProperties.java b/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/config/wxMa/WxMaProperties.java deleted file mode 100644 index ed8b023..0000000 --- a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/config/wxMa/WxMaProperties.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.cpop.sdk.framework.config.wxMa; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; - -import java.util.List; - -/** - * @author DB - * @createTime 2023/09/28 10:01 - * @description - */ -@Data -@ConfigurationProperties(prefix = "wx.miniapp") -public class WxMaProperties { - - private List configs; - - @Data - public static class Config { - /** - * 设置微信小程序的appid - */ - private String appid; - - /** - * 设置微信小程序的Secret - */ - private String secret; - - /** - * 设置微信小程序消息服务器配置的token - */ - private String token; - - /** - * 设置微信小程序消息服务器配置的EncodingAESKey - */ - private String aesKey; - - /** - * 消息格式,XML或者JSON - */ - private String msgDataFormat; - } - -} diff --git a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/qCloudCos/QCloudCosHandler.java b/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/qCloudCos/QCloudCosHandler.java deleted file mode 100644 index 5026df2..0000000 --- a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/handler/qCloudCos/QCloudCosHandler.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.cpop.sdk.framework.handler.qCloudCos; - -import com.cpop.core.utils.uuid.IdUtils; -import com.qcloud.cos.COSClient; -import com.qcloud.cos.ClientConfig; -import com.qcloud.cos.auth.BasicCOSCredentials; -import com.qcloud.cos.auth.COSCredentials; -import com.qcloud.cos.exception.CosClientException; -import com.qcloud.cos.http.HttpProtocol; -import com.qcloud.cos.model.ObjectMetadata; -import com.qcloud.cos.model.PutObjectRequest; -import com.qcloud.cos.model.StorageClass; -import com.qcloud.cos.model.UploadResult; -import com.qcloud.cos.region.Region; -import com.qcloud.cos.transfer.TransferManager; -import com.qcloud.cos.transfer.TransferManagerConfiguration; -import com.qcloud.cos.transfer.Upload; -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * @author DB - * @createTime 2023/09/28 11:08 - * @description 腾讯云handler - */ -@Data -@Component -@ConfigurationProperties(prefix = "q-cloud.cos") -public class QCloudCosHandler { - - /** - * id - */ - private String secretId; - - /** - * 密钥 - */ - private String secretKey; - - /** - * 资源桶 - */ - private String bucketName; - - /** - * CDN加速路径 - */ - private String cndUrl; - - /** - * @descriptions 获取client - * @author DB - * @date 2023/09/28 11:12 - * @return: com.qcloud.cos.COSClient - */ - private COSClient createCosClient() { - //初始化 - COSCredentials cred = new BasicCOSCredentials(secretId, secretKey); - Region region = new Region("ap-guangzhou"); - ClientConfig clientConfig = new ClientConfig(region); - //从 5.6.54 版本开始,默认使用了 https - clientConfig.setHttpProtocol(HttpProtocol.https); - //生成 cos 客户端。 - return new COSClient(cred, clientConfig); - } - - /** - * @descriptions 创建 TransferManager 实例,这个实例用来后续调用高级接口 - * @author DB - * @date 2023/09/28 11:20 - * @return: TransferManager - */ - TransferManager createTransferManager() { - // 创建一个 COSClient 实例,这是访问 COS 服务的基础实例。 - COSClient cosClient = createCosClient(); - // 自定义线程池大小,建议在客户端与 COS 网络充足(例如使用腾讯云的 CVM,同地域上传 COS)的情况下,设置成16或32即可,可较充分的利用网络资源 - // 对于使用公网传输且网络带宽质量不高的情况,建议减小该值,避免因网速过慢,造成请求超时。 - ExecutorService threadPool = Executors.newFixedThreadPool(32); - // 传入一个 threadPool, 若不传入线程池,默认 TransferManager 中会生成一个单线程的线程池。 - TransferManager transferManager = new TransferManager(cosClient, threadPool); - // 设置高级接口的配置项 - // 分块上传阈值和分块大小分别为 5MB 和 1MB - TransferManagerConfiguration transferManagerConfiguration = new TransferManagerConfiguration(); - transferManagerConfiguration.setMultipartUploadThreshold(5 * 1024 * 1024); - transferManagerConfiguration.setMinimumUploadPartSize(1 * 1024 * 1024); - transferManager.setConfiguration(transferManagerConfiguration); - return transferManager; - } - - /** - * @descriptions 关闭 TransferManager - * @author DB - * @date 2023/09/28 11:24 - * @param transferManager TransferManager 实例 - * @return: void - */ - void shutdownTransferManager(TransferManager transferManager) { - // 指定参数为 true, 则同时会关闭 transferManager 内部的 COSClient 实例。 - // 指定参数为 false, 则不会关闭 transferManager 内部的 COSClient 实例。 - transferManager.shutdownNow(true); - } - - /** - * @descriptions 文件上传 - * @author DB - * @date 2023/09/28 13:56 - * @param file 文件 - * @return: 返回cdn加速路径 - */ - public String upload(File file) { - // 使用高级接口必须先保证本进程存在一个 TransferManager 实例,如果没有则创建 - // 详细代码参见本页:高级接口 -> 创建 TransferManager - TransferManager transferManager = createTransferManager(); - // 对象键(Key)是对象在存储桶中的唯一标识。 - String key = IdUtils.fastSimpleUUID(); - PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, file); - // 设置存储类型(如有需要,不需要请忽略此行代码), 默认是标准(Standard), 低频(standard_ia) - // 更多存储类型请参见 https://cloud.tencent.com/document/product/436/33417 - putObjectRequest.setStorageClass(StorageClass.Standard); - //若需要设置对象的自定义 Headers 可参照下列代码,若不需要可省略下面这几行,对象自定义 Headers 的详细信息可参考 https://cloud.tencent.com/document/product/436/13361 - ObjectMetadata objectMetadata = new ObjectMetadata(); - //若设置 Content-Type、Cache-Control、Content-Disposition、Content-Encoding、Expires 这五个字自定义 Headers,推荐采用 objectMetadata.setHeader() - //若要设置 “x-cos-meta-[自定义后缀]” 这样的自定义 Header,推荐采用 - Map userMeta = new HashMap(); - objectMetadata.setUserMetadata(userMeta); - putObjectRequest.withMetadata(objectMetadata); - UploadResult uploadResult = null; - try { - // 高级接口会返回一个异步结果Upload - // 可同步地调用 waitForUploadResult 方法等待上传完成,成功返回 UploadResult, 失败抛出异常 - Upload upload = transferManager.upload(putObjectRequest); - upload.waitForUploadResult(); - return "https://" + bucketName + cndUrl + key; - } catch (CosClientException | InterruptedException e) { - e.printStackTrace(); - } finally { - // 确定本进程不再使用 transferManager 实例之后,关闭即可 - shutdownTransferManager(transferManager); - } - return null; - } - -} diff --git a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/utils/JsonUtils.java b/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/utils/JsonUtils.java deleted file mode 100644 index ba86f23..0000000 --- a/Cpop-Sdk/src/main/java/com/cpop/sdk/framework/utils/JsonUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.cpop.sdk.framework.utils; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * @author Binary Wang - */ -public class JsonUtils { - private static final ObjectMapper JSON = new ObjectMapper(); - - static { - JSON.setSerializationInclusion(Include.NON_NULL); - JSON.configure(SerializationFeature.INDENT_OUTPUT, Boolean.TRUE); - } - - public static String toJson(Object obj) { - try { - return JSON.writeValueAsString(obj); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/Cpop-Sdk/src/main/resources/application-sdk.yml b/Cpop-Sdk/src/main/resources/application-sdk.yml deleted file mode 100644 index 23b0f2d..0000000 --- a/Cpop-Sdk/src/main/resources/application-sdk.yml +++ /dev/null @@ -1,44 +0,0 @@ -#腾讯云 -qCloud: - cos: - secretId: AKIDFK8hz0kDRP6XjdGciX5LK3VfYBWaMs7V - secretKey: 92g38wUlkSt50e17wUllUw71pMcaIjtl - bucketName: dataresource-1302318474 - cndUrl: .cos.accelerate.myqcloud.com/ - -#微信SDK -wx: - #开放平台 - open: - openAppid: wx6e07ba6606e912a5 - componentAppId: wx1efbf67f8637d7d1 - componentSecret: fc2e9457aaa32342751cc655b5a1d273 - componentToken: jambox - componentAesKey: 1a3NBxmCFwkCJvfoQ7WhJHB6iX3qHPsc9JbaDznE1i0 - redirectUri: https://empower.oamapi.cpopsz.com/test/openPlatform/thirdPartyPlatform/redirectUrl - #小程序 - miniapp: - configs: - #appid - - appid: wx1eb0e5fb7dac3c05 - #Secret - secret: f274d2ca01cc58cb5387379356c005c1 - # - token: - # - aesKey: - msgDataFormat: JSON - #企业微信 - cp: - corpId: ww9b83a363662f219f - appConfigs: - #通讯录同步 - - agentId: 1000000 - secret: YAvZS9i2Ccc3_arbH-qi3zTEDJfmEt_2L-k2LG_TTEw - token: xKOLVqjOUklbQ - aesKey: A71T8zPqzb5B2uPesyfRyuTEFpDjhinIRdHg65NuUFj - #Oam-企业微信互通应用 - - agentId: 1000024 - secret: VJFNBvZgK6oNEKpfrb5B9KQcm7yB0CacpWS2BfTln5Q - token: 1i2dz2yxD0Np2xvMYTD - aesKey: DLSzfHVUZN3O9WhtL07RBXUoooqC2bjEJYwep8k8ojt \ No newline at end of file diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java index 26684ff..4d96f94 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java @@ -50,7 +50,7 @@ public class BrandController { @ApiOperation("新增系统品牌") public R insertSysBrand(@RequestBody @ApiParam("系统-品牌") BrandBo brand) { Brand entity = BeanUtils.mapToClass(brand, Brand.class); - entity.setSourceType(SourceType.COMMON); + entity.setSourceType(SourceType.COMMON.toString()); brandService.save(entity); return R.ok(); } diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/ProfitSharingController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/ProfitSharingController.java new file mode 100644 index 0000000..56d5c0f --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/ProfitSharingController.java @@ -0,0 +1,106 @@ +package com.cpop.system.business.controller; + +import com.mybatisflex.core.paginate.Page; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.beans.factory.annotation.Autowired; +import com.cpop.system.business.entity.ProfitSharing; +import com.cpop.system.business.service.ProfitSharingService; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.io.Serializable; +import java.util.List; + +/** + * 系统分账表 控制层。 + * + * @author DB + * @since 2023-10-27 + */ +@RestController +@Api(tags = "系统分账表接口") +@RequestMapping("/profitSharing") +public class ProfitSharingController { + + @Autowired + private ProfitSharingService profitSharingService; + + /** + * 添加系统分账表。 + * + * @param profitSharing 系统分账表 + * @return {@code true} 添加成功,{@code false} 添加失败 + */ + @PostMapping("/save") + @ApiOperation("保存系统分账表") + public boolean save(@RequestBody @ApiParam("系统分账表") ProfitSharing profitSharing) { + return profitSharingService.save(profitSharing); + } + + /** + * 根据主键删除系统分账表。 + * + * @param id 主键 + * @return {@code true} 删除成功,{@code false} 删除失败 + */ + @DeleteMapping("/remove/{id}") + @ApiOperation("根据主键系统分账表") + public boolean remove(@PathVariable @ApiParam("系统分账表主键") Serializable id) { + return profitSharingService.removeById(id); + } + + /** + * 根据主键更新系统分账表。 + * + * @param profitSharing 系统分账表 + * @return {@code true} 更新成功,{@code false} 更新失败 + */ + @PutMapping("/update") + @ApiOperation("根据主键更新系统分账表") + public boolean update(@RequestBody @ApiParam("系统分账表主键") ProfitSharing profitSharing) { + return profitSharingService.updateById(profitSharing); + } + + /** + * 查询所有系统分账表。 + * + * @return 所有数据 + */ + @GetMapping("/list") + @ApiOperation("查询所有系统分账表") + public List list() { + return profitSharingService.list(); + } + + /** + * 根据系统分账表主键获取详细信息。 + * + * @param id 系统分账表主键 + * @return 系统分账表详情 + */ + @GetMapping("/getInfo/{id}") + @ApiOperation("根据主键获取系统分账表") + public ProfitSharing getInfo(@PathVariable @ApiParam("系统分账表主键") Serializable id) { + return profitSharingService.getById(id); + } + + /** + * 分页查询系统分账表。 + * + * @param page 分页对象 + * @return 分页对象 + */ + @GetMapping("/page") + @ApiOperation("分页查询系统分账表") + public Page page(@ApiParam("分页信息") Page page) { + return profitSharingService.page(page); + } + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/SysCommonController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/SysCommonController.java similarity index 95% rename from Cpop-Oam/src/main/java/com/cpop/oam/business/controller/SysCommonController.java rename to Cpop-System/src/main/java/com/cpop/system/business/controller/SysCommonController.java index 708a752..5be820d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/SysCommonController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/SysCommonController.java @@ -1,11 +1,11 @@ -package com.cpop.oam.business.controller; +package com.cpop.system.business.controller; import com.cpop.core.base.R; import com.cpop.core.config.CpopConfig; import com.cpop.core.config.ServerConfig; import com.cpop.core.utils.file.FileUploadUtils; import com.cpop.core.utils.file.FileUtils; -import com.cpop.oam.business.vo.SysFileVo; +import com.cpop.system.business.vo.SysFileVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java index f0ccf41..7957dbd 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java @@ -58,7 +58,7 @@ public class Brand extends BaseEntity implements Serializable { /** * 数据来源 */ - private SourceType sourceType; + private String sourceType; /** * 逻辑删除(0否1是) diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/ProfitSharing.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/ProfitSharing.java new file mode 100644 index 0000000..05474a8 --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/ProfitSharing.java @@ -0,0 +1,73 @@ +package com.cpop.system.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 系统分账表 实体类。 + * + * @author DB + * @since 2023-10-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_sys_profit_sharing", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class ProfitSharing extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 外部分账单号 + */ + private String outProfitSharingId; + + /** + * 订单id + */ + private String orderId; + + /** + * 订单来源 + */ + private String orderSource; + + /** + * 分账金额(单位分) + */ + private Long amount; + + /** + * 支付账号信息 + */ + private String payAccount; + + /** + * 分账状态(0:分账中;1:分账成功;2;分账退款) + */ + private Integer profitSharingStatus; + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java index 77954bf..dd94bcc 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java @@ -53,7 +53,7 @@ public class Store extends BaseEntity implements Serializable { /** * 来源 */ - private SourceType sourceType; + private String sourceType; /** * 逻辑删除(0否1是) diff --git a/Cpop-System/src/main/java/com/cpop/system/business/mapper/ProfitSharingMapper.java b/Cpop-System/src/main/java/com/cpop/system/business/mapper/ProfitSharingMapper.java new file mode 100644 index 0000000..593d2f1 --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/mapper/ProfitSharingMapper.java @@ -0,0 +1,14 @@ +package com.cpop.system.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.system.business.entity.ProfitSharing; + +/** + * 系统分账表 映射层。 + * + * @author DB + * @since 2023-10-27 + */ +public interface ProfitSharingMapper extends BaseMapper { + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/ProfitSharingService.java b/Cpop-System/src/main/java/com/cpop/system/business/service/ProfitSharingService.java new file mode 100644 index 0000000..8156fe0 --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/ProfitSharingService.java @@ -0,0 +1,14 @@ +package com.cpop.system.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.system.business.entity.ProfitSharing; + +/** + * 系统分账表 服务层。 + * + * @author DB + * @since 2023-10-27 + */ +public interface ProfitSharingService extends IService { + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java index d91c873..27d322b 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java @@ -79,7 +79,7 @@ public class BrandServiceImpl extends ServiceImpl implements .setWxMchId(brand.getString("wxMchId")) .setWxMchKey(brand.getString("wxMchKey")) .setWxKeyPath(brand.getString("wxKeyPath")) - .setSourceType(SourceType.JAMBOX); + .setSourceType(SourceType.JAMBOX.toString()); this.save(sysBrand); //果酱拓展表信息 LocalDateTime now = LocalDateTime.now(); @@ -124,7 +124,7 @@ public class BrandServiceImpl extends ServiceImpl implements List stores = RowUtil.toEntityList(storeList, Store.class); stores.forEach(item->{ item.setBrandId(brandId); - item.setSourceType(SourceType.JAMBOX); + item.setSourceType(SourceType.JAMBOX.toString()); }); SpringUtils.getBean(StoreService.class).saveBatch(stores); //保存拓展表 diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java index 8837ec7..f3707ef 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java @@ -44,7 +44,6 @@ public class LoginServiceImpl implements LoginService { .setAvatar(loginStaffInfo.getString("avatar")) .setPermissions(loginUser.getPermissions()) .setRoles(Collections.singleton("Cpop")) - //TODO:不同用户根页面不一样,可能后面调整 .setHomePath(""); } diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/ProfitSharingServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/ProfitSharingServiceImpl.java new file mode 100644 index 0000000..66b957e --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/ProfitSharingServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.system.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.system.business.entity.ProfitSharing; +import com.cpop.system.business.mapper.ProfitSharingMapper; +import com.cpop.system.business.service.ProfitSharingService; +import org.springframework.stereotype.Service; + +/** + * 系统分账表 服务层实现。 + * + * @author DB + * @since 2023-10-27 + */ +@Service("profitSharingService") +public class ProfitSharingServiceImpl extends ServiceImpl implements ProfitSharingService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/SysFileVo.java b/Cpop-System/src/main/java/com/cpop/system/business/vo/SysFileVo.java similarity index 95% rename from Cpop-Oam/src/main/java/com/cpop/oam/business/vo/SysFileVo.java rename to Cpop-System/src/main/java/com/cpop/system/business/vo/SysFileVo.java index 504d91b..3ad55d4 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/SysFileVo.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/vo/SysFileVo.java @@ -1,4 +1,4 @@ -package com.cpop.oam.business.vo; +package com.cpop.system.business.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Jambox/src/main/resources/mapper/CampusMapper.xml b/Cpop-System/src/main/resources/mapper/ProfitSharingMapper.xml similarity index 70% rename from Cpop-Jambox/src/main/resources/mapper/CampusMapper.xml rename to Cpop-System/src/main/resources/mapper/ProfitSharingMapper.xml index 79896f4..b9e4f61 100644 --- a/Cpop-Jambox/src/main/resources/mapper/CampusMapper.xml +++ b/Cpop-System/src/main/resources/mapper/ProfitSharingMapper.xml @@ -2,6 +2,6 @@ - + diff --git a/pom.xml b/pom.xml index 0dedf18..0e64c3c 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,6 @@ Cpop-Core Cpop-Generator Cpop-Api - Cpop-Sdk Cpop-Oam Cpop-Oam/Cpop-Oam-Web Cpop-Jambox @@ -99,11 +98,6 @@ Cpop-Api ${cpop.version} - - com.cpop - Cpop-Sdk - ${cpop.version} - com.cpop Cpop-Oam