删除SDK拓展包;集成微信支付;商城仓储;商城下单;修订Jambox模块

This commit is contained in:
DB 2023-10-27 23:01:07 +08:00
parent 4976380d67
commit 2de5f008de
124 changed files with 1511 additions and 1915 deletions

View File

@ -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 <a href="https://github.com/binarywang">Binary Wang</a>
*/
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;
}
}

View File

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

View File

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

View File

@ -86,7 +86,7 @@ public class SysUser extends BaseEntity implements Serializable {
/**
* 用户类型
*/
private UserType userType;
private String userType;
/**
* 逻辑删除0否1是

View File

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

View File

@ -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<String, Object> credentials) {
switch (sysUser.getUserType()) {
switch (UserType.valueOf(sysUser.getUserType())) {
case OAM_USER:
return getOamStaffLoginInfo(sysUser);
case MALL_USER:

View File

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

View File

@ -177,6 +177,13 @@ public interface RedisService {
*/
Collection<String> keys(final String pattern);
/**
* 原子类递增减
* @param key
* @param stock
*/
Long longIncrement(final String key, Long stock);
/**
* @param key
* @return

View File

@ -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());
}
}

View File

@ -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

View File

@ -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");

View File

@ -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_";
/**
* 主入口

View File

@ -18,10 +18,6 @@
<groupId>com.cpop</groupId>
<artifactId>Cpop-Core</artifactId>
</dependency>
<dependency>
<groupId>com.cpop</groupId>
<artifactId>Cpop-Sdk</artifactId>
</dependency>
</dependencies>
</project>

View File

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

View File

@ -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<String> brandIds;
/**
* 校区id
*/
@ApiModelProperty("校区id")
private List<String> campusIds;
}

View File

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

View File

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

View File

@ -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<String> brandIds;
}

View File

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

View File

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

View File

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

View File

@ -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<java.util.List<com.cpop.jambox.business.vo.CardTemplateListVo>>
*/
@GetMapping("/getListByBrandOrCampus")
@ApiOperation("根据品牌或校区获取模板")
public R<List<CardTemplateListVo>> getListByBrandOrCampus(CardTemplateListBo bo) {
List<CardTemplateListVo> 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<java.lang.Void>
*/
@PostMapping("saveUnionCardTemplate")
@ApiOperation("保存课卡模板")
public R<Void> 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<CardTemplate> page(@ApiParam("分页信息") Page<CardTemplate> page) {
return cardTemplateService.page(page);
}
}

View File

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

View File

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

View File

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

View File

@ -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<BrandStaff> {
}

View File

@ -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<BrandStaffMidCampus> {
}

View File

@ -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<Campus> {
}

View File

@ -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<BrandStaffMidCampus> {
}

View File

@ -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<BrandStaff> {
/**
* @Description: 查询品牌管理员分页列表
* @param bo 请求参数
* @return: R<PageVo<BrandManagementStaffPageListVo>>
* @Author: DB
* @Date: 2023/6/2 14:01
**/
Page<BrandStaffPageVo> getBrandStaffPage(BrandStaffPageBo bo);
/**
* @descriptions 新增品牌管理员
* @author DB
* @date 2023/09/14 16:54
* @param bo 请求参数
*/
void insertBrandStaff(BrandStaffBo bo);
/**
* @Description: 删除品牌管理员
* @param id 主键
* @return: R<Void>
* @Author: DB
* @Date: 2023/6/5 10:03
**/
void removeBrandStaffById(String id);
}

View File

@ -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<Campus> {
/**
* @Description: 查询校区分页列表
* @param bo 请求参数
* @return R<PageVo<CampusPageListVo>>
* @Author Administrator
* @Date: 2023/6/7 0007 10:18
*/
Page<CampusPageVo> getCampusPage(CampusPageBo bo);
/**
* @descriptions 修改校区
* @author DB
* @date 2023/09/14 11:40
* @param bo 请求参数
*/
void updateCampus(CampusBo bo);
}

View File

@ -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<CardTemplate> {
/**
* @descriptions 根据品牌或校区获取模板
* @author DB
* @date 2023/09/27 17:02
* @param bo 请求参数
* @return java.util.List<com.cpop.jambox.business.vo.CardTemplateListVo>
*/
List<CardTemplateListVo> getListByBrandOrCampus(CardTemplateListBo bo);
/**
* @descriptions 保存课卡模板
* @author DB
* @date 2023/09/27 18:00
* @param bo 请求参数
* @return: void
*/
void saveUnionCardTemplate(CardTemplateUnionBo bo);
}

View File

@ -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<BrandStaffMidCampusMapper, BrandStaffMidCampus> implements BrandStaffMidCampusService {
}

View File

@ -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<BrandStaffMapper, BrandStaff> implements BrandStaffService {
/**
* @Description: 查询品牌管理员分页列表
* @param bo 请求参数
* @return: R<PageVo<BrandManagementStaffPageListVo>>
* @Author: DB
* @Date: 2023/6/2 14:01
**/
@Override
public Page<BrandStaffPageVo> 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<BrandStaffMidCampus> 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<Campus> campusList = SpringUtils.getBean(CampusService.class).list(QueryWrapper.create().where(CAMPUS.ID.in(bo.getCampusIds())));
Set<String> campusBrandIds = campusList
.stream().map(Campus::getBrandId).collect(Collectors.toSet());
Set<String> 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<Void>
* @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:通知到云库
}
}

View File

@ -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<CampusMapper, Campus> implements CampusService {
/**
* @Description: 查询校区分页列表
* @param bo 请求参数
* @return R<PageVo<CampusPageListVo>>
* @Author Administrator
* @Date: 2023/6/7 0007 10:18
*/
@Override
public Page<CampusPageVo> 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:通知到云库
}
}

View File

@ -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<CardTemplateMapper, CardTemplate> 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<com.cpop.jambox.business.vo.CardTemplateListVo>
*/
@Override
public List<CardTemplateListVo> 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";
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpop.jambox.business.mapper.BrandStaffMapper">
</mapper>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpop.jambox.business.mapper.BrandStaffMidCampusMapper">
</mapper>

View File

@ -95,4 +95,14 @@ knife4j:
group-name: System
api-rule: package
api-rule-resources:
- com.cpop.system
- com.cpop.system
logging:
level:
com.github.binarywang.wxpay: debug
#微信支付
wx:
pay:
#通知地址
notifyUrl: https://frp-oak.top:11899/Cpop-Mall/wxPay/callback/notify/order

View File

@ -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
password: Customer0401
logging:
level:
com.github.binarywang.wxpay: error
#微信支付
wx:
pay:
#通知地址
notifyUrl:

View File

@ -1,17 +1,18 @@
# 项目相关配置
cpop:
# 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPathLinux配置 /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
- com.cpop.system
logging:
level:
com.github.binarywang.wxpay: debug
#微信支付
wx:
pay:
#通知地址
notifyUrl: https://frp-oak.top:11899/Cpop-Mall/wxPay/callback/notify/order

View File

@ -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
#微信支付商户号

View File

@ -27,6 +27,11 @@
<groupId>com.cpop</groupId>
<artifactId>Cpop-Jambox</artifactId>
</dependency>
<!--微信支付-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
</dependency>
</dependencies>
</project>

View File

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

View File

@ -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;
/**
* 订单详情
*/

View File

@ -47,6 +47,12 @@ public class ProductBo implements Serializable {
@ApiModelProperty("品牌id")
private String brandId;
/**
* 支付方式(微信支付:0;积分支付:1)
*/
@ApiModelProperty("支付方式(微信支付:0;积分支付:1)")
private Integer payType;
/**
* 商店(校区)集合
*/

View File

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

View File

@ -104,7 +104,7 @@ public class BackstageMallRoleController {
@PreAuthorize("@aps.hasPermission('system:role:remove')")
@ApiOperation("删除商城角色")
@DeleteMapping("/removeMallRole/{id}")
public R<Void> removeMallRole(@PathVariable String id) {
public R<Void> removeMallRole(@PathVariable("id") String id) {
roleBrandService.removeMallRole(id);
return R.ok();
}

View File

@ -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<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.ProductPageVo>>
*/
@GetMapping("/getOrderRefundPage")
@ApiOperation("分页查询商城-退款列表")
public R<Page<OrderRefundPageVo>> getOrderRefundPage(@RequestBody @ApiParam("分页参数") OrderRefundPageBo bo) {
Page<OrderRefundPageVo> page = orderRefundService.getOrderRefundPage(bo);
return R.ok(page);
}
/**
* @descriptions 同意退款
* @author DB
@ -44,7 +62,7 @@ public class BackstageOrderRefundController {
*/
@PutMapping("/agreeRefund/{id}")
@ApiOperation("同意退款")
public R<Void> agreeRefund(@PathVariable String id) {
public R<Void> agreeRefund(@PathVariable("id") String id) {
orderRefundService.agreeRefund(id);
return R.ok();
}

View File

@ -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<Void> update(@PathVariable String id) {
public R<Void> 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<Void> removeById(@PathVariable @ApiParam("商城-商品主键") Serializable id) {
public R<Void> 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<java.lang.Void>
*/
@PutMapping("/productUpOrDown")
@ApiOperation("商城商品上下架")
public R<Void> 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();
}
}

View File

@ -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("成功");
}
}

View File

@ -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<Void> placeOrder(@RequestBody @Validated @ApiParam("商城-订单") PlaceOrderBo bo) {
orderService.placeOrder(bo);
return R.ok();
public R<Object> 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<java.lang.Object>
*/
@PutMapping("/cancelOrder")
@ApiOperation("取消订单")
public R<Object> cancelOrder(@RequestParam("orderId") @ApiParam("商城-订单Id") String orderId) {
orderService.cancelOrder(orderId);
return R.ok();
}
}

View File

@ -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<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>>
*/
@GetMapping("/getProductPage")
@GetMapping("/getMiniProductPage")
@ApiOperation("分页查询商城-商品")
public R<Page<ProductPageVo>> getProductPage(@ApiParam("分页参数") ProductPageBo bo) {
Page<ProductPageVo> page = productService.getProductPage(bo);
public R<Page<MiniProductPageVo>> getMiniProductPage(@ApiParam("分页参数") ProductPageBo bo) {
Page<MiniProductPageVo> page = productService.getMiniProductPage(bo);
return R.ok(page);
}

View File

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

View File

@ -105,6 +105,11 @@ public class Order extends BaseEntity implements Serializable {
*/
private String logisticsOrder;
/**
* 支付方式(0:微信支付;1:积分支付)
*/
private Integer payType;
/**
* 备注
*/

View File

@ -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是
*/

View File

@ -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;

View File

@ -58,6 +58,12 @@ public class ProductRecord extends BaseEntity implements Serializable {
*/
private Integer recordPoints;
/**
* 乐观锁标识
*/
@Column(version = true)
private Integer version;
/**
* 逻辑删除0否1是
*/

View File

@ -49,7 +49,7 @@ public class Staff extends BaseEntity implements Serializable {
/**
* 用户来源
*/
private SourceType sourceType;
private String sourceType;
/**
* 角色-品牌-id

View File

@ -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<OrderRefund> {
* @return: void
*/
void rejectRefund(OrderRejectRefundBo bo);
/**
* @descriptions 商城退款列表
* @author DB
* @date 2023/10/27 17:34
* @param bo 请求参数
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.OrderRefundPageVo>
*/
Page<OrderRefundPageVo> getOrderRefundPage(OrderRefundPageBo bo);
/**
* @descriptions 退款回调通知处理
* @author DB
* @date 2023/10/27 18:22
* @param xmlData 请求数据
* @return: void
*/
void wxPayNotifyRefund(String xmlData);
}

View File

@ -32,7 +32,7 @@ public interface OrderService extends IService<Order> {
* @param bo 下单请求对象
* @return: void
*/
void placeOrder(PlaceOrderBo bo);
Object placeOrder(PlaceOrderBo bo);
/**
* @descriptions 申请退款
@ -42,4 +42,24 @@ public interface OrderService extends IService<Order> {
* @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);
}

View File

@ -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<Product> {
*/
Page<ProductPageVo> getProductPage(ProductPageBo bo);
/**
* @descriptions 分页查询商城-商品
* @author DB
* @date 2023/10/27 13:41
* @param bo 请求参数
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.MiniProductPageVo>
*/
Page<MiniProductPageVo> getMiniProductPage(ProductPageBo bo);
/**
* @descriptions 创建规格
* @author DB
@ -90,4 +100,5 @@ public interface ProductService extends IService<Product> {
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.ProductEvaluateVo>
*/
Page<ProductEvaluateVo> getOrderEvaluatePage(String productId);
}

View File

@ -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<OrderRefundMapper, OrderRefund> implements OrderRefundService {
@Autowired
private WxPayHandler wxPayHandler;
/**
* @descriptions 同意退款
* @author DB
@ -27,8 +57,38 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
*/
@Override
public void agreeRefund(String id) {
//TODO:调用退款接口
this.updateChain().set(ORDER_REFUND.REFUND_STATUS, 1).where(ORDER_REFUND.ID.eq(id)).update();
try {
WxPayService wxPayService = wxPayHandler.getWxPayService();
OrderRefund orderRefund = this.queryChain().where(ORDER_REFUND.ID.eq(id)).one();
Order order = SpringUtils.getBean(OrderService.class).queryChain().where(ORDER.ID.eq(orderRefund.getOrderId())).one();
//分账记录
ProfitSharing profitSharing = SpringUtils.getBean(ProfitSharingService.class).queryChain().where(PROFIT_SHARING.ORDER_ID.eq(order.getId()))
.and(PROFIT_SHARING.ORDER_SOURCE.eq(OrderSource.MALL.toString())).one();
//TODO:可能还需要先从分账退款
ProfitSharingReturnRequest profitSharingReturnRequest = new ProfitSharingReturnRequest();
profitSharingReturnRequest.setOrderId(profitSharing.getOutProfitSharingId());
profitSharingReturnRequest.setReturnMchid(profitSharing.getPayAccount());
profitSharingReturnRequest.setAmount(profitSharing.getAmount());
profitSharingReturnRequest.setOutOrderNo(profitSharing.getId());
profitSharingReturnRequest.setDescription("订单退款");
profitSharingReturnRequest.setSubMchId("1618436087");
ProfitSharingReturnResult profitSharingReturnResult = wxPayService.getProfitSharingV3Service().profitSharingReturn(profitSharingReturnRequest);
WxPayRefundV3Request request = new WxPayRefundV3Request();
WxPayRefundV3Request.Amount amount = new WxPayRefundV3Request.Amount();
//退款金额(单位分)
int refund = order.getTotalAmount().scaleByPowerOfTen(2).intValue();
amount.setRefund(refund)
.setTotal(refund)
.setCurrency("CNY");
request.setTransactionId(order.getOutOrderNo())
.setOutRefundNo(id)
.setReason(orderRefund.getRefundReason())
.setAmount(amount);
WxPayRefundV3Result result = wxPayService.refundV3(request);
this.updateChain().set(ORDER_REFUND.OUT_REFUND_ID, result.getRefundId()).update();
} catch (WxPayException e) {
throw new ServiceException(e.getMessage());
}
}
/**
@ -46,4 +106,53 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
.update();
}
/**
* @descriptions 商城退款列表
* @author DB
* @date 2023/10/27 17:34
* @param bo 请求参数
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.OrderRefundPageVo>
*/
@Override
public Page<OrderRefundPageVo> 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());
}
}
}

View File

@ -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<OrderMapper, Order> implements OrderService {
@Autowired
private WxPayHandler wxPayHandler;
/**
* @descriptions 分页查询商城-订单
* @author DB
@ -72,7 +89,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> 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<OrderMapper, Order> implements
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void placeOrder(PlaceOrderBo bo) {
Order order = BeanUtils.mapToClass(bo, Order.class);
List<OrderDetail> orderDetails = BeanUtils.mapToList(bo.getPlaceOrderDetailList(), OrderDetail.class);
//规格记录ids
Set<String> recordIds = orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet());
//获取涉及到的商品
ProductService productService = SpringUtils.getBean(ProductService.class);
List<Product> 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<String, Integer> recordNumIsEnough = recordNumIsEnough(bo.getPlaceOrderDetailList());
try {
Order order = BeanUtils.mapToClass(bo, Order.class);
List<OrderDetail> orderDetails = BeanUtils.mapToList(bo.getPlaceOrderDetailList(), OrderDetail.class);
//规格记录ids
Set<String> recordIds = orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet());
//获取涉及到的商品
ProductService productService = SpringUtils.getBean(ProductService.class);
List<Product> 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<String, Integer> recordNumIsEnough){
/*List<ProductRecord> 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<String, Integer> 预库存记录
*/
private Boolean recordNumIsEnough(String recordId,Integer num) {
private Map<String, Integer> recordNumIsEnough(List<PlaceOrderBo.PlaceOrderDetail> list) {
RedisService redisService = SpringUtils.getBean(RedisService.class);
//库存
Integer stockNum = redisService.getCacheObject(MallRedisConstant.STOCK_RECORD_NUM + recordId);
return stockNum - num >= 0;
Map<String, Integer> 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<OrderMapper, Order> 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<OrderDetail> orderDetails = SpringUtils.getBean(OrderDetailService.class).queryChain()
.where(ORDER_DETAIL.ORDER_ID.eq(orderId)).list();
//订单数量集合
Map<String, Integer> orderNumMap = orderDetails.stream().collect(Collectors.toMap(OrderDetail::getProductRecordId, OrderDetail::getNumber));
ProductRecordService productRecordService = SpringUtils.getBean(ProductRecordService.class);
List<ProductRecord> 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<OrderDetail> orderDetails = SpringUtils.getBean(OrderDetailService.class).queryChain().where(ORDER_DETAIL.ORDER_ID.eq(orderId)).list();
Map<String, Integer> 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());
});
}
}

View File

@ -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<ProductMapper, Product> impl
@Override
public Page<ProductPageVo> 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<ProductMapper, Product> 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<com.cpop.mall.business.vo.MiniProductPageVo>
*/
@Override
public Page<MiniProductPageVo> 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<ProductMapper, Product> 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<ProductMapper, Product> 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);

View File

@ -111,7 +111,7 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> 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);
}
//再添加员工信息

View File

@ -0,0 +1,9 @@
package com.cpop.mall.business.task;
/**
* @author DB
* @createTime 2023/10/27 17:26
* @description 凌晨同步库存任务
*/
public class ProductRecordSyncStockTask {
}

View File

@ -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<ProductSpecificationVo> productSpecificationVos;
/**
* 产品规格记录
*/
@RelationOneToMany(selfField = "id", targetField = "productId",targetTable = "cp_mall_product_record")
@ApiModelProperty("产品规格记录")
private List<ProductRecordVo> productRecordVos;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -18,6 +18,12 @@ import java.math.BigDecimal;
@ApiModel(value = "商城订单详情返回对象")
public class OrderDetailVo implements Serializable {
/**
* 订单id
*/
@ApiModelProperty("订单id")
private String orderId;
/**
* 商品记录id
*/

View File

@ -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<OrderDetailVo> detailList;
}

View File

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

View File

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

View File

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

View File

@ -60,4 +60,9 @@ public class WxPayProperties {
* apiV3 证书序列号值
*/
private String certSerialNo;
/**
* 通知地址
*/
private String notifyUrl;
}

View File

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

View File

@ -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;

View File

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

View File

@ -31,6 +31,16 @@
<groupId>com.cpop</groupId>
<artifactId>Cpop-System</artifactId>
</dependency>
<!--企业微信-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-cp</artifactId>
</dependency>
<!--微信开放平台-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-open</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -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<PageVo<BrandManagementStaffPageListVo>>
* @Author: DB
* @Date: 2023/6/2 14:01
**/
@PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:list')")
@ApiOperation("查询品牌管理员分页列表")
@GetMapping("/getBrandStaffPage")
public R<Page<BrandStaffPageVo>> getBrandStaffPage(BrandStaffPageBo bo) {
Page<BrandStaffPageVo> pageVo = brandStaffService.getBrandStaffPage(bo);
return R.ok(pageVo);
}
/**
* @descriptions 查询品牌列表
* @author DB
* @date 2023/09/13 17:55
* @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.jambox.business.vo.BrandPageVo>>
*/
@ApiOperation("查询品牌列表")
@GetMapping("/getBrandList")
public R<List<BrandListVo>> getBrandList() {
List<BrandListVo> pageVo = brandService.listAs(QueryWrapper.create(), BrandListVo.class);
return R.ok(pageVo);
}
/**
* @Description: 根据品牌查询校区列表
* @return: R<List<CampusListByBrandVo>>
* @Author: DB
* @Date: 2023/6/2 17:37
**/
@ApiOperation("根据品牌查询校区列表")
@PostMapping("/getCampusListByBrand")
public R<List<CampusListByBrandVo>> getCampusListByBrand(@RequestBody CampusListByBrandBo bo) {
List<CampusListByBrandVo> 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<java.lang.Void>
*/
@PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:insert')")
@ApiOperation("新增品牌管理员")
@PostMapping("/insertBrandStaff")
public R<Void> insertBrandStaff(@RequestBody BrandStaffBo bo) {
brandStaffService.insertBrandStaff(bo);
return R.ok();
}
/**
* @Description: 删除品牌管理员
* @param id 主键
* @return: R<Void>
* @Author: DB
* @Date: 2023/6/5 10:03
**/
@PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:remove')")
@ApiOperation("删除品牌管理员")
@DeleteMapping("/removeBrandStaffById/{id}")
public R<Void> removeBrandStaffById(@PathVariable String id) {
brandStaffService.removeBrandStaffById(id);
//TODO:通知到云库
return R.ok();
}
}

View File

@ -71,7 +71,7 @@ public class TaskWorkOrderController {
@PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')")
@ApiOperation("任务管理模块-工单记录")
@GetMapping("/getWorkOrderRecordList/{workRecordId}")
public R<List<TaskWorkOrderRecordListVo>> getWorkOrderRecordList(@PathVariable String workRecordId) {
public R<List<TaskWorkOrderRecordListVo>> getWorkOrderRecordList(@PathVariable("workRecordId") String workRecordId) {
List<TaskWorkOrderRecordListVo> 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<Void> concludeWorkOrder(@PathVariable String id) {
public R<Void> concludeWorkOrder(@PathVariable("id") String id) {
taskWorkOrderService.concludeWorkOrder(id);
return R.ok();
}

View File

@ -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;

View File

@ -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;

View File

@ -56,7 +56,6 @@ public class LoginServiceImpl implements LoginService {
.setUsername(loginUser.getUsername())
.setRealName(staffInfo.getName())
.setAvatar(staffInfo.getAvatar())
//TODO:不同用户根页面不一样可能后面调整
.setHomePath("");
}

View File

@ -117,7 +117,7 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> 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<StaffMapper, Staff> 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;

View File

@ -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 ServiceImpl<TaskDemandMapper, TaskDem
return SpringUtils.getBean(TaskService.class).getMapper().paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
queryWrapper.select(TASK.ALL_COLUMNS)
.select(TASK_DEMAND.DEMAND_TYPE.as(TaskDemandPageVo::getDemandType),TASK_DEMAND.RECORD_STAFF_ID,TASK_DEMAND.BRAND_ID,TASK_DEMAND.CAMPUS_ID)
.select(CAMPUS.NAME.as(TaskDemandPageVo::getCampusName))
.select(STORE.STORE_NAME.as(TaskDemandPageVo::getCampusName))
.select(BRAND.BRAND_NAME.as(TaskDemandPageVo::getBrandName))
.select(STAFF.NAME.as(TaskDemandPageVo::getRecordStaffName))
.from(TASK)
//任务需求表
.leftJoin(TASK_DEMAND).on(TASK_DEMAND.TASK_ID.eq(TASK.ID))
//校区表
.leftJoin(CAMPUS).on(CAMPUS.ID.eq(TASK_DEMAND.CAMPUS_ID))
.leftJoin(STORE).on(STORE.ID.eq(TASK_DEMAND.CAMPUS_ID))
//品牌表
.leftJoin(BRAND).on(BRAND.ID.eq(CAMPUS.BRAND_ID))
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
//员工表
.leftJoin(STAFF).on(STAFF.ID.eq(TASK_DEMAND.RECORD_STAFF_ID))
.where(TASK.TASK_TYPE.eq(1))
.and(TASK.TASK_NAME.like(bo.getTaskName()))
.and(CAMPUS.NAME.like(bo.getCampusName())),
.and(STORE.STORE_NAME.like(bo.getCampusName())),
TaskDemandPageVo.class);
}

View File

@ -46,7 +46,6 @@ import java.util.*;
import java.util.stream.Collectors;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS;
import static com.cpop.oam.business.entity.table.DutyTableDef.DUTY;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STAFF_GROUP;
@ -54,6 +53,7 @@ import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
import static com.cpop.oam.business.entity.table.TaskWorkOrderRecordTableDef.TASK_WORK_ORDER_RECORD;
import static com.cpop.oam.business.entity.table.TaskWorkOrderTableDef.TASK_WORK_ORDER;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
/**
* 任务-工单表 服务层实现
@ -195,21 +195,21 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
TASK.RESPONSIBLE_STAFF_ID.as(TaskWorkOrderPageVo::getResponsibleStaffId))
.select(STAFF.NAME.as(TaskWorkOrderPageVo::getRecordStaffId))
.select(BRAND.BRAND_NAME.as(TaskWorkOrderPageVo::getBrandName))
.select(CAMPUS.NAME.as(TaskWorkOrderPageVo::getCampusName))
.select(STORE.STORE_NAME.as(TaskWorkOrderPageVo::getCampusName))
.select("rs.name as responsibleStaffName")
.from(TASK_WORK_ORDER)
//任务表
.leftJoin(TASK).on(TASK.ID.eq(TASK_WORK_ORDER.TASK_ID))
//小区表
.leftJoin(CAMPUS).on(CAMPUS.ID.eq(TASK_WORK_ORDER.CAMPUS_ID))
.leftJoin(STORE).on(STORE.ID.eq(TASK_WORK_ORDER.CAMPUS_ID))
//品牌表
.leftJoin(BRAND).on(BRAND.ID.eq(CAMPUS.BRAND_ID))
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
//员工表
.leftJoin(STAFF).on(STAFF.ID.eq(TASK_WORK_ORDER.RECORD_STAFF_ID))
.leftJoin(STAFF).as("rs").on("rs.id = cp_oam_task.responsible_staff_id")
.and(TASK.TASK_NAME.like(bo.getTaskName()))
.and(TASK.TASK_STATUS.eq(bo.getTaskStatus()))
.and(CAMPUS.NAME.like(bo.getCampusName())),
.and(STORE.STORE_NAME.like(bo.getCampusName())),
TaskWorkOrderPageVo.class);
}

View File

@ -1,4 +1,4 @@
package com.cpop.sdk.framework.builder.wxCp;
package com.cpop.oam.framework.builder.wxCp;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;

View File

@ -1,4 +1,4 @@
package com.cpop.sdk.framework.builder.wxCp;
package com.cpop.oam.framework.builder.wxCp;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;

View File

@ -1,4 +1,4 @@
package com.cpop.sdk.framework.builder.wxCp;
package com.cpop.oam.framework.builder.wxCp;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;

View File

@ -1,8 +1,6 @@
package com.cpop.oam.framework.config.wxCp;
import com.cpop.sdk.framework.config.wxCp.WxCpProperties;
import com.cpop.sdk.framework.handler.wxCp.*;
import com.cpop.oam.framework.handler.wxCp.ContactChangeHandler;
import com.cpop.oam.framework.handler.wxCp.*;
import com.google.common.collect.Maps;
import lombok.val;
import me.chanjar.weixin.common.api.WxConsts;

View File

@ -1,6 +1,6 @@
package com.cpop.sdk.framework.config.wxCp;
package com.cpop.oam.framework.config.wxCp;
import com.cpop.sdk.framework.utils.JsonUtils;
import com.cpop.common.utils.JsonUtils;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

View File

@ -1,4 +1,4 @@
package com.cpop.sdk.framework.config.wxOpen;
package com.cpop.oam.framework.config.wxOpen;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -93,3 +93,4 @@ public class WxOpenProperties {
ToStringStyle.MULTI_LINE_STYLE);
}
}

View File

@ -1,4 +1,4 @@
package com.cpop.sdk.framework.handler.wxCp;
package com.cpop.oam.framework.handler.wxCp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,10 +1,9 @@
package com.cpop.oam.framework.handler.wxCp;
import com.cpop.common.utils.JsonUtils;
import com.cpop.oam.business.service.StaffService;
import com.cpop.oam.framework.builder.wxCp.TextBuilder;
import com.cpop.oam.framework.constant.WxCpNoticeType;
import com.cpop.sdk.framework.builder.wxCp.TextBuilder;
import com.cpop.sdk.framework.handler.wxCp.AbstractHandler;
import com.cpop.sdk.framework.utils.JsonUtils;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;

View File

@ -1,4 +1,4 @@
package com.cpop.sdk.framework.handler.wxCp;
package com.cpop.oam.framework.handler.wxCp;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;

View File

@ -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.api.WxConsts;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.cp.api.WxCpService;

View File

@ -1,6 +1,6 @@
package com.cpop.sdk.framework.handler.wxCp;
package com.cpop.oam.framework.handler.wxCp;
import com.cpop.sdk.framework.utils.JsonUtils;
import com.cpop.common.utils.JsonUtils;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;

View File

@ -1,4 +1,4 @@
package com.cpop.sdk.framework.handler.wxCp;
package com.cpop.oam.framework.handler.wxCp;
import me.chanjar.weixin.common.api.WxConsts.MenuButtonType;
import me.chanjar.weixin.common.session.WxSessionManager;

View File

@ -1,7 +1,7 @@
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.sdk.framework.utils.JsonUtils;
import com.cpop.common.utils.JsonUtils;
import com.cpop.oam.framework.builder.wxCp.TextBuilder;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.cp.api.WxCpService;

View File

@ -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;

Some files were not shown because too many files have changed in this diff Show More