分享相关代码 注释掉

优惠券 管理端重写 使用的地方 注释
This commit is contained in:
2025-09-11 16:10:38 +08:00
parent 65ba0e18ce
commit 35d257bc56
23 changed files with 1292 additions and 91 deletions

View File

@@ -1,54 +1,54 @@
package com.czg.controller.admin;
import com.czg.account.dto.ShopShareDTO;
import com.czg.account.service.ShopShareService;
import com.czg.account.vo.ShopShareRecordVO;
import com.czg.account.vo.ShopShareVO;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 小程序分享奖励管理
* @author Administrator
*/
@RestController
@RequestMapping("/admin/shopShare")
public class ShopShareController {
@Resource
private ShopShareService shopShareService;
/**
* 获取分享奖励配置
*/
@SaAdminCheckPermission(value = "shopShare:list", name = "分享好友信息")
@GetMapping
public CzgResult<ShopShareVO> get() {
return CzgResult.success(shopShareService.get(StpKit.USER.getShopId()));
}
/**
* 修改分享奖励配置
*/
@SaAdminCheckPermission(value = "shopShare:add", name = "分享好友信息添加")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopShareDTO shopShareDTO) {
return CzgResult.success(shopShareService.add(StpKit.USER.getShopId(), shopShareDTO));
}
/**
* 分享奖励记录
* @param key 邀请人/被邀请人手机号或昵称
* @param status 0 非新用户 1 未领取 2 已领取 3 已使用 不传递为全部
* @return 分页数据
*/
@SaAdminCheckPermission(value = "shopShare:record", name = "分享邀请记录")
@GetMapping("/record")
public CzgResult<Page<ShopShareRecordVO>> record(String key, Integer status) {
return CzgResult.success(shopShareService.recordPage(StpKit.USER.getShopId(), key, status));
}
}
//package com.czg.controller.admin;
//
//import com.czg.account.dto.ShopShareDTO;
//import com.czg.account.service.ShopShareService;
//import com.czg.account.vo.ShopShareRecordVO;
//import com.czg.account.vo.ShopShareVO;
//import com.czg.annotation.SaAdminCheckPermission;
//import com.czg.resp.CzgResult;
//import com.czg.sa.StpKit;
//import com.mybatisflex.core.paginate.Page;
//import jakarta.annotation.Resource;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
///**
// * 小程序分享奖励管理
// * @author Administrator
// */
//@RestController
//@RequestMapping("/admin/shopShare")
//public class ShopShareController {
// @Resource
// private ShopShareService shopShareService;
//
// /**
// * 获取分享奖励配置
// */
// @SaAdminCheckPermission(value = "shopShare:list", name = "分享好友信息")
// @GetMapping
// public CzgResult<ShopShareVO> get() {
// return CzgResult.success(shopShareService.get(StpKit.USER.getShopId()));
// }
//
// /**
// * 修改分享奖励配置
// */
// @SaAdminCheckPermission(value = "shopShare:add", name = "分享好友信息添加")
// @PostMapping
// public CzgResult<Boolean> add(@RequestBody @Validated ShopShareDTO shopShareDTO) {
// return CzgResult.success(shopShareService.add(StpKit.USER.getShopId(), shopShareDTO));
// }
//
// /**
// * 分享奖励记录
// * @param key 邀请人/被邀请人手机号或昵称
// * @param status 0 非新用户 1 未领取 2 已领取 3 已使用 不传递为全部
// * @return 分页数据
// */
// @SaAdminCheckPermission(value = "shopShare:record", name = "分享邀请记录")
// @GetMapping("/record")
// public CzgResult<Page<ShopShareRecordVO>> record(String key, Integer status) {
// return CzgResult.success(shopShareService.recordPage(StpKit.USER.getShopId(), key, status));
// }
//}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.czg</groupId>
<artifactId>cash-api</artifactId>
<version>1.0.0</version>
</parent>
<name>营销相关API</name>
<description>营销相关API</description>
<artifactId>market-server</artifactId>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.czg</groupId>
<artifactId>cash-common-log</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.czg</groupId>
<artifactId>market-service</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,25 @@
package com.czg;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author ww
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableTransactionManagement
@MapperScan("com.czg.service.market.mapper")
@EnableDubbo
@Slf4j
public class MarketApplication {
public static void main(String[] args) {
SpringApplication.run(MarketApplication.class, args);
}
}

View File

@@ -0,0 +1,107 @@
package com.czg.controller.admin;
import cn.hutool.core.thread.ThreadUtil;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.log.annotation.OperationLog;
import com.czg.market.dto.ShopCouponDTO;
import com.czg.market.service.ShopCouponService;
import com.czg.product.service.ShopSyncService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.AssertUtil;
import com.czg.validator.group.DefaultGroup;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 优惠券
*
* @author ww
*/
@RestController
@RequestMapping("/admin/coupon")
public class ACouponController {
@Resource
private ShopCouponService shopCouponService;
@DubboReference
private ShopSyncService shopSyncService;
/**
* 分页
*/
@GetMapping("page")
@OperationLog("优惠券列表-分页")
@SaAdminCheckPermission("coupon:page")
public CzgResult<Page<ShopCouponDTO>> getCouponPage(ShopCouponDTO param) {
Page<ShopCouponDTO> data = shopCouponService.getCouponPage(param);
return CzgResult.success(data);
}
/**
* 详情
*
* @param id 分组id
*/
@GetMapping("{id}")
@OperationLog("优惠券-详情")
@SaAdminCheckPermission("coupon:info")
public CzgResult<ShopCouponDTO> getCouponById(@PathVariable("id") Long id) {
AssertUtil.isNull(id, "{}不能为空", "id");
ShopCouponDTO data = shopCouponService.getCouponById(id);
return CzgResult.success(data);
}
/**
* 新增
*/
@PostMapping
@OperationLog("优惠券-新增")
@SaAdminCheckPermission("coupon:add")
public CzgResult<Void> addCoupon(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopCouponDTO dto) {
Long shopId = StpKit.USER.getShopId(0L);
dto.setShopId(shopId);
shopCouponService.addCoupon(dto);
asyncToBranchShop(dto.getId(),1);
return CzgResult.success();
}
/**
* 修改
*/
@PutMapping
@OperationLog("优惠券-修改")
@SaAdminCheckPermission("coupon:update")
public CzgResult<Void> updateCoupon(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopCouponDTO dto) {
Long shopId = StpKit.USER.getShopId(0L);
dto.setShopId(shopId);
shopCouponService.updateCouponById(dto);
asyncToBranchShop(dto.getId(),2);
return CzgResult.success();
}
/**
* 删除
*/
@DeleteMapping("{id}")
@OperationLog("优惠券-删除")
@SaAdminCheckPermission("prodGroup:delete")
public CzgResult<Void> deleteCoupon(@PathVariable("id") Long id) {
AssertUtil.isNull(id, "{}不能为空", "id");
shopCouponService.deleteCoupon(id);
asyncToBranchShop(id,3);
return CzgResult.success();
}
private void asyncToBranchShop(Long id,Integer type) {
long shopId = StpKit.USER.getShopId(0L);
ThreadUtil.execAsync(() -> {
shopSyncService.syncCouponBySourceShop(shopId, id,type);
});
}
}

View File

@@ -0,0 +1,56 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.1.31:3306/czg_cashier?useUnicode=true&characterEncoding=utf-8
username: root
password: Chaozg123.
data:
redis:
host: 192.168.1.31
port: 6379
password: Chaozg123.
timeout: 1000
database: 0
lettuce:
pool:
min-idle: 0
max-idle: 8
max-wait: -1ms
max-active: 16
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: product-server
qos-port: 22261
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-dev
protocol:
port: 10601
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: market-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@@ -0,0 +1,50 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1b572nblln4jho2.mysql.rds.aliyuncs.com:3306/czg_cashier?useUnicode=true&characterEncoding=utf-8
username: root
password: Czg666888
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 3
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: product-server
qos-port: 22263
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-prod
protocol:
port: 10603
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: market-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@@ -0,0 +1,50 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/czg_cashier?useUnicode=true&characterEncoding=utf-8
username: cashier
password: Cashier@1@
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 2
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: product-server
qos-port: 22262
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-test
protocol:
port: 10602
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: market-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@@ -0,0 +1,34 @@
server:
port: 9500
spring:
application:
name: market-server
profiles:
active: dev
include: tools
wx:
ysk:
appId: wx212769170d2c6b2a
secrete: 8492a7e8d55bbb1b57f5c8276ea1add0
operationMsgTmpId: wFdoUG-dUT7bDRHq8bMJD9CF5TjyH9x_uJQgQByZqHg
warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0
logging:
config: classpath:logback.xml
# MyBatis-Flex
mybatis-flex:
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
pagehelper:
helper-dialect: mysql
support-methods-arguments: true
dubbo:
consumer:
check: false

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>market-server</contextName>
<property name="log.charset" value="utf-8" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<!--写入文件格式-->
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!--按天生成日志-->
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/market/logback.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--生成日志文件名称-->
<fileNamePattern>logs/product/history/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<maxFileSize>20MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${p_file}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!--普通日志输出到控制台-->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="logFile"/>
</root>
</configuration>