From 73ff8b82b8c742fa78f1981fd2c2b6f9af22e501 Mon Sep 17 00:00:00 2001 From: DB <2502523450@qq.com> Date: Sun, 7 Jan 2024 16:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E5=90=88=E6=94=AF=E4=BB=98;=E6=A0=A1?= =?UTF-8?q?=E5=8C=BA=E6=8F=92=E4=BB=B6=E6=A8=A1=E5=9D=97;=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AF=BC=E5=85=A5=E8=B0=83=E6=95=B4;=E4=BA=8B?= =?UTF-8?q?=E5=8A=A1=E5=88=86=E5=8F=91=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/base/entity/BaseInsertListener.java | 10 +- .../com/cpop/generator/CpopGenerator.java | 2 +- .../com/cpop/jambox/business/bo/PlugBo.java | 67 +++++++++++++ .../com/cpop/jambox/business/entity/Plug.java | 77 +++++++++++++++ .../jambox/business/entity/StorePlug.java | 16 --- .../jambox/business/mapper/PlugMapper.java | 14 +++ .../jambox/business/service/PlugService.java | 40 ++++++++ .../service/impl/PlugServiceImpl.java | 60 ++++++++++++ .../service/impl/StorePlugServiceImpl.java | 46 ++++----- .../cpop/jambox/business/vo/PlugPageVo.java | 59 +++++++++++ .../com/cpop/jambox/business/vo/PlugVo.java | 60 ++++++++++++ .../jambox/business/vo/StorePlugListVo.java | 51 +++++----- .../src/main/resources/mapper/PlugMapper.xml | 7 ++ .../com/cpop/mall/web/CpopWxPayTests.java | 24 ++--- .../service/impl/OrderRefundServiceImpl.java | 8 +- .../src/main/resources/application-dev.yml | 2 +- .../java/com/cpop/oam/web/CpopCoreTests.java | 7 +- .../com/cpop/oam/web/CpopEasyLearnTest.java | 6 +- .../com/cpop/oam/web/CpopImportTests.java | 52 ++++++++-- .../oam/business/bo/ChangePlugOpenBo.java | 41 ++++++++ .../backstage/StorePlugController.java | 98 +++++++++++++++++-- .../controller/backstage/WxPayController.java | 2 +- .../oam/business/dto/DataImportParamsDto.java | 5 + .../service/impl/BusinessServiceImpl.java | 10 +- .../service/impl/DataImportServiceImpl.java | 2 +- .../service/impl/TaskServiceImpl.java | 3 +- .../core/dto/LearnNowPayLaterPlanDto.java | 12 +++ .../pay/framewok/handler/UnionPayHandler.java | 15 +++ .../framewok/strategy/UnionPayStrategy.java | 15 +++ .../wxPay/LearnNowPayLaterOnePayStrategy.java | 38 +++++++ .../pay/framewok/task/WxPayAsyncTask.java | 4 +- pom.xml | 2 +- 32 files changed, 738 insertions(+), 117 deletions(-) create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/PlugBo.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Plug.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/PlugMapper.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/PlugService.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugPageVo.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugVo.java create mode 100644 Cpop-Jambox/src/main/resources/mapper/PlugMapper.xml create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ChangePlugOpenBo.java create mode 100644 Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java create mode 100644 Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/UnionPayHandler.java create mode 100644 Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/UnionPayStrategy.java create mode 100644 Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/wxPay/LearnNowPayLaterOnePayStrategy.java diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java index 6590407..fff0e7b 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java @@ -3,6 +3,8 @@ package com.cpop.core.base.entity; import com.cpop.core.utils.SecurityUtils; import com.mybatisflex.annotation.InsertListener; +import java.time.LocalDateTime; + /** * @author: DB * @Date: 2023/08/04/15:12 @@ -15,9 +17,9 @@ public class BaseInsertListener implements InsertListener { BaseEntity baseEntity = (BaseEntity) entity; LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); //设置 account 被新增时的一些默认数据 - //baseEntity.setCreateTime(LocalDateTime.now()); - //baseEntity.setCreateUserId(null == loginUser ? "1" : loginUser.getUserId()); - //baseEntity.setUpdateTime(LocalDateTime.now()); - //baseEntity.setUpdateUserId(null == loginUser ? "1" : loginUser.getUserId()); + baseEntity.setCreateTime(LocalDateTime.now()); + baseEntity.setCreateUserId(null == loginUser ? "1" : loginUser.getUserId()); + baseEntity.setUpdateTime(LocalDateTime.now()); + baseEntity.setUpdateUserId(null == loginUser ? "1" : loginUser.getUserId()); } } diff --git a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java index 58040d6..cfc90dd 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -34,7 +34,7 @@ public class CpopGenerator { /** * 数据库密码 */ - private static final String PASSWORD = "root"; + private static final String PASSWORD = "Admin@123"; //private static final String PASSWORD = "Customer0401"; /** diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/PlugBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/PlugBo.java new file mode 100644 index 0000000..ed8f2bc --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/PlugBo.java @@ -0,0 +1,67 @@ +package com.cpop.jambox.business.bo; + +import com.mybatisflex.annotation.Id; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-05 12:47 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "PlugBo对象", description = "插件请求参数") +public class PlugBo { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 插件名 + */ + @NotBlank(message = "插件名不能为空") + @ApiModelProperty(value = "插件名",required = true) + private String name; + + /** + * 插件标签 + */ + @NotBlank(message = "插件标签不能为空") + @ApiModelProperty(value = "插件标签",required = true) + private String plugTag; + + /** + * 插件图标地址 + */ + @ApiModelProperty("插件图标地址") + private String picUrl; + + /** + * 排序 + */ + @NotNull(message = "排序不能为空") + @ApiModelProperty(value = "排序",required = true) + private Integer orderNo; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 状态(0:禁用;1:使用) + */ + @NotNull(message = "状态不能为空") + @ApiModelProperty(value = "状态",required = true) + private Integer status; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Plug.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Plug.java new file mode 100644 index 0000000..02cafdd --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Plug.java @@ -0,0 +1,77 @@ +package com.cpop.jambox.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 果酱-插件 实体类。 + * + * @author DB + * @since 2024-01-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_plug", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class Plug extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 插件名 + */ + private String name; + + /** + * 插件标签 + */ + private String plugTag; + + /** + * 插件图标地址 + */ + private String picUrl; + + /** + * 排序 + */ + private Integer orderNo; + + /** + * 备注 + */ + private String remark; + + /** + * 状态(0:禁用;1:使用) + */ + private Integer status; + + + + + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/StorePlug.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/StorePlug.java index 0ea54b6..c19d58f 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/StorePlug.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/StorePlug.java @@ -42,20 +42,4 @@ public class StorePlug extends BaseEntity implements Serializable { */ private String plugTag; - /** - * 备注 - */ - private String remarks; - - /** - * 是否开启 - */ - private Boolean isOpen; - - /** - * 逻辑删除(0否1是) - */ - @Column(isLogicDelete = true) - private Boolean isDelete; - } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/PlugMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/PlugMapper.java new file mode 100644 index 0000000..7466663 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/PlugMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.Plug; + +/** + * 果酱-插件 映射层。 + * + * @author DB + * @since 2024-01-05 + */ +public interface PlugMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/PlugService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/PlugService.java new file mode 100644 index 0000000..e37093e --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/PlugService.java @@ -0,0 +1,40 @@ +package com.cpop.jambox.business.service; + +import com.cpop.jambox.business.bo.PlugBo; +import com.cpop.jambox.business.vo.PlugPageVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.entity.Plug; + +/** + * 果酱-插件 服务层。 + * + * @author DB + * @since 2024-01-05 + */ +public interface PlugService extends IService { + + /** + * 查询插件分页 + * @author DB + * @since 2024/1/5 + * @return R> + */ + Page getPlugPage(); + + /** + * 新增插件 + * @author DB + * @since 2024/1/5 + * @param bo 请求参数 + */ + void insertPlug(PlugBo bo); + + /** + * 修改插件 + * @author DB + * @since 2024/1/5 + * @param bo 请求参数 + */ + void updatePlug(PlugBo bo); +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java new file mode 100644 index 0000000..3e30447 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java @@ -0,0 +1,60 @@ +package com.cpop.jambox.business.service.impl; + +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.jambox.business.bo.PlugBo; +import com.cpop.jambox.business.vo.PlugPageVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.jambox.business.entity.Plug; +import com.cpop.jambox.business.mapper.PlugMapper; +import com.cpop.jambox.business.service.PlugService; +import org.springframework.stereotype.Service; + +import static com.cpop.jambox.business.entity.table.PlugTableDef.PLUG; + +/** + * 果酱-插件 服务层实现。 + * + * @author DB + * @since 2024-01-05 + */ +@Service("plugService") +public class PlugServiceImpl extends ServiceImpl implements PlugService { + + /** + * 查询插件分页 + * @author DB + * @since 2024/1/5 + * @return R> + */ + @Override + public Page getPlugPage() { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.pageAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()), + QueryWrapper.create() + .select(PLUG.ID, PLUG.NAME, PLUG.ORDER_NO, PLUG.STATUS, PLUG.PLUG_TAG, PLUG.REMARK) + .orderBy(PLUG.ORDER_NO.desc()), + PlugPageVo.class); + } + + /** + * 新增插件 + * @author DB + * @since 2024/1/5 + * @param bo 请求参数 + */ + @Override + public void insertPlug(PlugBo bo) { + Plug plug = BeanUtils.mapToClass(bo, Plug.class); + this.save(plug); + } + + @Override + public void updatePlug(PlugBo bo) { + Plug plug = BeanUtils.mapToClass(bo, Plug.class); + this.updateById(plug); + } +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/StorePlugServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/StorePlugServiceImpl.java index 5db53da..2461b61 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/StorePlugServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/StorePlugServiceImpl.java @@ -1,8 +1,12 @@ package com.cpop.jambox.business.service.impl; import com.cpop.common.utils.StringUtils; +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.utils.SpringUtils; +import com.cpop.jambox.business.entity.Plug; import com.cpop.jambox.business.entity.StorePlug; import com.cpop.jambox.business.mapper.StorePlugMapper; +import com.cpop.jambox.business.service.PlugService; import com.cpop.jambox.business.service.StorePlugService; import com.cpop.jambox.business.vo.StorePlugListVo; import com.mybatisflex.core.datasource.DataSourceKey; @@ -12,11 +16,13 @@ import com.mybatisflex.core.row.Row; import com.mybatisflex.spring.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import static com.cpop.jambox.business.entity.table.PlugTableDef.PLUG; import static com.cpop.jambox.business.entity.table.StorePlugTableDef.STORE_PLUG; /** @@ -42,37 +48,23 @@ public class StorePlugServiceImpl extends ServiceImpl(); } - List rows; - try { - DataSourceKey.use("jambox"); - rows = Db.selectListByQuery("t_application_info", QueryWrapper.create() - .select("application", "char_tag as plugTag", "pic", "tag", "status", "creation_time as listingTime") - .from("t_application_info") - .where("deleted = 1") - .and("char_tag IS NOT NULL")); - } finally { - DataSourceKey.clear(); - } - if (!rows.isEmpty()) { - Map rowsMap = rows.stream().collect(Collectors.toMap(item -> item.getString("plugTag"), item -> item)); - List storePlugListVos = this.listAs(QueryWrapper.create() - .select(STORE_PLUG.PLUG_TAG, STORE_PLUG.ID, STORE_PLUG.CREATE_TIME,STORE_PLUG.IS_OPEN) - .where(STORE_PLUG.STORE_ID.eq(storeId)), - StorePlugListVo.class); - storePlugListVos.forEach(item -> { - if (rowsMap.get(item.getPlugTag()) != null) { - Row row = rowsMap.get(item.getPlugTag()); - item.setListingTime(row.getLocalDateTime("listingTime")); - item.setPlugName(row.getString("application")); - item.setPlugType("tag"); + //获取所有插件 + List plugList = SpringUtils.getBean(PlugService.class).listAs(QueryWrapper.create(), StorePlugListVo.class); + if (!plugList.isEmpty()) { + Map plugTagMap = this.list(QueryWrapper.create() + .where(STORE_PLUG.STORE_ID.eq(storeId))).stream().collect(Collectors.toMap(StorePlug::getPlugTag, BaseEntity::getCreateTime)); + plugList.forEach(item -> { + if (plugTagMap.get(item.getPlugTag()) != null) { + item.setIsOpen(true); + item.setOpenTime(plugTagMap.get(item.getPlugTag())); + } else { + item.setIsOpen(false); } + item.setStoreId(storeId); }); - return storePlugListVos; + return plugList; } else { return new ArrayList<>(); } } - - - } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugPageVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugPageVo.java new file mode 100644 index 0000000..5024353 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugPageVo.java @@ -0,0 +1,59 @@ +package com.cpop.jambox.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mybatisflex.annotation.Id; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * 果酱插件 + * @author DB + * @version 1.0.0 + * @since 2024-01-05 10:33 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "PlugPageVo对象") +public class PlugPageVo { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 插件名 + */ + @ApiModelProperty("插件名") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String remark; + + /** + * 插件标签 + */ + @ApiModelProperty("插件标签") + private String plugTag; + + /** + * 排序 + */ + @ApiModelProperty("排序") + private Integer orderNo; + + /** + * 状态(0:禁用;1:使用) + */ + @ApiModelProperty("状态(0:禁用;1:使用)") + private Integer status; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugVo.java new file mode 100644 index 0000000..5db617e --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/PlugVo.java @@ -0,0 +1,60 @@ +package com.cpop.jambox.business.vo; + +import com.mybatisflex.annotation.Id; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-05 13:48 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "PlugPageVo对象") +public class PlugVo { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 插件名 + */ + @ApiModelProperty("插件名") + private String name; + + /** + * 插件标签 + */ + @ApiModelProperty("插件标签") + private String plugTag; + + /** + * 插件图标地址 + */ + @ApiModelProperty("插件图标地址") + private String picUrl; + + /** + * 排序 + */ + @ApiModelProperty("排序") + private Integer orderNo; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String remark; + + /** + * 状态(0:禁用;1:使用) + */ + @ApiModelProperty("状态(0:禁用;1:使用)") + private Integer status; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/StorePlugListVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/StorePlugListVo.java index 8cb4722..0e29923 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/StorePlugListVo.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/StorePlugListVo.java @@ -24,47 +24,54 @@ public class StorePlugListVo { @ApiModelProperty("主键") private String id; - /** - * 插件标记 - */ - @ApiModelProperty("插件标记") - private String plugTag; - /** * 插件名 */ @ApiModelProperty("插件名") - private String plugName; - - /** - * 插件类型 - */ - @ApiModelProperty("插件类型") - private String plugType; + private String name; /** * 备注 */ @ApiModelProperty("备注") - private String remarks; + private String remark; /** - * 最后修改时间 + * 插件标签 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") - @ApiModelProperty("上架时间") - private LocalDateTime listingTime; + @ApiModelProperty("插件标签") + private String plugTag; /** - * 最后修改时间 + * 排序 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") - @ApiModelProperty("开启时间") - private LocalDateTime createTime; + @ApiModelProperty("排序") + private Integer orderNo; /** * 是否开启 */ @ApiModelProperty("是否开启") private Boolean isOpen; + + + /** + * 上架时间 + */ + @ApiModelProperty("上架时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime updateTime; + + /** + * 开启时间 + */ + @ApiModelProperty("开启时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime openTime; + + /** + * 校区id + */ + @ApiModelProperty("校区id") + private String storeId; } diff --git a/Cpop-Jambox/src/main/resources/mapper/PlugMapper.xml b/Cpop-Jambox/src/main/resources/mapper/PlugMapper.xml new file mode 100644 index 0000000..3980ddf --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/PlugMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java b/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java index a377cca..f53410f 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java +++ b/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java @@ -3,12 +3,12 @@ package com.cpop.mall.web; import com.alibaba.fastjson.JSONObject; import com.cpop.core.utils.uuid.IdUtils; import com.cpop.pay.framewok.config.wxPay.WxPayProperties; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingFinishRequest; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingQueryRequest; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingQueryResult; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingReceiverRequest; -import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingResult; -import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReturnRequest; +import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingQueryRequest; +import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingReceiverRequest; +import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingReturnRequest; +import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingUnfreezeRequest; +import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingQueryResult; +import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingV3Result; import com.github.binarywang.wxpay.bean.request.WxPayOrderReverseRequest; import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request; import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult; @@ -85,10 +85,10 @@ public class CpopWxPayTests { profitSharingReturnRequest.setOutReturnNo("97948799695069184"); profitSharingReturnRequest.setDescription("分账退款"); profitSharingReturnRequest.setSubMchId("1661323640"); - profitSharingReturnRequest.setReturnMchid("1618884922"); + profitSharingReturnRequest.setReturnAccount("1618884922"); //profitSharingReturnRequest.setAmount(profitSharing.getAmount()); - profitSharingReturnRequest.setAmount(6L); - wxPayService.getProfitSharingV3Service().profitSharingReturn(profitSharingReturnRequest); + profitSharingReturnRequest.setReturnAmount(6); + wxPayService.getProfitSharingService().profitSharingReturn(profitSharingReturnRequest); } /** @@ -162,8 +162,8 @@ public class CpopWxPayTests { */ @Test public void getProfitSharingResult() throws WxPayException { - ProfitSharingResult profitSharingResult = wxPayService.getProfitSharingV3Service().getProfitSharingResult("97976952480079872", "4200002127202312282719627535", "1661323640"); - System.out.println(profitSharingResult); + ProfitSharingV3Result profitSharingV3Result = wxPayService.getProfitSharingService().profitSharingQueryV3("97976952480079872", "4200002127202312282719627535", "1661323640"); + System.out.println(profitSharingV3Result); } /** @@ -172,7 +172,7 @@ public class CpopWxPayTests { */ @Test public void profitSharingFinish() throws WxPayException { - ProfitSharingFinishRequest profitSharingFinishRequest = new ProfitSharingFinishRequest(); + ProfitSharingUnfreezeRequest profitSharingFinishRequest = new ProfitSharingUnfreezeRequest(); profitSharingFinishRequest.setTransactionId("4200002093202312282215936862"); profitSharingFinishRequest.setOutOrderNo("97973671418667008"); profitSharingFinishRequest.setDescription("结束分账"); diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java index 8896e23..0c4d80b 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java @@ -21,7 +21,7 @@ import com.cpop.pay.framewok.handler.wxPay.WxPayHandler; import com.cpop.system.business.entity.ProfitSharing; import com.cpop.system.business.service.ProfitSharingService; import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result; -import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReturnRequest; +import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingReturnRequest; import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request; import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; @@ -86,9 +86,9 @@ public class OrderRefundServiceImpl extends ServiceImpl rowList; + try { + DataSourceKey.use("jambox"); + rowList = DbChain.table("t_application_info") + .select("application as name", "char_tag as plugTag", "pic as picUrl") + .select("top as orderNo", "tag as remark", "if(status = '即将上线',0,1) as status") + .from("t_application_info") + .where("deleted = 1") + .list(); + } finally { + DataSourceKey.clear(); + } + List entityList = RowUtil.toEntityList(rowList, Plug.class); + SpringUtils.getBean(PlugService.class).saveBatch(entityList); + } + + @Test + public void batchUpdateStaffPassword(){ + List cpSysUser = DbChain.table("cp_sys_user") + .select("id","phone_number","password") + .where("user_type = 'OAM_USER'") + .and("is_delete = 0") + .list(); + List entityList = RowUtil.toEntityList(cpSysUser, SysUser.class); + //加密 + PasswordEncoder passwordEncoder = SpringUtils.getBean(PasswordEncoder.class); + entityList.forEach(item->{ + item.setPassword(passwordEncoder.encode(item.getPhoneNumber())); + }); + Db.executeBatch(entityList, CoreMapper.class, CoreMapper::updateSysUser); + } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ChangePlugOpenBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ChangePlugOpenBo.java new file mode 100644 index 0000000..dd7dafc --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ChangePlugOpenBo.java @@ -0,0 +1,41 @@ +package com.cpop.oam.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 javax.validation.constraints.NotNull; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-05 14:31 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "ChangePlugOpenBo对象") +public class ChangePlugOpenBo { + + /** + * 校区 + */ + @NotBlank(message = "校区不能为空") + @ApiModelProperty(value = "校区",required = true) + private String storeId; + + /** + * 插件 + */ + @NotBlank(message = "插件不能为空") + @ApiModelProperty(value = "插件",required = true) + private String plugTag; + + /** + * 开启与关闭 + */ + @NotNull(message = "开启与关闭不能为空") + @ApiModelProperty(value = "开启与关闭",required = true) + private Boolean isOpen; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StorePlugController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StorePlugController.java index f7acc63..b7e11d4 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StorePlugController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StorePlugController.java @@ -1,16 +1,27 @@ package com.cpop.oam.business.controller.backstage; +import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.R; +import com.cpop.jambox.business.bo.PlugBo; +import com.cpop.jambox.business.entity.StorePlug; +import com.cpop.jambox.business.service.PlugService; import com.cpop.jambox.business.service.StorePlugService; +import com.cpop.jambox.business.vo.PlugPageVo; +import com.cpop.jambox.business.vo.PlugVo; import com.cpop.jambox.business.vo.StorePlugListVo; +import com.cpop.oam.business.bo.ChangePlugOpenBo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; +import static com.cpop.jambox.business.entity.table.PlugTableDef.PLUG; import static com.cpop.jambox.business.entity.table.StorePlugTableDef.STORE_PLUG; /** @@ -27,6 +38,78 @@ public class StorePlugController { @Autowired private StorePlugService storePlugService; + @Autowired + private PlugService plugService; + + /** + * 查询插件分页 + * @author DB + * @since 2024/1/5 + * @return R> + */ + @GetMapping("/getPlugPage") + @ApiOperation("查询插件分页") + public R> getPlugPage() { + Page page = plugService.getPlugPage(); + return R.ok(page); + } + + /** + * 查询插件详情 + * @author DB + * @since 2024/1/5 + * @param id 主键 + * @return R + */ + @GetMapping("/getPlugById/{id}") + @ApiOperation("查询插件详情") + public R getPlugById(@PathVariable String id) { + PlugVo vo = plugService.getOneAs(QueryWrapper.create().where(PLUG.ID.eq(id)), PlugVo.class); + return R.ok(vo); + } + + /** + * 新增插件 + * @author DB + * @since 2024/1/5 + * @param bo 请求参数 + * @return R + */ + @ApiOperation("新增插件") + @PostMapping("/insertPlug") + public R insertPlug(@RequestBody @Validated PlugBo bo) { + plugService.insertPlug(bo); + return R.ok(); + } + + /** + * 修改插件 + * @author DB + * @since 2024/1/5 + * @param bo 请求参数 + * @return R + */ + @ApiOperation("修改插件") + @PutMapping("/updatePlug") + public R updateStaff(@RequestBody @Validated PlugBo bo) { + plugService.updatePlug(bo); + return R.ok(); + } + + /** + * 删除插件 + * @author DB + * @since 2024/1/5 + * @param id 主键 + * @return R + */ + @ApiOperation("删除插件") + @DeleteMapping("/removePlugById/{id}") + public R removeStaffById(@PathVariable String id) { + plugService.removeById(id); + return R.ok(); + } + /** * 查询校区插件列表 * @@ -36,19 +119,22 @@ public class StorePlugController { @GetMapping("/getStorePlugList") @ApiOperation("查询校区插件列表") public R> getStorePlugList(@ApiParam("品牌id") String brandId, @ApiParam("校区id") String storeId) { - List list = storePlugService.getStorePlugList(brandId,storeId); + List list = storePlugService.getStorePlugList(brandId, storeId); return R.ok(list); } /** * 插件开启与关闭 */ - @PutMapping("/changePlugOpen/{id}") + @PutMapping("/changePlugOpen") @ApiOperation("插件开启与关闭") - public R changePlugOpen(@PathVariable String id) { - storePlugService.updateChain().setRaw(STORE_PLUG.IS_OPEN, "if(is_open = 0, 1, 0)") - .where(STORE_PLUG.ID.eq(id)) - .update(); + public R changePlugOpen(@RequestBody @Validated ChangePlugOpenBo bo) { + StorePlug storePlug = BeanUtils.mapToClass(bo, StorePlug.class); + if (bo.getIsOpen()){ + storePlugService.save(storePlug); + } else { + storePlugService.updateChain().where(STORE_PLUG.STORE_ID.eq(bo.getStoreId())).and(STORE_PLUG.PLUG_TAG.eq(bo.getPlugTag())).remove(); + } return R.ok(); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java index 443fa7b..032ba35 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java @@ -8,7 +8,7 @@ import com.cpop.pay.framewok.config.wxPay.WxPayConfiguration; import com.cpop.system.business.bo.ChangeWechatSharingBo; import com.cpop.system.business.entity.Brand; import com.cpop.system.business.service.BrandService; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingReceiverRequest; +import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingReceiverRequest; import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java index db595bf..dcbfb43 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java @@ -12,6 +12,11 @@ import lombok.experimental.Accessors; @Accessors(chain = true) public class DataImportParamsDto { + /** + * 上传id + */ + private String uploadId; + /** * 文件地址 */ diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java index 6121ad6..2c4b5ce 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java @@ -187,14 +187,14 @@ public class BusinessServiceImpl extends ServiceImpl i if (businessDistributeDataList.isEmpty()) { throw new ServiceException("导入的excel存在空文件,请检查后重新操作"); } - List storeList = SpringUtils.getBean(StoreService.class).queryChain() + List businessDetails = SpringUtils.getBean(StoreService.class).queryChain() + .select(STORE.BRAND_ID, STORE.ID.as(BusinessDetail::getStoreId)) .where(STORE.ID.in(businessDistributeDataList.stream().map(BusinessDistributeDto::getStoreId).collect(Collectors.toSet()))) - .list(); - if (storeList.size() != businessDistributeDataList.size()) { + .listAs(BusinessDetail.class); + if (businessDetails.size() != businessDistributeDataList.size()) { throw new ServiceException("校区查询匹配失败,请核实数据后重新提交"); } - List businessDetails = BeanUtils.mapToList(storeList, BusinessDetail.class); - businessDetails.forEach(inner->{ + businessDetails.forEach(inner -> { inner.setBusinessId(businessId); }); //保存详情 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java index 272e425..b78033e 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java @@ -107,7 +107,7 @@ public class DataImportServiceImpl extends ServiceImpl implements Ta TaskArchivingPagVo.class, // 负责人 item -> item.field(TaskArchivingPagVo::getResponsibleStaffName) - .queryWrapper( - recordStaff -> queryChain().select(STAFF.NAME.as(TaskArchivingPagVo::getResponsibleStaffName)) + .queryWrapper(recordStaff -> queryChain().select(STAFF.NAME.as(TaskArchivingPagVo::getResponsibleStaffName)) .from(STAFF) .where(STAFF.ID.eq(recordStaff.getResponsibleStaffId()))), // 小组成员 diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java new file mode 100644 index 0000000..cac2fdc --- /dev/null +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java @@ -0,0 +1,12 @@ +package com.cpop.pay.framewok.core.dto; + +import lombok.Data; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-05 16:13 + */ +@Data +public class LearnNowPayLaterPlanDto { +} diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/UnionPayHandler.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/UnionPayHandler.java new file mode 100644 index 0000000..ee57076 --- /dev/null +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/UnionPayHandler.java @@ -0,0 +1,15 @@ +package com.cpop.pay.framewok.handler; + +import org.springframework.stereotype.Component; + +/** + * 联合支付处理器 + * @author DB + * @version 1.0.0 + * @since 2024-01-05 15:24 + */ +@Component +public class UnionPayHandler { + + +} diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/UnionPayStrategy.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/UnionPayStrategy.java new file mode 100644 index 0000000..b87c3d6 --- /dev/null +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/UnionPayStrategy.java @@ -0,0 +1,15 @@ +package com.cpop.pay.framewok.strategy; + +import org.springframework.stereotype.Component; + +/** + * 联合支付策略 + * @author DB + * @version 1.0.0 + * @since 2024-01-05 15:26 + */ +public interface UnionPayStrategy { + + Object unionPay(String unionPayNo); + +} diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/wxPay/LearnNowPayLaterOnePayStrategy.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/wxPay/LearnNowPayLaterOnePayStrategy.java new file mode 100644 index 0000000..fb7218e --- /dev/null +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/wxPay/LearnNowPayLaterOnePayStrategy.java @@ -0,0 +1,38 @@ +package com.cpop.pay.framewok.strategy.wxPay; + +import com.cpop.pay.framewok.strategy.UnionPayStrategy; +import com.github.binarywang.wxpay.bean.payscore.WxPartnerPayScoreSignPlanRequest; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.PartnerPayScoreSignPlanService; +import com.github.binarywang.wxpay.service.WxPayService; +import org.springframework.stereotype.Component; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-05 15:27 + */ +@Component +public class LearnNowPayLaterOnePayStrategy implements UnionPayStrategy { + + /** + * 联合支付 + * @author DB + * @since 2024/1/5 + * @param unionPayNo + * @return Object + */ + @Override + public Object unionPay(String unionPayNo) { + + return null; + } + + public void createPayScorePlan(WxPayService wxPayService) throws WxPayException { + PartnerPayScoreSignPlanService partnerPayScoreSignPlanService = wxPayService.getPartnerPayScoreSignPlanService(); + WxPartnerPayScoreSignPlanRequest planRequest = new WxPartnerPayScoreSignPlanRequest(); + //planRequest.setPlanId() + partnerPayScoreSignPlanService.createPlans(planRequest); + + } +} diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java index c3ed39e..2779422 100644 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java @@ -6,8 +6,8 @@ import com.cpop.core.base.enums.OrderSource; import com.cpop.core.base.exception.ServiceException; import com.cpop.pay.framewok.config.wxPay.WxPayProperties; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingRequest; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingResult; +import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingRequest; +import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingResult; import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; import com.mybatisflex.core.row.Db; diff --git a/pom.xml b/pom.xml index 5f89b99..cd1ca7a 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ 0.9.1 4.0.3 4.2.0 - 4.5.0 + 4.6.0 1.70 5.6.155 5.3.31