commit
6cb511ba10
2
DB/version4.2.3to4.2.4.sql
Normal file
2
DB/version4.2.3to4.2.4.sql
Normal file
@ -0,0 +1,2 @@
|
||||
/** 新增已退货数量 **/
|
||||
ALTER TABLE li_order_item ADD return_goods_number int DEFAULT 0 COMMENT '退货数量 ';
|
@ -54,3 +54,11 @@ ALTER TABLE li_goods RENAME COLUMN is_auth TO auth_flag;
|
||||
|
||||
ALTER TABLE li_goods_sku RENAME COLUMN is_promotion TO promotion_flag;
|
||||
ALTER TABLE li_goods_sku RENAME COLUMN is_auth TO auth_flag;
|
||||
|
||||
|
||||
-- 增加会员表索引
|
||||
ALTER TABLE li_member ADD INDEX query_mobile (`mobile`) COMMENT 'query_member';
|
||||
-- 会员签到唯一索引 惠券查询索引
|
||||
ALTER TABLE li_member_sign ADD INDEX query_create_time (`create_time`) COMMENT 'query_create_time';
|
||||
ALTER TABLE li_member_sign ADD INDEX query_member_id (`member_id`) COMMENT 'query_member_id';
|
||||
ALTER TABLE li_member_sign add unique uk_member_day (member_id, create_time) COMMENT 'uk_member_day';
|
@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,分销员接口")
|
||||
@RequestMapping("/buyer/distribution")
|
||||
@RequestMapping("/buyer/distribution/distribution")
|
||||
public class DistributionBuyerController {
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
@ -49,6 +50,7 @@ public class DistributionCashBuyerController {
|
||||
private DistributionCashService distributorCashService;
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "分销员提现")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "price", value = "申请金额", required = true, paramType = "query", dataType = "double")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
@ -29,7 +30,7 @@ import javax.validation.constraints.NotNull;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,分销商品接口")
|
||||
@RequestMapping("/buyer/distributionGoods")
|
||||
@RequestMapping("/buyer/distribution/goods")
|
||||
public class DistributionGoodsBuyerController {
|
||||
|
||||
/**
|
||||
@ -50,6 +51,7 @@ public class DistributionGoodsBuyerController {
|
||||
return ResultUtil.data(distributionGoodsService.goodsPage(distributionGoodsSearchParams));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "选择分销商品")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path"),
|
||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,商品分类接口")
|
||||
@RequestMapping("/buyer/category")
|
||||
@RequestMapping("/buyer/goods/category")
|
||||
public class CategoryBuyerController {
|
||||
/**
|
||||
* 商品分类
|
||||
|
@ -43,7 +43,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Api(tags = "买家端,商品接口")
|
||||
@RestController
|
||||
@RequestMapping("/buyer/goods")
|
||||
@RequestMapping("/buyer/goods/goods")
|
||||
public class GoodsBuyerController {
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,浏览历史接口")
|
||||
@RequestMapping("/buyer/footprint")
|
||||
@RequestMapping("/buyer/member/footprint")
|
||||
public class FootprintController {
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,会员地址接口")
|
||||
@RequestMapping("/buyer/memberAddress")
|
||||
@RequestMapping("/buyer/member/address")
|
||||
public class MemberAddressBuyerController {
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
@ -28,7 +29,7 @@ import javax.validation.constraints.NotNull;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,会员商品评价接口")
|
||||
@RequestMapping("/buyer/memberEvaluation")
|
||||
@RequestMapping("/buyer/member/evaluation")
|
||||
public class MemberEvaluationBuyerController {
|
||||
|
||||
/**
|
||||
@ -37,10 +38,11 @@ public class MemberEvaluationBuyerController {
|
||||
@Autowired
|
||||
private MemberEvaluationService memberEvaluationService;
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "添加会员评价")
|
||||
@PostMapping
|
||||
public ResultMessage<MemberEvaluationDTO> save(@Valid MemberEvaluationDTO memberEvaluationDTO) {
|
||||
return ResultUtil.data(memberEvaluationService.addMemberEvaluation(memberEvaluationDTO));
|
||||
return ResultUtil.data(memberEvaluationService.addMemberEvaluation(memberEvaluationDTO, true));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看会员评价详情")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberSign;
|
||||
@ -27,6 +28,8 @@ public class MemberSignBuyerController {
|
||||
@Autowired
|
||||
private MemberSignService memberSignService;
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@PostMapping
|
||||
@ApiOperation(value = "会员签到")
|
||||
public ResultMessage<Boolean> memberSign() {
|
||||
|
@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,会员站内消息接口")
|
||||
@RequestMapping("/buyer/member/message")
|
||||
@RequestMapping("/buyer/message/member")
|
||||
public class MemberMessageBuyerController {
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -35,7 +36,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,售后管理接口")
|
||||
@RequestMapping("/buyer/afterSale")
|
||||
@RequestMapping("/buyer/order/afterSale")
|
||||
public class AfterSaleBuyerController {
|
||||
|
||||
/**
|
||||
@ -77,6 +78,7 @@ public class AfterSaleBuyerController {
|
||||
return ResultUtil.data(afterSaleService.getAfterSaleVO(sn));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@PostMapping(value = "/save/{orderItemSn}")
|
||||
@ApiImplicitParam(name = "orderItemSn", value = "订单货物编号", required = true, paramType = "query")
|
||||
@ApiOperation(value = "申请售后")
|
||||
@ -101,6 +103,7 @@ public class AfterSaleBuyerController {
|
||||
return ResultUtil.data(afterSaleService.buyerDelivery(afterSaleSn, logisticsNo, logisticsId, mDeliverTime));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "售后,取消售后")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "afterSaleSn", value = "售后sn", required = true, dataType = "String", paramType = "path")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
@ -235,6 +236,7 @@ public class CartController {
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "创建交易")
|
||||
@PostMapping(value = "/create/trade", consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Object> crateTrade(@RequestBody TradeParams tradeParams) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
@ -34,7 +35,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,订单接口")
|
||||
@RequestMapping("/buyer/orders")
|
||||
@RequestMapping("/buyer/order/order")
|
||||
public class OrderBuyerController {
|
||||
|
||||
/**
|
||||
@ -62,6 +63,7 @@ public class OrderBuyerController {
|
||||
return ResultUtil.data(orderDetailVO);
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "确认收货")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, paramType = "path")
|
||||
@ -80,6 +82,7 @@ public class OrderBuyerController {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "取消订单")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path"),
|
||||
@ -91,6 +94,7 @@ public class OrderBuyerController {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "删除订单")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
|
||||
@ -113,6 +117,7 @@ public class OrderBuyerController {
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "开票")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
@ -33,7 +34,7 @@ import java.util.Objects;
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "买家端,交易投诉接口")
|
||||
@RequestMapping("/buyer/complain")
|
||||
@RequestMapping("/buyer/order/complain")
|
||||
public class OrderComplaintBuyerController {
|
||||
|
||||
/**
|
||||
@ -66,6 +67,7 @@ public class OrderComplaintBuyerController {
|
||||
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "添加交易投诉")
|
||||
@PostMapping
|
||||
public ResultMessage<OrderComplaint> add(@Valid OrderComplaintDTO orderComplaintDTO) {
|
||||
@ -85,6 +87,7 @@ public class OrderComplaintBuyerController {
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "取消售后")
|
||||
@ApiImplicitParam(name = "id", value = "投诉单ID", required = true, paramType = "path")
|
||||
@PutMapping(value = "/status/{id}")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -41,6 +42,7 @@ public class ReceiptBuyerController {
|
||||
return ResultUtil.data(this.receiptService.getReceiptData(searchParams, pageVO));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "保存发票信息")
|
||||
@PostMapping
|
||||
public ResultMessage<Receipt> save(@Valid Receipt receipt) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.wallet.entity.dos.Recharge;
|
||||
@ -9,7 +10,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -31,6 +31,7 @@ public class RechargeTradeBuyerController {
|
||||
@Autowired
|
||||
private RechargeService rechargeService;
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@PostMapping
|
||||
@ApiOperation(value = "创建余额充值订单")
|
||||
@ApiImplicitParams({
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,APP版本")
|
||||
@RequestMapping("/buyer/appVersion")
|
||||
@RequestMapping("/buyer/other/appVersion")
|
||||
public class AppVersionBuyerController {
|
||||
|
||||
@Autowired
|
||||
|
@ -29,7 +29,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,文章接口")
|
||||
@RequestMapping("/buyer/article")
|
||||
@RequestMapping("/buyer/other/article")
|
||||
public class ArticleBuyerController {
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -22,7 +23,7 @@ import javax.validation.Valid;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,意见反馈接口")
|
||||
@RequestMapping("/buyer/feedback")
|
||||
@RequestMapping("/buyer/other/feedback")
|
||||
public class FeedbackBuyerController {
|
||||
|
||||
/**
|
||||
@ -31,6 +32,7 @@ public class FeedbackBuyerController {
|
||||
@Autowired
|
||||
private FeedbackService feedbackService;
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "添加意见反馈")
|
||||
@PostMapping()
|
||||
public ResultMessage<Object> save(@Valid Feedback feedback) {
|
||||
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,物流公司接口")
|
||||
@RequestMapping("/buyer/logistics")
|
||||
@RequestMapping("/buyer/other/logistics")
|
||||
public class LogisticsBuyerController {
|
||||
|
||||
@Autowired
|
||||
|
@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,页面接口")
|
||||
@RequestMapping("/buyer/pageData")
|
||||
@RequestMapping("/buyer/other/pageData")
|
||||
public class PageBuyerController {
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.other.purchase;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
@ -29,7 +30,7 @@ import javax.validation.constraints.NotNull;
|
||||
*/
|
||||
@Api(tags = "买家端,采购接口")
|
||||
@RestController
|
||||
@RequestMapping("/buyer/purchase")
|
||||
@RequestMapping("/buyer/other/purchase/purchase")
|
||||
public class PurchaseBuyerController {
|
||||
|
||||
/**
|
||||
@ -48,6 +49,8 @@ public class PurchaseBuyerController {
|
||||
return ResultUtil.data(goodsUnitService.page(PageUtil.initPage(pageVO)));
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "添加采购单")
|
||||
@PostMapping
|
||||
public ResultMessage<PurchaseOrderVO> addPurchaseOrderVO(@RequestBody PurchaseOrderVO purchaseOrderVO) {
|
||||
@ -74,6 +77,7 @@ public class PurchaseBuyerController {
|
||||
return ResultUtil.data(purchaseOrderService.page(purchaseOrderSearchParams));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "关闭采购单")
|
||||
@ApiImplicitParam(name = "id", value = "采购单ID", required = true, dataType = "Long", paramType = "path")
|
||||
@PutMapping("/{id}")
|
||||
|
@ -27,7 +27,7 @@ import java.util.List;
|
||||
*/
|
||||
@Api(tags = "买家端,采购报价接口")
|
||||
@RestController
|
||||
@RequestMapping("/buyer/purchaseQuoted")
|
||||
@RequestMapping("/buyer/other/purchase/purchaseQuoted")
|
||||
public class PurchaseQuotedController {
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ import javax.validation.constraints.NotNull;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,会员接口")
|
||||
@RequestMapping("/buyer/members")
|
||||
@RequestMapping("/buyer/passport/member")
|
||||
public class MemberBuyerController {
|
||||
|
||||
@Autowired
|
||||
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,app/小程序 联合登录")
|
||||
@RequestMapping("/buyer/connect/bind")
|
||||
@RequestMapping("/buyer/passport/connect/bind")
|
||||
public class ConnectBuyerBindController {
|
||||
|
||||
@Autowired
|
||||
|
@ -33,7 +33,7 @@ import java.io.IOException;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "买家端,web联合登录")
|
||||
@RequestMapping("/buyer/connect")
|
||||
@RequestMapping("/buyer/passport/connect/connect")
|
||||
public class ConnectBuyerWebController {
|
||||
|
||||
@Autowired
|
||||
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||
* @since 2021/2/19 09:28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/buyer/mini-program")
|
||||
@RequestMapping("/buyer/passport/connect/miniProgram")
|
||||
@Api(tags = "买家端,小程序登录接口")
|
||||
public class MiniProgramBuyerController {
|
||||
|
||||
|
@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "买家端,收银台接口")
|
||||
@RequestMapping("/buyer/cashier")
|
||||
@RequestMapping("/buyer/payment/cashier")
|
||||
public class CashierController {
|
||||
|
||||
@Autowired
|
||||
|
@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
*/
|
||||
@Api(tags = "买家端,退款回调")
|
||||
@RestController
|
||||
@RequestMapping("/buyer/cashier/refund")
|
||||
@RequestMapping("/buyer/payment/cashierRefund")
|
||||
public class CashierRefundController {
|
||||
|
||||
@Autowired
|
||||
|
@ -31,7 +31,7 @@ import java.util.List;
|
||||
* @since 2020/11/17 2:32 下午
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/buyer/store")
|
||||
@RequestMapping("/buyer/store/store")
|
||||
@Api(tags = "买家端,店铺接口")
|
||||
public class StoreBuyerController {
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.wallet;
|
||||
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -23,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,会员发票接口")
|
||||
@RequestMapping("/buyer/member/receipt")
|
||||
@RequestMapping("/buyer/wallet/receipt")
|
||||
public class MemberReceiptController {
|
||||
|
||||
@Autowired
|
||||
@ -35,6 +36,7 @@ public class MemberReceiptController {
|
||||
return ResultUtil.data(memberReceiptService.getPage(memberReceiptVO, page));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "新增会员发票")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> add(MemberReceiptAddVO memberReceiptAddVO) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.controller.wallet;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
@ -34,7 +35,7 @@ import javax.validation.constraints.Pattern;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,会员余额接口")
|
||||
@RequestMapping("/buyer/members/wallet")
|
||||
@RequestMapping("/buyer/wallet/wallet")
|
||||
public class MemberWalletBuyerController {
|
||||
|
||||
/**
|
||||
@ -120,6 +121,7 @@ public class MemberWalletBuyerController {
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@PostMapping(value = "/withdrawal")
|
||||
@ApiOperation(value = "会员中心余额提现")
|
||||
@ApiImplicitParams({
|
||||
|
@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -24,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,预存款充值记录接口")
|
||||
@RequestMapping("/buyer/member/recharge")
|
||||
@RequestMapping("/buyer/wallet/recharge")
|
||||
public class RechargeBuyerController {
|
||||
|
||||
@Autowired
|
||||
|
@ -128,21 +128,22 @@ ignored:
|
||||
- /MP_verify_qSyvBPhDsPdxvOhC.txt
|
||||
- /weixin/**
|
||||
- /source/**
|
||||
- /buyer/mini-program/**
|
||||
- /buyer/cashier/**
|
||||
- /buyer/pageData/**
|
||||
- /buyer/article/**
|
||||
- /buyer/payment/cashier/**
|
||||
- /buyer/payment/cashierRefund/**
|
||||
- /buyer/other/pageData/**
|
||||
- /buyer/other/article/**
|
||||
- /buyer/goods/**
|
||||
- /buyer/category/**
|
||||
- /buyer/store/**
|
||||
- /buyer/connect/**
|
||||
- /buyer/passport/connect/**
|
||||
- /buyer/members/**
|
||||
- /buyer/passport/member/**
|
||||
- /buyer/promotion/pintuan/**
|
||||
- /buyer/promotion/seckill/**
|
||||
- /buyer/promotion/pointsGoods/**
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /buyer/appVersion/**
|
||||
- /buyer/promotion/coupon
|
||||
- /buyer/member/evaluation/**/goodsEvaluation
|
||||
- /buyer/member/evaluation/**/evaluationNumber
|
||||
- /buyer/other/appVersion/**
|
||||
- /buyer/broadcast/studio/**
|
||||
- /druid/**
|
||||
- /swagger-ui.html
|
||||
@ -183,7 +184,7 @@ logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
root: error
|
||||
root: info
|
||||
# org.springframework: debug
|
||||
file:
|
||||
# 指定路径
|
||||
|
@ -30,8 +30,8 @@ import java.util.List;
|
||||
* @since 2020/11/26 15:41
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "文件管理管理接口")
|
||||
@RequestMapping("/common/file")
|
||||
@Api(tags = "文件管理接口")
|
||||
@RequestMapping("/common/common/file")
|
||||
public class FileController {
|
||||
|
||||
@Autowired
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* 2021-09-16 15:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common/IM")
|
||||
@RequestMapping("/common/common/IM")
|
||||
@Api(tags = "IM 中心")
|
||||
public class IMController {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.lili.controller.common;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.utils.IpHelper;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "获取IP信息以及天气")
|
||||
@RequestMapping("/common/ip")
|
||||
@RequestMapping("/common/common/ip")
|
||||
public class IpInfoManagerController {
|
||||
@Autowired
|
||||
private IpHelper ipHelper;
|
||||
@ -28,6 +28,7 @@ public class IpInfoManagerController {
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "IP及天气相关信息")
|
||||
public ResultMessage<Object> upload(HttpServletRequest request) {
|
||||
|
||||
String result = ipHelper.getIpCity(request);
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2020/11/26 15:41
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "文件管理管理接口")
|
||||
@RequestMapping("/common/logo")
|
||||
@Api(tags = "文件管理接口")
|
||||
@RequestMapping("/common/common/logo")
|
||||
public class LogoController {
|
||||
|
||||
@Autowired
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "地址信息接口")
|
||||
@RequestMapping("/common/region")
|
||||
@RequestMapping("/common/common/region")
|
||||
public class RegionController {
|
||||
|
||||
@Autowired
|
||||
|
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/common/slider")
|
||||
@RequestMapping("/common/common/slider")
|
||||
@Api(tags = "滑块验证码接口")
|
||||
public class SliderImageController {
|
||||
|
||||
|
@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "短信验证码接口")
|
||||
@RequestMapping("/common/sms")
|
||||
@RequestMapping("/common/common/sms")
|
||||
public class SmsController {
|
||||
|
||||
@Autowired
|
||||
|
@ -5,7 +5,6 @@ import cn.lili.cache.Cache;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.properties.SystemSettingProperties;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
@ -40,7 +39,7 @@ import java.util.Objects;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "文件上传接口")
|
||||
@RequestMapping("/common/upload")
|
||||
@RequestMapping("/common/common/upload")
|
||||
public class UploadController {
|
||||
|
||||
@Autowired
|
||||
|
@ -119,24 +119,8 @@ ignored:
|
||||
- /MP_verify_qSyvBPhDsPdxvOhC.txt
|
||||
- /weixin/**
|
||||
- /source/**
|
||||
- /buyer/mini-program/**
|
||||
- /buyer/cashier/**
|
||||
- /buyer/pageData/**
|
||||
- /buyer/article/**
|
||||
- /buyer/goods/**
|
||||
- /buyer/category/**
|
||||
- /buyer/shop/**
|
||||
- /buyer/connect/**
|
||||
- /buyer/members/smsLogin
|
||||
- /buyer/members/refresh/*
|
||||
- /buyer/members/refresh**
|
||||
- /buyer/promotion/pintuan
|
||||
- /buyer/promotion/seckill
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /store/login/**
|
||||
- /manager/user/login
|
||||
- /manager/user/refresh/**
|
||||
- /common/common/slider/**
|
||||
- /common/common/sms/**
|
||||
- /druid/**
|
||||
- /swagger-ui.html
|
||||
- /doc.html
|
||||
@ -176,7 +160,7 @@ logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
root: error
|
||||
root: info
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
file:
|
||||
|
@ -183,7 +183,7 @@ mybatis-plus:
|
||||
logging:
|
||||
# 输出级别
|
||||
level:
|
||||
root: error
|
||||
root: info
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
# org.springframework.data.mongodb.core: debug
|
||||
|
@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -79,6 +80,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||
private PointsGoodsService pointsGoodsService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void orderChange(OrderMessage orderMessage) {
|
||||
|
||||
switch (orderMessage.getNewStatus()) {
|
||||
@ -154,14 +156,11 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||
* @param stocks
|
||||
*/
|
||||
private void checkStocks(List<Integer> stocks, OrderDetailVO order) {
|
||||
for (int i = 0; i < stocks.size(); i++) {
|
||||
if (null == stocks.get(i)) {
|
||||
initSkuCache(order.getOrderItems());
|
||||
initPromotionCache(order.getOrderItems());
|
||||
return;
|
||||
}
|
||||
|
||||
if (order.getOrderItems().size() == stocks.size()) {
|
||||
return;
|
||||
}
|
||||
initSkuCache(order.getOrderItems());
|
||||
initPromotionCache(order.getOrderItems());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,7 +146,7 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
memberEvaluationDTO.setDescriptionScore(5);
|
||||
memberEvaluationDTO.setServiceScore(5);
|
||||
|
||||
memberEvaluationService.addMemberEvaluation(memberEvaluationDTO);
|
||||
memberEvaluationService.addMemberEvaluation(memberEvaluationDTO, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,9 @@ public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
private void addSeckill() {
|
||||
Setting setting = settingService.get(SettingEnum.SECKILL_SETTING.name());
|
||||
SeckillSetting seckillSetting = new Gson().fromJson(setting.getSettingValue(), SeckillSetting.class);
|
||||
Seckill seckill = new Seckill(SeckillService.PRE_CREATION, seckillSetting.getHours(), seckillSetting.getSeckillRule());
|
||||
seckillService.savePromotions(seckill);
|
||||
for (int i = 1; i <= SeckillService.PRE_CREATION; i++) {
|
||||
Seckill seckill = new Seckill(i, seckillSetting.getHours(), seckillSetting.getSeckillRule());
|
||||
seckillService.savePromotions(seckill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
root: error
|
||||
root: info
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
file:
|
||||
|
@ -35,6 +35,12 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -72,6 +78,10 @@
|
||||
<artifactId>HdrHistogram</artifactId>
|
||||
<groupId>org.hdrhistogram</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -81,6 +91,12 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-redis</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@ -96,29 +112,40 @@
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql-connector-version}</version>
|
||||
</dependency>
|
||||
<!-- Redis-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- Swagger API文档 -->
|
||||
<!-- https://mvnrepository.com/artifact/org.redisson/redisson-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson</artifactId>
|
||||
<version>${redisson}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Hutool工具包 -->
|
||||
<dependency>
|
||||
@ -148,6 +175,12 @@
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>${aliyun-version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 阿里云OSS -->
|
||||
<dependency>
|
||||
@ -171,6 +204,10 @@
|
||||
<artifactId>org.jacoco.agent</artifactId>
|
||||
<groupId>org.jacoco</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--脚本编程-->
|
||||
@ -188,6 +225,10 @@
|
||||
<artifactId>fastjson</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- token加密 -->
|
||||
@ -212,6 +253,12 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 解决版本提示问题 -->
|
||||
@ -241,6 +288,14 @@
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
<groupId>org.antlr</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
@ -248,6 +303,12 @@
|
||||
<groupId>org.apache.shardingsphere</groupId>
|
||||
<artifactId>sharding-jdbc-spring-namespace</artifactId>
|
||||
<version>${sharding-jdbc-version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--druid-->
|
||||
<dependency>
|
||||
@ -307,11 +368,6 @@
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>${logstash-logback-encoder}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>javax.interceptor</groupId>-->
|
||||
<!-- <artifactId>javax.interceptor-api</artifactId>-->
|
||||
<!-- <version>${interceptor-api}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
|
@ -1,9 +1,17 @@
|
||||
package cn.lili.cache.config.redis;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.redisson.Redisson;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.config.ClusterServersConfig;
|
||||
import org.redisson.config.Config;
|
||||
import org.redisson.config.SentinelServersConfig;
|
||||
import org.redisson.config.SingleServerConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@ -28,7 +36,9 @@ import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -49,6 +59,9 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||
@Value("${lili.cache.timeout:7200}")
|
||||
private Integer timeout;
|
||||
|
||||
@Autowired
|
||||
private RedisProperties redisProperties;
|
||||
|
||||
|
||||
/**
|
||||
* 当有多个管理器的时候,必须使用该注解在一个管理器上注释:表示该管理器为默认的管理器
|
||||
@ -99,6 +112,44 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
public RedissonClient redisson() {
|
||||
Config config = new Config();
|
||||
|
||||
if (redisProperties.getSentinel() != null && !redisProperties.getSentinel().getNodes().isEmpty()) {
|
||||
// 哨兵模式
|
||||
SentinelServersConfig sentinelServersConfig = config.useSentinelServers();
|
||||
sentinelServersConfig.setMasterName(redisProperties.getSentinel().getMaster());
|
||||
List<String> sentinelAddress = new ArrayList<>();
|
||||
for (String node : redisProperties.getCluster().getNodes()) {
|
||||
sentinelAddress.add("redis://" + node);
|
||||
}
|
||||
sentinelServersConfig.setSentinelAddresses(sentinelAddress);
|
||||
if (CharSequenceUtil.isNotEmpty(redisProperties.getSentinel().getPassword())) {
|
||||
sentinelServersConfig.setSentinelPassword(redisProperties.getSentinel().getPassword());
|
||||
}
|
||||
} else if (redisProperties.getCluster() != null && !redisProperties.getCluster().getNodes().isEmpty()) {
|
||||
// 集群模式
|
||||
ClusterServersConfig clusterServersConfig = config.useClusterServers();
|
||||
List<String> clusterNodes = new ArrayList<>();
|
||||
for (String node : redisProperties.getCluster().getNodes()) {
|
||||
clusterNodes.add("redis://" + node);
|
||||
}
|
||||
clusterServersConfig.setNodeAddresses(clusterNodes);
|
||||
if (CharSequenceUtil.isNotEmpty(redisProperties.getPassword())) {
|
||||
clusterServersConfig.setPassword(redisProperties.getPassword());
|
||||
}
|
||||
} else {
|
||||
SingleServerConfig singleServerConfig = config.useSingleServer();
|
||||
singleServerConfig.setAddress("redis://" + redisProperties.getHost() + ":" + redisProperties.getPort());
|
||||
if (CharSequenceUtil.isNotEmpty(redisProperties.getPassword())) {
|
||||
singleServerConfig.setPassword(redisProperties.getPassword());
|
||||
}
|
||||
}
|
||||
|
||||
return Redisson.create(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义缓存key生成策略,默认将使用该策略
|
||||
*/
|
||||
|
@ -1,9 +1,10 @@
|
||||
package cn.lili.cache.limit.interceptor;
|
||||
|
||||
import cn.lili.cache.limit.enums.LimitTypeEnums;
|
||||
import cn.lili.cache.limit.annotation.LimitPoint;
|
||||
import cn.lili.cache.limit.enums.LimitTypeEnums;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.IpUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -16,7 +17,6 @@ import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -54,7 +54,8 @@ public class LimitInterceptor {
|
||||
key = limitPointAnnotation.key();
|
||||
break;
|
||||
default:
|
||||
key = limitPointAnnotation.key() + getIpAddress();
|
||||
key = limitPointAnnotation.key() + IpUtils
|
||||
.getIpAddress(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
}
|
||||
ImmutableList<String> keys = ImmutableList.of(StringUtils.join(limitPointAnnotation.prefix(), key));
|
||||
try {
|
||||
@ -71,32 +72,8 @@ public class LimitInterceptor {
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("服务器异常,请稍后再试");
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 默认unknown常量值
|
||||
*/
|
||||
private static final String UNKNOWN = "unknown";
|
||||
|
||||
/**
|
||||
* 获取ip
|
||||
* @return ip
|
||||
*/
|
||||
public String getIpAddress() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@ import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 演示站点注解
|
||||
* <p>
|
||||
* PS 此注解需要用户登录之后才可以使用
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/7/9 1:40 上午
|
||||
|
@ -0,0 +1,24 @@
|
||||
package cn.lili.common.aop.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 防止重复提交注解
|
||||
*
|
||||
* @author liushuai(liushuai711 @ gmail.com)
|
||||
* @version v4.0
|
||||
* @Description:
|
||||
* @since 2022/1/25 09:17
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
public @interface PreventDuplicateSubmissions {
|
||||
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
long expire() default 3;
|
||||
}
|
@ -26,7 +26,7 @@ public class DemoInterceptor {
|
||||
|
||||
@Before("@annotation(demoSite)")
|
||||
public void doAfter(DemoSite demoSite) {
|
||||
if (systemSettingProperties.getIsDemoSite()) {
|
||||
if (Boolean.TRUE.equals(systemSettingProperties.getIsDemoSite())) {
|
||||
throw new ServiceException(ResultCode.DEMO_SITE_EXCEPTION);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,67 @@
|
||||
package cn.lili.common.aop.interceptor;
|
||||
|
||||
/**
|
||||
* 防重复提交业务
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2022-01-25 09:20
|
||||
*/
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PreventDuplicateSubmissionsInterceptor {
|
||||
|
||||
@Autowired
|
||||
private Cache<String> cache;
|
||||
|
||||
|
||||
@Before("@annotation(preventDuplicateSubmissions)")
|
||||
public void interceptor(PreventDuplicateSubmissions preventDuplicateSubmissions) {
|
||||
|
||||
try {
|
||||
Long count = cache.incr(getParams(), preventDuplicateSubmissions.expire());
|
||||
//如果超过1或者设置的参数,则表示重复提交了
|
||||
if (count.intValue() >= preventDuplicateSubmissions.expire()) {
|
||||
throw new ServiceException(ResultCode.LIMIT_ERROR);
|
||||
}
|
||||
}
|
||||
//如果参数为空,则表示用户未登录,直接略过,不做处理
|
||||
catch (NullPointerException e) {
|
||||
return;
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getParams() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
//请求地址
|
||||
return request.getRequestURI() + UserContext.getCurrentUser().getId() + UserContext.getCurrentUser().getUsername();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -45,8 +45,7 @@ public class UserContext {
|
||||
public static String getUuid() {
|
||||
if (RequestContextHolder.getRequestAttributes() != null) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String uuid = request.getHeader(SecurityEnum.UUID.getValue());
|
||||
return uuid;
|
||||
return request.getHeader(SecurityEnum.UUID.getValue());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,15 +1,11 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* SnowflakeInitiator
|
||||
@ -25,7 +21,7 @@ public class SnowflakeInitiator {
|
||||
/**
|
||||
* 缓存前缀
|
||||
*/
|
||||
private static String KEY = "{Snowflake}";
|
||||
private static final String KEY = "{Snowflake}";
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.modules.connect.serviceimpl;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
@ -13,7 +14,6 @@ import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.utils.CookieUtil;
|
||||
import cn.lili.common.utils.HttpUtils;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.modules.connect.entity.Connect;
|
||||
import cn.lili.modules.connect.entity.dto.ConnectAuthUser;
|
||||
import cn.lili.modules.connect.entity.dto.WechatMPLoginParams;
|
||||
@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
@ -55,6 +56,7 @@ import java.util.concurrent.TimeUnit;
|
||||
@Service
|
||||
public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> implements ConnectService {
|
||||
|
||||
static final boolean AUTO_REGION = true;
|
||||
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
@ -65,10 +67,8 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
static boolean AUTO_REGION = true;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Token unionLoginCallback(String type, String unionid, String uuid, boolean longTerm) throws NoPermissionException {
|
||||
|
||||
try {
|
||||
@ -94,6 +94,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Token unionLoginCallback(String type, ConnectAuthUser authUser, String uuid) {
|
||||
|
||||
Token token;
|
||||
@ -126,6 +127,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unbind(String type) {
|
||||
|
||||
LambdaQueryWrapper<Connect> queryWrapper = new LambdaQueryWrapper<>();
|
||||
@ -142,13 +144,12 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
queryWrapper.eq(Connect::getUserId, UserContext.getCurrentUser().getId());
|
||||
List<Connect> connects = this.list(queryWrapper);
|
||||
List<String> keys = new ArrayList<>();
|
||||
connects.forEach(item -> {
|
||||
keys.add(item.getUnionType());
|
||||
});
|
||||
connects.forEach(item -> keys.add(item.getUnionType()));
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Token appLoginCallback(ConnectAuthUser authUser, String uuid) {
|
||||
try {
|
||||
return this.unionLoginCallback(authUser.getSource(), authUser.getUuid(), uuid, true);
|
||||
@ -209,6 +210,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
* @param unionId 微信unionid
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Token phoneMpBindAndLogin(String sessionKey, WechatMPLoginParams params, String openId, String unionId) {
|
||||
String encryptedData = params.getEncryptedData(), iv = params.getIv();
|
||||
JSONObject userInfo = this.getUserInfo(encryptedData, sessionKey, iv);
|
||||
@ -237,9 +239,9 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
public Connect queryConnect(ConnectQueryDTO connectQueryDTO) {
|
||||
|
||||
LambdaQueryWrapper<Connect> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(connectQueryDTO.getUserId()), Connect::getUserId, connectQueryDTO.getUserId())
|
||||
.eq(StringUtils.isNotEmpty(connectQueryDTO.getUnionType()), Connect::getUnionType, connectQueryDTO.getUnionType())
|
||||
.eq(StringUtils.isNotEmpty(connectQueryDTO.getUnionId()), Connect::getUnionId, connectQueryDTO.getUnionId());
|
||||
queryWrapper.eq(CharSequenceUtil.isNotEmpty(connectQueryDTO.getUserId()), Connect::getUserId, connectQueryDTO.getUserId())
|
||||
.eq(CharSequenceUtil.isNotEmpty(connectQueryDTO.getUnionType()), Connect::getUnionType, connectQueryDTO.getUnionType())
|
||||
.eq(CharSequenceUtil.isNotEmpty(connectQueryDTO.getUnionId()), Connect::getUnionId, connectQueryDTO.getUnionId());
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@ -258,7 +260,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
|
||||
|
||||
//如果unionid 不为空 则为账号绑定unionid
|
||||
if (StringUtils.isNotEmpty(unionId)) {
|
||||
if (CharSequenceUtil.isNotEmpty(unionId)) {
|
||||
LambdaQueryWrapper<Connect> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.eq(Connect::getUnionId, unionId);
|
||||
lambdaQueryWrapper.eq(Connect::getUnionType, ConnectEnum.WECHAT.name());
|
||||
@ -271,12 +273,12 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
this.save(connect);
|
||||
}
|
||||
}//如果openid 不为空 则为账号绑定openid
|
||||
if (StringUtils.isNotEmpty(openId)) {
|
||||
if (CharSequenceUtil.isNotEmpty(openId)) {
|
||||
LambdaQueryWrapper<Connect> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.eq(Connect::getUnionId, openId);
|
||||
lambdaQueryWrapper.eq(Connect::getUnionType, ConnectEnum.WECHAT_MP_OPEN_ID.name());
|
||||
List<Connect> connects = this.list(lambdaQueryWrapper);
|
||||
if (connects.size() == 0) {
|
||||
if (connects.isEmpty()) {
|
||||
Connect connect = new Connect();
|
||||
connect.setUnionId(openId);
|
||||
connect.setUserId(member.getId());
|
||||
@ -290,7 +292,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
/**
|
||||
* 获取微信小程序配置
|
||||
*
|
||||
* @return
|
||||
* @return 微信小程序配置
|
||||
*/
|
||||
private WechatConnectSettingItem getWechatMPSetting() {
|
||||
Setting setting = settingService.get(SettingEnum.WECHAT_CONNECT.name());
|
||||
|
@ -3,22 +3,22 @@ package cn.lili.modules.connect.util;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.properties.ApiProperties;
|
||||
import cn.lili.common.properties.DomainProperties;
|
||||
import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.connect.config.AuthConfig;
|
||||
import cn.lili.modules.connect.config.ConnectAuthEnum;
|
||||
import cn.lili.modules.connect.entity.dto.AuthCallback;
|
||||
import cn.lili.modules.connect.entity.dto.AuthResponse;
|
||||
import cn.lili.modules.connect.entity.dto.ConnectAuthUser;
|
||||
import cn.lili.modules.connect.exception.AuthException;
|
||||
import cn.lili.modules.connect.request.BaseAuthQQRequest;
|
||||
import cn.lili.modules.connect.request.AuthRequest;
|
||||
import cn.lili.modules.connect.request.BaseAuthQQRequest;
|
||||
import cn.lili.modules.connect.request.BaseAuthWeChatPCRequest;
|
||||
import cn.lili.modules.connect.request.BaseAuthWeChatRequest;
|
||||
import cn.lili.modules.connect.service.ConnectService;
|
||||
@ -62,7 +62,7 @@ public class ConnectUtil {
|
||||
private DomainProperties domainProperties;
|
||||
|
||||
|
||||
static String prefix = "/buyer/connect/callback/";
|
||||
static String prefix = "/buyer/passport/connect/connect/callback/";
|
||||
|
||||
/**
|
||||
* 回调地址获取
|
||||
|
@ -57,6 +57,7 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean cash(Double applyMoney) {
|
||||
|
||||
//检查分销功能开关
|
||||
@ -75,7 +76,7 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
distributionService.updateById(distribution);
|
||||
//提现申请记录
|
||||
DistributionCash distributionCash = new DistributionCash("D" + SnowFlake.getId(), distribution.getId(), applyMoney, distribution.getMemberName());
|
||||
Boolean result = this.save(distributionCash);
|
||||
boolean result = this.save(distributionCash);
|
||||
if (result) {
|
||||
//发送提现消息
|
||||
MemberWithdrawalMessage memberWithdrawalMessage = new MemberWithdrawalMessage();
|
||||
@ -109,6 +110,7 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DistributionCash audit(String id, String result) {
|
||||
|
||||
//检查分销功能开关
|
||||
@ -120,7 +122,7 @@ public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMap
|
||||
if (distributorCash != null) {
|
||||
//获取分销员
|
||||
Distribution distribution = distributionService.getById(distributorCash.getDistributionId());
|
||||
if (distribution != null && distributorCash != null && distribution.getDistributionStatus().equals(DistributionStatusEnum.PASS.name())) {
|
||||
if (distribution != null && distribution.getDistributionStatus().equals(DistributionStatusEnum.PASS.name())) {
|
||||
MemberWithdrawalMessage memberWithdrawalMessage = new MemberWithdrawalMessage();
|
||||
//审核通过
|
||||
if (result.equals(WithdrawStatusEnum.VIA_AUDITING.name())) {
|
||||
|
@ -21,7 +21,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -79,6 +79,7 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
||||
* @param orderSn 订单编号
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void calculationDistribution(String orderSn) {
|
||||
|
||||
//根据订单编号获取订单数据
|
||||
@ -148,6 +149,7 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
||||
* @param orderSn 订单编号
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelOrder(String orderSn) {
|
||||
//根据订单编号获取订单数据
|
||||
Order order = orderService.getBySn(orderSn);
|
||||
|
@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 分销选择商品接口实现
|
||||
|
@ -7,7 +7,6 @@ import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.distribution.entity.dos.Distribution;
|
||||
import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO;
|
||||
@ -21,6 +20,7 @@ import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.DistributionSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -69,6 +69,7 @@ public class DistributionServiceImpl extends ServiceImpl<DistributionMapper, Dis
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Distribution applyDistribution(DistributionApplyDTO distributionApplyDTO) {
|
||||
|
||||
//检查分销开关
|
||||
@ -173,7 +174,7 @@ public class DistributionServiceImpl extends ServiceImpl<DistributionMapper, Dis
|
||||
//获取分销是否开启
|
||||
Setting setting = settingService.get(SettingEnum.DISTRIBUTION_SETTING.name());
|
||||
DistributionSetting distributionSetting = JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class);
|
||||
if (!distributionSetting.getIsOpen()) {
|
||||
if (Boolean.FALSE.equals(distributionSetting.getIsOpen())) {
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_CLOSE);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
package cn.lili.modules.file.serviceimpl;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.file.entity.File;
|
||||
@ -12,12 +11,12 @@ import cn.lili.modules.file.entity.dto.FileOwnerDTO;
|
||||
import cn.lili.modules.file.mapper.FileMapper;
|
||||
import cn.lili.modules.file.plugin.FileManagerPlugin;
|
||||
import cn.lili.modules.file.service.FileService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -37,7 +36,7 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements Fi
|
||||
@Override
|
||||
public void batchDelete(List<String> ids) {
|
||||
|
||||
LambdaQueryWrapper<File> queryWrapper = new LambdaQueryWrapper();
|
||||
LambdaQueryWrapper<File> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(File::getId, ids);
|
||||
|
||||
List<File> files = this.list(queryWrapper);
|
||||
@ -49,7 +48,7 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements Fi
|
||||
|
||||
@Override
|
||||
public void batchDelete(List<String> ids, AuthUser authUser) {
|
||||
LambdaQueryWrapper<File> queryWrapper = new LambdaQueryWrapper();
|
||||
LambdaQueryWrapper<File> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(File::getId, ids);
|
||||
|
||||
queryWrapper.eq(File::getUserEnums, authUser.getRole().name());
|
||||
@ -76,26 +75,24 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements Fi
|
||||
@Override
|
||||
public IPage<File> customerPage(File file, SearchVO searchVO, PageVO pageVo) {
|
||||
LambdaQueryWrapper<File> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(file.getName()), File::getName, file.getName())
|
||||
.like(StringUtils.isNotEmpty(file.getFileKey()), File::getFileKey, file.getFileKey())
|
||||
.like(StringUtils.isNotEmpty(file.getFileType()), File::getFileType, file.getFileType())
|
||||
.between(StringUtils.isNotEmpty(searchVO.getStartDate()) && StringUtils.isNotEmpty(searchVO.getEndDate()),
|
||||
queryWrapper.like(CharSequenceUtil.isNotEmpty(file.getName()), File::getName, file.getName())
|
||||
.like(CharSequenceUtil.isNotEmpty(file.getFileKey()), File::getFileKey, file.getFileKey())
|
||||
.like(CharSequenceUtil.isNotEmpty(file.getFileType()), File::getFileType, file.getFileType())
|
||||
.between(CharSequenceUtil.isNotEmpty(searchVO.getStartDate()) && CharSequenceUtil.isNotEmpty(searchVO.getEndDate()),
|
||||
File::getCreateTime, searchVO.getStartDate(), searchVO.getEndDate());
|
||||
IPage<File> page = this.page(PageUtil.initPage(pageVo), queryWrapper);
|
||||
return page;
|
||||
return this.page(PageUtil.initPage(pageVo), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<File> customerPageOwner(FileOwnerDTO ownerDTO, File file, SearchVO searchVO, PageVO pageVo) {
|
||||
LambdaQueryWrapper<File> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(ownerDTO.getOwnerId()), File::getOwnerId, ownerDTO.getOwnerId())
|
||||
queryWrapper.eq(CharSequenceUtil.isNotEmpty(ownerDTO.getOwnerId()), File::getOwnerId, ownerDTO.getOwnerId())
|
||||
.eq(File::getUserEnums, ownerDTO.getUserEnums())
|
||||
.like(StringUtils.isNotEmpty(file.getName()), File::getName, file.getName())
|
||||
.like(StringUtils.isNotEmpty(file.getFileKey()), File::getFileKey, file.getFileKey())
|
||||
.like(StringUtils.isNotEmpty(file.getFileType()), File::getFileType, file.getFileType())
|
||||
.between(StringUtils.isNotEmpty(searchVO.getStartDate()) && StringUtils.isNotEmpty(searchVO.getEndDate()),
|
||||
.like(CharSequenceUtil.isNotEmpty(file.getName()), File::getName, file.getName())
|
||||
.like(CharSequenceUtil.isNotEmpty(file.getFileKey()), File::getFileKey, file.getFileKey())
|
||||
.like(CharSequenceUtil.isNotEmpty(file.getFileType()), File::getFileType, file.getFileType())
|
||||
.between(CharSequenceUtil.isNotEmpty(searchVO.getStartDate()) && CharSequenceUtil.isNotEmpty(searchVO.getEndDate()),
|
||||
File::getCreateTime, searchVO.getStartDate(), searchVO.getEndDate());
|
||||
IPage<File> page = this.page(PageUtil.initPage(pageVo), queryWrapper);
|
||||
return page;
|
||||
return this.page(PageUtil.initPage(pageVo), queryWrapper);
|
||||
}
|
||||
}
|
@ -8,7 +8,6 @@ import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -110,7 +109,7 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
|
||||
/**
|
||||
* 校验绑定关系
|
||||
*
|
||||
* @param brandIds
|
||||
* @param brandIds 品牌Ids
|
||||
*/
|
||||
private void checkBind(List<String> brandIds) {
|
||||
//分了绑定关系查询
|
||||
@ -130,19 +129,11 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验绑定关系
|
||||
*
|
||||
* @param brandIds
|
||||
*/
|
||||
private void checkoutGoods(List<String> brandIds) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否存在
|
||||
*
|
||||
* @param brandId
|
||||
* @return
|
||||
* @param brandId 品牌ID
|
||||
* @return 品牌
|
||||
*/
|
||||
private Brand checkExist(String brandId) {
|
||||
Brand brand = getById(brandId);
|
||||
|
@ -38,6 +38,7 @@ public class CategoryBrandServiceImpl extends ServiceImpl<CategoryBrandMapper, C
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveCategoryBrandList(String categoryId, List<String> brandIds) {
|
||||
//删除分类品牌绑定信息
|
||||
this.deleteByCategoryId(categoryId);
|
||||
|
@ -3,7 +3,6 @@ package cn.lili.modules.goods.serviceimpl;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
||||
import cn.lili.modules.goods.entity.dos.Goods;
|
||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
||||
@ -17,7 +16,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -47,12 +45,6 @@ public class CategoryParameterGroupServiceImpl extends ServiceImpl<CategoryParam
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
@Override
|
||||
public List<ParameterGroupVO> getCategoryParams(String categoryId) {
|
||||
//根据id查询参数组
|
||||
@ -75,6 +67,7 @@ public class CategoryParameterGroupServiceImpl extends ServiceImpl<CategoryParam
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateCategoryGroup(CategoryParameterGroup categoryParameterGroup) {
|
||||
CategoryParameterGroup origin = this.getById(categoryParameterGroup.getId());
|
||||
if (origin == null) {
|
||||
|
@ -6,10 +6,7 @@ import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.goods.entity.dos.Category;
|
||||
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
||||
import cn.lili.modules.goods.entity.vos.CategoryVO;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsParamsVO;
|
||||
import cn.lili.modules.goods.mapper.CategoryMapper;
|
||||
import cn.lili.modules.goods.service.CategoryBrandService;
|
||||
import cn.lili.modules.goods.service.CategoryParameterGroupService;
|
||||
@ -25,7 +22,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -199,6 +199,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean saveCategory(Category category) {
|
||||
//判断分类佣金是否正确
|
||||
if (category.getCommissionRate() < 0) {
|
||||
@ -215,6 +216,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateCategory(Category category) {
|
||||
//判断分类佣金是否正确
|
||||
if (category.getCommissionRate() < 0) {
|
||||
@ -240,6 +242,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(String id) {
|
||||
this.removeById(id);
|
||||
removeCache();
|
||||
@ -250,6 +253,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateCategoryStatus(String categoryId, Boolean enableOperations) {
|
||||
//禁用子分类
|
||||
CategoryVO categoryVO = new CategoryVO(this.getById(categoryId));
|
||||
@ -303,34 +307,6 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼装返回值
|
||||
*
|
||||
* @param paramList 参数列表
|
||||
* @return 拼装后的返回值
|
||||
*/
|
||||
private List<GoodsParamsGroupVO> convertParamList(List<CategoryParameterGroup> groupList, List<GoodsParamsVO> paramList) {
|
||||
Map<String, List<GoodsParamsVO>> map = new HashMap<>(16);
|
||||
for (GoodsParamsVO param : paramList) {
|
||||
if (map.get(param.getGroupId()) != null) {
|
||||
map.get(param.getGroupId()).add(param);
|
||||
} else {
|
||||
List<GoodsParamsVO> list = new ArrayList<>();
|
||||
list.add(param);
|
||||
map.put(param.getGroupId(), list);
|
||||
}
|
||||
}
|
||||
List<GoodsParamsGroupVO> resList = new ArrayList<>();
|
||||
for (CategoryParameterGroup group : groupList) {
|
||||
GoodsParamsGroupVO list = new GoodsParamsGroupVO();
|
||||
list.setGroupName(group.getGroupName());
|
||||
list.setGroupId(group.getId());
|
||||
list.setParams(map.get(group.getId()));
|
||||
resList.add(list);
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的子分类ID
|
||||
*
|
||||
|
@ -7,7 +7,6 @@ import cn.lili.modules.goods.service.CategorySpecificationService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -46,6 +47,7 @@ public class CommodityServiceImpl extends ServiceImpl<CommodityMapper, Commodity
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addCommodity(List<Commodity> commodityList) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
for (Commodity commodity : commodityList) {
|
||||
@ -54,7 +56,7 @@ public class CommodityServiceImpl extends ServiceImpl<CommodityMapper, Commodity
|
||||
commodity.setStoreId(storeId);
|
||||
//添加直播商品
|
||||
JSONObject json = wechatLivePlayerUtil.addGoods(commodity);
|
||||
if(!"0".equals(json.getStr("errcode"))){
|
||||
if (!"0".equals(json.getStr("errcode"))) {
|
||||
log.error(json.getStr("errmsg"));
|
||||
throw new ServiceException(ResultCode.COMMODITY_ERROR);
|
||||
}
|
||||
@ -93,10 +95,11 @@ public class CommodityServiceImpl extends ServiceImpl<CommodityMapper, Commodity
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void getGoodsWareHouse() {
|
||||
//查询审核中的商品
|
||||
List<String> goodsIdList = this.baseMapper.getAuditCommodity();
|
||||
if (goodsIdList.size() > 0) {
|
||||
if (!goodsIdList.isEmpty()) {
|
||||
//同步状态
|
||||
JSONObject json = wechatLivePlayerUtil.getGoodsWareHouse(goodsIdList);
|
||||
//修改状态
|
||||
|
@ -8,7 +8,6 @@ import cn.lili.modules.goods.entity.dos.Category;
|
||||
import cn.lili.modules.goods.entity.dos.DraftGoods;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsGallery;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.modules.goods.entity.dto.DraftGoodsDTO;
|
||||
import cn.lili.modules.goods.entity.dto.DraftGoodsSearchParams;
|
||||
import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
|
||||
@ -18,11 +17,11 @@ import cn.lili.modules.goods.service.CategoryService;
|
||||
import cn.lili.modules.goods.service.DraftGoodsService;
|
||||
import cn.lili.modules.goods.service.GoodsGalleryService;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -36,6 +36,7 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(List<String> goodsGalleryList, String goodsId) {
|
||||
//删除原来商品相册信息
|
||||
this.baseMapper.delete(new UpdateWrapper<GoodsGallery>().eq("goods_id", goodsId));
|
||||
|
@ -121,6 +121,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void underStoreGoods(String storeId) {
|
||||
//获取商品ID列表
|
||||
List<String> list = this.baseMapper.getGoodsIdByStoreId(storeId);
|
||||
@ -135,6 +136,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
* @param params 商品参数
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateGoodsParams(String goodsId, String params) {
|
||||
LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(Goods::getId, goodsId);
|
||||
@ -151,6 +153,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addGoods(GoodsOperationDTO goodsOperationDTO) {
|
||||
Goods goods = new Goods(goodsOperationDTO);
|
||||
//检查商品
|
||||
@ -174,6 +177,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void editGoods(GoodsOperationDTO goodsOperationDTO, String goodsId) {
|
||||
Goods goods = new Goods(goodsOperationDTO);
|
||||
goods.setId(goodsId);
|
||||
@ -264,6 +268,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean auditGoods(List<String> goodsIds, GoodsAuthEnum goodsAuthEnum) {
|
||||
boolean result = false;
|
||||
for (String goodsId : goodsIds) {
|
||||
@ -282,6 +287,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateGoodsMarketAble(List<String> goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason) {
|
||||
boolean result;
|
||||
|
||||
@ -311,6 +317,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean managerUpdateGoodsMarketAble(List<String> goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason) {
|
||||
boolean result;
|
||||
|
||||
@ -342,6 +349,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteGoods(List<String> goodsIds) {
|
||||
|
||||
LambdaUpdateWrapper<Goods> updateWrapper = this.getUpdateWrapperByStoreAuthority();
|
||||
@ -365,6 +373,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean freight(List<String> goodsIds, String templateId) {
|
||||
|
||||
AuthUser authUser = this.checkStoreAuthority();
|
||||
@ -383,7 +392,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStock(String goodsId, Integer quantity) {
|
||||
LambdaUpdateWrapper<Goods> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
||||
lambdaUpdateWrapper.set(Goods::getQuantity, quantity);
|
||||
@ -425,6 +433,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStoreDetail(Store store) {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper<>()
|
||||
.eq("store_id", store.getId())
|
||||
|
@ -7,6 +7,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.enums.PromotionTypeEnum;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
@ -113,6 +114,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(List<Map<String, Object>> skuList, Goods goods) {
|
||||
// 检查是否需要生成索引
|
||||
List<GoodsSku> newSkuList;
|
||||
@ -186,6 +188,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
* @param goodsSku sku信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(GoodsSku goodsSku) {
|
||||
this.updateById(goodsSku);
|
||||
cache.remove(GoodsSkuService.getCacheKeys(goodsSku.getId()));
|
||||
@ -319,6 +322,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
* @param goods 商品信息(Id,MarketEnable/AuthFlag)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateGoodsSkuStatus(Goods goods) {
|
||||
LambdaUpdateWrapper<GoodsSku> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(GoodsSku::getGoodsId, goods.getId());
|
||||
@ -431,6 +435,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStocks(List<GoodsSkuStockDTO> goodsSkuStockDTOS) {
|
||||
for (GoodsSkuStockDTO goodsSkuStockDTO : goodsSkuStockDTOS) {
|
||||
this.updateStock(goodsSkuStockDTO.getSkuId(), goodsSkuStockDTO.getQuantity());
|
||||
@ -438,6 +443,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStock(String skuId, Integer quantity) {
|
||||
GoodsSku goodsSku = getGoodsSkuByIdFromCache(skuId);
|
||||
if (goodsSku != null) {
|
||||
@ -445,7 +451,10 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
goodsIndexService.deleteIndexById(goodsSku.getId());
|
||||
}
|
||||
goodsSku.setQuantity(quantity);
|
||||
this.update(new LambdaUpdateWrapper<GoodsSku>().eq(GoodsSku::getId, skuId).set(GoodsSku::getQuantity, quantity));
|
||||
boolean update = this.update(new LambdaUpdateWrapper<GoodsSku>().eq(GoodsSku::getId, skuId).set(GoodsSku::getQuantity, quantity));
|
||||
if (update) {
|
||||
cache.remove(CachePrefix.GOODS.getPrefix() + goodsSku.getGoodsId());
|
||||
}
|
||||
cache.put(GoodsSkuService.getCacheKeys(skuId), goodsSku);
|
||||
cache.put(GoodsSkuService.getStockCacheKey(skuId), quantity);
|
||||
|
||||
@ -470,6 +479,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateGoodsStuck(List<GoodsSku> goodsSkus) {
|
||||
//商品id集合 hashset 去重复
|
||||
Set<String> goodsIds = new HashSet<>();
|
||||
@ -498,6 +508,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateGoodsSkuCommentNum(String skuId) {
|
||||
//获取商品信息
|
||||
GoodsSku goodsSku = this.getGoodsSkuByIdFromCache(skuId);
|
||||
@ -578,7 +589,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
* @param skuList sku列表
|
||||
* @param goods 商品信息
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
List<GoodsSku> addGoodsSku(List<Map<String, Object>> skuList, Goods goods) {
|
||||
List<GoodsSku> skus = new ArrayList<>();
|
||||
for (Map<String, Object> skuVO : skuList) {
|
||||
|
@ -5,7 +5,6 @@ import cn.lili.modules.goods.mapper.GoodsWordsMapper;
|
||||
import cn.lili.modules.goods.service.GoodsWordsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 商品关键字业务层实现
|
||||
|
@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -51,6 +52,7 @@ public class ParametersServiceImpl extends ServiceImpl<ParametersMapper, Paramet
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateParameter(Parameters parameters) {
|
||||
Parameters origin = this.getById(parameters.getId());
|
||||
if (origin == null) {
|
||||
|
@ -3,13 +3,11 @@ package cn.lili.modules.goods.serviceimpl;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.goods.entity.dos.Category;
|
||||
import cn.lili.modules.goods.entity.dos.CategorySpecification;
|
||||
import cn.lili.modules.goods.entity.dos.Specification;
|
||||
import cn.lili.modules.goods.mapper.SpecificationMapper;
|
||||
import cn.lili.modules.goods.service.CategorySpecificationService;
|
||||
import cn.lili.modules.goods.service.SpecificationService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -41,21 +39,20 @@ public class SpecificationServiceImpl extends ServiceImpl<SpecificationMapper, S
|
||||
|
||||
@Override
|
||||
public boolean deleteSpecification(List<String> ids) {
|
||||
boolean result = false;
|
||||
for (String id : ids) {
|
||||
//如果此规格绑定分类则不允许删除
|
||||
List<CategorySpecification> list = categorySpecificationService.list(new QueryWrapper<CategorySpecification>().eq("specification_id", id));
|
||||
if (!list.isEmpty()) {
|
||||
List<String> categoryIds = new ArrayList<>();
|
||||
list.forEach(item -> {
|
||||
categoryIds.add(item.getCategoryId());
|
||||
});
|
||||
list.forEach(item -> categoryIds.add(item.getCategoryId()));
|
||||
throw new ServiceException(ResultCode.SPEC_DELETE_ERROR,
|
||||
JSONUtil.toJsonStr(categoryService.getCategoryNameByIds(categoryIds)));
|
||||
}
|
||||
//删除规格
|
||||
this.removeById(id);
|
||||
result = this.removeById(id);
|
||||
}
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -83,6 +83,7 @@ public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public StoreGoodsLabel addStoreGoodsLabel(StoreGoodsLabel storeGoodsLabel) {
|
||||
//获取当前登录商家账号
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
@ -98,6 +99,7 @@ public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public StoreGoodsLabel editStoreGoodsLabel(StoreGoodsLabel storeGoodsLabel) {
|
||||
//修改当前店铺的商品分类
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
|
@ -35,6 +35,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
@ -63,6 +64,7 @@ public class StudioServiceImpl extends ServiceImpl<StudioMapper, Studio> impleme
|
||||
private GoodsService goodsService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean create(Studio studio) {
|
||||
studio.setStoreId(Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId());
|
||||
//创建小程序直播
|
||||
@ -97,6 +99,7 @@ public class StudioServiceImpl extends ServiceImpl<StudioMapper, Studio> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean edit(Studio studio) {
|
||||
Studio oldStudio = this.getById(studio.getId());
|
||||
wechatLivePlayerUtil.editRoom(studio);
|
||||
@ -153,6 +156,7 @@ public class StudioServiceImpl extends ServiceImpl<StudioMapper, Studio> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean push(Integer roomId, Integer goodsId, String storeId) {
|
||||
|
||||
//判断直播间是否已添加商品
|
||||
@ -183,6 +187,7 @@ public class StudioServiceImpl extends ServiceImpl<StudioMapper, Studio> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean goodsDeleteInRoom(Integer roomId, Integer goodsId, String storeId) {
|
||||
Goods goods = goodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getId, goodsId).eq(Goods::getStoreId, storeId));
|
||||
if (goods == null) {
|
||||
|
@ -41,9 +41,10 @@ public interface MemberEvaluationService extends IService<MemberEvaluation> {
|
||||
* 4.发送用户评价消息修改商品的评价数量以及好评率
|
||||
*
|
||||
* @param memberEvaluationDTO 评论
|
||||
* @param isSelf 是否自己操作(true:买家操作/false 系统操作)
|
||||
* @return 操作状态
|
||||
*/
|
||||
MemberEvaluationDTO addMemberEvaluation(MemberEvaluationDTO memberEvaluationDTO);
|
||||
MemberEvaluationDTO addMemberEvaluation(MemberEvaluationDTO memberEvaluationDTO, Boolean isSelf);
|
||||
|
||||
/**
|
||||
* 根据ID查询会员评价
|
||||
|
@ -36,6 +36,7 @@ public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint
|
||||
private EsGoodsSearchService esGoodsSearchService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public FootPrint saveFootprint(FootPrint footPrint) {
|
||||
LambdaQueryWrapper<FootPrint> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(FootPrint::getMemberId, footPrint.getMemberId());
|
||||
@ -69,8 +70,7 @@ public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint
|
||||
LambdaQueryWrapper<FootPrint> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(FootPrint::getMemberId, UserContext.getCurrentUser().getId());
|
||||
lambdaQueryWrapper.in(FootPrint::getGoodsId, ids);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
return true;
|
||||
return this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -55,6 +55,7 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MemberAddress saveMemberAddress(MemberAddress memberAddress) {
|
||||
//判断当前地址是否为默认地址,如果为默认需要将其他的地址修改为非默认
|
||||
removeDefaultAddress(memberAddress);
|
||||
@ -65,6 +66,7 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MemberAddress updateMemberAddress(MemberAddress memberAddress) {
|
||||
MemberAddress originalMemberAddress = this.getMemberAddress(memberAddress.getId());
|
||||
if (originalMemberAddress != null &&
|
||||
|
@ -11,7 +11,6 @@ import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.sensitive.SensitiveWordsFilter;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
@ -106,13 +105,16 @@ public class MemberEvaluationServiceImpl extends ServiceImpl<MemberEvaluationMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberEvaluationDTO addMemberEvaluation(MemberEvaluationDTO memberEvaluationDTO) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MemberEvaluationDTO addMemberEvaluation(MemberEvaluationDTO memberEvaluationDTO, Boolean isSelf) {
|
||||
//获取子订单信息
|
||||
OrderItem orderItem = orderItemService.getBySn(memberEvaluationDTO.getOrderItemSn());
|
||||
//获取订单信息
|
||||
Order order = orderService.getBySn(orderItem.getOrderSn());
|
||||
//检测是否可以添加会员评价
|
||||
checkMemberEvaluation(orderItem, order);
|
||||
if (Boolean.TRUE.equals(isSelf)) {
|
||||
checkMemberEvaluation(orderItem, order);
|
||||
}
|
||||
//获取用户信息
|
||||
Member member = memberService.getUserInfo();
|
||||
//获取商品信息
|
||||
@ -158,7 +160,7 @@ public class MemberEvaluationServiceImpl extends ServiceImpl<MemberEvaluationMap
|
||||
UpdateWrapper<MemberEvaluation> updateWrapper = Wrappers.update();
|
||||
updateWrapper.set("reply_status", true);
|
||||
updateWrapper.set("reply", reply);
|
||||
if (StringUtils.isNotEmpty(replyImage)) {
|
||||
if (CharSequenceUtil.isNotEmpty(replyImage)) {
|
||||
updateWrapper.set("have_reply_image", true);
|
||||
updateWrapper.set("reply_image", replyImage);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dos.MemberNotice;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeSenter;
|
||||
@ -42,6 +42,7 @@ public class MemberNoticeSenterServiceImpl extends ServiceImpl<MemberNoticeSente
|
||||
private MemberNoticeService memberNoticeService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean customSave(MemberNoticeSenter memberNoticeSenter) {
|
||||
|
||||
if (this.saveOrUpdate(memberNoticeSenter)) {
|
||||
@ -49,7 +50,7 @@ public class MemberNoticeSenterServiceImpl extends ServiceImpl<MemberNoticeSente
|
||||
//如果是选中会员发送
|
||||
if (memberNoticeSenter.getSendType().equals(SendTypeEnum.SELECT.name())) {
|
||||
//判定消息是否有效
|
||||
if (!StringUtils.isEmpty(memberNoticeSenter.getMemberIds())) {
|
||||
if (!CharSequenceUtil.isEmpty(memberNoticeSenter.getMemberIds())) {
|
||||
String[] ids = memberNoticeSenter.getMemberIds().split(",");
|
||||
MemberNotice memberNotice;
|
||||
for (String id : ids) {
|
||||
@ -77,7 +78,7 @@ public class MemberNoticeSenterServiceImpl extends ServiceImpl<MemberNoticeSente
|
||||
}
|
||||
}
|
||||
//防止没有会员导致报错
|
||||
if (memberNotices.size() > 0) {
|
||||
if (!memberNotices.isEmpty()) {
|
||||
//批量保存
|
||||
if (memberNoticeService.saveBatch(memberNotices)) {
|
||||
return true;
|
||||
|
@ -2,7 +2,6 @@ package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dos.MemberPointsHistory;
|
||||
@ -49,7 +48,7 @@ public class MemberPointsHistoryServiceImpl extends ServiceImpl<MemberPointsHist
|
||||
.eq(CharSequenceUtil.isNotEmpty(memberId), MemberPointsHistory::getMemberId, memberId)
|
||||
.like(CharSequenceUtil.isNotEmpty(memberName), MemberPointsHistory::getMemberName, memberName);
|
||||
//如果排序为空,则默认创建时间倒序
|
||||
if (StringUtils.isEmpty(page.getSort())) {
|
||||
if (CharSequenceUtil.isEmpty(page.getSort())) {
|
||||
page.setSort("createTime");
|
||||
page.setOrder("desc");
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ package cn.lili.modules.member.serviceimpl;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dos.MemberReceipt;
|
||||
@ -13,12 +12,14 @@ import cn.lili.modules.member.entity.vo.MemberReceiptVO;
|
||||
import cn.lili.modules.member.mapper.MemberReceiptMapper;
|
||||
import cn.lili.modules.member.service.MemberReceiptService;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -40,13 +41,14 @@ public class MemberReceiptServiceImpl extends ServiceImpl<MemberReceiptMapper, M
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addMemberReceipt(MemberReceiptAddVO memberReceiptAddVO, String memberId) {
|
||||
//校验发票抬头是否重复
|
||||
List<MemberReceipt> receipts = this.baseMapper.selectList(new QueryWrapper<MemberReceipt>()
|
||||
.eq("member_id", memberId)
|
||||
.eq("receipt_title", memberReceiptAddVO.getReceiptTitle())
|
||||
);
|
||||
if (receipts.size() > 0) {
|
||||
if (!receipts.isEmpty()) {
|
||||
throw new ServiceException(ResultCode.USER_RECEIPT_REPEAT_ERROR);
|
||||
}
|
||||
//参数封装
|
||||
@ -60,7 +62,7 @@ public class MemberReceiptServiceImpl extends ServiceImpl<MemberReceiptMapper, M
|
||||
//设置发票默认
|
||||
List<MemberReceipt> list = this.baseMapper.selectList(new QueryWrapper<MemberReceipt>().eq("member_id", memberId));
|
||||
//如果当前会员只有一个发票则默认为默认发票,反之需要校验参数默认值,做一些处理
|
||||
if (list.size() <= 0) {
|
||||
if (list.isEmpty()) {
|
||||
memberReceipt.setIsDefault(1);
|
||||
} else {
|
||||
if (memberReceiptAddVO.getIsDefault().equals(1)) {
|
||||
@ -78,6 +80,7 @@ public class MemberReceiptServiceImpl extends ServiceImpl<MemberReceiptMapper, M
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean editMemberReceipt(MemberReceiptAddVO memberReceiptAddVO, String memberId) {
|
||||
//根据会员id查询发票信息
|
||||
MemberReceipt memberReceiptDb = this.baseMapper.selectById(memberReceiptAddVO.getId());
|
||||
@ -92,7 +95,7 @@ public class MemberReceiptServiceImpl extends ServiceImpl<MemberReceiptMapper, M
|
||||
.eq("receipt_title", memberReceiptAddVO.getReceiptTitle())
|
||||
.ne("id", memberReceiptAddVO.getId())
|
||||
);
|
||||
if (receipts.size() > 0) {
|
||||
if (!receipts.isEmpty()) {
|
||||
throw new ServiceException(ResultCode.USER_RECEIPT_REPEAT_ERROR);
|
||||
}
|
||||
BeanUtil.copyProperties(memberReceiptAddVO, memberReceiptDb);
|
||||
|
@ -50,6 +50,7 @@ import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -380,6 +381,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
|
||||
@Override
|
||||
@PointLogPoint
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateMemberPoint(Long point, String type, String memberId, String content) {
|
||||
//获取当前会员信息
|
||||
Member member = this.getById(memberId);
|
||||
|
@ -2,34 +2,30 @@ package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.member.entity.enums.PointTypeEnum;
|
||||
import cn.lili.modules.system.entity.dto.PointSettingItem;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.MemberTagsEnum;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.common.utils.DateUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.modules.member.entity.dos.MemberSign;
|
||||
import cn.lili.modules.member.entity.enums.PointTypeEnum;
|
||||
import cn.lili.modules.member.mapper.MemberSignMapper;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.member.service.MemberSignService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.PointSetting;
|
||||
import cn.lili.modules.system.entity.dto.PointSettingItem;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.MemberTagsEnum;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 会员签到业务层实现
|
||||
@ -67,14 +63,6 @@ public class MemberSignServiceImpl extends ServiceImpl<MemberSignMapper, MemberS
|
||||
//获取当前会员信息
|
||||
AuthUser authUser = UserContext.getCurrentUser();
|
||||
if (authUser != null) {
|
||||
QueryWrapper<MemberSign> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("member_id", authUser.getId());
|
||||
queryWrapper.between("create_time", new Date(DateUtil.startOfTodDay() * 1000), DateUtil.getCurrentDayEndTime());
|
||||
//校验今天是否已经签到
|
||||
List<MemberSign> todaySigns = this.baseMapper.getTodayMemberSign(queryWrapper);
|
||||
if (todaySigns.size() > 0) {
|
||||
throw new ServiceException(ResultCode.MEMBER_SIGN_REPEAT);
|
||||
}
|
||||
//当前签到天数的前一天日期
|
||||
List<MemberSign> signs = this.baseMapper.getBeforeMemberSign(authUser.getId());
|
||||
//构建参数
|
||||
@ -82,21 +70,24 @@ public class MemberSignServiceImpl extends ServiceImpl<MemberSignMapper, MemberS
|
||||
memberSign.setMemberId(authUser.getId());
|
||||
memberSign.setMemberName(authUser.getUsername());
|
||||
//如果size大于0 说明昨天已经签到过,获取昨天的签到数,反之新签到
|
||||
if (signs.size() > 0) {
|
||||
if (!signs.isEmpty()) {
|
||||
//截止目前为止 签到总天数 不带今天
|
||||
Integer signDay = signs.get(0).getSignDay();
|
||||
memberSign.setSignDay(CurrencyUtil.add(signDay, 1).intValue());
|
||||
} else {
|
||||
memberSign.setSignDay(1);
|
||||
}
|
||||
Integer result = this.baseMapper.insert(memberSign);
|
||||
//签到成功后发送消息赠送积分
|
||||
if (result > 0) {
|
||||
//手动写入创建时间,以保证唯一索引生效
|
||||
memberSign.setCreateTime(DateUtil.getCurrentDayEndTime());
|
||||
try {
|
||||
this.baseMapper.insert(memberSign);
|
||||
//签到成功后发送消息赠送积分
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_SING.name();
|
||||
rocketMQTemplate.asyncSend(destination, memberSign, RocketmqSendCallbackBuilder.commonCallback());
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(ResultCode.MEMBER_SIGN_REPEAT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -50,6 +51,7 @@ public class StoreCollectionServiceImpl extends ServiceImpl<StoreCollectionMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public StoreCollection addStoreCollection(String storeId) {
|
||||
if (this.getOne(new LambdaUpdateWrapper<StoreCollection>()
|
||||
.eq(StoreCollection::getMemberId, UserContext.getCurrentUser().getId())
|
||||
@ -63,6 +65,7 @@ public class StoreCollectionServiceImpl extends ServiceImpl<StoreCollectionMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteStoreCollection(String storeId) {
|
||||
QueryWrapper<StoreCollection> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
|
||||
|
@ -1,15 +1,14 @@
|
||||
package cn.lili.modules.member.token;
|
||||
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.security.token.TokenUtil;
|
||||
import cn.lili.common.security.token.base.AbstractTokenGenerate;
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.MemberTagsEnum;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
|
@ -8,7 +8,6 @@ import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.security.token.TokenUtil;
|
||||
import cn.lili.common.security.token.base.AbstractTokenGenerate;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.store.entity.dos.Store;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -31,7 +30,7 @@ public class StoreTokenGenerate extends AbstractTokenGenerate<Member> {
|
||||
|
||||
@Override
|
||||
public Token createToken(Member member, Boolean longTerm) {
|
||||
if (!member.getHaveStore()) {
|
||||
if (Boolean.FALSE.equals(member.getHaveStore())) {
|
||||
throw new ServiceException(ResultCode.STORE_NOT_OPEN);
|
||||
}
|
||||
LambdaQueryWrapper<Store> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -1,14 +1,14 @@
|
||||
package cn.lili.modules.message.serviceimpl;
|
||||
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.OtherTagsEnum;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.message.entity.dos.Message;
|
||||
import cn.lili.modules.message.entity.vos.MessageVO;
|
||||
import cn.lili.modules.message.mapper.MessageMapper;
|
||||
import cn.lili.modules.message.service.MessageService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.OtherTagsEnum;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
@ -38,6 +38,7 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean sendMessage(Message message) {
|
||||
//保存站内信信息
|
||||
this.save(message);
|
||||
|
@ -1,8 +1,7 @@
|
||||
package cn.lili.modules.message.serviceimpl;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.message.entity.dos.MemberMessage;
|
||||
import cn.lili.modules.message.entity.dos.NoticeMessage;
|
||||
@ -12,6 +11,7 @@ import cn.lili.modules.message.entity.enums.NoticeMessageParameterEnum;
|
||||
import cn.lili.modules.message.mapper.NoticeMessageTemplateMapper;
|
||||
import cn.lili.modules.message.service.MemberMessageService;
|
||||
import cn.lili.modules.message.service.NoticeMessageService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -38,7 +38,7 @@ public class NoticeMessageServiceImpl extends ServiceImpl<NoticeMessageTemplateM
|
||||
//构建查询参数
|
||||
QueryWrapper<NoticeMessage> messageTemplateQueryWrapper = new QueryWrapper<>();
|
||||
//消息模板类型
|
||||
messageTemplateQueryWrapper.eq(!StringUtils.isEmpty(type), "type", type);
|
||||
messageTemplateQueryWrapper.eq(!CharSequenceUtil.isEmpty(type), "type", type);
|
||||
messageTemplateQueryWrapper.orderByDesc("create_time");
|
||||
//查询数据返回
|
||||
return this.page(PageUtil.initPage(pageVO), messageTemplateQueryWrapper);
|
||||
@ -85,10 +85,10 @@ public class NoticeMessageServiceImpl extends ServiceImpl<NoticeMessageTemplateM
|
||||
* @return 替换后站内信内容
|
||||
*/
|
||||
String replaceNoticeContent(String noticeContent, Map<String, String> parameter) {
|
||||
for (String key : parameter.keySet()) {
|
||||
String description = NoticeMessageParameterEnum.getValueByType(key);
|
||||
if (description != null && parameter.get(key) != null) {
|
||||
noticeContent = noticeContent.replace("#{" + description + "}".trim(), parameter.get(key));
|
||||
for (Map.Entry<String, String> entry : parameter.entrySet()) {
|
||||
String description = NoticeMessageParameterEnum.getValueByType(entry.getKey());
|
||||
if (description != null && entry.getValue() != null) {
|
||||
noticeContent = noticeContent.replace("#{" + description + "}".trim(), entry.getValue());
|
||||
}
|
||||
}
|
||||
return noticeContent;
|
||||
|
@ -6,7 +6,6 @@ import cn.lili.modules.message.service.ShortLinkService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user