fix bug
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
package co.yixiang.yshop.framework.desensitize.core.util;
|
||||
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import co.yixiang.yshop.framework.desensitize.core.slider.annotation.MobileDesensitize;
|
||||
import co.yixiang.yshop.framework.desensitize.core.slider.handler.MobileDesensitization;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
public class DesensitizeUtil {
|
||||
public static <T> void mobileDesensitize(List<T> voList, String fieldName) {
|
||||
MobileDesensitization mobileDesensitize = new MobileDesensitization();
|
||||
|
||||
MobileDesensitize desensitize = new MobileDesensitize() {
|
||||
|
||||
@Override
|
||||
public Class<? extends Annotation> annotationType() {
|
||||
return MobileDesensitize.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int prefixKeep() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int suffixKeep() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String replacer() {
|
||||
return "*";
|
||||
}
|
||||
};
|
||||
voList.forEach(vo -> {
|
||||
Object value = ReflectUtil.getFieldValue(vo, fieldName);
|
||||
if (value != null) {
|
||||
String desensitized = mobileDesensitize.desensitize((String) value, desensitize);
|
||||
ReflectUtil.setFieldValue(vo, fieldName, desensitized);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -151,6 +152,7 @@ public class DistributorWagesLogController {
|
||||
if (wagesLogDO.getType().equals(DistributorWagesLogTypeEnum.WITHDRAW_FAIL.getType())) {
|
||||
excelVO.setStatusStr(DistributorWagesLogTypeEnum.WITHDRAW_FAIL.getName());
|
||||
}
|
||||
excelVO.setAmountStr(wagesLogDO.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
||||
datas.add(excelVO);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@ import co.yixiang.yshop.module.product.api.product.dto.ProductPageReqVO;
|
||||
import co.yixiang.yshop.module.system.enums.DistributorDictEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ -50,10 +49,7 @@ import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -205,7 +201,7 @@ public class DistributorFacadeImpl implements DistributorFacade {
|
||||
respVO.setFirstWages(level.getFirstWages());
|
||||
respVO.setSecondWages(level.getSecondWages());
|
||||
|
||||
MemberUserRespDTO user = memberUserApi.getUser(distributorDO.getUserId());
|
||||
MemberUserRespDTO user = Optional.ofNullable(memberUserApi.getUser(distributorDO.getUserId())).orElseGet(MemberUserRespDTO::new);
|
||||
respVO.setMobile(user.getMobile());
|
||||
|
||||
// 获取我的用户
|
||||
|
@ -87,8 +87,7 @@ public class RechargeOrderController {
|
||||
@Operation(summary = "获得充值订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('order:recharge-order:query')")
|
||||
public CommonResult<PageResult<RechargeOrderRespVO>> getRechargeOrderPage(@Valid RechargeOrderPageReqVO pageVO) {
|
||||
PageResult<RechargeOrderDO> pageResult = rechargeOrderService.getRechargeOrderPage(pageVO);
|
||||
return success(RechargeOrderConvert.INSTANCE.convertPage(pageResult));
|
||||
return success(rechargeOrderService.getRechargeOrderPage(pageVO));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
|
@ -1,11 +1,10 @@
|
||||
package co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@ -18,6 +17,9 @@ import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class RechargeOrderPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "充值订单id", example = "15798")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "用户id", example = "15798")
|
||||
private Long userId;
|
||||
|
||||
@ -37,4 +39,7 @@ public class RechargeOrderPageReqVO extends PageParam {
|
||||
@Schema(description = "充值套餐ID", example = "8014")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ public class RechargeOrderRespVO extends RechargeOrderBaseVO {
|
||||
@Schema(description = "订单ID", required = true, example = "12534")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "昵称", required = true, example = "12534")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package co.yixiang.yshop.module.order.controller.admin.storeorder;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.desensitize.core.util.DesensitizeUtil;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.framework.security.core.annotations.PreAuthenticated;
|
||||
@ -140,9 +141,14 @@ public class StoreOrderController {
|
||||
List<StoreOrderDO> list = storeOrderService.getStoreOrderList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<StoreOrderExcelVO> datas = StoreOrderConvert.INSTANCE.convertList02(list);
|
||||
desensitize(datas);
|
||||
ExcelUtils.write(response, "订单.xls", "数据", StoreOrderExcelVO.class, datas);
|
||||
}
|
||||
|
||||
private void desensitize(List<StoreOrderExcelVO> datas) {
|
||||
DesensitizeUtil.mobileDesensitize(datas, "userPhone");
|
||||
}
|
||||
|
||||
@GetMapping("/printOrder")
|
||||
@Operation(summary = "打印电子面单")
|
||||
@Parameters({
|
||||
|
@ -1,13 +1,17 @@
|
||||
package co.yixiang.yshop.module.order.dal.mysql.rechargeorder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo.RechargeOrderExportReqVO;
|
||||
import co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo.RechargeOrderPageReqVO;
|
||||
import co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo.RechargeOrderRespVO;
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.rechargeorder.RechargeOrderDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 充值订单 Mapper
|
||||
@ -20,6 +24,7 @@ public interface RechargeOrderMapper extends BaseMapperX<RechargeOrderDO> {
|
||||
default PageResult<RechargeOrderDO> selectPage(RechargeOrderPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RechargeOrderDO>()
|
||||
.eqIfPresent(RechargeOrderDO::getUserId, reqVO.getUserId())
|
||||
.likeIfPresent(RechargeOrderDO::getId, reqVO.getId())
|
||||
.eqIfPresent(RechargeOrderDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(RechargeOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(RechargeOrderDO::getRechargeAmount, reqVO.getRechargeAmount())
|
||||
@ -39,4 +44,5 @@ public interface RechargeOrderMapper extends BaseMapperX<RechargeOrderDO> {
|
||||
.orderByDesc(RechargeOrderDO::getId));
|
||||
}
|
||||
|
||||
IPage<RechargeOrderRespVO> selectPageVO(IPage<RechargeOrderRespVO> mpPage, @Param("param") RechargeOrderPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public interface RechargeOrderService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 充值订单分页
|
||||
*/
|
||||
PageResult<RechargeOrderDO> getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO);
|
||||
PageResult<RechargeOrderRespVO> getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得充值订单列表, 用于 Excel 导出
|
||||
|
@ -1,27 +1,29 @@
|
||||
package co.yixiang.yshop.module.order.service.rechargeorder;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.mybatis.core.util.MyBatisUtils;
|
||||
import co.yixiang.yshop.module.member.api.user.MemberUserApi;
|
||||
import co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo.*;
|
||||
import co.yixiang.yshop.module.order.convert.rechargeorder.RechargeOrderConvert;
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.rechargeorder.RechargeOrderDO;
|
||||
import co.yixiang.yshop.module.order.dal.mysql.rechargeorder.RechargeOrderMapper;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.PaymentKit;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.WXPayUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo.*;
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.rechargeorder.RechargeOrderDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.order.convert.rechargeorder.RechargeOrderConvert;
|
||||
import co.yixiang.yshop.module.order.dal.mysql.rechargeorder.RechargeOrderMapper;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.order.enums.ErrorCodeConstants.*;
|
||||
import static co.yixiang.yshop.module.order.enums.ErrorCodeConstants.RECHARGE_ORDER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 充值订单 Service 实现类
|
||||
@ -36,6 +38,9 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
||||
@Resource
|
||||
private RechargeOrderMapper rechargeOrderMapper;
|
||||
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
|
||||
@Value("${weixin.certurl}")
|
||||
private String cert_url;
|
||||
|
||||
@ -82,8 +87,23 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RechargeOrderDO> getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO) {
|
||||
return rechargeOrderMapper.selectPage(pageReqVO);
|
||||
public PageResult<RechargeOrderRespVO> getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO) {
|
||||
// PageResult<RechargeOrderRespVO> pageResult =
|
||||
// RechargeOrderConvert.INSTANCE.convertPage(rechargeOrderMapper.selectPage(pageReqVO));
|
||||
// if(CollectionUtils.isNotEmpty(pageResult.getList())){
|
||||
// List<Long> ids =
|
||||
// pageResult.getList().stream().map(RechargeOrderRespVO::getUserId).collect(Collectors.toList());
|
||||
// List<MemberUserRespDTO> users = memberUserApi.getUsers(ids);
|
||||
// Map<Long, String> userMap =
|
||||
// users.stream().collect(Collectors.toMap(MemberUserRespDTO::getId, MemberUserRespDTO::getNickname));
|
||||
// for (RechargeOrderRespVO vo :pageResult.getList()){
|
||||
// vo.setNickname(userMap.get(vo.getUserId()));
|
||||
// }
|
||||
// }
|
||||
// MyBatis Plus 查询
|
||||
IPage<RechargeOrderRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
|
||||
rechargeOrderMapper.selectPageVO(mpPage,pageReqVO);
|
||||
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,4 +9,32 @@
|
||||
文档可见:https://www.yixiang.co/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectPageVO" resultType="co.yixiang.yshop.module.order.controller.admin.rechargeorder.vo.RechargeOrderRespVO">
|
||||
select t1.* ,
|
||||
t2.nickname as nickname
|
||||
from yshop_recharge_order t1
|
||||
left join yshop_user t2
|
||||
on t1.user_id = t2.id
|
||||
where 1 = 1
|
||||
<if test="param.id != null and param.id != ''">
|
||||
and t1.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
and t1.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
and t1.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.createTime != null and param.createTime.length == 2">
|
||||
and t1.create_time between #{param.createTime[0]} and #{param.createTime[1]}
|
||||
</if>
|
||||
<if test="param.packageId != null">
|
||||
and t1.package_id = #{param.packageId}
|
||||
</if>
|
||||
<if test="param.nickname != null and param.nickname != ''">
|
||||
and t2.nickname like concat('%',#{param.nickname},'%')
|
||||
</if>
|
||||
and t1.deleted = 0 and t2.deleted = 0
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<select id="getTrendChart" resultMap="trendChartResultMap">
|
||||
SELECT DATE(create_time) AS 'key', SUM(total_price) AS 'value'
|
||||
FROM yshop_store_order
|
||||
WHERE create_time >= CURDATE() - INTERVAL 7 DAY
|
||||
WHERE paid = 1 and refund_status != 2 and create_time >= CURDATE() - INTERVAL 7 DAY
|
||||
GROUP BY DATE(create_time)
|
||||
</select>
|
||||
|
||||
|
@ -48,14 +48,14 @@ public class CampaignInfoController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建活动信息")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:create')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:create')")
|
||||
public CommonResult<Long> createCampaignInfo(@Valid @RequestBody CampaignInfoCreateReqVO createReqVO) {
|
||||
return success(campaignInfoService.createCampaignInfo(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新活动信息")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:update')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:update')")
|
||||
public CommonResult<Boolean> updateCampaignInfo(@Valid @RequestBody CampaignInfoUpdateReqVO updateReqVO) {
|
||||
campaignInfoService.updateCampaignInfo(updateReqVO);
|
||||
return success(true);
|
||||
@ -64,7 +64,7 @@ public class CampaignInfoController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除活动信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:delete')")
|
||||
public CommonResult<Boolean> deleteCampaignInfo(@RequestParam("id") Long id) {
|
||||
campaignInfoService.deleteCampaignInfo(id);
|
||||
return success(true);
|
||||
@ -73,7 +73,7 @@ public class CampaignInfoController {
|
||||
@GetMapping("/close")
|
||||
@Operation(summary = "结束活动信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:close')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:close')")
|
||||
public CommonResult<Boolean> closeCampaignInfo(@RequestParam("id") Long id) {
|
||||
campaignInfoService.closeCampaignInfo(id);
|
||||
return success(true);
|
||||
@ -82,7 +82,7 @@ public class CampaignInfoController {
|
||||
@GetMapping("/start")
|
||||
@Operation(summary = "开始活动信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:start')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:start')")
|
||||
public CommonResult<Boolean> startCampaignInfo(@RequestParam("id") Long id) {
|
||||
campaignInfoService.startCampaignInfo(id);
|
||||
return success(true);
|
||||
@ -91,21 +91,21 @@ public class CampaignInfoController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得活动信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:query')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:get')")
|
||||
public CommonResult<CampaignInfoRespVO> getCampaignInfo(@RequestParam("id") Long id) {
|
||||
return success(campaignInfoService.getCampaignInfo(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得活动信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:query')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:query')")
|
||||
public CommonResult<PageResult<CampaignInfoPageRespVO>> getCampaignInfoPage(@Valid CampaignInfoPageReqVO pageVO) {
|
||||
return success(campaignInfoService.getCampaignInfoPage(pageVO));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出活动信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:export')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportCampaignInfoExcel(@Valid CampaignInfoExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@ -118,27 +118,28 @@ public class CampaignInfoController {
|
||||
@GetMapping("/data")
|
||||
@Operation(summary = "获得活动数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:data')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:data')")
|
||||
public CommonResult<CampaignDataRespVO> getCampaignData(@RequestParam("id") Long id) {
|
||||
return success(campaignInfoService.getCampaignData(id));
|
||||
}
|
||||
|
||||
@GetMapping("/data-detail")
|
||||
@Operation(summary = "获得活动信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:data-detail')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:data-detail')")
|
||||
public CommonResult<PageResult<CampaignDataDetailRespVO>> getCampaignDataDetail(@Valid CampaignDataDetailPageReqVO pageVO) {
|
||||
return success(campaignInfoService.getCampaignDataDetail(pageVO));
|
||||
}
|
||||
|
||||
@GetMapping("/canvas/page")
|
||||
@Operation(summary = "获得画布活动分页")
|
||||
@PreAuthorize("@ss.hasPermission('yshop:campaign-info:canvas:page')")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:canvas:page')")
|
||||
public CommonResult<PageResult<CanvasCampaignPageRespVO>> getCanvasCampaignPage(@Valid CanvasCampaignPageReqVO pageVO) {
|
||||
return success(campaignInfoService.getCanvasCampaignPage(pageVO));
|
||||
}
|
||||
|
||||
@PostMapping("/canvas/product-page")
|
||||
@Operation(summary = "获得营销活动商品列表")
|
||||
@PreAuthorize("@ss.hasPermission('product:campaign-info:canvas:product-page')")
|
||||
public CommonResult<PageResult<CampaignProductRespVO>> getCampaignProductPage(@RequestBody CampaignProductReqVO reqVO) {
|
||||
return success(appCampaignInfoService.getCampaignProductPage(reqVO));
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import co.yixiang.yshop.module.product.controller.admin.productcoupon.vo.*;
|
||||
import co.yixiang.yshop.module.product.service.productcoupon.ProductCouponService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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.*;
|
||||
|
||||
@ -26,12 +27,14 @@ public class ProductCouponController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建优惠券")
|
||||
@PreAuthorize("@ss.hasPermission('product:coupon:create')")
|
||||
public CommonResult<Long> createCoupon(@Validated @RequestBody ProductCouponCreateReqVO vo) {
|
||||
return success(couponService.createCoupon(vo));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "修改优惠券")
|
||||
@PreAuthorize("@ss.hasPermission('product:coupon:update')")
|
||||
public CommonResult<Boolean> updateCoupon(@Validated @RequestBody ProductCouponUpdateReqVO vo) {
|
||||
couponService.updateCoupon(vo);
|
||||
return success(true);
|
||||
@ -39,24 +42,28 @@ public class ProductCouponController {
|
||||
|
||||
@GetMapping("/detail/{id}")
|
||||
@Operation(summary = "优惠券详情")
|
||||
@PreAuthorize("@ss.hasPermission('product:coupon:detail')")
|
||||
public CommonResult<ProductCouponDetailRespVO> getCouponDetail(@PathVariable Long id) {
|
||||
return success(couponService.getCouponDetail(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "优惠券分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:coupon:query')")
|
||||
public CommonResult<PageResult<ProductCouponDetailRespVO>> getStoreProductPage(@Valid StoreProductCouponPageReqVO pageVO) {
|
||||
return success(couponService.getStoreProductPage(pageVO));
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
@Operation(summary = "删除优惠券")
|
||||
@PreAuthorize("@ss.hasPermission('product:coupon:delete')")
|
||||
public CommonResult<Boolean> deleteCoupon(@PathVariable Long id) {
|
||||
return success(couponService.deleteCoupon(id));
|
||||
}
|
||||
|
||||
@GetMapping("/canvas/page")
|
||||
@Operation(summary = "画布优惠券分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:coupon:canvas:page')")
|
||||
public CommonResult<PageResult<CanvasProductCouponRespVO>> getCanvasProductPage(@Valid CanvasProductCouponPageReqVO pageVO) {
|
||||
return success(couponService.getCanvasProductPage(pageVO));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class TeamworkInfoController {
|
||||
|
||||
@GetMapping("/order-page")
|
||||
@Operation(summary = "获得拼团订单信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:teamwork-info:order-pag')")
|
||||
@PreAuthorize("@ss.hasPermission('product:teamwork-info:order-page')")
|
||||
public CommonResult<PageResult<TeamworkOrderInfoRespVO>> getTeamworkInfoPage(@Valid TeamworkOrderInfoPageReqVO pageVO) {
|
||||
return success(teamworkInfoService.getTeamworkOrderInfoPage(pageVO));
|
||||
}
|
||||
|
@ -560,6 +560,7 @@ public class CampaignInfoServiceImpl implements CampaignInfoService {
|
||||
StoreProductDO updateProduct = updateProductMap.get(detail.getProductId());
|
||||
if (ObjectUtil.isNull(updateProduct)) {
|
||||
StoreProductDO product = productMap.get(detail.getProductId());
|
||||
if (ObjectUtil.isNull(product)) continue;
|
||||
product.setStock(product.getStock() + detail.getStock());
|
||||
updateProductMap.put(detail.getProductId(), product);
|
||||
} else {
|
||||
|
@ -56,7 +56,7 @@
|
||||
inner join yshop_store_product_attr_value as yspav on ycd.sku_id = yspav.id
|
||||
inner join yshop_store_product as ysp on ycd.product_id = ysp.id
|
||||
where
|
||||
yci.state in (1,3) and yci.deleted = 0 and ycd.deleted = 0
|
||||
yci.state in (1,3) and yci.deleted = 0 and ycd.deleted = 0 and ysp.deleted = 0 and ysp.is_show = 1
|
||||
<if test="reqVO.type != null">
|
||||
and yci.type = #{reqVO.type}
|
||||
</if>
|
||||
|
@ -67,7 +67,7 @@ public class PopupController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得弹窗")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('shop:popup:query')")
|
||||
@PreAuthorize("@ss.hasPermission('shop:popup:get')")
|
||||
public CommonResult<PopupRespVO> getPopup(@RequestParam("id") Long id) {
|
||||
PopupDO popup = popupService.getPopup(id);
|
||||
return success(PopupConvert.INSTANCE.convert(popup));
|
||||
@ -76,7 +76,7 @@ public class PopupController {
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得弹窗列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('shop:popup:query')")
|
||||
@PreAuthorize("@ss.hasPermission('shop:popup:list')")
|
||||
public CommonResult<List<PopupRespVO>> getPopupList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<PopupDO> list = popupService.getPopupList(ids);
|
||||
return success(PopupConvert.INSTANCE.convertList(list));
|
||||
|
@ -139,18 +139,20 @@ public class ShopAssistantServiceImpl implements ShopAssistantService {
|
||||
}
|
||||
|
||||
private void fillData(PageResult<ShopAssistantRespVO> resPage) {
|
||||
List<Long> userIds = resPage.getList().stream().map(ShopAssistantRespVO::getUserId).distinct().collect(Collectors.toList());
|
||||
List<Long> storeIds = resPage.getList().stream().map(ShopAssistantRespVO::getStoreId).distinct().collect(Collectors.toList());
|
||||
Map<Long, MemberUserDO> userMap = userService.getUserList(userIds).stream().collect(Collectors.toMap(MemberUserDO::getId, Function.identity()));
|
||||
Map<Long, ShopDO> storeMap = shopService.getShopList(storeIds).stream().collect(Collectors.toMap(ShopDO::getId, Function.identity()));
|
||||
if(resPage.getTotal() > 0){
|
||||
List<Long> userIds = resPage.getList().stream().map(ShopAssistantRespVO::getUserId).distinct().collect(Collectors.toList());
|
||||
List<Long> storeIds = resPage.getList().stream().map(ShopAssistantRespVO::getStoreId).distinct().collect(Collectors.toList());
|
||||
Map<Long, MemberUserDO> userMap = userService.getUserList(userIds).stream().collect(Collectors.toMap(MemberUserDO::getId, Function.identity()));
|
||||
Map<Long, ShopDO> storeMap = shopService.getShopList(storeIds).stream().collect(Collectors.toMap(ShopDO::getId, Function.identity()));
|
||||
|
||||
resPage.getList().forEach(item -> {
|
||||
MemberUserDO user = userMap.getOrDefault(item.getUserId(), new MemberUserDO());
|
||||
ShopDO shop = storeMap.getOrDefault(item.getStoreId(), new ShopDO());
|
||||
item.setAvatar(user.getAvatar());
|
||||
item.setNickname(user.getNickname());
|
||||
item.setStoreName(shop.getStoreName());
|
||||
});
|
||||
resPage.getList().forEach(item -> {
|
||||
MemberUserDO user = userMap.getOrDefault(item.getUserId(), new MemberUserDO());
|
||||
ShopDO shop = storeMap.getOrDefault(item.getStoreId(), new ShopDO());
|
||||
item.setAvatar(user.getAvatar());
|
||||
item.setNickname(user.getNickname());
|
||||
item.setStoreName(shop.getStoreName());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,6 +37,7 @@ public interface ErrorCodeConstants {
|
||||
// ========== 签到记录 ==========
|
||||
ErrorCode SIGN_IN_RECORD_NOT_EXISTS = new ErrorCode(1004009000, "签到记录不存在");
|
||||
ErrorCode TODAY_SIGN_IN_RECORD_EXISTS = new ErrorCode(100409001, "今日已签到");
|
||||
ErrorCode SIGN_IN_CLOSED = new ErrorCode(100409002, "已关闭签到");
|
||||
// ========== 会员等级配置 ==========
|
||||
ErrorCode USER_LEVEL_CONFIG_NOT_EXISTS = new ErrorCode(1004011000, "会员等级配置不存在");
|
||||
// ========== 会员等级权益配置==========
|
||||
|
@ -1,16 +1,11 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.integralrule.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员积分规则 Excel 导出 Request VO,参数和 IntegralRulePageReqVO 是一致的")
|
||||
@ -33,4 +28,7 @@ public class IntegralRuleExportReqVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "是否开启")
|
||||
private Boolean enable;
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.integralrule.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@ -34,4 +33,7 @@ public class IntegralRulePageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "是否开启")
|
||||
private Boolean enable;
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package co.yixiang.yshop.module.member.controller.admin.user;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.desensitize.core.util.DesensitizeUtil;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.*;
|
||||
@ -112,11 +113,17 @@ public class MemberUserController {
|
||||
public void exportMaterialExcel(@Valid UserExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<MemberUserDO> list = userService.getUserList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<MemberUserExcelVO> voList = UserConvert.INSTANCE.convertListExcel(list);
|
||||
desensitize(voList);
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "会员用户.xls", "数据", MemberUserExcelVO.class, voList);
|
||||
}
|
||||
|
||||
private void desensitize(List<MemberUserExcelVO> voList) {
|
||||
DesensitizeUtil.mobileDesensitize(voList, "mobile");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("updateTag")
|
||||
@Operation(summary = "更新用户标签")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:update')")
|
||||
|
@ -58,7 +58,9 @@ public class AppSignInRecordController {
|
||||
@Operation(summary = "每日任务")
|
||||
@PreAuthenticated
|
||||
public CommonResult<List<IntegralRuleRespVO>> integralRule() {
|
||||
List<IntegralRuleDO> list = integralRuleService.getIntegralRuleList(new IntegralRuleExportReqVO());
|
||||
IntegralRuleExportReqVO reqVO = new IntegralRuleExportReqVO();
|
||||
reqVO.setEnable(Boolean.TRUE);
|
||||
List<IntegralRuleDO> list = integralRuleService.getIntegralRuleList(reqVO);
|
||||
return CommonResult.success(IntegralRuleConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ import lombok.*;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class IntegralRuleDO extends BaseDO {
|
||||
|
||||
/**
|
||||
@ -53,4 +51,25 @@ public class IntegralRuleDO extends BaseDO {
|
||||
*/
|
||||
private Boolean enable;
|
||||
|
||||
public IntegralRuleDO() {
|
||||
}
|
||||
|
||||
public IntegralRuleDO(Integer integral) {
|
||||
this.integral = integral;
|
||||
}
|
||||
|
||||
public IntegralRuleDO(Long id, String type, String typeName, Integer integral, String attribute1, String iconUrl, Boolean enable) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.typeName = typeName;
|
||||
this.integral = integral;
|
||||
this.attribute1 = attribute1;
|
||||
this.iconUrl = iconUrl;
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public IntegralRuleDO(Integer integral, Boolean enable) {
|
||||
this.integral = integral;
|
||||
this.enable = enable;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public interface IntegralRuleMapper extends BaseMapperX<IntegralRuleDO> {
|
||||
.likeIfPresent(IntegralRuleDO::getTypeName, reqVO.getTypeName())
|
||||
.eqIfPresent(IntegralRuleDO::getIntegral, reqVO.getIntegral())
|
||||
.eqIfPresent(IntegralRuleDO::getAttribute1, reqVO.getAttribute1())
|
||||
.eqIfPresent(IntegralRuleDO::getEnable, reqVO.getEnable())
|
||||
.betweenIfPresent(IntegralRuleDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(IntegralRuleDO::getId));
|
||||
}
|
||||
@ -35,6 +36,7 @@ public interface IntegralRuleMapper extends BaseMapperX<IntegralRuleDO> {
|
||||
.likeIfPresent(IntegralRuleDO::getTypeName, reqVO.getTypeName())
|
||||
.eqIfPresent(IntegralRuleDO::getIntegral, reqVO.getIntegral())
|
||||
.eqIfPresent(IntegralRuleDO::getAttribute1, reqVO.getAttribute1())
|
||||
.eqIfPresent(IntegralRuleDO::getEnable, reqVO.getEnable())
|
||||
.betweenIfPresent(IntegralRuleDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(IntegralRuleDO::getId));
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class IntegralRuleServiceImpl implements IntegralRuleService {
|
||||
|
||||
@Override
|
||||
public List<IntegralRuleDO> getIntegralRuleByTypes(List<String> typeList) {
|
||||
return integralRuleMapper.selectList(Wrappers.<IntegralRuleDO>lambdaQuery().in(IntegralRuleDO::getType, typeList));
|
||||
return integralRuleMapper.selectList(Wrappers.<IntegralRuleDO>lambdaQuery().in(IntegralRuleDO::getType, typeList).eq(IntegralRuleDO::getEnable,Boolean.TRUE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,8 +41,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.constant.ShopConstants.DAY_FORMAT_STR;
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.SIGN_IN_RECORD_NOT_EXISTS;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.TODAY_SIGN_IN_RECORD_EXISTS;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 签到记录 Service 实现类
|
||||
@ -168,7 +167,7 @@ public class SignInRecordServiceImpl implements SignInRecordService {
|
||||
//查询签到相关积分规则
|
||||
List<IntegralRuleDO> integralRuleList = integralRuleService.getIntegralRuleByTypes(ListUtil.of(BillDetailEnum.SIGN.getValue()));
|
||||
//每日签到规则
|
||||
IntegralRuleDO everydayIntegralRuleDO = integralRuleList.stream().filter(item -> item.getAttribute1().equals("1")).findFirst().get();
|
||||
IntegralRuleDO everydayIntegralRuleDO = integralRuleList.stream().filter(item -> item.getAttribute1().equals("1")).findFirst().orElse(new IntegralRuleDO(0));
|
||||
AtomicInteger predictCount = new AtomicInteger(count);
|
||||
|
||||
List<DateTime> dateTimes = DateUtil.rangeToList(DateUtils.of(startTime), DateUtils.of(endTime), DateField.DAY_OF_WEEK);
|
||||
@ -205,6 +204,9 @@ public class SignInRecordServiceImpl implements SignInRecordService {
|
||||
verifyExistSignInToday(userId);
|
||||
//获取当前签到规则
|
||||
IntegralRuleDO currentIntegralRule = getIntegralRule(userId);
|
||||
if(!currentIntegralRule.getEnable()){
|
||||
throw exception(SIGN_IN_CLOSED);
|
||||
}
|
||||
//领取积分
|
||||
IntegralRuleDTO rule = new IntegralRuleDTO();
|
||||
rule.setUserId(userId);
|
||||
@ -232,7 +234,7 @@ public class SignInRecordServiceImpl implements SignInRecordService {
|
||||
//查询签到相关积分规则
|
||||
List<IntegralRuleDO> integralRuleList = integralRuleService.getIntegralRuleByTypes(ListUtil.of(BillDetailEnum.SIGN.getValue()));
|
||||
//每日签到规则
|
||||
IntegralRuleDO everydayIntegralRuleDO = integralRuleList.stream().filter(item -> item.getAttribute1().equals("1")).findFirst().get();
|
||||
IntegralRuleDO everydayIntegralRuleDO = integralRuleList.stream().filter(item -> item.getAttribute1().equals("1")).findFirst().orElse(new IntegralRuleDO(0,Boolean.FALSE));
|
||||
//当前签到天数
|
||||
Integer count = countByUserIdThisWeek(userId) + 1;
|
||||
//获取当前签到规则
|
||||
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.yshop.module.member.service.userlevelconfig;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
@ -207,8 +208,10 @@ public class UserLevelConfigServiceImpl implements UserLevelConfigService {
|
||||
couponEquityOpt.ifPresent(equity -> {
|
||||
Long couponId = equity.getEquityValue();
|
||||
if (Objects.nonNull(couponId)) {
|
||||
couponApi.receiveCoupon(couponId, userId);
|
||||
log.warn("会员:{},升级:{},发放优惠券:{}", userId, levelId, equity.getEquityValue());
|
||||
ThreadUtil.execute(() -> {
|
||||
couponApi.receiveCoupon(couponId, userId);
|
||||
log.warn("会员:{},升级:{},发放优惠券:{}", userId, levelId, equity.getEquityValue());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -30,6 +30,9 @@
|
||||
<if test="param.pm != null">
|
||||
and t1.pm = #{param.pm}
|
||||
</if>
|
||||
<if test="param.createTime != null and param.createTime.length == 2">
|
||||
and t1.create_time between #{param.createTime[0]} and #{param.createTime[1]}
|
||||
</if>
|
||||
<if test="param.nickname != null and param.nickname != ''">
|
||||
and ( t2.nickname like concat('%',#{param.nickname},'%')
|
||||
or t2.mobile like concat('%',#{param.nickname},'%')
|
||||
|
@ -104,7 +104,7 @@ public class BackupRecordServiceImpl extends ServiceImpl<BackupRecordMapper, Bac
|
||||
log.info("======备份成功=====");
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void revertBackup() {
|
||||
BackupRecordDO backupRecordDO = backupRecordMapper.selectOne(new LambdaQueryWrapper<BackupRecordDO>().orderByDesc(
|
||||
|
Reference in New Issue
Block a user