From 37d2f50b3369044a3506177869c0647f00fcddd9 Mon Sep 17 00:00:00 2001 From: DB <2502523450@qq.com> Date: Thu, 18 Jan 2024 22:10:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98;=E4=BF=AE=E8=AE=A2=E5=95=86=E5=9F=8Ejedis=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=B1=A0;=E6=B7=BB=E5=8A=A0=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95;=E5=95=86=E5=9F=8E=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E5=9B=BE;=E8=AF=BE=E5=8D=A1=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=8B=93=E5=B1=95;=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=A3=80=E6=9F=A5;=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=A0=A1=E5=8C=BA=E6=A3=80=E6=9F=A5;=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98=E5=88=86?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/dto/CloudCourseStudentDto.java | 4 +- .../com/cpop/generator/CpopGenerator.java | 6 +- .../business/bo/CardTemplateUnionBo.java | 34 ++- .../business/bo/LearnNowPayLaterPlanBo.java | 8 +- .../backstage/CardTemplateController.java | 16 +- .../jambox/business/entity/CardTemplate.java | 15 +- .../business/entity/CardTemplateExtend.java | 62 +++++ .../mapper/CardTemplateExtendMapper.java | 14 ++ .../service/CardTemplateExtendService.java | 14 ++ .../business/service/CardTemplateService.java | 2 +- .../impl/CardTemplateExtendServiceImpl.java | 18 ++ .../service/impl/CardTemplateServiceImpl.java | 38 ++- .../framework/tasks/LearnNowPayLaterTask.java | 92 ++++++++ .../mapper/CardTemplateExtendMapper.xml | 7 + .../src/main/resources/application-dev.yml | 1 + .../src/main/resources/application-local.yml | 1 + .../src/main/resources/application-prod.yml | 1 + .../src/main/resources/application-test.yml | 1 + .../BackstageCarouselController.java | 7 +- .../service/impl/OrderRefundServiceImpl.java | 1 + .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application.yml | 15 +- .../com/cpop/oam/web/CpopDataSyncTests.java | 217 +++++++++++++++++- .../com/cpop/oam/web/CpopImportTests.java | 3 +- .../oam/business/bo/TaskAuditCommentsBo.java | 4 + .../service/impl/BusinessServiceImpl.java | 1 - .../service/impl/DataImportServiceImpl.java | 3 + .../service/impl/TaskServiceImpl.java | 37 +-- .../config/wxPay/WxPayConfiguration.java | 1 + .../config/wxPay/WxPayProperties.java | 4 + .../src/main/resources/application-pay.yml | 14 +- .../service/impl/StoreRenewServiceImpl.java | 18 +- .../service/impl/StoreServiceImpl.java | 4 +- .../system/framework/utils/DictUtils.java | 1 + 34 files changed, 561 insertions(+), 105 deletions(-) create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplateExtend.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CardTemplateExtendMapper.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateExtendService.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateExtendServiceImpl.java create mode 100644 Cpop-Jambox/src/main/java/com/cpop/jambox/framework/tasks/LearnNowPayLaterTask.java create mode 100644 Cpop-Jambox/src/main/resources/mapper/CardTemplateExtendMapper.xml diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java index a2cefcb..05e95a1 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java @@ -123,11 +123,11 @@ public class CloudCourseStudentDto { * 扣除课卡名 */ @SerializedName("periodName") - private String cardName; + private String deductionCardName; /** * 状态操作时间 */ @SerializedName("_createTime") - private String createTime; + private String entryTime; } 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 6c85a8c..cfc90dd 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -40,17 +40,17 @@ public class CpopGenerator { /** * 输出路径 */ - private static final String EXPORT_URL = "/Cpop-Mall"; + private static final String EXPORT_URL = "/Cpop-Jambox"; /** * 模块 */ - private static final String EXPORT_ITEM = "mall"; + private static final String EXPORT_ITEM = "jambox"; /** * 表前缀 */ - private static final String TABLE_PREFIX = "cp_mall_"; + private static final String TABLE_PREFIX = "cp_j_"; /** * 主入口 diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java index c051c11..4d08e0b 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java @@ -8,9 +8,11 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.time.LocalDate; +import java.util.List; /** * @author DB @@ -28,6 +30,12 @@ public class CardTemplateUnionBo { @ApiModelProperty(value = "主键") private String id; + /** + * 旧课卡模板id + */ + @ApiModelProperty(value = "旧课卡模板id") + private String oldTemplateId; + /** * 云品牌id */ @@ -53,12 +61,6 @@ public class CardTemplateUnionBo { @ApiModelProperty(value = "有效日期数") private Integer validDay; - /** - * 开始日期 - */ - @ApiModelProperty(value = "开始日期") - private LocalDate startDate; - /** * 结束日期 */ @@ -109,11 +111,11 @@ public class CardTemplateUnionBo { private String scopeUse; /** - * 支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付;4:线下支付) + * 支付类型(0:微信支付;1:先学后付次付;2:旧放心学合约支付;3:数字人民币支付;4:线下支付;5:先学后付月付;) */ - @NotNull(message = "支付类型不能为空") - @ApiModelProperty(value = "支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付;4:线下支付") - private Integer payType; + @NotEmpty(message = "支付类型不能为空") + @ApiModelProperty(value = "支付类型(0:微信支付;1:先学后付次付;2:旧放心学合约支付;3:数字人民币支付;4:线下支付;5:先学后付月付;)") + private List payType; /** * 是否是会员(0否1是) @@ -121,6 +123,18 @@ public class CardTemplateUnionBo { @ApiModelProperty(value = "是否是会员(0否1是)") private Boolean isMember; + /** + * 是否是引流卡 + */ + @ApiModelProperty(value = "是否是引流卡(0否1是)") + private Boolean isDrainage; + + /** + * 二维码 + */ + @ApiModelProperty(value = "二维码") + private String qrCode; + /** * 先学后付支付 */ diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanBo.java index c60538a..e2e8f9a 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanBo.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanBo.java @@ -41,8 +41,8 @@ public class LearnNowPayLaterPlanBo { @ApiModelProperty("支付分计划原总金额") private Integer totalOriginalPrice; - public void setDeductionQuantity(BigDecimal deductionQuantity) { - this.deductionQuantity = deductionQuantity.scaleByPowerOfTen(2).intValue(); + public void setTotalOriginalPrice(BigDecimal totalOriginalPrice) { + this.totalOriginalPrice = totalOriginalPrice.scaleByPowerOfTen(2).intValue(); } /** @@ -51,8 +51,8 @@ public class LearnNowPayLaterPlanBo { @ApiModelProperty("支付分计划实际扣费总金额(单位分)") private Integer totalActualPrice; - public void setTotalOriginalPrice(BigDecimal totalOriginalPrice) { - this.totalOriginalPrice = totalOriginalPrice.scaleByPowerOfTen(2).intValue(); + public void setTotalActualPrice(BigDecimal totalActualPrice) { + this.totalActualPrice = totalActualPrice.scaleByPowerOfTen(2).intValue(); } /** diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/CardTemplateController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/CardTemplateController.java index fdf9653..ce6661b 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/CardTemplateController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/CardTemplateController.java @@ -1,22 +1,15 @@ package com.cpop.jambox.business.controller.backstage; +import com.cpop.core.annontation.SimpleSignatureCheck; import com.cpop.jambox.business.bo.CardTemplateUnionBo; -import com.mybatisflex.core.paginate.Page; import com.cpop.core.base.R; -import com.cpop.jambox.business.entity.CardTemplate; import com.cpop.jambox.business.service.CardTemplateService; -import com.cpop.jambox.business.vo.CardTemplateListVo; 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 javax.servlet.http.HttpServletRequest; -import java.io.Serializable; -import java.util.List; - /** * 果酱-课卡模板 控制层。 * @@ -37,10 +30,11 @@ public class CardTemplateController { * @since 2023/10/07 9:59 * @param bo 请求参数 */ + //@SimpleSignatureCheck @ApiOperation(value = "添加课卡模板(整合)") @PostMapping("/insertCardTemplateUnion") - public R insertCardTemplateUnion(@RequestBody @Validated CardTemplateUnionBo bo) { - String templateId = cardTemplateService.insertCardTemplateUnion(bo); - return R.ok(templateId); + public R insertCardTemplateUnion(@RequestBody @Validated CardTemplateUnionBo bo) { + cardTemplateService.insertCardTemplateUnion(bo); + return R.ok(); } } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplate.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplate.java index f84b5bf..890f36b 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplate.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplate.java @@ -65,11 +65,6 @@ public class CardTemplate extends BaseEntity implements Serializable { */ private Integer validDay; - /** - * 开始日期 - */ - private LocalDate startDate; - /** * 结束日期 */ @@ -110,11 +105,6 @@ public class CardTemplate extends BaseEntity implements Serializable { */ private String scopeUse; - /** - * 支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付;4:线下支付) - */ - private Integer payType; - /** * 太阳码 */ @@ -125,6 +115,11 @@ public class CardTemplate extends BaseEntity implements Serializable { */ private Boolean isMember; + /** + * 是否是引流卡 + */ + private Boolean isDrainage; + /** * 逻辑删除(0否1是) */ diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplateExtend.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplateExtend.java new file mode 100644 index 0000000..fcc457f --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplateExtend.java @@ -0,0 +1,62 @@ +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.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-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_card_template_extend", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class CardTemplateExtend extends BaseEntity implements Serializable { + + /** + * 模板id + */ + @Id + private String templateId; + + /** + * 支付类型(0:微信支付;1:先学后付次付;2:旧放心学合约支付;3:数字人民币支付;4:线下支付;5:先学后付月付 + */ + @Id + private Integer payType; + + /** + * 拓展id + */ + private String extendId; + + /** + * 拓展参数1 + */ + private String extendParamOne; + + /** + * 拓展参数2 + */ + private String extendParamTwo; + + /** + * 拓展参数3 + */ + private String extendParamThree; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CardTemplateExtendMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CardTemplateExtendMapper.java new file mode 100644 index 0000000..0a08f9f --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CardTemplateExtendMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.CardTemplateExtend; + +/** + * 果酱模板拓展表 映射层。 + * + * @author DB + * @since 2024-01-17 + */ +public interface CardTemplateExtendMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateExtendService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateExtendService.java new file mode 100644 index 0000000..2021c53 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateExtendService.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.entity.CardTemplateExtend; + +/** + * 果酱模板拓展表 服务层。 + * + * @author DB + * @since 2024-01-17 + */ +public interface CardTemplateExtendService extends IService { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java index 5431941..ee7f963 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java @@ -33,5 +33,5 @@ public interface CardTemplateService extends IService { * @param bo 请求参数 * @return String 旧模板id */ - String insertCardTemplateUnion(CardTemplateUnionBo bo); + void insertCardTemplateUnion(CardTemplateUnionBo bo); } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateExtendServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateExtendServiceImpl.java new file mode 100644 index 0000000..611cded --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateExtendServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.jambox.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.jambox.business.entity.CardTemplateExtend; +import com.cpop.jambox.business.mapper.CardTemplateExtendMapper; +import com.cpop.jambox.business.service.CardTemplateExtendService; +import org.springframework.stereotype.Service; + +/** + * 果酱模板拓展表 服务层实现。 + * + * @author DB + * @since 2024-01-17 + */ +@Service("cardTemplateExtendService") +public class CardTemplateExtendServiceImpl extends ServiceImpl implements CardTemplateExtendService { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java index 71ee595..9654d20 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java @@ -1,28 +1,36 @@ package com.cpop.jambox.business.service.impl; +import com.alibaba.fastjson.JSONArray; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.entity.LoginUser; +import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.bo.CardTemplateUnionBo; import com.cpop.jambox.business.entity.BrandExtend; import com.cpop.jambox.business.entity.CardTemplate; +import com.cpop.jambox.business.entity.CardTemplateExtend; import com.cpop.jambox.business.entity.StoreExtend; import com.cpop.jambox.business.mapper.CardTemplateMapper; import com.cpop.jambox.business.service.BrandExtendService; +import com.cpop.jambox.business.service.CardTemplateExtendService; import com.cpop.jambox.business.service.CardTemplateService; import com.cpop.jambox.business.service.StoreExtendService; +import com.cpop.jambox.framework.tasks.LearnNowPayLaterTask; import com.cpop.system.business.entity.Store; import com.cpop.system.business.service.StoreService; import com.mybatisflex.core.datasource.DataSourceKey; import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.core.row.Db; -import com.mybatisflex.core.row.Row; -import com.mybatisflex.core.row.RowUtil; +import com.mybatisflex.core.row.*; import com.mybatisflex.spring.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.io.File; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import static com.cpop.jambox.business.entity.table.BrandExtendTableDef.BRAND_EXTEND; import static com.cpop.jambox.business.entity.table.CardTemplateTableDef.CARD_TEMPLATE; @@ -69,7 +77,8 @@ public class CardTemplateServiceImpl extends ServiceImpl cardTemplateExtends = new ArrayList<>(); + //添加课卡模板拓展 + bo.getPayType().forEach(item->{ + CardTemplateExtend cardTemplateExtend = new CardTemplateExtend(); + cardTemplateExtend.setTemplateId(cardTemplate.getId()) + .setPayType(item); + cardTemplateExtends.add(cardTemplateExtend); + }); + SpringUtils.getBean(CardTemplateExtendService.class).saveBatch(cardTemplateExtends); + //次付 + if (bo.getPayType().contains(1)) { + SpringUtils.getBean(LearnNowPayLaterTask.class).asyncCreateLearnNowPayLaterPlan(cardTemplate, bo.getLearnNowPayLaterPay(), 1); + } + //月付 + if (bo.getPayType().contains(5)) { + SpringUtils.getBean(LearnNowPayLaterTask.class).asyncCreateLearnNowPayLaterPlan(cardTemplate, bo.getLearnNowPayLaterMonthPay(), 5); + } } + } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/tasks/LearnNowPayLaterTask.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/tasks/LearnNowPayLaterTask.java new file mode 100644 index 0000000..965d87d --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/tasks/LearnNowPayLaterTask.java @@ -0,0 +1,92 @@ +package com.cpop.jambox.framework.tasks; + +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.CardTemplateUnionBo; +import com.cpop.jambox.business.bo.LearnNowPayLaterPlanBo; +import com.cpop.jambox.business.entity.CardTemplate; +import com.cpop.jambox.business.entity.CardTemplateExtend; +import com.cpop.jambox.business.service.CardTemplateExtendService; +import com.cpop.pay.framewok.handler.wxPay.WxPayHandler; +import com.cpop.system.business.entity.WxPayScore; +import com.cpop.system.business.entity.WxPayScoreDetail; +import com.cpop.system.business.service.WxPayScoreDetailService; +import com.cpop.system.business.service.WxPayScoreService; +import com.github.binarywang.wxpay.bean.payscore.PayScorePlanDetailRequest; +import com.github.binarywang.wxpay.bean.payscore.WxPartnerPayScoreSignPlanRequest; +import com.github.binarywang.wxpay.bean.payscore.WxPartnerPayScoreSignPlanResult; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.PartnerPayScoreSignPlanService; +import com.github.binarywang.wxpay.service.WxPayService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static com.cpop.jambox.business.entity.table.CardTemplateExtendTableDef.CARD_TEMPLATE_EXTEND; +import static com.cpop.jambox.business.entity.table.CardTemplateTableDef.CARD_TEMPLATE; +import static com.cpop.system.business.entity.table.WxPayScoreTableDef.WX_PAY_SCORE; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-17 18:18 + */ +@Component +public class LearnNowPayLaterTask { + + @Autowired + private WxPayHandler wxPayHandler; + + /** + * 异步创建先学后付计划 + * @author DB + * @since 2024/1/17 + * @param cardTemplate 课卡模板 + * @param payType 支付类型 + */ + @Async("customAsyncThreadPool") + @Transactional(rollbackFor = Exception.class) + public void asyncCreateLearnNowPayLaterPlan(CardTemplate cardTemplate, LearnNowPayLaterPlanBo bo, Integer payType) { + String subMchId = wxPayHandler.getSubMchId(cardTemplate.getBrandId(), cardTemplate.getStoreId()); + //录入计划与详情 + WxPayScore wxPayScore = BeanUtils.mapToClass(bo, WxPayScore.class); + wxPayScore.setSignAccount(subMchId); + WxPayScoreService wxPayScoreService = SpringUtils.getBean(WxPayScoreService.class); + wxPayScoreService.save(wxPayScore); + //创建计划 + WxPayService wxPayService = wxPayHandler.getWxPayService(null, subMchId); + PartnerPayScoreSignPlanService partnerPayScoreSignPlanService = wxPayService.getPartnerPayScoreSignPlanService(); + WxPartnerPayScoreSignPlanRequest planRequest = BeanUtils.mapToClass(bo,WxPartnerPayScoreSignPlanRequest.class); + List payScorePlanDetailRequests = BeanUtils.mapToList(bo.getPlanDetailList(), PayScorePlanDetailRequest.class); + planRequest.setPlanDetailList(payScorePlanDetailRequests); + planRequest.setMerchantPlanNo(wxPayScore.getId()); + WxPartnerPayScoreSignPlanResult result; + //设置商户侧计划 + try { + result = partnerPayScoreSignPlanService.createPlans(planRequest); + } catch (WxPayException e) { + throw new ServiceException(e.getMessage()); + } + List wxPayScoreDetails = BeanUtils.mapToList(result.getPlanDetailList(), WxPayScoreDetail.class); + wxPayScoreDetails.forEach(item -> { + item.setSysWxPayScoreId(wxPayScore.getId()); + }); + //批量保存计划详情 + SpringUtils.getBean(WxPayScoreDetailService.class).saveBatch(wxPayScoreDetails); + //更新外部计划id + wxPayScoreService.updateChain() + .set(WX_PAY_SCORE.OUT_PLAN_ID,result.getPlanId()) + .where(WX_PAY_SCORE.ID.eq(wxPayScore.getId())) + .update(); + //更新模板拓展 + SpringUtils.getBean(CardTemplateExtendService.class).updateChain() + .set(CARD_TEMPLATE_EXTEND.EXTEND_ID,wxPayScore.getId()) + .where(CARD_TEMPLATE_EXTEND.PAY_TYPE.eq(payType)) + .and(CARD_TEMPLATE_EXTEND.TEMPLATE_ID.eq(cardTemplate.getId())) + .update(); + } +} diff --git a/Cpop-Jambox/src/main/resources/mapper/CardTemplateExtendMapper.xml b/Cpop-Jambox/src/main/resources/mapper/CardTemplateExtendMapper.xml new file mode 100644 index 0000000..72de3dd --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/CardTemplateExtendMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml index f381106..599c38f 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-dev.yml @@ -38,6 +38,7 @@ spring: max-active: 8 # max-wait: -1ms + client-type: jedis data: mongodb: host: localhost diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-local.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-local.yml index c62c2b0..d22df63 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-local.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-local.yml @@ -38,6 +38,7 @@ spring: max-active: 8 # max-wait: -1ms + client-type: jedis data: mongodb: host: localhost diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml index 126bd7d..212238d 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml @@ -39,6 +39,7 @@ spring: max-active: 8 # max-wait: -1ms + client-type: jedis data: mongodb: host: localhost diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml index 1ce4040..8bfe9de 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-test.yml @@ -39,6 +39,7 @@ spring: max-active: 8 # max-wait: -1ms + client-type: jedis data: mongodb: host: localhost diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java index 58a582a..c1ef383 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java @@ -1,6 +1,8 @@ package com.cpop.mall.business.controller.backstage; +import com.alibaba.fastjson.JSONObject; import com.cpop.core.base.R; +import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.bo.CarouselBo; import com.cpop.mall.business.service.ProductService; @@ -120,10 +122,11 @@ public class BackstageCarouselController { */ @GetMapping("/getUpProductList") @ApiOperation("获取上架商品") - public R> getUpProductList(@ApiParam("品牌id") @RequestParam(value = "brandId", required = false) String brandId) { + public R> getUpProductList() { + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); List productSimpleVos = SpringUtils.getBean(ProductService.class).listAs(QueryWrapper.create() .select(PRODUCT.ID, PRODUCT.PRODUCT_NAME) - .where(PRODUCT.BRAND_ID.eq(brandId)) + .where(PRODUCT.BRAND_ID.eq(loginUserInfo.getString("brandId"))) .and(PRODUCT.IS_UP.eq(true)) , ProductSimpleVo.class); return R.ok(productSimpleVos); 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 0c4d80b..44ed93b 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 @@ -87,6 +87,7 @@ public class OrderRefundServiceImpl extends ServiceImpl storeList = RowUtil.toEntityList(rowList, Store.class).stream().filter(item -> StringUtils.isNotBlank(item.getId())).collect(Collectors.toList()); SpringUtils.getBean(StoreService.class).updateBatch(storeList); } + + /** + * 同步课卡模板 + * @author DB + * @since 2024/1/17 + */ + @Test + public void syncCardTemplate(){ + List rowList; + try { + DataSourceKey.use("jambox"); + rowList = DbChain.table("t_card_template") + .select("tct.template_id as oldTemplateId", "tct.brand_id as brandCloudId", "tct.store_id as storeCloudId", "tct.open_status as status", "tct.name", "tct.day as validDay", + "tct.end as endDate", "tct.price", "tct.week_appointment", "tct.day_appointment", "tct.free_day as bufferDay", "tct.number as classNumber", + "tct.type as scopeUse", "tct.time_limit", "tct.is_suda", "tct.pay_type", "tct.template_qr_code as qrCode", "tct.is_member", "tct.stage_num", "tct.deposit", "tct.buffer_days", + "tct.is_drainage", "tct.is_ecpp_activity", "tct.ecpp_activity_code", "tct.ecpp_activity_desc") + .select("(SELECT jwpp.plan_id from j_wechat_pay_plan as jwpp WHERE jwpp.template_id = tct.template_id AND jwpp.is_month = 0 AND jwpp.deleted = 1 LIMIT 1 ) as oncePlanId") + .select("(SELECT jwpp.plan_id from j_wechat_pay_plan as jwpp WHERE jwpp.template_id = tct.template_id AND jwpp.is_month = 1 AND jwpp.deleted = 1 LIMIT 1 ) as monthPlanId") + .select("creation_time as createTime", "last_modification_date as updateTime") + .from("t_card_template").as("tct") + .where("tct.deleted = 1") + .list(); + } finally { + DataSourceKey.clear(); + } + //获取所有计划 + Map wxPayScoreMap = SpringUtils.getBean(WxPayScoreService.class).list().stream().collect(Collectors.toMap(WxPayScore::getOutPlanId, item -> item)); + Map brandMap = SpringUtils.getBean(BrandExtendService.class).list().stream().collect(Collectors.toMap(BrandExtend::getBrandCloudId, BrandExtend::getBrandId)); + Map storeMap = SpringUtils.getBean(StoreExtendService.class).list().stream().collect(Collectors.toMap(StoreExtend::getStoreCloudId, StoreExtend::getStoreId)); + List cardTemplateExtends = new ArrayList<>(); + rowList.forEach(item -> { + //模板类型 + item.set("templateType", changeTimeLimitToTemplateType(item.getString("timeLimit"))); + if (item.getBoolean("isSuda")){ + CardTemplateExtend cardTemplateExtend = new CardTemplateExtend(); + cardTemplateExtend.setTemplateId(item.getString("oldTemplateId")) + .setPayType(3) + .setExtendParamOne(item.getString("isEcppActivity")) + .setExtendParamTwo(item.getString("ecppActivityCode")) + .setExtendParamThree(item.getString("ecppActivityDesc")); + cardTemplateExtends.add(cardTemplateExtend); + } + if (StringUtils.isNotBlank(item.getString("brandCloudId"))){ + item.set("brandId",brandMap.get(item.getString("brandCloudId"))); + } + if (StringUtils.isNotBlank(item.getString("storeCloudId"))){ + item.set("storeId",storeMap.get(item.getString("storeCloudId"))); + } + if (StringUtils.isNotBlank(item.getString("payType"))){ + List payTypeList = Arrays.stream(item.getString("payType").split(",")).collect(Collectors.toList()); + payTypeList.forEach(inner -> { + changePayType(inner, cardTemplateExtends, item, wxPayScoreMap); + }); + } else { + CardTemplateExtend cardTemplateExtend = new CardTemplateExtend(); + cardTemplateExtend.setTemplateId(item.getString("oldTemplateId")) + .setPayType(4); + cardTemplateExtends.add(cardTemplateExtend); + } + + }); + List entityList = RowUtil.toEntityList(rowList, CardTemplate.class); + SpringUtils.getBean(CardTemplateService.class).saveBatch(entityList); + Map collect = entityList.stream().collect(Collectors.toMap(CardTemplate::getOldTemplateId, CardTemplate::getId)); + LocalDateTime now = LocalDateTime.now(); + cardTemplateExtends.forEach(item->{ + item.setTemplateId(collect.get(item.getTemplateId())); + item.setCreateTime(now); + item.setUpdateTime(now); + }); + SpringUtils.getBean(CardTemplateExtendService.class).saveBatch(cardTemplateExtends); + } + + private Integer changeTimeLimitToTemplateType(String timeLimit) { + switch (timeLimit) { + case "课时卡": + return 0; + case "时限卡": + return 1; + default: + return 2; + } + } + + private void changePayType(String payType,List cardTemplateExtends,Row row,Map wxPayScoreMap) { + CardTemplateExtend cardTemplateExtend = new CardTemplateExtend(); + switch (payType) { + //先学后付次付 + case "1": + if (StringUtils.isNotBlank(row.getString("oncePlanId"))){ + WxPayScore oncePlan = wxPayScoreMap.get(row.getString("oncePlanId")); + if (oncePlan != null){ + cardTemplateExtend.setExtendId(oncePlan.getId()) + .setPayType(1); + cardTemplateExtends.add(cardTemplateExtend); + } + } + break; + //旧放心学合约 + case "2": + cardTemplateExtend.setTemplateId(row.getString("oldTemplateId")) + .setPayType(2) + .setExtendParamOne(row.getString("stageNum")) + .setExtendParamTwo(row.getString("deposit")) + .setExtendParamThree(row.getString("bufferDays")); + cardTemplateExtends.add(cardTemplateExtend); + break; + //先学后付月付 + case "5": + if (StringUtils.isNotBlank(row.getString("monthPlanId"))){ + WxPayScore monthPlan = wxPayScoreMap.get(row.getString("monthPlanId")); + if (monthPlan != null){ + cardTemplateExtend.setExtendId(monthPlan.getId()) + .setPayType(5); + cardTemplateExtends.add(cardTemplateExtend); + } + } + break; + default: + break; + } + } + + /** + * 同步校区签约 + * @author DB + * @since 2024/1/18 + */ + @Test + public void syncOldStoreSignData() { + List rowList; + try { + DataSourceKey.use("jambox"); + rowList = DbChain.table("t_signContract_mechanism") + .select("tsm.store_id as storeCloudId", "tsm.creation_time as createTime", "tsm.last_modification_date as updateTime","os.phone") + .from("t_signContract_mechanism").as("tsm") + .leftJoin("t_mechanism_info").as("tmi").on("tmi.store_id = tsm.store_id") + .leftJoin("OAM_staff").as("os").on("os.staff_id = tmi.clue_id") + .where("tsm.deleted = 1") + .list(); + } finally { + DataSourceKey.clear(); + } + Map phoneToId = DbChain.table(STAFF.getTableName()) + .select(STAFF.ID) + .select(SYS_USER.PHONE_NUMBER.as("phone")) + .from(STAFF) + .leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID)) + .list() + .stream().collect(Collectors.toMap(item -> item.getString("phone"), item -> item.getString("id"))); + Map cloudToId = SpringUtils.getBean(StoreExtendService.class).list() + .stream().collect(Collectors.toMap(StoreExtend::getStoreCloudId, StoreExtend::getStoreId)); + rowList.forEach(item->{ + if (StringUtils.isNotBlank(item.getString("phone"))){ + item.set("sign_staff_id",phoneToId.get(item.getString("phone"))); + } + item.set("store_id",cloudToId.get(item.getString("storeCloudId"))); + }); + List entityList = RowUtil.toEntityList(rowList, StoreSign.class) + .stream().filter(item->StringUtils.isNotBlank(item.getStoreId())).collect(Collectors.toList()); + Db.executeBatch(entityList, StoreSignMapper.class, (mapper, storeSign) -> { + // ↑↑↑↑↑ 以上的这个 mapper,未被使用 + UpdateChain.of(mapper) + .set(STORE_SIGN.CREATE_TIME,storeSign.getCreateTime()) + .set(STORE_SIGN.UPDATE_TIME,storeSign.getUpdateTime()) + .set(STORE_SIGN.SIGN_STAFF_ID,storeSign.getSignStaffId()) + .where(STORE_SIGN.STORE_ID.eq(storeSign.getStoreId())) + .update(); + }); + } + + @Test + public void removeExtendSignData(){ + StoreSignService storeSignService = SpringUtils.getBean(StoreSignService.class); + List list = storeSignService.queryChain() + .select(max(STORE_SIGN.ID).as(StoreSign::getId)) + .groupBy(STORE_SIGN.STORE_ID) + .having(count(STORE_SIGN.STORE_ID).gt(1)).list(); + storeSignService.removeByIds(list.stream().map(StoreSign::getId).collect(Collectors.toList())); + } + + @Test + public void checkSpecialCharacter(){ + String input = "排课000\uD83C\uDF3F\uD83C\uDF8B\uD83C\uDF15\uD83C\uDF44\uD83D\uDC1A"; + //特殊字符过滤 + String pattern = "[^a-zA-Z0-9]"; + System.out.println(input.replaceAll(pattern, "")); + } } diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java index 8e9a782..fa644ed 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java @@ -59,7 +59,7 @@ import static com.cpop.system.business.entity.table.StoreTableDef.STORE; */ @Slf4j @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles(profiles = {"prod", "core"}) +@ActiveProfiles(profiles = {"dev", "core"}) public class CpopImportTests { /** @@ -1638,4 +1638,5 @@ public class CpopImportTests { }); financeReimburseService.updateBatch(updateEnetyList); } + } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskAuditCommentsBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskAuditCommentsBo.java index c16fd36..1d8e2a8 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskAuditCommentsBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskAuditCommentsBo.java @@ -47,6 +47,10 @@ public class TaskAuditCommentsBo { @ApiModelProperty("任务权重(任务绩点)") private Integer taskWeight; + public void setTaskWeight(String taskWeight) { + this.taskWeight = Integer.parseInt(taskWeight.split(",")[0]); + } + /** * 备注(不通过时可以写入备注) */ 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 909dfad..6745cc0 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 @@ -393,7 +393,6 @@ public class BusinessServiceImpl extends ServiceImpl i storeSign.setSignStaffId(loginUserInfo.getString("id")); storeSignService.save(storeSign); } - } } } 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 cd0f146..6bb2e04 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 @@ -225,6 +225,9 @@ public class DataImportServiceImpl extends ServiceImpl implements Ta } } + /** + * 任务评级 + */ + private final String OAM_TASK_RATING = "oam_task_rating"; + /** * 技术模块-任务领取-技术人员领取任务 * @@ -244,32 +253,8 @@ public class TaskServiceImpl extends ServiceImpl implements Ta // 获取任务评级 String taskRating = task.getTaskRating(); LocalDate now = LocalDate.now(); - switch (taskRating) { - case "A": - // 30天 - task.setExpectedCompletionDate(now.plusDays(30)); - break; - case "B": - // 21天 - task.setExpectedCompletionDate(now.plusDays(21)); - break; - case "C": - // 15天 - task.setExpectedCompletionDate(now.plusDays(15)); - break; - case "D": - // 7天 - task.setExpectedCompletionDate(now.plusDays(7)); - break; - case "E": - // 3天 - task.setExpectedCompletionDate(now.plusDays(3)); - break; - default: - // 1天 - task.setExpectedCompletionDate(now.plusDays(1)); - break; - } + String dictValue = DictUtils.getDictValue(OAM_TASK_RATING, taskRating); + task.setExpectedCompletionDate(now.plusDays(Integer.parseInt(dictValue.split(",")[1]))); } // 获取当前用户 JSONObject loginUser = SecurityUtils.getInstance().getLoginUserInfo(); diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayConfiguration.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayConfiguration.java index f65d3ef..b5b12df 100644 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayConfiguration.java +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayConfiguration.java @@ -41,6 +41,7 @@ public class WxPayConfiguration { payConfig.setPrivateCertPath(this.properties.getPrivateCertPath()); //通知地址 payConfig.setNotifyUrl(this.properties.getNotifyUrl()); + payConfig.setServiceId(this.properties.getServiceId()); // 可以指定是否使用沙箱环境 payConfig.setUseSandboxEnv(false); WxPayService wxPayService = new WxPayServiceImpl(); diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayProperties.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayProperties.java index bdf4a17..454800d 100644 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayProperties.java +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/config/wxPay/WxPayProperties.java @@ -81,4 +81,8 @@ public class WxPayProperties { */ private String easyLearnUnionPayNotifyUrl; + /** + * 服务id + */ + private String serviceId; } diff --git a/Cpop-Pay/src/main/resources/application-pay.yml b/Cpop-Pay/src/main/resources/application-pay.yml index c5f1be7..65fd4b0 100644 --- a/Cpop-Pay/src/main/resources/application-pay.yml +++ b/Cpop-Pay/src/main/resources/application-pay.yml @@ -2,12 +2,14 @@ wx: #微信支付 pay: #微信公众号或者小程序等的appid - appId: wx20853d18c455e874 + app-id: wx20853d18c455e874 #微信支付商户号 - mchId: 1618884922 + mch-id: 1618884922 #微信支付商户密钥 - mchKey: JamBox20230919174000000000000002 - apiV3Key: JamBox20230919174000000000000002 + mch-key: JamBox20230919174000000000000002 + api-v3-key: JamBox20230919174000000000000002 + #服务id + service-id: 00003053000000169450961228104460 #分账服务商账号 - sharingAccount: 1618884922 - sharingAccountName: 果酱盒子 + sharing-account: 1618884922 + sharing-account-name: 果酱盒子 diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java index 7f5603e..2a9df4e 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java @@ -10,6 +10,7 @@ import com.cpop.core.service.impl.RedisServiceImpl; import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.system.business.bo.StoreRenewBo; +import com.cpop.system.business.service.StoreService; import com.cpop.system.business.service.StoreSignService; import com.cpop.system.framework.constant.SystemRedisKey; import com.mybatisflex.core.datasource.DataSourceKey; @@ -32,10 +33,12 @@ import redis.clients.jedis.JedisClientConfig; import javax.annotation.Resource; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.concurrent.TimeUnit; import static com.cpop.system.business.entity.table.StoreSignTableDef.STORE_SIGN; +import static com.cpop.system.business.entity.table.StoreTableDef.STORE; /** * 校区续费表 服务层实现。 @@ -62,6 +65,10 @@ public class StoreRenewServiceImpl extends ServiceImpl implements LocalDateTime now = LocalDateTime.now(); LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); BrandService brandService = SpringUtils.getBean(BrandService.class); - if (brandExtend.isEmpty()) { + if (brandExtend == null || brandExtend.isEmpty()) { brand = new Brand(); brand.setBrandName(brandInfo.getBrandName()).setSourceType(SourceType.JAMBOX.toString()); brandService.save(brand); @@ -107,7 +107,7 @@ public class StoreServiceImpl extends ServiceImpl implements .set("create_user_id", loginUser == null ? "1" : loginUser.getUserId()) .set("update_user_id", loginUser == null ? "1" : loginUser.getUserId()) .save(); - }else { + } else { brand = brandService.getById(brandExtend.getString("brandId")); } Store store = BeanUtils.mapToClass(bo.getStoreInfo(), Store.class); diff --git a/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java b/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java index 6e8c13f..c6f6378 100644 --- a/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java +++ b/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java @@ -19,6 +19,7 @@ import java.util.stream.Collectors; /** * 字典工具类 + * @author Lost */ public class DictUtils { /**