diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardDto.java index 2329351..5d3f259 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardDto.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardDto.java @@ -162,7 +162,7 @@ public class CloudClassCardDto { /** * 每期课次 */ - private Integer classHour; + private String classHour; /** * 签约计划详情,json格式 diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java index f36e035..f5c3842 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java @@ -160,6 +160,25 @@ public class CloudClassCardHandler { } else { throw new ServiceException("办卡失败!"); } + } + + /** + * 通知退款退卡 + * @author DB + * @since 2024/1/22 + * @param dto 请求参数 + */ + public void refundCloudClassCard(CloudClassCardDto dto){ + JSONObject jsonBody = JSONObject.parseObject(JSONObject.toJSONString(dto)); + jsonBody.put("_type", "periodRefund"); + JSONObject result = restTemplate.postForObject(CloudDbUrl.COMMON_USE_URL, jsonBody, JSONObject.class); + if (result != null) { + if (!result.getBoolean("success")) { + throw new UtilException(result.getString("error")); + } + } else { + throw new ServiceException("操作失败!"); + } } } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterServiceOrderBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterServiceOrderBo.java index dc874c1..e7c365c 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterServiceOrderBo.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterServiceOrderBo.java @@ -37,13 +37,6 @@ public class LearnNowPayLaterServiceOrderBo { @ApiModelProperty(value = "服务商公众号下的用户标识",required = true) private String openid; - /** - * 支付分订单在商户侧的订单号,必须和创建签约计划时传入的该笔订单对应的商户侧计划明细使用订单号(merchant\_plan\_detail\_no)一致 - */ - @NotBlank(message = "outTradeNo不能为空") - @ApiModelProperty(value = "支付分订单在商户侧的订单号,必须和创建签约计划时传入的该笔订单对应的商户侧计划明细使用订单号(merchant_plan_detail_no)一致",required = true) - private String outTradeNo; - /** * 卡号 */ diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterUserSignPlansBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterUserSignPlansBo.java index 3ee1da8..b649bff 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterUserSignPlansBo.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterUserSignPlansBo.java @@ -39,18 +39,33 @@ public class LearnNowPayLaterUserSignPlansBo { /** * 支付分计划名称 */ - @ApiModelProperty("支付分计划名称") + @NotBlank(message = "支付分计划名称不能为空") + @ApiModelProperty(value = "支付分计划名称",required = true) private String planName; /** * 客户名 */ - @ApiModelProperty("客户名") + @NotBlank(message = "客户名不能为空") + @ApiModelProperty(value = "客户名",required = true) private String customerName; /** * 客户手机号 */ - @ApiModelProperty("客户手机号") + @NotBlank(message = "客户手机号不能为空") + @ApiModelProperty(value = "客户手机号", required = true) private String customerPhone; + + /** + * 模板id + */ + @ApiModelProperty(value = "模板id") + private String templateId; + + /** + * 旧模板id + */ + @ApiModelProperty(value = "旧模板id") + private String oldTemplateId; } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java index 784add9..eff1d0a 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java @@ -6,8 +6,10 @@ import com.cpop.jambox.business.bo.CardTemplateUnionBo; import com.cpop.jambox.business.entity.CardTemplate; import com.cpop.jambox.business.service.CardTemplateExtendService; import com.cpop.jambox.business.service.CardTemplateService; +import com.cpop.jambox.business.vo.CardTemplateInfoVo; 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.*; @@ -77,4 +79,19 @@ public class MiniCardTemplateController { .remove(); return R.ok(); } + + /** + * 获取模板信息 + * @author DB + * @since 2024/1/22 + * @param id 主键 + * @return R + */ + @ApiOperation(value = "获取模板信息") + @GetMapping("/getCardTemplateInfo") + public R getCardTemplateInfo(@ApiParam("id") @RequestParam(value = "id", required = false) String id, + @ApiParam("旧模板id") @RequestParam(value = "oldTemplateId", required = false) String oldTemplateId) { + CardTemplateInfoVo vo = cardTemplateService.getCardTemplateInfo(id, oldTemplateId); + return R.ok(vo); + } } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java index 1743b56..232b224 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java @@ -42,9 +42,10 @@ public class MiniEasyLearnController { */ @ApiOperation("获取支付分计划") @GetMapping("/getWxPayScorePlan") - public R getWxPayScorePlan(@ApiParam(value = "旧模板id", required = true) @RequestParam("oldTemplateId") String oldTemplateId, - @ApiParam(value = "是否月付(0否1是)", required = true) @RequestParam("isMonth") Boolean isMonth) { - LearnNowPayLaterPlanVo vo = cardTemplateService.getWxPayScorePlan(oldTemplateId, isMonth); + public R getWxPayScorePlan(@ApiParam(value = "旧模板id") @RequestParam(value = "oldTemplateId", required = false) String oldTemplateId, + @ApiParam(value = "模板id") @RequestParam(value = "templateId", required = false) String templateId, + @ApiParam(value = "是否月付(0否1是)", required = true) @RequestParam("isMonth") Boolean isMonth) { + LearnNowPayLaterPlanVo vo = cardTemplateService.getWxPayScorePlan(oldTemplateId, templateId, isMonth); return R.ok(vo); } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java index 796e06b..f6964aa 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java @@ -104,6 +104,11 @@ public class EasyLearnOrder extends BaseEntity implements Serializable { */ private Double rate; + /** + * 模板id + */ + private String templateId; + /** * 逻辑删除(0否1是) */ 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 c587f7e..dc3a79c 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 @@ -2,6 +2,7 @@ package com.cpop.jambox.business.service; import com.cpop.jambox.business.bo.CardTemplateUnionBo; import com.cpop.jambox.business.entity.CardTemplate; +import com.cpop.jambox.business.vo.CardTemplateInfoVo; import com.cpop.jambox.business.vo.LearnNowPayLaterPlanDetailVo; import com.cpop.jambox.business.vo.LearnNowPayLaterPlanVo; import com.mybatisflex.core.row.Row; @@ -50,5 +51,13 @@ public interface CardTemplateService extends IService { * @param isMonth 是否月付 * @return LearnNowPayLaterPlanDetailVo */ - LearnNowPayLaterPlanVo getWxPayScorePlan(String oldTemplateId, Boolean isMonth); + LearnNowPayLaterPlanVo getWxPayScorePlan(String oldTemplateId,String templateId, Boolean isMonth); + + /** + * 获取模板信息 + * @author DB + * @since 2024/1/22 + * @param id 主键 + */ + CardTemplateInfoVo getCardTemplateInfo(String id,String oldTemplateId); } 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 7ed2da7..8821148 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 @@ -15,6 +15,7 @@ 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.business.vo.CardTemplateInfoVo; import com.cpop.jambox.business.vo.LearnNowPayLaterPlanDetailVo; import com.cpop.jambox.business.vo.LearnNowPayLaterPlanVo; import com.cpop.jambox.framework.tasks.LearnNowPayLaterTask; @@ -283,8 +284,13 @@ public class CardTemplateServiceImpl extends ServiceImpl payTypeList = SpringUtils.getBean(CardTemplateExtendService.class).queryChain() + .where(CARD_TEMPLATE_EXTEND.TEMPLATE_ID.eq(vo.getId())) + .list().stream().map(CardTemplateExtend::getPayType) + .collect(Collectors.toList()); + vo.setPayType(payTypeList); + return vo; + } + } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java index 9da9d65..a9469e3 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java @@ -47,6 +47,7 @@ import com.mybatisflex.core.datasource.FlexDataSource; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.row.Db; +import com.mybatisflex.core.row.DbChain; import com.mybatisflex.core.row.Row; import com.mybatisflex.core.row.RowUtil; import com.mybatisflex.spring.service.impl.ServiceImpl; @@ -72,6 +73,7 @@ import static com.cpop.jambox.business.entity.table.EasyLearnOrderTableDef.EASY_ import static com.cpop.jambox.business.entity.table.StoreExtendTableDef.STORE_EXTEND; import static com.cpop.system.business.entity.table.StoreTableDef.STORE; import static com.cpop.system.business.entity.table.WxPayScoreDetailTableDef.WX_PAY_SCORE_DETAIL; +import static com.cpop.system.business.entity.table.WxPayScoreTableDef.WX_PAY_SCORE; /** * 果酱-放心学订单表 服务层实现。 @@ -679,33 +681,48 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl wxPayScoreDetails = SpringUtils.getBean(WxPayScoreDetailService.class).queryChain() - .where(WX_PAY_SCORE_DETAIL.SYS_WX_PAY_SCORE_ID.eq(bo.getId())) - .list(); - Row brandAndStore = Db.selectOneByQuery(QueryWrapper.create() - .select(STORE.ID,STORE.BRAND_ID) - .leftJoin(STORE_EXTEND).on(STORE_EXTEND.STORE_ID.eq(STORE.ID)) - .where(STORE_EXTEND.STORE_CLOUD_ID.eq(bo.getStoreCloudId()))); - //创建用户签约计划 - String orderId = createEasyLearnUserSignPlans(bo, brandAndStore, wxPayScore); - String subMchId = wxPayHandler.getSubMchId(brandAndStore.getString("brandId"), brandAndStore.getString("id")); - WxPayService wxPayService = wxPayHandler.getWxPayService(null, subMchId); - PartnerPayScoreSignPlanService partnerPayScoreSignPlanService = wxPayService.getPartnerPayScoreSignPlanService(); - List payScorePlanDetailRequests = BeanUtils.mapToList(wxPayScoreDetails, PayScorePlanDetailRequest.class); - WxPartnerPayScoreSignPlanRequest signPlanRequest = new WxPartnerPayScoreSignPlanRequest(); - signPlanRequest.setPlanId(wxPayScore.getOutPlanId()).setSubAppid(subMchId) - .setSubOpenid(bo.getSubOpenId()) - .setMerchantSignPlanNo(orderId) - .setPlanDetailList(payScorePlanDetailRequests) - .setNotifyUrl(wxPayConfiguration.getProperties().getLearnNowPayLaterUserSignPlanNotifyUrl()); - try { - return partnerPayScoreSignPlanService.createUserSignPlans(signPlanRequest); - } catch (WxPayException e) { - throw new ServiceException(e.getMessage()); + //分布式锁进行幂等处理 + RedisService redisService = SpringUtils.getBean(RedisService.class); + //分布式锁进行幂等处理 + Lock userIdLock = redisService.distributedLock(JamboxRedisConstant.LEARN_NOW_PAY_LATER_CREATE_USER_PLANS_LOCK_USER_PAY + bo.getId()); + if (userIdLock.tryLock()) { + try { + // 获取计划 + WxPayScore wxPayScore = SpringUtils.getBean(WxPayScoreService.class).getById(bo.getId()); + //获取计划详情 + List wxPayScoreDetails = SpringUtils.getBean(WxPayScoreDetailService.class).queryChain() + .where(WX_PAY_SCORE_DETAIL.SYS_WX_PAY_SCORE_ID.eq(bo.getId())) + .list(); + Row brandAndStore = Db.selectOneByQuery(QueryWrapper.create() + .select(STORE.ID, STORE.BRAND_ID) + .leftJoin(STORE_EXTEND).on(STORE_EXTEND.STORE_ID.eq(STORE.ID)) + .where(STORE_EXTEND.STORE_CLOUD_ID.eq(bo.getStoreCloudId()))); + //创建用户签约计划 + String orderId = createEasyLearnUserSignPlans(bo, brandAndStore, wxPayScore); + String subMchId = wxPayHandler.getSubMchId(brandAndStore.getString("brandId"), brandAndStore.getString("id")); + WxPayService wxPayService = wxPayHandler.getWxPayService(null, subMchId); + PartnerPayScoreSignPlanService partnerPayScoreSignPlanService = wxPayService.getPartnerPayScoreSignPlanService(); + List payScorePlanDetailRequests = BeanUtils.mapToList(wxPayScoreDetails, PayScorePlanDetailRequest.class); + WxPartnerPayScoreSignPlanRequest signPlanRequest = new WxPartnerPayScoreSignPlanRequest(); + signPlanRequest.setPlanId(wxPayScore.getOutPlanId()).setSubAppid(subMchId) + .setSubOpenid(bo.getSubOpenId()) + .setMerchantSignPlanNo(orderId) + .setPlanDetailList(payScorePlanDetailRequests) + .setNotifyUrl(wxPayConfiguration.getProperties().getLearnNowPayLaterUserSignPlanNotifyUrl()); + try { + return partnerPayScoreSignPlanService.createUserSignPlans(signPlanRequest); + } catch (WxPayException e) { + throw new ServiceException(e.getMessage()); + } + } finally { + //释放锁 + userIdLock.unlock(); + } + } else { + //获取锁失败,直接返回空 + throw new ServiceException("请勿重复提交"); } + } /** @@ -726,11 +743,18 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl payType; + + /** + * 是否是会员(0否1是) + */ + @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/framework/constant/JamboxRedisConstant.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/constant/JamboxRedisConstant.java index 2dc1188..7dbeb9f 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/constant/JamboxRedisConstant.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/constant/JamboxRedisConstant.java @@ -11,4 +11,15 @@ public interface JamboxRedisConstant { * 一次性支付 */ String ONCE_PAY_LOCK_USER_PAY = "jambox:oncePayLock:userPay:"; + + /** + * 先学后付创建计划 + */ + String LEARN_NOW_PAY_LATER_CREATE_USER_PLANS_LOCK_USER_PAY = "jambox:learnNowPayLaterCreateUserPlansLock:userPay:"; + + /** + * 先学后付用户核销 + */ + String LEARN_NOW_PAY_LATER_SERVICE_ORDER_LOCK_USER_PAY = "jambox:learnNowPayLaterServiceOrderLock:userPay:"; + } diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml index 2177965..8112abe 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml @@ -111,4 +111,4 @@ wx: # 先学后付用户签约通知地址 learn-now-pay-later-user-sign-plan-notify-url: # 先学后付用户核销通知地址 - learn-now-pay-later-service-order-notify-url: + learn-now-pay-later-service-order-notify-url: \ No newline at end of file diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java index ad659c3..407a71b 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopDataSyncTests.java @@ -13,6 +13,7 @@ import com.cpop.jambox.business.service.StoreExtendService; import com.cpop.system.business.entity.Store; import com.cpop.system.business.entity.StoreSign; import com.cpop.system.business.entity.WxPayScore; +import com.cpop.system.business.mapper.StoreMapper; import com.cpop.system.business.mapper.StoreSignMapper; import com.cpop.system.business.service.StoreService; import com.cpop.system.business.service.StoreSignService; @@ -269,4 +270,20 @@ public class CpopDataSyncTests { String pattern = "[^a-zA-Z0-9]"; System.out.println(input.replaceAll(pattern, "")); } + + /** + * 同步校区签约数据 + */ + @Test + public void syncStoreSignData(){ + List list = SpringUtils.getBean(StoreSignService.class).list(); + List stores = new ArrayList<>(); + list.forEach(item->{ + Store store = new Store(); + store.setId(item.getStoreId()) + .setSignId(item.getId()); + stores.add(store); + }); + SpringUtils.getBean(StoreService.class).updateBatch(stores); + } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BusinessDistributeBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BusinessDistributeBo.java index 0ed582a..1b3c9e9 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BusinessDistributeBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BusinessDistributeBo.java @@ -30,12 +30,7 @@ public class BusinessDistributeBo { @NotNull(message = "业务等级不能为空") @ApiModelProperty(value = "业务等级") private Integer businessLevel; - /** - * 业务类型 - */ - @NotNull(message = "业务类型不能为空") - @ApiModelProperty(value = "业务类型") - private Integer businessType; + /** * 对接列表 */ @@ -58,11 +53,6 @@ public class BusinessDistributeBo { */ @ApiModelProperty(value = "备注") private String remark; - /** - * 签约列表 - */ - @ApiModelProperty(value = "签约列表") - private List sign; @Data public static class ButtJoint { @@ -77,18 +67,4 @@ public class BusinessDistributeBo { @ApiModelProperty(value = "接收员工id") private String staffId; } - - @Data - public static class Sign { - /** - * 接收员工id - */ - @ApiModelProperty(value = "接收员工id") - private String staffId; - /** - * 剩余数量 - */ - @ApiModelProperty(value = "剩余数量") - private Integer surplusQuantity; - } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BusinessController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BusinessController.java index bc07085..3a187d2 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BusinessController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BusinessController.java @@ -10,10 +10,7 @@ import com.cpop.oam.business.bo.BusinessRemoveBo; import com.cpop.oam.business.dto.BusinessDistributeDto; import com.cpop.oam.business.service.BusinessService; import com.cpop.oam.business.service.StaffService; -import com.cpop.oam.business.vo.BusinessInfoPageVo; -import com.cpop.oam.business.vo.BusinessPageVo; -import com.cpop.oam.business.vo.PersonBusinessInfoVo; -import com.cpop.oam.business.vo.StaffVo; +import com.cpop.oam.business.vo.*; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -163,4 +160,32 @@ public class BusinessController { return R.ok(); } + /** + * 查询未签约校区分页列表 + * @author DB + * @since 2024/1/22 + * @param params 请求参数 + * @return R> + */ + @ApiOperation("查询未签约校区分页列表") + @GetMapping("/getUnSignStorePage") + public R> getUnSignStorePage(@ApiParam("查询参数") @RequestParam(value = "params", required = false) String params) { + Page pageVo = businessService.getUnSignStorePage(params); + return R.ok(pageVo); + } + + /** + * 校区签约 + * @author DB + * @since 2024/1/22 + * @param id 校区id + * @return R + */ + @ApiOperation("校区签约") + @PutMapping("/storeSign") + public R storeSign(@ApiParam(value = "校区id", required = true) @RequestParam(value = "id") String id) { + businessService.storeSign(id); + return R.ok(); + } + } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BusinessService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BusinessService.java index 97c0f34..83a1022 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BusinessService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BusinessService.java @@ -6,6 +6,7 @@ import com.cpop.oam.business.bo.BusinessInfoPageBo; import com.cpop.oam.business.bo.BusinessRemoveBo; import com.cpop.oam.business.vo.BusinessInfoPageVo; import com.cpop.oam.business.vo.BusinessPageVo; +import com.cpop.oam.business.vo.BusinessUnSignPageVo; import com.cpop.oam.business.vo.PersonBusinessInfoVo; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.service.IService; @@ -69,4 +70,21 @@ public interface BusinessService extends IService { * @return PersonBusinessInfoVo */ PersonBusinessInfoVo getPersonBusinessInfoById(String id); + + /** + * 查询未签约校区分页列表 + * @author DB + * @since 2024/1/22 + * @param params 请求参数 + * @return Page + */ + Page getUnSignStorePage(String params); + + /** + * 校区签约 + * @author DB + * @since 2024/1/22 + * @param id 主键 + */ + void storeSign(String id); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java index 2369152..4b26bbf 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java @@ -83,7 +83,8 @@ public class BrandManagerServiceImpl extends ServiceImpl i .setStartDate(bo.getStartAndEnd().get(0)) .setEndDate(bo.getStartAndEnd().get(1)); this.save(business); - Integer allSurplusQuantity; - //机构对接 - if (business.getBusinessType() == 0){ - allSurplusQuantity = createButtJoint(bo, business.getId()); - } else { - allSurplusQuantity = createSign(bo,business.getId()); - } + Integer allSurplusQuantity = createButtJoint(bo, business.getId()); business.setAllSurplusQuantity(allSurplusQuantity); this.updateById(business); //TODO:定时检查事务过期? } - /** - * 事务签约 - * @author DB - * @since 2023/12/13 - * @param bo 请求 - * @param businessId 事务id - * @return Integer - */ - private Integer createSign(BusinessDistributeBo bo, String businessId) { - //事务详情数量标记 - AtomicReference flag = new AtomicReference<>(0); - if (bo.getSign().isEmpty()){ - throw new ServiceException("签约人不能为空"); - } - List businessStaffs = BeanUtils.mapToList(bo.getSign(), BusinessStaff.class); - businessStaffs.forEach(item -> { - item.setBusinessId(businessId); - flag.updateAndGet(v -> v + item.getSurplusQuantity()); - }); - //保存负责员工 - SpringUtils.getBean(BusinessStaffService.class).saveBatch(businessStaffs); - return flag.get(); - } - /** * 事务对接 * @author DB @@ -226,68 +199,7 @@ public class BusinessServiceImpl extends ServiceImpl i */ @Override public Page getBusinessInfoPage(BusinessInfoPageBo bo) { - //获取当前事务 - Business business = this.getById(bo.getId()); - //对接 - if (business.getBusinessType() == 0) { - return getButtJoint(bo); - } else { - //签约 - return getSign(bo); - } - } - - /** - * 获取签约数据 - * @author DB - * @since 2023/12/13 - * @param bo 请求 - * @return Page - */ - private Page getSign(BusinessInfoPageBo bo) { - //获取当前员工信息 - JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); - QueryWrapper queryWrapper = QueryWrapper.create(); - //运营人员 - if (loginUserInfo.getInteger("staffType") == 1) { - //查询自己处理中的校区的记录 - queryWrapper.and(BUSINESS_STAFF.STAFF_ID.eq(loginUserInfo.getString("id")) - //获取所有无人处理的校区 - .or(STORE.ID.notIn(select(distinct(BUSINESS_DETAIL.STORE_ID)) - .from(BUSINESS_DETAIL) - .leftJoin(BUSINESS_STAFF).on(BUSINESS_STAFF.ID.eq(BUSINESS_DETAIL.BUSINESS_STAFF_ID)) - .where(BUSINESS_STAFF.STAFF_ID.ne(loginUserInfo.getString("id")) - .and(BUSINESS_DETAIL.STORE_ID.isNotNull())) - ))); - } else { - queryWrapper.and(BUSINESS_STAFF.STAFF_ID.in(bo.getStaffIds())); - } - PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); - return SpringUtils.getBean(StoreService.class).getMapper().paginateAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()), - queryWrapper - .select(BUSINESS_DETAIL.ID.as(BusinessInfoPageVo::getId),BUSINESS_DETAIL.BUSINESS_ID, BUSINESS_DETAIL.DETAIL_STATUS, BUSINESS_DETAIL.DETAIL_DESC, BUSINESS_DETAIL.DETAIL_RECORD_TIME) - //品牌 - .select(BRAND.BRAND_NAME) - //校区 - .select(STORE.STORE_NAME, STORE.PERSON_CHARGE, STORE.PHONE, STORE.ID.as(BusinessInfoPageVo::getStoreId)) - //营业执照 - .select(STORE_LICENSE.LICENSE_NAME, STORE_LICENSE.LICENSE_USER_NAME, STORE_LICENSE.LICENSE_ADDR) - .leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID)) - .leftJoin(STORE_LICENSE).on(STORE_LICENSE.STORE_ID.eq(STORE.ID)) - .leftJoin(BUSINESS_DETAIL).on(BUSINESS_DETAIL.STORE_ID.eq(STORE.ID)) - .leftJoin(BUSINESS_STAFF).on(BUSINESS_STAFF.ID.eq(BUSINESS_DETAIL.BUSINESS_STAFF_ID)) - .leftJoin(STAFF).on(STAFF.ID.eq(BUSINESS_STAFF.STAFF_ID)) - //品牌或校区名模糊查询 - .and(BRAND.BRAND_NAME.like(bo.getBrandOrStore()).or(STORE.STORE_NAME.like(bo.getBrandOrStore()))) - //校区地址或校区名模糊查询 - .and(STORE_LICENSE.LICENSE_NAME.like(bo.getAddrOrName()).or(STORE_LICENSE.LICENSE_ADDR.like(bo.getAddrOrName()))) - //未签约-非测试 - .and(STORE.IS_TEST.eq(false)) - .and(STORE.HAVE_ACTIVE.eq(false)) - .and(BUSINESS_DETAIL.DETAIL_STATUS.eq(bo.getDetailStatus())) - .orderBy(BUSINESS_DETAIL.CREATE_TIME.asc()), - BusinessInfoPageVo.class); - + return getButtJoint(bo); } /** @@ -382,18 +294,7 @@ public class BusinessServiceImpl extends ServiceImpl i .where(BUSINESS_STAFF.BUSINESS_ID.eq(businessDetail.getBusinessId())) .and(BUSINESS_STAFF.STAFF_ID.eq(loginUserInfo.getString("id"))) .update(); - //机构签约 - if (business.getBusinessType()== 1){ - //校区自动延期一年 - StoreSignService storeSignService = SpringUtils.getBean(StoreSignService.class); - StoreSign storeSign = storeSignService.getOne(QueryWrapper.create().where(STORE_SIGN.STORE_ID.eq(bo.getStoreId()))); - if (storeSign == null) { - storeSign = new StoreSign(); - storeSign.setStoreId(bo.getStoreId()); - storeSign.setSignStaffId(loginUserInfo.getString("id")); - storeSignService.save(storeSign); - } - } + } } @@ -454,4 +355,51 @@ public class BusinessServiceImpl extends ServiceImpl i .and(BUSINESS_STAFF.STAFF_ID.eq(loginUserInfo.getString("id"))), PersonBusinessInfoVo.class); } + + /** + * 查询未签约校区分页列表 + * @author DB + * @since 2024/1/22 + * @param params 请求参数 + * @return Page + */ + @Override + public Page getUnSignStorePage(String params) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.pageAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()), + QueryWrapper.create() + .select(STORE.ID, STORE.STORE_NAME, STORE.PERSON_CHARGE, STORE.PHONE, STORE.BRAND_ID) + .select(BRAND.BRAND_NAME) + .select(STORE_LICENSE.LICENSE_PIC_URL) + .select(BRAND_EXTEND.BRAND_CLOUD_ID) + .select(STORE_EXTEND.STORE_CLOUD_ID) + .from(STORE) + .leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID)) + .leftJoin(STORE_LICENSE).on(STORE_LICENSE.STORE_ID.eq(STORE.ID)) + .leftJoin(BRAND_EXTEND).on(BRAND_EXTEND.BRAND_ID.eq(BRAND.ID)) + .leftJoin(STORE_EXTEND).on(STORE_EXTEND.STORE_ID.eq(STORE.ID)) + .leftJoin(STORE_SIGN).on(STORE_SIGN.ID.eq(STORE.SIGN_ID)) + .where(STORE.SIGN_ID.isNull()) + .and(STORE.STORE_NAME.like(params) + .or(STORE.PERSON_CHARGE.like(params) + .or(STORE.PHONE.eq(params)))) + .orderBy(STORE.CREATE_TIME.desc()), + BusinessUnSignPageVo.class); + } + + /** + * 校区签约 + * @author DB + * @since 2024/1/22 + * @param id 主键 + */ + @Override + public void storeSign(String id) { + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); + StoreSign storeSign = new StoreSign(); + storeSign.setStoreId(id); + storeSign.setSignStaffId(loginUserInfo.getString("id")); + StoreSignService storeSignService = SpringUtils.getBean(StoreSignService.class); + storeSignService.save(storeSign); + } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java index e3095f1..ca79032 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java @@ -353,27 +353,34 @@ public class TaskServiceImpl extends ServiceImpl implements Ta .where(STAFF.ID.eq(staffId))); //对比当前员工是否是测试管理员 if (!Arrays.asList(testStaffPhones.split(",")).contains(staff.getString("phoneNumber"))) { - queryWrapper.and(TASK.TASK_STATUS.in(2, 3)) + queryWrapper.and(TASK.TASK_STATUS.in(2, 3, 8, 9)) .and(TASK_STAFF_GROUP.STAFF_ID.eq(staffId)); } else { //测试人员 - queryWrapper.and(TASK.TASK_STATUS.eq(3)) + queryWrapper.and(TASK.TASK_STATUS.in(3, 8, 9)) .groupBy(TASK.ID); } } else { JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); //对比当前员工是否是测试管理员 if (!Arrays.asList(testStaffPhones.split(",")).contains(loginUserInfo.getString("phoneNumber"))) { - queryWrapper.and(TASK.TASK_STATUS.in(2, 3)) + queryWrapper.and(TASK.TASK_STATUS.in(2, 3, 8, 9)) .and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))); } else { //测试人员 - queryWrapper.and(TASK.TASK_STATUS.eq(3)) + queryWrapper.and(TASK.TASK_STATUS.in(3, 8, 9)) .groupBy(TASK.ID); } } if (startDate != null && endDate != null) { queryWrapper.and(dateFormat(TASK.TASK_RECEIPT_TIME, "%Y-%m-%d").between(startDate, endDate)); + } else { + LocalDate date = LocalDate.now(); + // 获取当前月的第一天 + LocalDate firstDay = date.with(TemporalAdjusters.firstDayOfMonth()); + // 获取当前月的最后一天 + LocalDate lastDay = date.with(TemporalAdjusters.lastDayOfMonth()); + queryWrapper.and(dateFormat(TASK.TASK_RECEIPT_TIME, "%Y-%m-%d").between(firstDay, lastDay)); } return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), @@ -791,7 +798,7 @@ public class TaskServiceImpl extends ServiceImpl implements Ta JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); queryWrapper.and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))); } - if (startDate!=null && endDate!=null){ + if (startDate != null && endDate != null) { queryWrapper.and(dateFormat(TASK.TASK_RECEIPT_TIME, "%Y-%m-%d").between(startDate, endDate)); } else { LocalDate now = LocalDate.now(); diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BusinessUnSignPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BusinessUnSignPageVo.java new file mode 100644 index 0000000..28df8ff --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BusinessUnSignPageVo.java @@ -0,0 +1,71 @@ +package com.cpop.oam.business.vo; + +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-22 13:47 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "校区/店铺未签约分页返回对象") +public class BusinessUnSignPageVo { + + /** + * 校区id + */ + @ApiModelProperty(value = "校区id") + private String id; + + /** + * 校区名 + */ + @ApiModelProperty(value = "校区名") + private String storeName; + + /** + * 负责人 + */ + @ApiModelProperty(value = "负责人") + private String personCharge; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + private String phone; + + /** + * 营业执照地址 + */ + @ApiModelProperty(value = "营业执照地址") + private String licensePicUrl; + + /** + * 云校区id + */ + @ApiModelProperty(value = "云校区id") + private String storeCloudId; + + /** + * 品牌id + */ + @ApiModelProperty(value = "品牌id") + private String brandId; + + /** + * 云品牌id + */ + @ApiModelProperty(value = "云品牌id") + private String brandCloudId; + + /** + * 品牌名 + */ + @ApiModelProperty(value = "品牌名") + private String brandName; +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java index 7499213..348eccb 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java @@ -92,6 +92,11 @@ public class Store extends BaseEntity implements Serializable { */ private String latitude; + /** + * 签约id + */ + private String signId; + /** * 逻辑删除(0否1是) */ diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/StoreService.java b/Cpop-System/src/main/java/com/cpop/system/business/service/StoreService.java index 9da5be5..9e14f5a 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/StoreService.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/StoreService.java @@ -39,4 +39,5 @@ public interface StoreService extends IService { * @param bo 请求参数 */ void updateStore(StoreBo bo); + }