Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-03-07 10:31:29 +08:00
28 changed files with 729 additions and 7 deletions

View File

@@ -1,8 +1,20 @@
package com.czg.controller.admin;
import com.czg.account.dto.msg.ShopMsgEditDTO;
import com.czg.account.dto.msg.ShopPushOpenIdEditDTO;
import com.czg.account.entity.ShopPushOpenId;
import com.czg.account.service.ShopMsgStateService;
import com.czg.account.service.ShopPushOpenIdService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.czg.sa.StpKit;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺消息推送相关
@@ -11,4 +23,71 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/admin/shopMsgPush")
public class ShopMsgPushController {
@Resource
private ShopMsgStateService shopMsgStateService;
@Resource
private ShopPushOpenIdService shopPushOpenIdService;
/**
* 店铺推送状态获取
*/
@SaAdminCheckPermission("shopMsgPush:state:list")
@GetMapping("/shopState")
public CzgResult<?> get() {
return CzgResult.success(shopMsgStateService.getState(StpKit.USER.getShopId()));
}
/**
* 店铺推送状态修改
* @param shopMsgEditDTO 修改嘻嘻你
* @return 是否成功
*/
@SaAdminCheckPermission("shopMsgPush:state:edit")
@PutMapping("/shopState")
public CzgResult<Boolean> edit(@RequestBody @Validated ShopMsgEditDTO shopMsgEditDTO) {
return CzgResult.success(shopMsgStateService.edit(StpKit.USER.getShopId(), shopMsgEditDTO));
}
/**
* 订阅用户列表
* @return 分页数据
*/
@SaAdminCheckPermission("shopMsgPush:list")
@GetMapping
public CzgResult<List<ShopPushOpenId>> allInfo() {
return CzgResult.success(shopPushOpenIdService.pageInfo(StpKit.USER.getShopId()));
}
/**
* 订阅解绑
* @param openId 唯一推送标识
* @return 是否成功
*/
@SaAdminCheckPermission("shopMsgPush:del")
@DeleteMapping
public CzgResult<Boolean> unbind(@RequestParam String openId) {
return CzgResult.success(shopPushOpenIdService.remove(new QueryWrapper().eq(ShopPushOpenId::getShopId, StpKit.USER.getShopId()).eq(ShopPushOpenId::getOpenId, openId)));
}
/**
* 推送状态修改
* @param shopPushOpenIdEditDTO 修改信息
* @return 是否成功
*/
@SaAdminCheckPermission("shopMsgPush:edit")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopPushOpenIdEditDTO shopPushOpenIdEditDTO) {
return CzgResult.success(shopPushOpenIdService.edit(StpKit.USER.getShopId(), shopPushOpenIdEditDTO));
}
/**
* 获取订阅二维码
* @return 二维码信息
* @throws Exception 异常
*/
@SaAdminCheckPermission("shopMsgPush:code")
@GetMapping("/code")
public CzgResult<String> getCoed() throws Exception {
return CzgResult.success(shopMsgStateService.getCode(StpKit.USER.getShopId()));
}
}

View File

@@ -0,0 +1,24 @@
package com.czg.controller.admin;
import com.czg.account.service.ShopProdStatisticService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Administrator
*/
@RestController
@RequestMapping("/admin/statistic")
public class ShopStatisticController {
@Resource
private ShopProdStatisticService shopProdStatisticService;
@GetMapping("/prod")
public CzgResult<?> getProduct(String name, String categoryId, String startTime, String endTime) {
return CzgResult.success(shopProdStatisticService.pageInfo(StpKit.USER.getShopId(), name, categoryId, startTime, endTime));
}
}