From f1fbbcf36d863934c8b02868b05b2254752ce50c Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Wed, 24 May 2023 14:10:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/buy/TopUpOrderController.java | 9 +- .../recharge/AppPhoneRecordController.java | 40 ++++++++ .../AppRefundFeeRecordController.java | 93 +++++++++++++++++++ .../app/recharge/vo/PhoneRecordRespVO.java | 24 +++++ .../order/impl/StoreOrderServiceImpl.java | 26 +++++- .../service/recharge/PhoneRecordService.java | 37 ++++++++ .../recharge/PhoneRecordServiceImpl.java | 44 +++++++++ .../service/recharge/RechargeGearService.java | 2 +- .../recharge/RechargeOrderServiceImpl.java | 33 +++---- .../recharge/RefundFeeRecordService.java | 1 + .../service/promoter/PromoterServiceImpl.java | 2 +- .../src/main/resources/application-local.yaml | 3 + 12 files changed, 286 insertions(+), 28 deletions(-) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordRespVO.java diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/buy/TopUpOrderController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/buy/TopUpOrderController.java index 4b944f022..a4661de4f 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/buy/TopUpOrderController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/buy/TopUpOrderController.java @@ -39,14 +39,7 @@ public class TopUpOrderController { log.info("initOrder会员充值===>{}", request); return CommonResult.success(storeOrderService.memberTopUp(request, servletRequest)); } - @TenantIgnore - @PreAuthenticated - @Operation(summary = "退款") - @RequestMapping(value = "/memberRefund", method = RequestMethod.POST) - public CommonResult memberRefund(@Valid @RequestBody RefundRequest request, HttpServletRequest servletRequest) throws Exception { - log.info("memberRefund会员退款===>{}", request); - return CommonResult.success(storeOrderService.memberRefund(request, servletRequest)); - } + @TenantIgnore @PreAuthenticated @Operation(summary = "申请退款") diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java new file mode 100644 index 000000000..021fe9fdd --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.shop.controller.app.recharge; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.convert.recharge.PhoneRecordConvert; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO; +import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "用户APP - 充值档位记录") +@RestController +@RequestMapping("/shop/phone-record") +@Validated +public class AppPhoneRecordController { + + @Resource + private PhoneRecordService phoneRecordService; + + + + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java new file mode 100644 index 000000000..2aef5212e --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java @@ -0,0 +1,93 @@ +package cn.iocoder.yudao.module.shop.controller.app.recharge; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.http.HttpUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.member.api.user.MemberUserApi; +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.convert.recharge.RefundFeeRecordConvert; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RefundFeeRecordDO; +import cn.iocoder.yudao.module.shop.service.recharge.RefundFeeRecordService; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "用户APP - 权益充值返费记录") +@RestController +@RequestMapping("/shop/refund-fee-record") +@Validated +public class AppRefundFeeRecordController { + + @Resource + private MemberUserApi memberUserApi; + @Value("${phone.query-url}") + private String phoneUrl; + + @Value("${phone.token}") + private String token; + + + @GetMapping("/query") + @Operation(summary = "查询档位信息") + public CommonResult query(@RequestParam String phone) { + if(StrUtil.isBlank(phone)){ + MemberUserRespDTO memberUserRespDTO = memberUserApi.getUser(SecurityFrameworkUtils.getLoginUserId()); + phone = memberUserRespDTO.getMobile(); + } + JSONObject param = new JSONObject(); + param.put("phone",phone); + String result = HttpRequest.post(phoneUrl+"query/info") + .header("token",token) + .body(JSONObject.toJSONString(param)) + .execute() + .body(); + JSONObject resultJson = JSONObject.parseObject(result); + if("0000".equals(resultJson.get("code"))){ + return success(resultJson.getJSONArray("body")); + } + return success(null); + } + @GetMapping("/query-item") + @Operation(summary = "查询档位返费信息") + public CommonResult queryItem(@RequestParam String reportId) { + if(StrUtil.isBlank(reportId)){ + throw new ServiceException("reportId不能为空"); + } + JSONObject param = new JSONObject(); + param.put("reportId",reportId); + String result = HttpRequest.post(phoneUrl+"query/item") + .header("token",token) + .body(JSONObject.toJSONString(param)) + .execute() + .body(); + JSONObject resultJson = JSONObject.parseObject(result); + if("0000".equals(resultJson.get("code"))){ + return success(resultJson.getJSONArray("body")); + } + return success(null); + } +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordRespVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordRespVO.java new file mode 100644 index 000000000..a2707f976 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordRespVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.shop.controller.app.recharge.vo; + +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.PhoneRecordBaseVO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; + +@Schema(description = "用户APP - 充值档位记录 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PhoneRecordRespVO extends PhoneRecordBaseVO { + + @Schema(description = "主键", required = true, example = "24509") + private Long id; + + @Schema(description = "创建时间", required = true) + private LocalDateTime createTime; + + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index 10cb26d90..dd6d60daa 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -22,9 +22,11 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearExportReqVO; import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO; import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper; @@ -44,6 +46,8 @@ import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderRefundService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderStatusService; +import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService; +import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService; import cn.iocoder.yudao.module.shop.support.StrategySupport; import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy; import cn.iocoder.yudao.module.shop.utils.CommonPage; @@ -148,9 +152,15 @@ public class StoreOrderServiceImpl extends ServiceImpl infoDOS = new ArrayList<>(); @@ -1415,11 +1425,23 @@ public class StoreOrderServiceImpl extends ServiceImpl orderInfos = request.getOrderInfos(); Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!"); + + //先查询提报总表 List collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList()); + List rechargeGearDOList = rechargeGearService.getRechargeGearList(collect); + rechargeGearDOList.forEach(rechargeGearDO->{ + Boolean flag = phoneRecordService.verifyPhone(request.getConfirmPhone(),rechargeGearDO.getRefundAmount().intValue()+""); + if (flag) { + throw new ServiceException("该挡位:" + rechargeGearDO.getName() + "你已购买,请勿重复操作"); + } + }); + List infoDOS = phoneRecordMapper.selectList(Wrappers.lambdaQuery() .eq(PhoneRecordDO::getUserId, user.getId()) .in(PhoneRecordDO::getRechargeGearId, collect)); + if (!CollectionUtils.isEmpty(infoDOS)) { + Map> collect1 = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId)); orderInfos.forEach(info -> { if (!CollectionUtils.isEmpty(collect1.get(info.getGearId()))) { diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordService.java index 645468ea2..485037bb7 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordService.java @@ -67,4 +67,41 @@ public interface PhoneRecordService { */ List getPhoneRecordList(PhoneRecordExportReqVO exportReqVO); + /** + *
+    * verifyPhone
+    * Description:验证手机号档位是否充值
+    * @author: zenghuapei
+    * @date: 2023/5/24 11:44
+    * @param phone:
+     * @param gear:
+    * @return
+    * 
+ */ + Boolean verifyPhone(String phone,String gear); + /** + *
+    * deletePhoneGear
+    * Description:删除档位信息
+    * @author: zenghuapei
+    * @date: 2023/5/24 12:44
+    * @param phone:
+     * @param gear:
+    * @return
+    * 
+ */ + Boolean deletePhoneGear(String phone, String gear); + /** + *
+    * insertPhone
+    * Description:新增档位信息
+    * @author: zenghuapei
+    * @date: 2023/5/24 12:45
+    * @param phone:
+     * @param gear:
+    * @return
+    * 
+ */ + Boolean insertPhone(String phone, String gear); + } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java index e20b2ba97..8295e57d3 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java @@ -1,6 +1,14 @@ package cn.iocoder.yudao.module.shop.service.recharge; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.member.api.user.MemberUserApi; +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -14,6 +22,7 @@ import cn.iocoder.yudao.module.shop.convert.recharge.PhoneRecordConvert; import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*; /** @@ -27,6 +36,13 @@ public class PhoneRecordServiceImpl implements PhoneRecordService { @Resource private PhoneRecordMapper phoneRecordMapper; + @Resource + private MemberUserApi memberUserApi; + @Value("${phone.query-url}") + private String phoneUrl; + + @Value("${phone.token}") + private String token; @Override public Long createPhoneRecord(PhoneRecordCreateReqVO createReqVO) { @@ -82,4 +98,32 @@ public class PhoneRecordServiceImpl implements PhoneRecordService { return phoneRecordMapper.selectList(exportReqVO); } + /** + *
+     * verifyPhone
+     * Description:验证手机号档位是否充值
+     * @author: zenghuapei
+     * @date: 2023/5/24 11:44
+     * @param phone :
+     * @param gear :
+     * @return
+     * 
+ */ + @Override + public Boolean verifyPhone(String phone, String gear) { + JSONObject param = new JSONObject(); + param.put("phone",phone); + param.put("gear",gear); + String result = HttpRequest.post(phoneUrl+"query/verify") + .header("token",token) + .body(JSONObject.toJSONString(param)) + .execute() + .body(); + JSONObject resultJson = JSONObject.parseObject(result); + if("0000".equals(resultJson.get("code"))){ + return resultJson.getBoolean("body"); + }else{ + throw new ServiceException("手机号档位验证失败"); + } + } } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java index 7a05e26cf..d82bdc315 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java @@ -49,7 +49,7 @@ public interface RechargeGearService { * @param ids 编号 * @return 充值档位列表 */ - List getRechargeGearList(Collection ids); + List getRechargeGearList(List ids); /** * 获得充值档位分页 diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java index dc0ab8d08..50a96210e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java @@ -148,22 +148,23 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { public MemberHeadResponse memberHeadInfo() { MemberHeadResponse response = new MemberHeadResponse(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - Assert.notNull(loginUser, "登录失效,请重新登录!"); - List orderDOS = rechargeOrderMapper.selectList(Wrappers.lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId())); - if (!CollectionUtils.isEmpty(orderDOS)) { - BigDecimal amount = new BigDecimal("0"); - for (RechargeOrderDO orderDO : orderDOS) { - amount = amount.add(orderDO.getPayPrice()); - } - if (amount.compareTo(new BigDecimal("640")) < 0) { - response.setGrade("普通会员"); - response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "640"); - } else if (amount.compareTo(new BigDecimal("640")) >= 0) { - response.setGrade("高级会员"); - response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "1040"); - } else { - response.setGrade("中级会员"); - response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "1040"); + if(loginUser!=null){ + List orderDOS = rechargeOrderMapper.selectList(Wrappers.lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId())); + if (!CollectionUtils.isEmpty(orderDOS)) { + BigDecimal amount = new BigDecimal("0"); + for (RechargeOrderDO orderDO : orderDOS) { + amount = amount.add(orderDO.getPayPrice()); + } + if (amount.compareTo(new BigDecimal("640")) < 0) { + response.setGrade("普通会员"); + response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "640"); + } else if (amount.compareTo(new BigDecimal("640")) >= 0) { + response.setGrade("高级会员"); + response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "1040"); + } else { + response.setGrade("中级会员"); + response.setIntegral(amount.stripTrailingZeros().toPlainString() + "/" + "1040"); + } } } return response; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RefundFeeRecordService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RefundFeeRecordService.java index 32a2fb217..f97de6a68 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RefundFeeRecordService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RefundFeeRecordService.java @@ -67,4 +67,5 @@ public interface RefundFeeRecordService { */ List getRefundFeeRecordList(RefundFeeRecordExportReqVO exportReqVO); + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java index d80564ea5..a0b8708ec 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java @@ -197,7 +197,7 @@ public class PromoterServiceImpl implements PromoterService { memberUserDO.setNickname(importUser.getNickName()); memberUserDO.setMobile(importUser.getMobile()); memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length() - 6)); - memberUserDO.setStatus(1); + memberUserDO.setStatus(0); memberUserService.createUserIfAbsent(importUser.getMobile(), importUser.getNickName(), getClientIP()); } // 插入 diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 175b1c047..577224347 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -254,3 +254,6 @@ justauth: prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 +phone: + query-url: http://192.168.1.189:4006/cyywl-phone-query-api/ + token: eyIwLnR5cCI6IkpXVCIsImFsZyI6IkhTNTEyIn0 \ No newline at end of file From 749e4b74591231b16b14d46b628cb08bdcc33ef2 Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Wed, 24 May 2023 16:02:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8F=90=E6=8A=A5=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/notify/WxPayNotifyController.java | 5 ++ .../recharge/RechargeGearController.java | 2 +- .../recharge/AppPhoneRecordController.java | 39 ++++++++++++++ .../AppRefundFeeRecordController.java | 4 ++ .../app/recharge/vo/PhoneRecordAdd.java | 17 ++++++ .../order/impl/StoreOrderServiceImpl.java | 25 +++++++++ .../service/recharge/PhoneRecordService.java | 9 ++-- .../recharge/PhoneRecordServiceImpl.java | 53 +++++++++++++++++++ .../recharge/RechargeGearServiceImpl.java | 2 +- 9 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordAdd.java diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java index 228301741..3f665e32b 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java @@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; +import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.binarywang.wxpay.bean.notify.OriginNotifyResponse; import com.github.binarywang.wxpay.bean.notify.SignatureHeader; @@ -46,6 +47,8 @@ public class WxPayNotifyController { @Autowired private RechargeOrderMapper rechargeOrderMapper; + private PhoneRecordService phoneRecordService; + /** * Description: 微信支付回调接口 @@ -138,6 +141,8 @@ public class WxPayNotifyController { orderDO.setRefundStatus(2); orderDO.setPaid(2); rechargeOrderMapper.updateById(orderDO); + //删除提报记录 + phoneRecordService.deletePhoneGear(orderDO.getOrderId()); // 修改订单状态 // 写入 response.setStatus(HttpServletResponse.SC_OK); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java index e463aaf1b..edf221e1a 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java @@ -74,7 +74,7 @@ public class RechargeGearController { @Operation(summary = "获得充值档位列表") @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") @PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')") - public CommonResult> getRechargeGearList(@RequestParam("ids") Collection ids) { + public CommonResult> getRechargeGearList(@RequestParam("ids") List ids) { List list = rechargeGearService.getRechargeGearList(ids); return success(RechargeGearConvert.INSTANCE.convertList(list)); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java index 021fe9fdd..8b223f46d 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppPhoneRecordController.java @@ -1,16 +1,21 @@ package cn.iocoder.yudao.module.shop.controller.app.recharge; +import cn.hutool.http.HttpRequest; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd; import cn.iocoder.yudao.module.shop.convert.recharge.PhoneRecordConvert; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO; import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService; +import com.alibaba.fastjson.JSONObject; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -29,12 +34,46 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E @RestController @RequestMapping("/shop/phone-record") @Validated +@Slf4j public class AppPhoneRecordController { @Resource private PhoneRecordService phoneRecordService; + @Value("${phone.query-url}") + private String phoneUrl; + + @Value("${phone.token}") + private String token; + @PostMapping("test") + public CommonResult test(@RequestBody List data){ + String result = HttpRequest.post(phoneUrl+"query/createReport") + .header("token",token) + .body(JSONObject.toJSONString(data)) + .execute() + .body(); + JSONObject resultJson = JSONObject.parseObject(result); + log.info("提报新增返回结果{}",JSONObject.toJSONString(resultJson)); + if("0000".equals(resultJson.get("code"))){ + return success(null); + } + return success(null); + } + @PostMapping("delete") + public CommonResult delete(@RequestBody List data){ + String result = HttpRequest.post(phoneUrl+"query/deleteReport") + .header("token",token) + .body(JSONObject.toJSONString(data)) + .execute() + .body(); + JSONObject resultJson = JSONObject.parseObject(result); + log.info("提报新增返回结果{}",JSONObject.toJSONString(resultJson)); + if("0000".equals(resultJson.get("code"))){ + return success(null); + } + return success(null); + } } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java index 2aef5212e..c3ad9e0c8 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/AppRefundFeeRecordController.java @@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -40,6 +41,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E @RestController @RequestMapping("/shop/refund-fee-record") @Validated +@Slf4j public class AppRefundFeeRecordController { @Resource @@ -66,6 +68,7 @@ public class AppRefundFeeRecordController { .execute() .body(); JSONObject resultJson = JSONObject.parseObject(result); + log.info("查询会员档次{}",resultJson); if("0000".equals(resultJson.get("code"))){ return success(resultJson.getJSONArray("body")); } @@ -85,6 +88,7 @@ public class AppRefundFeeRecordController { .execute() .body(); JSONObject resultJson = JSONObject.parseObject(result); + log.info("查询档位返费信息{}",resultJson); if("0000".equals(resultJson.get("code"))){ return success(resultJson.getJSONArray("body")); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordAdd.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordAdd.java new file mode 100644 index 000000000..a1f9f5a7e --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/recharge/vo/PhoneRecordAdd.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.shop.controller.app.recharge.vo; + + +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class PhoneRecordAdd { + private String phone; + private BigDecimal money; + private String gear; + private String orderTime; + private String channel; + private String orderNo; +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index dd6d60daa..7c7cba6a7 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearExportReqVO; +import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd; import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO; @@ -1219,6 +1220,13 @@ public class StoreOrderServiceImpl extends ServiceImpl infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderId)); List recordDOS = new ArrayList<>(); + List phoneRecordAdds = new ArrayList<>(); + DeptRespDTO deptRespDTO = deptApi.getDept(orderDO.getDeptId()); infoDOS.forEach(info -> { + Long rechargeGearId = info.getRechargeGearId(); + RechargeGearDO rechargeGearDO = rechargeGearService.getRechargeGear(rechargeGearId.toString()); PhoneRecordDO phoneRecordDO = new PhoneRecordDO(); + PhoneRecordAdd phoneRecordAdd = new PhoneRecordAdd(); phoneRecordDO.setUserId(Long.valueOf(orderDO.getUid())); phoneRecordDO.setRechargeOrderId(Long.valueOf(orderDO.getId())); phoneRecordDO.setPhone(orderDO.getUserPhone()); @@ -1257,9 +1270,21 @@ public class StoreOrderServiceImpl extends ServiceImplDescription:删除档位信息 * @author: zenghuapei * @date: 2023/5/24 12:44 - * @param phone: - * @param gear: * @return * */ - Boolean deletePhoneGear(String phone, String gear); + Boolean deletePhoneGear(String orderId); /** *
     * insertPhone
     * Description:新增档位信息
     * @author: zenghuapei
     * @date: 2023/5/24 12:45
-    * @param phone:
-     * @param gear:
     * @return
     * 
*/ - Boolean insertPhone(String phone, String gear); + Boolean insertPhone(List data); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java index 8295e57d3..984000c4e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/PhoneRecordServiceImpl.java @@ -6,8 +6,10 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; +import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -32,6 +34,7 @@ import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*; */ @Service @Validated +@Slf4j public class PhoneRecordServiceImpl implements PhoneRecordService { @Resource @@ -126,4 +129,54 @@ public class PhoneRecordServiceImpl implements PhoneRecordService { throw new ServiceException("手机号档位验证失败"); } } + + /** + *
+     * deletePhoneGear
+     * Description:删除档位信息
+     * @author: zenghuapei
+     * @date: 2023/5/24 12:44
+     * @return
+     * 
+ */ + @Override + public Boolean deletePhoneGear(String orderId) { + String result = HttpRequest.post(phoneUrl+"query/deleteReport") + .header("token",token) + .body(JSONObject.toJSONString(orderId)) + .execute() + .body(); + JSONObject resultJson = JSONObject.parseObject(result); + log.info("删除提报{}",JSONObject.toJSONString(resultJson)); + if("0000".equals(resultJson.get("code"))){ + return true; + } + return false; + } + + /** + *
+     * insertPhone
+     * Description:新增档位信息
+     * @author: zenghuapei
+     * @date: 2023/5/24 12:45
+     * @return
+     * 
+ * + * @param data + */ + @Override + public Boolean insertPhone(List data) { + String result = HttpRequest.post(phoneUrl+"query/createReport") + .header("token",token) + .body(JSONObject.toJSONString(data)) + .execute() + .body(); + JSONObject resultJson = JSONObject.parseObject(result); + log.info("提报新增返回结果{}",JSONObject.toJSONString(resultJson)); + if("0000".equals(resultJson.get("code"))){ + return true; + } + return false; + } } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java index 9e53955f4..5821a7322 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java @@ -87,7 +87,7 @@ public class RechargeGearServiceImpl implements RechargeGearService { } @Override - public List getRechargeGearList(Collection ids) { + public List getRechargeGearList(List ids) { return rechargeGearMapper.selectBatchIds(ids); }