Merge branch 'feature/mall_product'
commit
022b9d2c8f
|
@ -29,5 +29,12 @@ public class RefundRequest implements Serializable {
|
|||
@Schema(description = "退款类型1:同意退款,2:拒绝退款、3:发起退款")
|
||||
@NotNull(message = "退款类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "退款类型")
|
||||
private Integer refundType;
|
||||
@Schema(description = "退款类型名称")
|
||||
private String refundName;
|
||||
@Schema(description = "会员退款理由")
|
||||
private String memberReason;
|
||||
@Schema(description = "管理员理由")
|
||||
private String adminReason;
|
||||
}
|
||||
|
|
|
@ -35,4 +35,6 @@ public class StatementAllRequest implements Serializable {
|
|||
@Schema(description = "1、当日2、上周3、上月4、累计")
|
||||
private String type;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
|
|
|
@ -27,4 +27,6 @@ public class StatementPageRequest extends PageParam {
|
|||
@Schema(description = "结束执行时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime endTime;
|
||||
|
||||
private Long tenantId;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderInfoService;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -28,11 +30,13 @@ import java.io.IOException;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
|
@ -112,7 +116,7 @@ public class RechargeOrderController {
|
|||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:query')")
|
||||
@TenantIgnore
|
||||
public CommonResult<PageResult<RechargeOrderRespVO>> getRechargeOrderPage(@Valid RechargeOrderPageReqVO pageVO) {
|
||||
if(!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())){
|
||||
if (!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())) {
|
||||
pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
}
|
||||
PageResult<RechargeOrderRespVO> pageResult = rechargeOrderService.getRechargeOrderPage(pageVO);
|
||||
|
@ -124,7 +128,7 @@ public class RechargeOrderController {
|
|||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:query')")
|
||||
@TenantIgnore
|
||||
public CommonResult<PageResult<PromoterDrawVO>> getRechargeOrderPage(@RequestBody PromoterDrawReqVO pageVO) {
|
||||
if(!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())){
|
||||
if (!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())) {
|
||||
pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
}
|
||||
PageResult<PromoterDrawVO> pageResult = rechargeOrderService.findPromoterDrawPage(pageVO);
|
||||
|
@ -137,7 +141,7 @@ public class RechargeOrderController {
|
|||
@OperateLog(type = EXPORT)
|
||||
@TenantIgnore
|
||||
public void getRechargeOrderExcel(@Valid PromoterDrawReqExcelVO excelVO, HttpServletResponse response) throws IOException {
|
||||
if(!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())){
|
||||
if (!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())) {
|
||||
excelVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
}
|
||||
List<PromoterDrawExcelVO> list = rechargeOrderService.findPromoterDrawExcel(excelVO);
|
||||
|
@ -151,7 +155,7 @@ public class RechargeOrderController {
|
|||
@OperateLog(type = EXPORT)
|
||||
@TenantIgnore
|
||||
public void exportRechargeOrderExcel(@Valid RechargeOrderExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<RechargeOrderExcelVO> list = rechargeOrderService.findListExcel(exportReqVO);
|
||||
ArrayList<Long> s = new ArrayList<>();
|
||||
list.forEach(x -> {
|
||||
|
@ -162,6 +166,7 @@ public class RechargeOrderController {
|
|||
|
||||
Excel.orderExport(response, list, infoList);
|
||||
}
|
||||
|
||||
@TenantIgnore
|
||||
@PreAuthenticated
|
||||
@Operation(summary = "退款")
|
||||
|
@ -169,25 +174,28 @@ public class RechargeOrderController {
|
|||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:refund')")
|
||||
public CommonResult<Object> memberRefund(@Valid @RequestBody RefundRequest request, HttpServletRequest servletRequest) throws Exception {
|
||||
log.info("memberRefund会员退款===>{}", request);
|
||||
Object obj=null;
|
||||
Object obj = null;
|
||||
//直接退款
|
||||
if(request.getType()==3){
|
||||
if (request.getType() == 3) {
|
||||
RechargeOrderUpdateReqVO vo = new RechargeOrderUpdateReqVO();
|
||||
vo.setId(request.getOrderId());
|
||||
vo.setRefundStatus(3);
|
||||
vo.setAdminReason(request.getAdminReason());
|
||||
rechargeOrderService.updateRechargeOrderStatus(vo);
|
||||
obj = storeOrderService.memberRefund(request, servletRequest);
|
||||
//拒绝退款
|
||||
}else if(request.getType()==2){
|
||||
//拒绝退款
|
||||
} else if (request.getType() == 2) {
|
||||
RechargeOrderUpdateReqVO vo = new RechargeOrderUpdateReqVO();
|
||||
vo.setId(request.getOrderId());
|
||||
vo.setRefundStatus(4);
|
||||
vo.setAdminReason(request.getAdminReason());
|
||||
rechargeOrderService.updateRechargeOrderStatus(vo);
|
||||
//同意
|
||||
}else if(request.getType()==1){
|
||||
} else if (request.getType() == 1) {
|
||||
RechargeOrderUpdateReqVO vo = new RechargeOrderUpdateReqVO();
|
||||
vo.setId(request.getOrderId());
|
||||
vo.setRefundStatus(3);
|
||||
vo.setAdminReason(request.getAdminReason());
|
||||
rechargeOrderService.updateRechargeOrderStatus(vo);
|
||||
obj = storeOrderService.memberRefund(request, servletRequest);
|
||||
}
|
||||
|
|
|
@ -14,5 +14,8 @@ public class RechargeOrderUpdateReqVO extends RechargeOrderBaseVO {
|
|||
@Schema(description = "订单ID", required = true, example = "17164")
|
||||
@NotNull(message = "订单ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 管理员理由
|
||||
*/
|
||||
private String adminReason;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Title:TenantListVo
|
||||
* @Description: TODO
|
||||
* @author: tangqian
|
||||
* @date: 2023/6/19 10:29
|
||||
* @version: V1.0.0
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class TenantListVo implements Serializable {
|
||||
private static final long serialVersionUID = 8280705984308676562L;
|
||||
private Long id;
|
||||
private String name;
|
||||
}
|
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsExcelVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.TenantListVo;
|
||||
import cn.iocoder.yudao.module.shop.request.order.StatementAllRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.order.StatementPageRequest;
|
||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
||||
|
@ -74,7 +75,7 @@ public class StatementController {
|
|||
if (!CollectionUtils.isEmpty(statistics.getList())) {
|
||||
statistics.getList().forEach(e -> {
|
||||
StatisticsExcelVO vo = new StatisticsExcelVO();
|
||||
BeanUtils.copyProperties(e,vo);
|
||||
BeanUtils.copyProperties(e, vo);
|
||||
list.add(vo);
|
||||
});
|
||||
}
|
||||
|
@ -82,4 +83,10 @@ public class StatementController {
|
|||
ExcelUtils.write(response, "导出数据统计(根据租户统计).xls", "数据", StatisticsExcelVO.class, list);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取租户")
|
||||
@RequestMapping(value = "/getTenantList", method = RequestMethod.GET)
|
||||
@TenantIgnore
|
||||
public CommonResult<List<TenantListVo>> getTenantList() {
|
||||
return CommonResult.success(storeOrderService.getTenantList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.shop.dal.dataobject.recharge;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -180,4 +181,29 @@ public class RechargeOrderDO extends TenantBaseDO {
|
|||
*/
|
||||
private Long deptId;
|
||||
|
||||
// 用于微信支付成功回调失败-补单逻辑
|
||||
/**
|
||||
* 补单标记
|
||||
*/
|
||||
private Integer isReplenishment;
|
||||
/**
|
||||
* 补单标记说明
|
||||
*/
|
||||
private String replenishmentName;
|
||||
/**
|
||||
* 退款类型
|
||||
*/
|
||||
private Integer refundType;
|
||||
/**
|
||||
* 退款类型名称
|
||||
*/
|
||||
private String refundName;
|
||||
/**
|
||||
* 会员退款理由
|
||||
*/
|
||||
private String memberReason;
|
||||
/**
|
||||
* 管理员理由
|
||||
*/
|
||||
private String adminReason;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public interface StoreOrderMapper extends BaseMapperX<StoreOrder> {
|
|||
|
||||
/**
|
||||
* 核销详情 月数据
|
||||
*
|
||||
* @param request 分页和日期
|
||||
* @return 月数据
|
||||
*/
|
||||
|
@ -55,6 +56,7 @@ public interface StoreOrderMapper extends BaseMapperX<StoreOrder> {
|
|||
|
||||
/**
|
||||
* 订单统计详情 price
|
||||
*
|
||||
* @param pram 时间区间参数
|
||||
* @return 月数据
|
||||
*/
|
||||
|
@ -62,6 +64,7 @@ public interface StoreOrderMapper extends BaseMapperX<StoreOrder> {
|
|||
|
||||
/**
|
||||
* 订单统计详情 订单量
|
||||
*
|
||||
* @param pram 时间区间参数
|
||||
* @return 月数据
|
||||
*/
|
||||
|
@ -69,12 +72,13 @@ public interface StoreOrderMapper extends BaseMapperX<StoreOrder> {
|
|||
|
||||
/**
|
||||
* 获取佣金相关数据
|
||||
* @param uid 用户uid
|
||||
*
|
||||
* @param uid 用户uid
|
||||
* @param spreadId 推广人uid
|
||||
*/
|
||||
OrderBrokerageData getBrokerageData(@Param("uid") Long uid, @Param("spreadId") Integer spreadId);
|
||||
|
||||
BigDecimal shoppingOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate")LocalDateTime endDate,@Param("promoterId") Long promoterId);
|
||||
BigDecimal shoppingOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("promoterId") Long promoterId);
|
||||
|
||||
List<StatementAllReqDataVo> statisticsAll(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime);
|
||||
List<StatementAllReqDataVo> statisticsAll(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("tenantId") Long tenantId);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.shop.service.order;
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.TenantListVo;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
||||
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.member.OrderPayRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
|
||||
|
@ -408,4 +410,8 @@ public interface StoreOrderService extends IService<StoreOrder> {
|
|||
StatementAllReqVo statisticsAll(StatementAllRequest request);
|
||||
|
||||
PageInfo<StatisticsPageVo> statistics(StatementPageRequest request);
|
||||
|
||||
List<TenantListVo> getTenantList();
|
||||
|
||||
void addPhone(RechargeOrderDO orderDO, String outTradeNo);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO;
|
|||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqDataVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.TenantListVo;
|
||||
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;
|
||||
|
@ -97,6 +98,8 @@ import java.util.*;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID;
|
||||
|
||||
/**
|
||||
* StoreOrderServiceImpl 接口实现
|
||||
* +----------------------------------------------------------------------
|
||||
|
@ -1195,7 +1198,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object aliNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, AlipayApiException {
|
||||
public Object aliNotify(HttpServletRequest request, HttpServletResponse response) throws AlipayApiException {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
Map requestParams = request.getParameterMap();
|
||||
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
|
||||
|
@ -1428,6 +1431,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
public Boolean memberApplyRefund(RefundRequest request) {
|
||||
RechargeOrderDO orderDO = rechargeOrderMapper.selectById(request.getOrderId());
|
||||
orderDO.setRefundStatus(1);
|
||||
orderDO.setRefundType(request.getRefundType());
|
||||
orderDO.setRefundName(request.getRefundName());
|
||||
orderDO.setMemberReason(request.getMemberReason());
|
||||
return rechargeOrderMapper.updateById(orderDO) > 0;
|
||||
}
|
||||
|
||||
|
@ -1464,7 +1470,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
request.setEndTime(LocalDateTimeUtil.endOfDay(lastDay));
|
||||
}
|
||||
}
|
||||
List<StatementAllReqDataVo> dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime());
|
||||
List<StatementAllReqDataVo> dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime(), request.getTenantId());
|
||||
if (!CollectionUtils.isEmpty(dataVos)) {
|
||||
reqVo.setTotalMoney(BigDecimal.valueOf(dataVos.stream().filter(x -> x.getRefundStatus() != 2).mapToDouble(StatementAllReqDataVo::getPrice).sum()));
|
||||
reqVo.setTotalNum(dataVos.size());
|
||||
|
@ -1483,10 +1489,11 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
pageDTO.setName(request.getName());
|
||||
pageDTO.setPageNo(request.getPageNo());
|
||||
pageDTO.setPageSize(request.getPageSize());
|
||||
pageDTO.setTenantId(request.getTenantId());
|
||||
PageResult<TenantDTO> tenantPage = tenantApi.getTenantPage(pageDTO);
|
||||
if (!CollectionUtils.isEmpty(tenantPage.getList())) {
|
||||
page.setTotal(tenantPage.getTotal());
|
||||
List<StatementAllReqDataVo> dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime());
|
||||
List<StatementAllReqDataVo> dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime(), null);
|
||||
Map<Long, List<StatementAllReqDataVo>> collect = dataVos.stream().collect(Collectors.groupingBy(StatementAllReqDataVo::getTenantId));
|
||||
List<StatisticsPageVo> vos = new ArrayList<>();
|
||||
tenantPage.getList().forEach(e -> {
|
||||
|
@ -1509,6 +1516,26 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenantListVo> getTenantList() {
|
||||
Long tenantId = TenantContextHolder.getTenantId();
|
||||
List<TenantDTO> tenantList = tenantApi.getTenantList(tenantId.equals(1L) ? null : tenantId);
|
||||
List<TenantListVo> list = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(tenantList)) {
|
||||
tenantList.forEach(e -> {
|
||||
TenantListVo vo = new TenantListVo();
|
||||
BeanUtils.copyProperties(e, vo);
|
||||
list.add(vo);
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPhone(RechargeOrderDO orderDO, String outTradeNo) {
|
||||
addPhoneRecord(orderDO, outTradeNo);
|
||||
}
|
||||
|
||||
|
||||
private RechargeOrderDO initializeOrder(OrderContentRequest request, String code, MemberUserRespDTO user, PromoterDTO promoterDTO) {
|
||||
Long tenantId = TenantContextHolder.getTenantId();
|
||||
|
|
|
@ -125,7 +125,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
public PageResult<RechargeOrderRespVO> getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO) {
|
||||
Page<RechargeOrderRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
Long tenantId = TenantContextHolder.getTenantId();
|
||||
pageReqVO.setTenantId(tenantId);
|
||||
pageReqVO.setTenantId(null != pageReqVO.getTenantId() ? pageReqVO.getTenantId() : tenantId);
|
||||
|
||||
rechargeOrderMapper.findListPage(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
|
@ -204,7 +204,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
@Override
|
||||
public List<RechargeOrderExcelVO> findListExcel(RechargeOrderExportReqVO data) {
|
||||
Long tenantId = TenantContextHolder.getTenantId();
|
||||
data.setTenantId(tenantId);
|
||||
data.setTenantId(null != data.getTenantId() ? data.getTenantId() : tenantId);
|
||||
return rechargeOrderMapper.findListExcel(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,288 @@
|
|||
package cn.iocoder.yudao.module.shop.task;
|
||||
|
||||
import cn.iocoder.yudao.framework.pay.properties.WxPayProperties;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Title:ReplenishmentTask
|
||||
* @Description: 会员充值补单定时任务
|
||||
* @author: tangqian
|
||||
* @date: 2023/6/19 11:33
|
||||
* @version: V1.0.0
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ReplenishmentTask {
|
||||
@Autowired
|
||||
private WxPayProperties properties;
|
||||
@Autowired
|
||||
private RechargeOrderMapper rechargeOrderMapper;
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
/**
|
||||
* 每天上午8点和下午3点执行补单计划
|
||||
*/
|
||||
// @Scheduled(cron = "0 0 8,15 * * ?")
|
||||
@TenantIgnore
|
||||
public void replenishmentTask() {
|
||||
/**
|
||||
* 1.扫描表里面未付款的订单
|
||||
* 2.根据订单号查询微信支付结果
|
||||
* 3.处理相关逻辑c
|
||||
*/
|
||||
List<RechargeOrderDO> orderDOS = rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery()
|
||||
.eq(RechargeOrderDO::getPaid, 0)
|
||||
.eq(RechargeOrderDO::getIsReplenishment, 0));
|
||||
if (!CollectionUtils.isEmpty(orderDOS)) {
|
||||
orderDOS.forEach(e -> {
|
||||
execute(e.getOrderId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void execute(String outTradeNo) {
|
||||
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo));
|
||||
if (null == orderDO) {
|
||||
log.info("订单号:{}未查询数据", outTradeNo);
|
||||
return;
|
||||
}
|
||||
String appId = properties.getAppId();
|
||||
String mchId = properties.getMchId();
|
||||
// 生成随机字符串
|
||||
String nonceStr = generateNonceStr();
|
||||
// 商户密钥
|
||||
String key = properties.getMchKey();
|
||||
|
||||
// 构建请求参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("appid", appId);
|
||||
params.put("mch_id", mchId);
|
||||
params.put("out_trade_no", outTradeNo);
|
||||
params.put("nonce_str", nonceStr);
|
||||
// 生成签名
|
||||
String sign = generateSign(params, key);
|
||||
params.put("sign", sign);
|
||||
|
||||
// 发起HTTP请求
|
||||
String requestUrl = "https://api.mch.weixin.qq.com/pay/orderquery";
|
||||
String response = sendRequest(requestUrl, mapToXml(params));
|
||||
log.info("根据订单编号:{},查询微信支付结果出参:{}", outTradeNo, response);
|
||||
Map<String, String> map = parseResponse(response);
|
||||
if ("SUCCESS".equals(map.get("trade_state")) && "SUCCESS".equals(map.get("result_code"))) {
|
||||
// 修改订单状态
|
||||
// orderDO.setPaid(1);
|
||||
// orderDO.setIsReplenishment(1);
|
||||
// orderDO.setReplenishmentName(map.toString());
|
||||
// rechargeOrderMapper.updateById(orderDO);
|
||||
// // 写入 充值档位记录表
|
||||
// storeOrderService.addPhone(orderDO, outTradeNo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析出参
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
private static Map<String, String> parseResponse(String response) {
|
||||
try {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
ByteArrayInputStream input = new ByteArrayInputStream(response.getBytes("UTF-8"));
|
||||
Document document = builder.parse(input);
|
||||
|
||||
Element root = document.getDocumentElement();
|
||||
NodeList nodeList = root.getChildNodes();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
Node node = nodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element element = (Element) node;
|
||||
String tagName = element.getTagName();
|
||||
String textContent = element.getTextContent();
|
||||
map.put(tagName, textContent);
|
||||
}
|
||||
}
|
||||
log.info("出参结果:{}", map.toString());
|
||||
return map;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成随机字符串
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static String generateNonceStr() {
|
||||
return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名
|
||||
*
|
||||
* @param params 相关参数
|
||||
* @param key 商户密钥
|
||||
* @return
|
||||
*/
|
||||
private static String generateSign(Map<String, String> params, String key) {
|
||||
List<String> keys = new ArrayList<>(params.keySet());
|
||||
Collections.sort(keys);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String k : keys) {
|
||||
String v = params.get(k);
|
||||
if (v != null && !v.isEmpty()) {
|
||||
sb.append(k).append("=").append(v).append("&");
|
||||
}
|
||||
}
|
||||
sb.append("key=").append(key);
|
||||
return md5(sb.toString()).toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送HTTP请求
|
||||
*
|
||||
* @param url
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private static String sendRequest(String url, String data) {
|
||||
// 使用Java的HTTP请求库发送POST请求,这里需要根据你使用的具体库进行实现
|
||||
// 示例代码中的sendPostRequest方法是一个自定义的方法,你需要使用适合你的HTTP请求库进行替换
|
||||
return sendPostRequest(url, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map转换为XML格式
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
private static String mapToXml(Map<String, String> map) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<xml>");
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
sb.append("<").append(entry.getKey()).append(">");
|
||||
sb.append("<![CDATA[").append(entry.getValue()).append("]]>");
|
||||
sb.append("</").append(entry.getKey()).append(">");
|
||||
}
|
||||
sb.append("</xml>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String md5(String input) {
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
byte[] messageDigest = md.digest(input.getBytes());
|
||||
|
||||
// Convert byte array to hexadecimal string
|
||||
StringBuilder hexString = new StringBuilder();
|
||||
for (byte b : messageDigest) {
|
||||
String hex = Integer.toHexString(0xFF & b);
|
||||
if (hex.length() == 1) {
|
||||
hexString.append('0');
|
||||
}
|
||||
hexString.append(hex);
|
||||
}
|
||||
return hexString.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String sendPostRequest(String url, String data) {
|
||||
try {
|
||||
URL requestUrl = new URL(url);
|
||||
HttpURLConnection connection = (HttpURLConnection) requestUrl.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setDoOutput(true);
|
||||
|
||||
// 设置请求头
|
||||
connection.setRequestProperty("Content-Type", "application/xml;charset=UTF-8");
|
||||
|
||||
// 发送请求数据
|
||||
OutputStream outputStream = connection.getOutputStream();
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
|
||||
writer.write(data);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
outputStream.close();
|
||||
|
||||
// 获取响应数据
|
||||
int responseCode = connection.getResponseCode();
|
||||
InputStream inputStream;
|
||||
if (responseCode >= 200 && responseCode < 300) {
|
||||
inputStream = connection.getInputStream();
|
||||
} else {
|
||||
inputStream = connection.getErrorStream();
|
||||
}
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
|
||||
StringBuilder response = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
reader.close();
|
||||
inputStream.close();
|
||||
|
||||
connection.disconnect();
|
||||
|
||||
return response.toString();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// String appId = "wx7e503d9cded34c07";
|
||||
// String mchId = "1641073271";
|
||||
// String nonceStr = generateNonceStr(); // 生成随机字符串
|
||||
// String key = "cyywl123456cyywl654321cyywl12345"; // 商户密钥
|
||||
//
|
||||
// // 构建请求参数
|
||||
// Map<String, String> params = new HashMap<>();
|
||||
// params.put("appid", appId);
|
||||
// params.put("mch_id", mchId);
|
||||
// params.put("out_trade_no", "MEMBER_16700496905020866571");
|
||||
// params.put("nonce_str", nonceStr);
|
||||
// String sign = generateSign(params, key); // 生成签名
|
||||
// params.put("sign", sign);
|
||||
//
|
||||
// // 发起HTTP请求
|
||||
// String requestUrl = "https://api.mch.weixin.qq.com/pay/orderquery";
|
||||
// String response = sendRequest(requestUrl, mapToXml(params));
|
||||
// System.out.println(response);
|
||||
// parseResponse(response);
|
||||
// }
|
||||
}
|
|
@ -3,15 +3,25 @@
|
|||
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper">
|
||||
|
||||
<select id="getTotalPrice" resultType="java.math.BigDecimal">
|
||||
select sum(pay_price) from eb_store_order where ${where} and refund_status = 0
|
||||
select sum(pay_price)
|
||||
from eb_store_order
|
||||
where ${where}
|
||||
and refund_status = 0
|
||||
</select>
|
||||
<select id="getRefundPrice" resultType="java.math.BigDecimal">
|
||||
select sum(refund_price) from eb_store_order where ${where} and refund_status = 2
|
||||
select sum(refund_price)
|
||||
from eb_store_order
|
||||
where ${where}
|
||||
and refund_status = 2
|
||||
</select>
|
||||
<select id="getRefundTotal" resultType="java.lang.Integer">
|
||||
select count(id) from eb_store_order where ${where} and refund_status = 2
|
||||
select count(id)
|
||||
from eb_store_order
|
||||
where ${where}
|
||||
and refund_status = 2
|
||||
</select>
|
||||
<select id="getOrderVerificationDetail" parameterType="cn.iocoder.yudao.module.shop.request.order.StoreOrderStaticsticsRequest"
|
||||
<select id="getOrderVerificationDetail"
|
||||
parameterType="cn.iocoder.yudao.module.shop.request.order.StoreOrderStaticsticsRequest"
|
||||
resultType="cn.iocoder.yudao.module.shop.vo.order.StoreStaffDetail">
|
||||
select sum(o.`pay_price`) as price, count(o.`id`) as count, DATE_FORMAT(o.`create_time`, '%Y-%m-%d') as time
|
||||
from `eb_store_order` o
|
||||
|
@ -24,23 +34,31 @@
|
|||
</if>
|
||||
GROUP by DATE_FORMAT(o.`create_time`, '%Y-%m-%d') order by o.`create_time` desc limit #{ pageNo },#{pageSize};
|
||||
</select>
|
||||
<select id="getOrderStatisticsPriceDetail" parameterType="cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram"
|
||||
<select id="getOrderStatisticsPriceDetail"
|
||||
parameterType="cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram"
|
||||
resultType="cn.iocoder.yudao.module.shop.response.order.StoreOrderStatisticsChartItemResponse">
|
||||
select sum(o.pay_price) as num,date_format(o.create_time, '%Y-%m-%d') as time
|
||||
select sum(o.pay_price) as num, date_format(o.create_time, '%Y-%m-%d') as time
|
||||
from eb_store_order o
|
||||
where o.is_del >= 0 and o.paid >= 1 and o.refund_status >= 0
|
||||
and o.create_time >= #{ startTime }
|
||||
and o.create_time < #{ endTime }
|
||||
where o.is_del >= 0
|
||||
and o.paid >= 1
|
||||
and o.refund_status >= 0
|
||||
and o.create_time >= #{ startTime }
|
||||
and o.create_time
|
||||
< #{ endTime }
|
||||
group by date_format(o.create_time, '%Y-%m-%d')
|
||||
order by o.create_time desc;
|
||||
</select>
|
||||
<select id="getOrderStatisticsOrderCountDetail" parameterType="cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram"
|
||||
<select id="getOrderStatisticsOrderCountDetail"
|
||||
parameterType="cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram"
|
||||
resultType="cn.iocoder.yudao.module.shop.response.order.StoreOrderStatisticsChartItemResponse">
|
||||
select count(id) as num, date_format(o.create_time, '%Y-%m-%d') as time
|
||||
from eb_store_order o
|
||||
where o.is_del >= 0 and o.paid >= 1 and o.refund_status >= 0
|
||||
and o.create_time >= #{ startTime }
|
||||
and o.create_time < #{ endTime }
|
||||
where o.is_del >= 0
|
||||
and o.paid >= 1
|
||||
and o.refund_status >= 0
|
||||
and o.create_time >= #{ startTime }
|
||||
and o.create_time
|
||||
< #{ endTime }
|
||||
group by date_format(o.create_time, '%Y-%m-%d')
|
||||
order by o.create_time asc;
|
||||
</select>
|
||||
|
@ -48,8 +66,10 @@
|
|||
<select id="getBrokerageData" resultType="cn.iocoder.yudao.module.shop.response.order.OrderBrokerageData">
|
||||
select count(*) as num, sum(o.pay_price) as price
|
||||
from eb_store_order as o
|
||||
right join eb_user_brokerage_record as br on br.link_id = o.order_id and br.status = 3 and br.uid = #{spreadId}
|
||||
where o.uid = #{uid} and o.status > 1;
|
||||
right join eb_user_brokerage_record as br
|
||||
on br.link_id = o.order_id and br.status = 3 and br.uid = #{spreadId}
|
||||
where o.uid = #{uid}
|
||||
and o.status > 1;
|
||||
</select>
|
||||
|
||||
<select id="shoppingOrderCount" resultType="java.math.BigDecimal">
|
||||
|
@ -67,22 +87,25 @@
|
|||
<select id="statisticsAll"
|
||||
resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqDataVo">
|
||||
SELECT
|
||||
info.recharge_order_id as orderId,
|
||||
ord.id,
|
||||
ord.paid,
|
||||
ord.refund_status,
|
||||
info.price,
|
||||
ord.tenant_id
|
||||
info.recharge_order_id as orderId,
|
||||
ord.id,
|
||||
ord.paid,
|
||||
ord.refund_status,
|
||||
info.price,
|
||||
ord.tenant_id
|
||||
FROM
|
||||
`cy_recharge_order_info` info
|
||||
LEFT JOIN cy_recharge_order ord ON info.recharge_order_id = ord.id
|
||||
`cy_recharge_order_info` info
|
||||
LEFT JOIN cy_recharge_order ord ON info.recharge_order_id = ord.id
|
||||
WHERE
|
||||
ord.paid != 0
|
||||
ord.paid != 0
|
||||
<if test="null != startTime">
|
||||
and info.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="null != endTime">
|
||||
and info.create_time < #{endTime}
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId!=1">
|
||||
and info.tenant_id =#{tenantId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -236,6 +236,9 @@
|
|||
<if test="data.orderId !=null and data.orderId!=''">
|
||||
and a.order_id like CONCAT('%',#{data.orderId},'%')
|
||||
</if>
|
||||
<if test="data.refundStatus !=null and data.refundStatus!=''">
|
||||
and a.refund_status =#{data.refundStatus}
|
||||
</if>
|
||||
<if test="data.paid !=null and data.paid!=''">
|
||||
and a.paid =#{data.paid}
|
||||
</if>
|
||||
|
|
|
@ -151,6 +151,7 @@ public class PromoterController {
|
|||
@Operation(summary = "导出所有推广员 Excel")
|
||||
@OperateLog(type = EXPORT)
|
||||
@TenantIgnore
|
||||
@PreAuthorize("@ss.hasPermission('member:promoter:allExcel')")
|
||||
public void allExportExcel(@Valid PromoterPageReqVO pageVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
PageResult<PromoterRespVO> pageResult = promoterService.getPromoterPage(pageVO);
|
||||
|
@ -168,6 +169,7 @@ public class PromoterController {
|
|||
|
||||
@PutMapping("/tenantIgnoreUpdate")
|
||||
@Operation(summary = "排除祖父更新推广员")
|
||||
@PreAuthorize("@ss.hasPermission('member:promoter:allUpdate')")
|
||||
@TenantIgnore
|
||||
public CommonResult<Boolean> updateByPromoter(@Valid @RequestBody PromoterUpdateReqVO updateReqVO) {
|
||||
promoterService.updatePromoter(updateReqVO);
|
||||
|
|
|
@ -30,4 +30,6 @@ public interface TenantApi {
|
|||
TenantDTO getTenant(Long id);
|
||||
|
||||
PageResult<TenantDTO> getTenantPage(TenantPageDTO pageDTO);
|
||||
|
||||
List<TenantDTO> getTenantList(Long aLong);
|
||||
}
|
||||
|
|
|
@ -16,4 +16,5 @@ public class TenantPageDTO {
|
|||
private String name;
|
||||
private Integer pageNo = PAGE_NO;
|
||||
private Integer pageSize = PAGE_SIZE;
|
||||
private Long tenantId;
|
||||
}
|
||||
|
|
|
@ -62,4 +62,11 @@ public class TenantApiImpl implements TenantApi {
|
|||
}
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenantDTO> getTenantList(Long tenantId)
|
||||
{
|
||||
|
||||
return tenantService.findByTenantId(tenantId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,4 +48,6 @@ public class TenantPageReqVO extends PageParam {
|
|||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
|
|||
|
||||
default PageResult<TenantDO> selectPage(TenantPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TenantDO>()
|
||||
.eqIfPresent(TenantDO::getId,reqVO.getTenantId())
|
||||
.likeIfPresent(TenantDO::getName, reqVO.getName())
|
||||
.likeIfPresent(TenantDO::getContactName, reqVO.getContactName())
|
||||
.likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile())
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.tenant;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler;
|
||||
|
@ -135,4 +136,6 @@ public interface TenantService {
|
|||
* @param id 租户编号
|
||||
*/
|
||||
void validTenant(Long id);
|
||||
|
||||
List<TenantDTO> findByTenantId(Long tenantId);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|||
import cn.iocoder.yudao.framework.tenant.config.TenantProperties;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||
import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCreateReqVO;
|
||||
|
@ -30,7 +31,10 @@ import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
|||
import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -38,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
@ -97,6 +102,22 @@ public class TenantServiceImpl implements TenantService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenantDTO> findByTenantId(Long tenantId) {
|
||||
List<TenantDTO> list = new ArrayList<>();
|
||||
LambdaQueryWrapper<TenantDO> lw = new LambdaQueryWrapper<>();
|
||||
lw.eq(null != tenantId, TenantDO::getId,tenantId);
|
||||
List<TenantDO> tenantDOS = tenantMapper.selectList(lw);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(tenantDOS)) {
|
||||
tenantDOS.forEach(e->{
|
||||
TenantDTO tenantDTO = new TenantDTO();
|
||||
BeanUtils.copyProperties(e,tenantDTO);
|
||||
list.add(tenantDTO);
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createTenant(TenantCreateReqVO createReqVO) {
|
||||
|
|
Loading…
Reference in New Issue