Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f12d03e768
|
|
@ -1,8 +1,20 @@
|
||||||
package com.czg.controller.admin;
|
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 com.czg.resp.CzgResult;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.czg.sa.StpKit;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
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
|
@RestController
|
||||||
@RequestMapping("/admin/shopMsgPush")
|
@RequestMapping("/admin/shopMsgPush")
|
||||||
public class ShopMsgPushController {
|
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
|
|
@ -81,7 +81,7 @@ public class PrintMqListener {
|
||||||
.eq(PrintMachine::getStatus, 1)
|
.eq(PrintMachine::getStatus, 1)
|
||||||
.eq(PrintMachine::getShopId, shopId)
|
.eq(PrintMachine::getShopId, shopId)
|
||||||
.eq(PrintMachine::getSubType, subType)
|
.eq(PrintMachine::getSubType, subType)
|
||||||
.eq(PrintMachine::getConnectionType, "network");
|
.eq(PrintMachine::getConnectionType, "网络");
|
||||||
if (StrUtil.isNotEmpty(printMethod)) {
|
if (StrUtil.isNotEmpty(printMethod)) {
|
||||||
wrapper.in(PrintMachine::getPrintMethod, Arrays.asList(printMethod, "all"));
|
wrapper.in(PrintMachine::getPrintMethod, Arrays.asList(printMethod, "all"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
package com.czg.account.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import java.io.Serial;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺消息推送设置 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ShopMsgStateDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型 -1 所有消息 0库存预警 1 耗材预警 2 操作预警
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0关闭推送 1开启推送
|
||||||
|
*/
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
|
||||||
|
package com.czg.account.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.io.Serial;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ShopProdStatisticDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long prodId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售数量
|
||||||
|
*/
|
||||||
|
private Long saleNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售金额
|
||||||
|
*/
|
||||||
|
private BigDecimal saleAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退单量
|
||||||
|
*/
|
||||||
|
private Long refundNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createDay;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.czg.account.dto.msg;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopMsgEditDTO {
|
||||||
|
/**
|
||||||
|
* 类型 -1 所有消息 0库存预警 1 耗材预警 2 操作预警
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* 0关闭 1开启
|
||||||
|
*/
|
||||||
|
private Integer state;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.czg.account.dto.msg;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopPushOpenIdEditDTO {
|
||||||
|
/**
|
||||||
|
* openId
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "openId不为空")
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 类型 耗材推送 con 商品推送 pro 操作预警 ope
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "typeInfo不为空")
|
||||||
|
private List<String> typeInfo;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺消息推送设置 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_msg_state")
|
||||||
|
public class ShopMsgState implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型 -1 所有消息 0库存预警 1 耗材预警 2 操作预警
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0关闭推送 1开启推送
|
||||||
|
*/
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_prod_statistic")
|
||||||
|
public class ShopProdStatistic implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long prodId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售数量
|
||||||
|
*/
|
||||||
|
private Long saleNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售金额
|
||||||
|
*/
|
||||||
|
private BigDecimal saleAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退单量
|
||||||
|
*/
|
||||||
|
private Long refundNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createDay;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.czg.account.entity;
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
|
@ -8,6 +9,7 @@ import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
|
@ -48,7 +50,7 @@ public class ShopPushOpenId implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 状态 1 正常 0 禁用
|
* 状态 1 正常 0 禁用
|
||||||
*/
|
*/
|
||||||
private String status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
|
|
@ -62,4 +64,17 @@ public class ShopPushOpenId implements Serializable {
|
||||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可推送类型 json字符串 耗材推送 conState 商品推送 proState 操作预警 allState
|
||||||
|
*/
|
||||||
|
private Object typeInfo;
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.czg.account.dto.msg.ShopMsgEditDTO;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.account.entity.ShopMsgState;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺消息推送设置 服务层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-07
|
||||||
|
*/
|
||||||
|
public interface ShopMsgStateService extends IService<ShopMsgState> {
|
||||||
|
|
||||||
|
HashMap<String, Object> getState(Long shopId);
|
||||||
|
|
||||||
|
Boolean edit(Long shopId, ShopMsgEditDTO shopMsgEditDTO);
|
||||||
|
|
||||||
|
String getCode(Long shopId) throws Exception;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.account.entity.ShopProdStatistic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-06
|
||||||
|
*/
|
||||||
|
public interface ShopProdStatisticService extends IService<ShopProdStatistic> {
|
||||||
|
|
||||||
|
Page<?> pageInfo(Long shopId, String name, String classifyId, String startTime, String endTime);
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.czg.account.service;
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.czg.account.dto.msg.ShopPushOpenIdEditDTO;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
import com.czg.account.entity.ShopPushOpenId;
|
import com.czg.account.entity.ShopPushOpenId;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户推送信息表 服务层。
|
* 用户推送信息表 服务层。
|
||||||
*
|
*
|
||||||
|
|
@ -11,4 +14,8 @@ import com.czg.account.entity.ShopPushOpenId;
|
||||||
*/
|
*/
|
||||||
public interface ShopPushOpenIdService extends IService<ShopPushOpenId> {
|
public interface ShopPushOpenIdService extends IService<ShopPushOpenId> {
|
||||||
|
|
||||||
|
List<ShopPushOpenId> pageInfo(Long shopId);
|
||||||
|
|
||||||
|
Boolean edit(Long shopId, ShopPushOpenIdEditDTO shopPushOpenIdEditDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.czg.account.vo;
|
||||||
|
|
||||||
|
import com.czg.account.entity.ShopProdStatistic;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ShopProdStatisticVO extends ShopProdStatistic {
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.czg.account.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopPushOpenIdVO {
|
||||||
|
private Integer allState;
|
||||||
|
private Integer conState;
|
||||||
|
private Integer opeState;
|
||||||
|
private Integer proState;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.ShopMsgState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺消息推送设置 映射层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-07
|
||||||
|
*/
|
||||||
|
public interface ShopMsgStateMapper extends BaseMapper<ShopMsgState> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.czg.account.vo.ShopProdStatisticVO;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.ShopProdStatistic;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 映射层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-06
|
||||||
|
*/
|
||||||
|
public interface ShopProdStatisticMapper extends BaseMapper<ShopProdStatistic> {
|
||||||
|
|
||||||
|
List<ShopProdStatisticVO> pageInfo(@Param("shopId") Long shopId, @Param("name") String name, @Param("classifyId") String classifyId,
|
||||||
|
@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.czg.service.account.mapper;
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.czg.account.vo.ShopPushOpenIdVO;
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
import com.czg.account.entity.ShopPushOpenId;
|
import com.czg.account.entity.ShopPushOpenId;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户推送信息表 映射层。
|
* 用户推送信息表 映射层。
|
||||||
*
|
*
|
||||||
|
|
@ -11,4 +14,5 @@ import com.czg.account.entity.ShopPushOpenId;
|
||||||
*/
|
*/
|
||||||
public interface ShopPushOpenIdMapper extends BaseMapper<ShopPushOpenId> {
|
public interface ShopPushOpenIdMapper extends BaseMapper<ShopPushOpenId> {
|
||||||
|
|
||||||
|
List<ShopPushOpenIdVO> pageInfo(Long shopId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||||
|
import cn.hutool.extra.qrcode.QrConfig;
|
||||||
|
import com.czg.account.dto.msg.ShopMsgEditDTO;
|
||||||
|
import com.czg.service.account.util.AliOssUtil;
|
||||||
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.account.entity.ShopMsgState;
|
||||||
|
import com.czg.account.service.ShopMsgStateService;
|
||||||
|
import com.czg.service.account.mapper.ShopMsgStateMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.springframework.core.io.ResourceLoader;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺消息推送设置 服务层实现。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ShopMsgStateServiceImpl extends ServiceImpl<ShopMsgStateMapper, ShopMsgState> implements ShopMsgStateService {
|
||||||
|
private static final HashMap<String, String> MSG_TYPE = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
MSG_TYPE.put("0", "stockState");
|
||||||
|
MSG_TYPE.put("1", "conState");
|
||||||
|
MSG_TYPE.put("2", "opeState");
|
||||||
|
MSG_TYPE.put("-1", "allState");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ResourceLoader resourceLoader;
|
||||||
|
@Resource
|
||||||
|
private AliOssUtil aliOssUtil;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, Object> getState(Long shopId) {
|
||||||
|
List<ShopMsgState> list = queryChain().eq(ShopMsgState::getShopId, shopId).list();
|
||||||
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
|
MSG_TYPE.forEach((k, v) -> {
|
||||||
|
ShopMsgState have = null;
|
||||||
|
for (ShopMsgState shopMsgState : list) {
|
||||||
|
if (shopMsgState.getType().equals(Integer.valueOf(k))) {
|
||||||
|
have = shopMsgState;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (have == null) {
|
||||||
|
ShopMsgState msgState = new ShopMsgState();
|
||||||
|
msgState.setShopId(shopId);
|
||||||
|
msgState.setCreateTime(DateUtil.date().toLocalDateTime());
|
||||||
|
msgState.setType(Integer.valueOf(k));
|
||||||
|
msgState.setState(0);
|
||||||
|
save(msgState);
|
||||||
|
}
|
||||||
|
data.put(v, have != null ? have.getState() : 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean edit(Long shopId, ShopMsgEditDTO shopMsgEditDTO) {
|
||||||
|
ShopMsgState msgState = queryChain().eq(ShopMsgState::getShopId, shopId).eq(ShopMsgState::getType, shopMsgEditDTO.getType()).one();
|
||||||
|
if (msgState == null) {
|
||||||
|
msgState = new ShopMsgState();
|
||||||
|
msgState.setShopId(shopId);
|
||||||
|
msgState.setCreateTime(DateUtil.date().toLocalDateTime());
|
||||||
|
msgState.setType(shopMsgEditDTO.getType());
|
||||||
|
msgState.setState(shopMsgEditDTO.getState());
|
||||||
|
return save(msgState);
|
||||||
|
}
|
||||||
|
BeanUtil.copyProperties(shopMsgEditDTO, msgState);
|
||||||
|
return updateById(msgState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCode(Long shopId) throws Exception {
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
org.springframework.core.io.Resource resource = resourceLoader.getResource("classpath:/static/logo.jpg");
|
||||||
|
InputStream inputStream = resource.getInputStream();
|
||||||
|
String url = StrUtil.format("https://invoice.sxczgkj.cn/index/wechat/weuserk?shopId={}", shopId);
|
||||||
|
QrCodeUtil.generate(url, new QrConfig(500, 500).
|
||||||
|
setImg(ImageIO.read(inputStream)).setErrorCorrection(ErrorCorrectionLevel.H).setRatio(4), "png", outputStream);
|
||||||
|
|
||||||
|
return aliOssUtil.uploadSuffix(outputStream.toByteArray(), "png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import com.czg.utils.PageUtil;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.account.entity.ShopProdStatistic;
|
||||||
|
import com.czg.account.service.ShopProdStatisticService;
|
||||||
|
import com.czg.service.account.mapper.ShopProdStatisticMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务层实现。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-03-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticMapper, ShopProdStatistic> implements ShopProdStatisticService{
|
||||||
|
@Override
|
||||||
|
public Page<?> pageInfo(Long shopId, String name, String classifyId, String startTime, String endTime) {
|
||||||
|
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||||
|
return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId, name, classifyId, startTime, endTime)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,18 @@
|
||||||
package com.czg.service.account.service.impl;
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.account.dto.msg.ShopPushOpenIdEditDTO;
|
||||||
|
import com.czg.exception.ApiNotPrintException;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import com.czg.account.entity.ShopPushOpenId;
|
import com.czg.account.entity.ShopPushOpenId;
|
||||||
import com.czg.account.service.ShopPushOpenIdService;
|
import com.czg.account.service.ShopPushOpenIdService;
|
||||||
import com.czg.service.account.mapper.ShopPushOpenIdMapper;
|
import com.czg.service.account.mapper.ShopPushOpenIdMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户推送信息表 服务层实现。
|
* 用户推送信息表 服务层实现。
|
||||||
*
|
*
|
||||||
|
|
@ -15,4 +22,24 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class ShopPushOpenIdServiceImpl extends ServiceImpl<ShopPushOpenIdMapper, ShopPushOpenId> implements ShopPushOpenIdService{
|
public class ShopPushOpenIdServiceImpl extends ServiceImpl<ShopPushOpenIdMapper, ShopPushOpenId> implements ShopPushOpenIdService{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ShopPushOpenId> pageInfo(Long shopId) {
|
||||||
|
// PageHelper.startPage(PageUtil.buildPageHelp());
|
||||||
|
// return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId)));
|
||||||
|
List<ShopPushOpenId> list = list(new QueryWrapper().eq(ShopPushOpenId::getShopId, shopId));
|
||||||
|
list.forEach(item -> item.setTypeInfo(JSONArray.parseArray((String) item.getTypeInfo())));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean edit(Long shopId, ShopPushOpenIdEditDTO shopPushOpenIdEditDTO) {
|
||||||
|
ShopPushOpenId pushOpenId = queryChain().eq(ShopPushOpenId::getShopId, shopId).eq(ShopPushOpenId::getOpenId, shopPushOpenIdEditDTO.getOpenId()).one();
|
||||||
|
if (pushOpenId == null) {
|
||||||
|
throw new ApiNotPrintException("订阅用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
pushOpenId.setTypeInfo(JSONObject.toJSONString(shopPushOpenIdEditDTO.getTypeInfo()));
|
||||||
|
pushOpenId.setStatus(shopPushOpenIdEditDTO.getStatus());
|
||||||
|
return updateById(pushOpenId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.account.mapper.ShopMsgStateMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.account.mapper.ShopProdStatisticMapper">
|
||||||
|
|
||||||
|
<select id="pageInfo" resultType="com.czg.account.vo.ShopProdStatisticVO">
|
||||||
|
select * from tb_shop_prod_statistic as a
|
||||||
|
left join tb_product as b on a.prod_id=b.id
|
||||||
|
where a.shop_id=#{shopId} and b.name like and b.category_id=
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
@ -4,4 +4,20 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.czg.service.account.mapper.ShopPushOpenIdMapper">
|
<mapper namespace="com.czg.service.account.mapper.ShopPushOpenIdMapper">
|
||||||
|
|
||||||
|
<select id="pageInfo" resultType="com.czg.account.vo.ShopPushOpenIdVO">
|
||||||
|
select
|
||||||
|
nickname, avatar,
|
||||||
|
SUM(IF(type = 0, `status`, 0)) AS proState,
|
||||||
|
SUM(IF(type = 1, `status`, 0)) AS conState,
|
||||||
|
SUM(IF(type = 2, `status`, 0)) AS opeState,
|
||||||
|
SUM(IF(type = -1, `status`, 0)) AS allState
|
||||||
|
from tb_shop_push_open_id where shop_id=#{shopId}
|
||||||
|
<if test="nickName !=null and nickName != ''">
|
||||||
|
and nickname like concat('%', #{nickName} '%')
|
||||||
|
</if>
|
||||||
|
<if test="openId !=null and openId != ''">
|
||||||
|
and open_id like concat('%', #{openId} '%')
|
||||||
|
</if>
|
||||||
|
group by shop_id, open_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
|
||||||
private static final String UKEY = "UfWkhXxSkeSSscsU";
|
private static final String UKEY = "UfWkhXxSkeSSscsU";
|
||||||
|
|
||||||
public FeiPrinter() {
|
public FeiPrinter() {
|
||||||
super("fePrinter");
|
super("飞鹅");
|
||||||
}
|
}
|
||||||
|
|
||||||
private final PrintSignLabel printSignLabel = new PrintSignLabel()
|
private final PrintSignLabel printSignLabel = new PrintSignLabel()
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ public abstract class PrinterHandler {
|
||||||
if (StrUtil.isBlank(printerBrand)) {
|
if (StrUtil.isBlank(printerBrand)) {
|
||||||
throw new RuntimeException("打印机品牌未赋值");
|
throw new RuntimeException("打印机品牌未赋值");
|
||||||
}
|
}
|
||||||
return printerBrand.equals(currentBrand) && "network".equals(connectType);
|
return printerBrand.equals(currentBrand) && "网络".equals(connectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<OrderDetail> getCanPrintOrderDetails(boolean partPrint, Long orderId, List<OrderDetail> tbOrderDetailList, List<?> categoryIds) {
|
protected List<OrderDetail> getCanPrintOrderDetails(boolean partPrint, Long orderId, List<OrderDetail> tbOrderDetailList, List<?> categoryIds) {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
public YxyPrinter() {
|
public YxyPrinter() {
|
||||||
super("yxyPrinter");
|
super("云想印");
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrintSignLabel printSignLabel = new PrintSignLabel()
|
private PrintSignLabel printSignLabel = new PrintSignLabel()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue