提报记录

pull/2/head
perry 2023-05-24 16:02:21 +08:00
parent f1fbbcf36d
commit 749e4b7459
9 changed files with 148 additions and 8 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

@ -1,16 +1,21 @@
package cn.iocoder.yudao.module.shop.controller.app.recharge; 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.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 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.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.convert.recharge.PhoneRecordConvert;
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.service.recharge.PhoneRecordService; 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.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; 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.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -29,12 +34,46 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E
@RestController @RestController
@RequestMapping("/shop/phone-record") @RequestMapping("/shop/phone-record")
@Validated @Validated
@Slf4j
public class AppPhoneRecordController { public class AppPhoneRecordController {
@Resource @Resource
private PhoneRecordService phoneRecordService; 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

@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -40,6 +41,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E
@RestController @RestController
@RequestMapping("/shop/refund-fee-record") @RequestMapping("/shop/refund-fee-record")
@Validated @Validated
@Slf4j
public class AppRefundFeeRecordController { public class AppRefundFeeRecordController {
@Resource @Resource
@ -66,6 +68,7 @@ public class AppRefundFeeRecordController {
.execute() .execute()
.body(); .body();
JSONObject resultJson = JSONObject.parseObject(result); JSONObject resultJson = JSONObject.parseObject(result);
log.info("查询会员档次{}",resultJson);
if("0000".equals(resultJson.get("code"))){ if("0000".equals(resultJson.get("code"))){
return success(resultJson.getJSONArray("body")); return success(resultJson.getJSONArray("body"));
} }
@ -85,6 +88,7 @@ public class AppRefundFeeRecordController {
.execute() .execute()
.body(); .body();
JSONObject resultJson = JSONObject.parseObject(result); JSONObject resultJson = JSONObject.parseObject(result);
log.info("查询档位返费信息{}",resultJson);
if("0000".equals(resultJson.get("code"))){ if("0000".equals(resultJson.get("code"))){
return success(resultJson.getJSONArray("body")); return success(resultJson.getJSONArray("body"));
} }

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

@ -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.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.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;
@ -1219,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 {
// 表示支付 // 表示支付
@ -1246,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());
@ -1257,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) {

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;
@ -85,23 +86,19 @@ public interface PhoneRecordService {
* <b>Description:</b> * <b>Description:</b>
* <b>@author:</b> zenghuapei * <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 12:44 * <b>@date:</b> 2023/5/24 12:44
* @param phone:
* @param gear:
* @return * @return
* </pre> * </pre>
*/ */
Boolean deletePhoneGear(String phone, String gear); Boolean deletePhoneGear(String orderId);
/** /**
* <pre> * <pre>
* <b>insertPhone</b> * <b>insertPhone</b>
* <b>Description:</b> * <b>Description:</b>
* <b>@author:</b> zenghuapei * <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 12:45 * <b>@date:</b> 2023/5/24 12:45
* @param phone:
* @param gear:
* @return * @return
* </pre> * </pre>
*/ */
Boolean insertPhone(String phone, String gear); Boolean insertPhone(List<PhoneRecordAdd> data);
} }

View File

@ -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.framework.security.core.util.SecurityFrameworkUtils;
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.shop.controller.app.recharge.vo.PhoneRecordAdd;
import com.alibaba.fastjson.JSONObject; 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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -32,6 +34,7 @@ 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
@ -126,4 +129,54 @@ public class PhoneRecordServiceImpl implements PhoneRecordService {
throw new ServiceException("手机号档位验证失败"); 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

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