Merge branch 'feature/mall_product' of http://117.33.142.185:3000/zenghuapei/cyywl_server into feature/mall_product

pull/2/head
TianYu 2023-05-24 16:04:19 +08:00
commit 87b0d7353a
15 changed files with 411 additions and 14 deletions

View File

@ -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.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper; 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.order.StoreOrderService;
import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.binarywang.wxpay.bean.notify.OriginNotifyResponse; import com.github.binarywang.wxpay.bean.notify.OriginNotifyResponse;
import com.github.binarywang.wxpay.bean.notify.SignatureHeader; import com.github.binarywang.wxpay.bean.notify.SignatureHeader;
@ -46,6 +47,8 @@ public class WxPayNotifyController {
@Autowired @Autowired
private RechargeOrderMapper rechargeOrderMapper; private RechargeOrderMapper rechargeOrderMapper;
private PhoneRecordService phoneRecordService;
/** /**
* Description: * Description:
@ -138,6 +141,8 @@ public class WxPayNotifyController {
orderDO.setRefundStatus(2); orderDO.setRefundStatus(2);
orderDO.setPaid(2); orderDO.setPaid(2);
rechargeOrderMapper.updateById(orderDO); rechargeOrderMapper.updateById(orderDO);
//删除提报记录
phoneRecordService.deletePhoneGear(orderDO.getOrderId());
// 修改订单状态 // 修改订单状态
// 写入 // 写入
response.setStatus(HttpServletResponse.SC_OK); response.setStatus(HttpServletResponse.SC_OK);

View File

@ -74,7 +74,7 @@ public class RechargeGearController {
@Operation(summary = "获得充值档位列表") @Operation(summary = "获得充值档位列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')") @PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')")
public CommonResult<List<RechargeGearRespVO>> getRechargeGearList(@RequestParam("ids") Collection<String> ids) { public CommonResult<List<RechargeGearRespVO>> getRechargeGearList(@RequestParam("ids") List<Long> ids) {
List<RechargeGearDO> list = rechargeGearService.getRechargeGearList(ids); List<RechargeGearDO> list = rechargeGearService.getRechargeGearList(ids);
return success(RechargeGearConvert.INSTANCE.convertList(list)); return success(RechargeGearConvert.INSTANCE.convertList(list));
} }

View File

@ -39,14 +39,7 @@ public class TopUpOrderController {
log.info("initOrder会员充值===>{}", request); log.info("initOrder会员充值===>{}", request);
return CommonResult.success(storeOrderService.memberTopUp(request, servletRequest)); return CommonResult.success(storeOrderService.memberTopUp(request, servletRequest));
} }
@TenantIgnore
@PreAuthenticated
@Operation(summary = "退款")
@RequestMapping(value = "/memberRefund", method = RequestMethod.POST)
public CommonResult<Object> memberRefund(@Valid @RequestBody RefundRequest request, HttpServletRequest servletRequest) throws Exception {
log.info("memberRefund会员退款===>{}", request);
return CommonResult.success(storeOrderService.memberRefund(request, servletRequest));
}
@TenantIgnore @TenantIgnore
@PreAuthenticated @PreAuthenticated
@Operation(summary = "申请退款") @Operation(summary = "申请退款")

View File

@ -0,0 +1,79 @@
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.*;
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
@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<Boolean> test(@RequestBody List<PhoneRecordAdd> 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<Boolean> delete(@RequestBody List<PhoneRecordAdd> 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);
}
}

View File

@ -0,0 +1,97 @@
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 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.*;
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
@Slf4j
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<JSONArray> 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);
log.info("查询会员档次{}",resultJson);
if("0000".equals(resultJson.get("code"))){
return success(resultJson.getJSONArray("body"));
}
return success(null);
}
@GetMapping("/query-item")
@Operation(summary = "查询档位返费信息")
public CommonResult<JSONArray> 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);
log.info("查询档位返费信息{}",resultJson);
if("0000".equals(resultJson.get("code"))){
return success(resultJson.getJSONArray("body"));
}
return success(null);
}
}

View File

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

View File

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

View File

@ -22,9 +22,12 @@ 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.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; 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.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.express.ExpressDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; 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.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.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper; import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
@ -44,6 +47,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.StoreOrderRefundService;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; 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.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.StrategySupport;
import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy; import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy;
import cn.iocoder.yudao.module.shop.utils.CommonPage; import cn.iocoder.yudao.module.shop.utils.CommonPage;
@ -148,9 +153,15 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
@Autowired @Autowired
private WxMpService wxMpService; private WxMpService wxMpService;
@Autowired
private DeptApi deptApi; private DeptApi deptApi;
@Resource
private PhoneRecordService phoneRecordService;
@Resource
private RechargeGearService rechargeGearService;
/** /**
* PC * PC
* *
@ -1209,6 +1220,13 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
amount = params.get("refund_fee"); amount = params.get("refund_fee");
orderDO.setPaid(2); orderDO.setPaid(2);
orderDO.setRefundStatus(2); orderDO.setRefundStatus(2);
//删除提报记录
try {
phoneRecordService.deletePhoneGear(orderDO.getOrderId());
}catch (Exception e) {
log.error("删除提报记录异常{}",e);
}
// 表示退款 // 表示退款
} else { } else {
// 表示支付 // 表示支付
@ -1236,8 +1254,13 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
public void addPhoneRecord(RechargeOrderDO orderDO, String orderId) { public void addPhoneRecord(RechargeOrderDO orderDO, String orderId) {
List<RechargeOrderInfoDO> infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderId)); List<RechargeOrderInfoDO> infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderId));
List<PhoneRecordDO> recordDOS = new ArrayList<>(); List<PhoneRecordDO> recordDOS = new ArrayList<>();
List<PhoneRecordAdd> phoneRecordAdds = new ArrayList<>();
DeptRespDTO deptRespDTO = deptApi.getDept(orderDO.getDeptId());
infoDOS.forEach(info -> { infoDOS.forEach(info -> {
Long rechargeGearId = info.getRechargeGearId();
RechargeGearDO rechargeGearDO = rechargeGearService.getRechargeGear(rechargeGearId.toString());
PhoneRecordDO phoneRecordDO = new PhoneRecordDO(); PhoneRecordDO phoneRecordDO = new PhoneRecordDO();
PhoneRecordAdd phoneRecordAdd = new PhoneRecordAdd();
phoneRecordDO.setUserId(Long.valueOf(orderDO.getUid())); phoneRecordDO.setUserId(Long.valueOf(orderDO.getUid()));
phoneRecordDO.setRechargeOrderId(Long.valueOf(orderDO.getId())); phoneRecordDO.setRechargeOrderId(Long.valueOf(orderDO.getId()));
phoneRecordDO.setPhone(orderDO.getUserPhone()); phoneRecordDO.setPhone(orderDO.getUserPhone());
@ -1247,9 +1270,21 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
LocalDateTime newLocalDateTime = LocalDateTimeUtil.offset(localDateTime,12, ChronoUnit.MONTHS); LocalDateTime newLocalDateTime = LocalDateTimeUtil.offset(localDateTime,12, ChronoUnit.MONTHS);
phoneRecordDO.setRefundFeeEndDate(newLocalDateTime); phoneRecordDO.setRefundFeeEndDate(newLocalDateTime);
phoneRecordDO.setRefundFeeNumber(12); phoneRecordDO.setRefundFeeNumber(12);
phoneRecordAdd.setChannel(deptRespDTO.getParentOrganizationName());
phoneRecordAdd.setPhone(phoneRecordDO.getPhone());
phoneRecordAdd.setMoney(info.getPrice());
phoneRecordAdd.setOrderNo(orderDO.getOrderId());
phoneRecordAdd.setOrderTime(LocalDateTimeUtil.formatNormal(orderDO.getPayTime().toLocalDate()));
phoneRecordAdd.setGear(rechargeGearDO.getRefundAmount().toString());
phoneRecordAdds.add(phoneRecordAdd);
recordDOS.add(phoneRecordDO); recordDOS.add(phoneRecordDO);
}); });
phoneRecordMapper.insertBatch(recordDOS); phoneRecordMapper.insertBatch(recordDOS);
try {
phoneRecordService.insertPhone(phoneRecordAdds);
}catch (Exception e){
log.info("调取提报新增报错{}",e);
}
} }
public BigDecimal replace(BigDecimal amount) { public BigDecimal replace(BigDecimal amount) {
@ -1389,7 +1424,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
orderDO.setProTotalPrice(sum); orderDO.setProTotalPrice(sum);
orderDO.setBeforePayPrice(sum); orderDO.setBeforePayPrice(sum);
orderDO.setPromoterId(user.getPromoterId()); orderDO.setPromoterId(user.getPromoterId());
orderDO.setDeptId(promoterDTO.getDeptId()); orderDO.setDeptId(deptId);
orderDO.setTenantId(tenantId); orderDO.setTenantId(tenantId);
rechargeOrderMapper.insert(orderDO); rechargeOrderMapper.insert(orderDO);
List<RechargeOrderInfoDO> infoDOS = new ArrayList<>(); List<RechargeOrderInfoDO> infoDOS = new ArrayList<>();
@ -1415,11 +1450,23 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
private void orderCheck(OrderContentRequest request, MemberUserRespDTO user) { private void orderCheck(OrderContentRequest request, MemberUserRespDTO user) {
List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos(); List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos();
Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!"); Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!");
//先查询提报总表
List<Long> collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList()); List<Long> collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList());
List<RechargeGearDO> rechargeGearDOList = rechargeGearService.getRechargeGearList(collect);
rechargeGearDOList.forEach(rechargeGearDO->{
Boolean flag = phoneRecordService.verifyPhone(request.getConfirmPhone(),rechargeGearDO.getRefundAmount().intValue()+"");
if (flag) {
throw new ServiceException("该挡位:" + rechargeGearDO.getName() + "你已购买,请勿重复操作");
}
});
List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery() List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery()
.eq(PhoneRecordDO::getUserId, user.getId()) .eq(PhoneRecordDO::getUserId, user.getId())
.in(PhoneRecordDO::getRechargeGearId, collect)); .in(PhoneRecordDO::getRechargeGearId, collect));
if (!CollectionUtils.isEmpty(infoDOS)) { if (!CollectionUtils.isEmpty(infoDOS)) {
Map<Long, List<PhoneRecordDO>> collect1 = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId)); Map<Long, List<PhoneRecordDO>> collect1 = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId));
orderInfos.forEach(info -> { orderInfos.forEach(info -> {
if (!CollectionUtils.isEmpty(collect1.get(info.getGearId()))) { if (!CollectionUtils.isEmpty(collect1.get(info.getGearId()))) {

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.shop.service.recharge;
import java.util.*; import java.util.*;
import javax.validation.*; import javax.validation.*;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; 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.dal.dataobject.recharge.PhoneRecordDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -67,4 +68,37 @@ public interface PhoneRecordService {
*/ */
List<PhoneRecordDO> getPhoneRecordList(PhoneRecordExportReqVO exportReqVO); List<PhoneRecordDO> getPhoneRecordList(PhoneRecordExportReqVO exportReqVO);
/**
* <pre>
* <b>verifyPhone</b>
* <b>Description:</b>
* <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 11:44
* @param phone:
* @param gear:
* @return
* </pre>
*/
Boolean verifyPhone(String phone,String gear);
/**
* <pre>
* <b>deletePhoneGear</b>
* <b>Description:</b>
* <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 12:44
* @return
* </pre>
*/
Boolean deletePhoneGear(String orderId);
/**
* <pre>
* <b>insertPhone</b>
* <b>Description:</b>
* <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 12:45
* @return
* </pre>
*/
Boolean insertPhone(List<PhoneRecordAdd> data);
} }

View File

@ -1,6 +1,16 @@
package cn.iocoder.yudao.module.shop.service.recharge; 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 cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -14,6 +24,7 @@ import cn.iocoder.yudao.module.shop.convert.recharge.PhoneRecordConvert;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper; 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.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*;
/** /**
@ -23,10 +34,18 @@ import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*;
*/ */
@Service @Service
@Validated @Validated
@Slf4j
public class PhoneRecordServiceImpl implements PhoneRecordService { public class PhoneRecordServiceImpl implements PhoneRecordService {
@Resource @Resource
private PhoneRecordMapper phoneRecordMapper; private PhoneRecordMapper phoneRecordMapper;
@Resource
private MemberUserApi memberUserApi;
@Value("${phone.query-url}")
private String phoneUrl;
@Value("${phone.token}")
private String token;
@Override @Override
public Long createPhoneRecord(PhoneRecordCreateReqVO createReqVO) { public Long createPhoneRecord(PhoneRecordCreateReqVO createReqVO) {
@ -82,4 +101,82 @@ public class PhoneRecordServiceImpl implements PhoneRecordService {
return phoneRecordMapper.selectList(exportReqVO); return phoneRecordMapper.selectList(exportReqVO);
} }
/**
* <pre>
* <b>verifyPhone</b>
* <b>Description:</b>
* <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 11:44
* @param phone :
* @param gear :
* @return
* </pre>
*/
@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("手机号档位验证失败");
}
}
/**
* <pre>
* <b>deletePhoneGear</b>
* <b>Description:</b>
* <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 12:44
* @return
* </pre>
*/
@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;
}
/**
* <pre>
* <b>insertPhone</b>
* <b>Description:</b>
* <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 12:45
* @return
* </pre>
*
* @param data
*/
@Override
public Boolean insertPhone(List<PhoneRecordAdd> 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;
}
} }

View File

@ -49,7 +49,7 @@ public interface RechargeGearService {
* @param ids * @param ids
* @return * @return
*/ */
List<RechargeGearDO> getRechargeGearList(Collection<String> ids); List<RechargeGearDO> getRechargeGearList(List<Long> ids);
/** /**
* *

View File

@ -87,7 +87,7 @@ public class RechargeGearServiceImpl implements RechargeGearService {
} }
@Override @Override
public List<RechargeGearDO> getRechargeGearList(Collection<String> ids) { public List<RechargeGearDO> getRechargeGearList(List<Long> ids) {
return rechargeGearMapper.selectBatchIds(ids); return rechargeGearMapper.selectBatchIds(ids);
} }

View File

@ -67,4 +67,5 @@ public interface RefundFeeRecordService {
*/ */
List<RefundFeeRecordDO> getRefundFeeRecordList(RefundFeeRecordExportReqVO exportReqVO); List<RefundFeeRecordDO> getRefundFeeRecordList(RefundFeeRecordExportReqVO exportReqVO);
} }

View File

@ -197,7 +197,7 @@ public class PromoterServiceImpl implements PromoterService {
memberUserDO.setNickname(importUser.getNickName()); memberUserDO.setNickname(importUser.getNickName());
memberUserDO.setMobile(importUser.getMobile()); memberUserDO.setMobile(importUser.getMobile());
memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length() - 6)); memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length() - 6));
memberUserDO.setStatus(1); memberUserDO.setStatus(0);
memberUserService.createUserIfAbsent(importUser.getMobile(), importUser.getNickName(), getClientIP()); memberUserService.createUserIfAbsent(importUser.getMobile(), importUser.getNickName(), getClientIP());
} }
// 插入 // 插入

View File

@ -254,3 +254,6 @@ justauth:
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
phone:
query-url: http://192.168.1.189:4006/cyywl-phone-query-api/
token: eyIwLnR5cCI6IkpXVCIsImFsZyI6IkhTNTEyIn0