Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c82661351 | ||
|
|
6792450f6b | ||
|
|
5b95673507 | ||
|
|
5cdc276b0c | ||
|
|
31a5c94adf | ||
| 9b868838f4 | |||
|
|
22c04c61f5 | ||
| 952a618175 | |||
| b435420d97 | |||
| 82b4f773e4 | |||
| 370f5c1b60 | |||
| 605b1778a4 | |||
| 09768ef42c | |||
| 878cc895d4 | |||
| 4b4394d070 | |||
| 48a6628acb | |||
| a4601fac99 | |||
| 57472bdf00 | |||
| 9a70d68d37 | |||
| 8ea20b8394 | |||
| dae3a75e0c | |||
| efd0d80dc3 | |||
| 3ab1629436 | |||
| 68d12fe2ed | |||
| a9b32b4e57 | |||
| 8281c2b9bc | |||
| bee86bbb73 | |||
| dc291231ee | |||
|
|
0f4d9f0127 | ||
|
|
cbae826ce2 |
@@ -220,9 +220,7 @@ public class CommonController {
|
||||
if (wxMsgSubDTO.getOpenId() == null || wxMsgSubDTO.getShopId() == null) {
|
||||
return Result.fail("shopId或openId缺失");
|
||||
}
|
||||
String msg = wxMsgSubDTO.getShopId().replace("msg", "");
|
||||
String[] split = msg.split(",");
|
||||
loginService.addShopId(wxMsgSubDTO.getOpenId(), split[0], split.length > 1 ? Integer.valueOf(split[1]) : null, wxMsgSubDTO.getNickname(), wxMsgSubDTO.getAvatar());
|
||||
loginService.addShopId(wxMsgSubDTO.getOpenId(), wxMsgSubDTO.getShopId(), null, wxMsgSubDTO.getNickname(), wxMsgSubDTO.getAvatar());
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,8 +125,7 @@ public class LoginContoller {
|
||||
// try{
|
||||
// String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
// if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
||||
// phone =JSONObject.parseObject(data).get("phoneNumber").toString();
|
||||
// }
|
||||
// }// phone =JSONObject.parseObject(data).get("phoneNumber").toString();
|
||||
// }catch (Exception e){
|
||||
// log.info("登录传参:获取手机号失败{}",e.getMessage());
|
||||
// }
|
||||
@@ -201,11 +200,11 @@ public class LoginContoller {
|
||||
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
try {
|
||||
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
||||
if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
|
||||
// if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
|
||||
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
|
||||
}
|
||||
log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
|
||||
return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
|
||||
// }
|
||||
// log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
|
||||
// return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
|
||||
}
|
||||
} catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
@@ -277,6 +276,7 @@ public class LoginContoller {
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
userInfo.setId(Integer.valueOf(userId));
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
// log.info("更新用户信息 param,{}",JSONObject.toJSONString(userInfo));
|
||||
return loginService.upUserInfo(userInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.TbShopAdDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopAdService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表控制层
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("tbShopAd")
|
||||
public class TbShopAdController {
|
||||
|
||||
private final TbShopAdService tbShopAdService;
|
||||
|
||||
public TbShopAdController(@Qualifier("tbShopAdServiceImpl") TbShopAdService tbShopAdService) {
|
||||
this.tbShopAdService = tbShopAdService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result list(@RequestParam(value = "shopId") Integer shopId) {
|
||||
List<TbShopAd> tbShopAds = tbShopAdService.shopAdList(shopId);
|
||||
return Result.success(CodeEnum.ENCRYPT, TbShopAdDto.convertShopAdDoToDtoList(tbShopAds));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
|
||||
import com.chaozhanggui.system.cashierservice.service.UserService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
@@ -61,8 +62,17 @@ public class UserContoller {
|
||||
// jsonObject.put("data",object);
|
||||
// return jsonObject;
|
||||
// }
|
||||
|
||||
@PostMapping("/openMember")
|
||||
public Result openMember(@RequestBody OpenMemberVo memberVo){
|
||||
return userService.openMember(memberVo);
|
||||
}
|
||||
|
||||
@GetMapping("/shopUserInfo")
|
||||
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
|
||||
if(shopId.equals("undefined")){
|
||||
return Result.fail("店铺信息错误,请联系管理员!");
|
||||
}
|
||||
TbShopUser shopUser = new TbShopUser();
|
||||
TbShopInfo tbShopInfo = new TbShopInfo();
|
||||
if (StringUtils.isNotBlank(shopId) && !shopId.equals("null")) {
|
||||
@@ -107,9 +117,11 @@ public class UserContoller {
|
||||
shopUser.setAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (tbShopInfo != null) {
|
||||
shopUser.setIsUser(tbShopInfo.getIsCustom());
|
||||
shopUser.setShopName(tbShopInfo.getShopName());
|
||||
}else {
|
||||
shopUser.setShopName("");
|
||||
shopUser.setLng(tbShopInfo.getLng());
|
||||
shopUser.setLat(tbShopInfo.getLat());
|
||||
shopUser.setAddress(tbShopInfo.getAddress());
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS, shopUser);
|
||||
}
|
||||
@@ -156,7 +168,9 @@ public class UserContoller {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/subQrCode")
|
||||
public Result getSubQrCode(String shopId) throws Exception {
|
||||
public Result getSubQrCode(
|
||||
@RequestParam String shopId
|
||||
) throws Exception {
|
||||
String url = userService.getSubQrCode(shopId);
|
||||
return Result.successWithData(url);
|
||||
}
|
||||
|
||||
@@ -10,23 +10,24 @@ import java.util.List;
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbProductGroupMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
// int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbProductGroup record);
|
||||
// int insert(TbProductGroup record);
|
||||
|
||||
int insertSelective(TbProductGroup record);
|
||||
// int insertSelective(TbProductGroup record);
|
||||
|
||||
TbProductGroup selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbProductGroup record);
|
||||
// int updateByPrimaryKeySelective(TbProductGroup record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(TbProductGroup record);
|
||||
// int updateByPrimaryKeyWithBLOBs(TbProductGroup record);
|
||||
|
||||
int updateByPrimaryKey(TbProductGroup record);
|
||||
// int updateByPrimaryKey(TbProductGroup record);
|
||||
|
||||
List<TbProductGroup> selectByIdAndShopId(@Param("code") String code);
|
||||
|
||||
List<TbProductGroup> selectByQrcode(@Param("qrCode") String qrCode,@Param("groupId") Integer groupId);
|
||||
List<TbProductGroup> selectByShopId(@Param("shopId") String shopId,@Param("groupId") Integer groupId);
|
||||
List<TbProductGroup> selectByProductId(@Param("shopId") String shopId,@Param("productId") String productId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表数据库访问层
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:09
|
||||
*/
|
||||
public interface TbShopAdDao {
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @return 对象列表
|
||||
*/
|
||||
@Select("select * from fycashier.tb_shop_ad where (shop_id = #{songId} or shop_id = 1) and status=1")
|
||||
List<TbShopAd> shopAdList(Integer shopId);
|
||||
}
|
||||
|
||||
@@ -38,4 +38,16 @@ public interface TbShopOpenIdMapper {
|
||||
|
||||
@Update("update tb_shop_open_id set nickname=#{nickName}, avatar=#{avatar} where open_id=#{openId} and status=1 ")
|
||||
int updateBaseInfoByOpenId(@Param("openId") String openId, @Param("nickName") String nickName, @Param("avatar") String avatar);
|
||||
|
||||
@Select("select count(*) from tb_shop_open_id where shop_id=#{shopId} and status=1;")
|
||||
int selectStateByShopId(@Param("shopId") String shopId);
|
||||
|
||||
@Select("select count(*) from tb_shop_open_id where shop_id=#{shopId} and status=1 and type=#{type};")
|
||||
int countStateByShopIdAndType(@Param("shopId") String shopId, @Param("type") int type);
|
||||
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1 and (type=#{type} or type=-1) group by open_id;")
|
||||
List<TbShopOpenId> selectStateByShopIdAndType(@Param("shopId") String shopId, @Param("type") int type);
|
||||
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and open_id=#{openId};")
|
||||
List<TbShopOpenId> selectStateByShopIdAndOpenId(@Param("openId") String openId, @Param("shopId") String shopId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.Enum;
|
||||
|
||||
public enum ShopWxMsgTypeEnum {
|
||||
ALL_MSG(-1),
|
||||
STOCK_MSG(0),
|
||||
CONSUMABLES_MSG(1),
|
||||
OPERATION_MSG(2);
|
||||
private final Integer type;
|
||||
|
||||
ShopWxMsgTypeEnum(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -137,6 +137,9 @@ public class TbProduct implements Serializable {
|
||||
private Integer stockNumber;
|
||||
private Integer suit;
|
||||
|
||||
//是否可售 1 可售 0非可售
|
||||
private Integer isSale = 1;
|
||||
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
@@ -672,4 +675,12 @@ public class TbProduct implements Serializable {
|
||||
public void setSuit(Integer suit) {
|
||||
this.suit = suit;
|
||||
}
|
||||
|
||||
public Integer getIsSale() {
|
||||
return isSale;
|
||||
}
|
||||
|
||||
public void setIsSale(Integer isSale) {
|
||||
this.isSale = isSale;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,15 @@ public class TbProductGroup implements Serializable {
|
||||
|
||||
private String productIds;
|
||||
|
||||
//是否可售 1 可售 0非可售
|
||||
private Integer isSale = 1;
|
||||
//是否使用时间管控 0不使用 1使用
|
||||
private Integer useTime = 0;
|
||||
|
||||
private String saleStartTime;
|
||||
|
||||
private String saleEndTime;
|
||||
|
||||
|
||||
|
||||
@Transient
|
||||
@@ -144,4 +153,37 @@ public class TbProductGroup implements Serializable {
|
||||
public void setProductIds(String productIds) {
|
||||
this.productIds = productIds == null ? null : productIds.trim();
|
||||
}
|
||||
|
||||
|
||||
public Integer getUseTime() {
|
||||
return useTime;
|
||||
}
|
||||
|
||||
public void setUseTime(Integer useTime) {
|
||||
this.useTime = useTime;
|
||||
}
|
||||
|
||||
public String getSaleStartTime() {
|
||||
return saleStartTime;
|
||||
}
|
||||
|
||||
public void setSaleStartTime(String saleStartTime) {
|
||||
this.saleStartTime = saleStartTime;
|
||||
}
|
||||
|
||||
public String getSaleEndTime() {
|
||||
return saleEndTime;
|
||||
}
|
||||
|
||||
public void setSaleEndTime(String saleEndTime) {
|
||||
this.saleEndTime = saleEndTime;
|
||||
}
|
||||
|
||||
public Integer getIsSale() {
|
||||
return isSale;
|
||||
}
|
||||
|
||||
public void setIsSale(Integer isSale) {
|
||||
this.isSale = isSale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* (TbShopAd)实体类
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:09
|
||||
*/
|
||||
@Data
|
||||
public class TbShopAd implements Serializable {
|
||||
private static final long serialVersionUID = -34028307481923067L;
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺id,如果是通用广告则为0
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 广告图片地址
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转页面路径
|
||||
*/
|
||||
private String linkPath;
|
||||
/**
|
||||
* 广告展示圆角
|
||||
*/
|
||||
private Integer borderRadius;
|
||||
/**
|
||||
* 弹窗展示位置:home首页,make_order点餐页
|
||||
*/
|
||||
private String showPosition;
|
||||
/**
|
||||
* 显示频率:only_one 仅首次展示, every_show 每次打开都展示,every_day 每天展示一次,three_day 每三天展示一次, seven_day 每七天展示一次, thirty_day 没30天展示一次
|
||||
*/
|
||||
private String frequency;
|
||||
/**
|
||||
* 广告状态:0未启用,1已启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -111,6 +111,8 @@ public class TbShopInfo implements Serializable {
|
||||
private String cities;
|
||||
private String districts;
|
||||
|
||||
private String isCustom;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName tb_shop_msg_state
|
||||
*/
|
||||
@Data
|
||||
public class TbShopMsgState implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TbShopMsgState other = (TbShopMsgState) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
||||
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
|
||||
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
|
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
||||
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
|
||||
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
|
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", shopId=").append(shopId);
|
||||
sb.append(", type=").append(type);
|
||||
sb.append(", state=").append(state);
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -63,7 +65,18 @@ public class TbShopUser implements Serializable {
|
||||
private Long updatedAt;
|
||||
|
||||
private String miniOpenId;
|
||||
private String shopName;
|
||||
private String shopName="";
|
||||
private String lat="";
|
||||
private String lng="";
|
||||
private String address="";
|
||||
|
||||
@Transient
|
||||
private String isUser;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Data
|
||||
public class TbShopAdDto {
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺id,如果是通用广告则为0
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 广告图片地址
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转页面路径
|
||||
*/
|
||||
private String linkPath;
|
||||
/**
|
||||
* 广告展示圆角
|
||||
*/
|
||||
private Integer borderRadius;
|
||||
/**
|
||||
* 弹窗展示位置:home首页,make_order点餐页
|
||||
*/
|
||||
private String showPosition;
|
||||
/**
|
||||
* 显示频率:only_one 仅首次展示, every_show 每次打开都展示,every_day 每天展示一次,three_day 每三天展示一次, seven_day 每七天展示一次, thirty_day 没30天展示一次
|
||||
*/
|
||||
private String frequency;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long updateTime;
|
||||
|
||||
public static List<TbShopAdDto> convertShopAdDoToDtoList(List<TbShopAd> adList) {
|
||||
return adList.stream().map(TbShopAdDto::convertShopAdDoToDto).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static TbShopAdDto convertShopAdDoToDto(TbShopAd ad) {
|
||||
TbShopAdDto dto = new TbShopAdDto();
|
||||
dto.setId(ad.getId());
|
||||
dto.setShopId(ad.getShopId());
|
||||
dto.setImgUrl(ad.getImgUrl());
|
||||
dto.setLinkPath(ad.getLinkPath());
|
||||
dto.setBorderRadius(ad.getBorderRadius());
|
||||
dto.setShowPosition(ad.getShowPosition());
|
||||
dto.setFrequency(ad.getFrequency());
|
||||
dto.setUpdateTime(ad.getUpdateTime().getTime());
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OpenMemberVo {
|
||||
private Integer id;
|
||||
private Integer shopId;
|
||||
private String headImg;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private String telephone;
|
||||
private String birthDay;
|
||||
}
|
||||
@@ -146,7 +146,8 @@ public class DefaultExceptionAdvice {
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(MsgException.class)
|
||||
public ResponseEntity handleException(MsgException e) {
|
||||
LOGGER.error("业务异常", e);
|
||||
// LOGGER.error("业务异常", e);
|
||||
LOGGER.error("业务异常", e.getMessage());
|
||||
Result response = Result.fail(e.getMessage());
|
||||
response.setMsg(e.getMessage());
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.chaozhanggui.system.cashierservice.mapper;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopMsgState;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_msg_state】的数据库操作Mapper
|
||||
* @createDate 2024-08-12 14:38:33
|
||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbShopMsgState
|
||||
*/
|
||||
public interface TbShopMsgStateMapper {
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(TbShopMsgState record);
|
||||
|
||||
int insertSelective(TbShopMsgState record);
|
||||
|
||||
TbShopMsgState selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbShopMsgState record);
|
||||
|
||||
int updateByPrimaryKey(TbShopMsgState record);
|
||||
|
||||
@Select("select * from tb_shop_msg_state where shop_id=#{shopId} and type=#{type};")
|
||||
TbShopMsgState selectByType(Integer type, Integer shopId);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.Enum.ShopWxMsgTypeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.netty.PushToAppChannelHandlerAdapter;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
@@ -336,13 +337,13 @@ public class CartService {
|
||||
(product.getIsDistribute() == 1 && product.getStockNumber() - num <= productSku.getWarnLine())
|
||||
|| (product.getIsDistribute() != 1) && productSku.getStockNumber() - num <= productSku.getWarnLine()
|
||||
) {
|
||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectStateByShopIdAndType(product.getShopId(), ShopWxMsgTypeEnum.STOCK_MSG.getType());
|
||||
shopOpenIds.forEach(item -> {
|
||||
String message = redisUtil.getMessage(RedisCst.SEND_STOCK_WARN_MSG + product.getId() + ":" + item.getOpenId());
|
||||
if (message == null) {
|
||||
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
||||
product.getIsDistribute() == 1 ? product.getStockNumber() - num : (int) (productSku.getStockNumber() - num)
|
||||
, item.getOpenId());
|
||||
, item.getOpenId(), ShopWxMsgTypeEnum.STOCK_MSG, shopInfo.getId());
|
||||
redisUtil.saveMessage(RedisCst.SEND_STOCK_WARN_MSG + product.getId() + ":" + item.getOpenId(), product.getId().toString(), 60 * 30L);
|
||||
}else {
|
||||
log.info("{}已在30分钟内推送过消息,跳过发送", item.getOpenId());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -60,41 +61,59 @@ public class LoginService {
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
|
||||
private final static int[] MSG_TYPE_LIST = new int[] {0, 1, 2};
|
||||
|
||||
public LoginService(TbShopOpenIdMapper shopOpenIdMapper) {
|
||||
this.shopOpenIdMapper = shopOpenIdMapper;
|
||||
}
|
||||
|
||||
public void addShopId(String openId, String shopId, Integer type, String nickName, String avatar) {
|
||||
TbUserShopMsg shopMsg = tbUserShopMsgMapper.selectByShopIdAndOpenId(Integer.valueOf(shopId), openId);
|
||||
if (Objects.isNull(shopMsg)) {
|
||||
shopMsg = new TbUserShopMsg();
|
||||
shopMsg.setShopId(Integer.valueOf(shopId));
|
||||
shopMsg.setOpenId(openId);
|
||||
shopMsg.setCreateTime(new Date());
|
||||
shopMsg.setStatus("1");
|
||||
tbUserShopMsgMapper.insert(shopMsg);
|
||||
public void addShopId(String openId, String shopId, Integer type1, String nickName, String avatar) {
|
||||
// 为商家绑定openid
|
||||
// TbShopOpenId tbShopOpenId = shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId), null);
|
||||
List<TbShopOpenId> shopOpenIdList = shopOpenIdMapper.selectStateByShopIdAndOpenId(openId, shopId);
|
||||
int openCount = shopOpenIdMapper.selectStateByShopId(shopId);
|
||||
|
||||
if (shopOpenIdList.isEmpty()) {
|
||||
for (int type : MSG_TYPE_LIST) {
|
||||
addShopOpenId(openId, shopId, nickName, avatar, openCount, type);
|
||||
}
|
||||
|
||||
|
||||
// 为商家绑定openid
|
||||
TbShopOpenId tbShopOpenId = shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId), type);
|
||||
if (tbShopOpenId == null) {
|
||||
TbShopOpenId shopOpenId = new TbShopOpenId();
|
||||
shopOpenId.setOpenId(openId);
|
||||
shopOpenId.setCreateTime(DateUtil.date());
|
||||
shopOpenId.setShopId(Integer.valueOf(shopId));
|
||||
shopOpenId.setStatus(1);
|
||||
shopOpenId.setNickname(nickName);
|
||||
shopOpenId.setAvatar(avatar);
|
||||
shopOpenId.setType(type == null ? -1 : type);
|
||||
shopOpenIdMapper.insert(shopOpenId);
|
||||
} else {
|
||||
boolean fullSize = shopOpenIdList.size() == MSG_TYPE_LIST.length;
|
||||
HashMap<String, Object> typeMap = new HashMap<>();
|
||||
for (TbShopOpenId tbShopOpenId : shopOpenIdList) {
|
||||
typeMap.put(tbShopOpenId.getType().toString(), tbShopOpenId.getOpenId());
|
||||
tbShopOpenId.setType(null);
|
||||
tbShopOpenId.setUpdateTime(DateUtil.date());
|
||||
tbShopOpenId.setNickname(nickName);
|
||||
tbShopOpenId.setAvatar(avatar);
|
||||
shopOpenIdMapper.updateByPrimaryKeySelective(tbShopOpenId);
|
||||
}
|
||||
|
||||
if (fullSize) {
|
||||
return;
|
||||
}
|
||||
for (int type : MSG_TYPE_LIST) {
|
||||
if (typeMap.get(String.valueOf(type)) == null) {
|
||||
addShopOpenId(openId, shopId, nickName, avatar, openCount, type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addShopOpenId(String openId, String shopId, String nickName, String avatar, int openCount, int type) {
|
||||
int count = shopOpenIdMapper.countStateByShopIdAndType(shopId, type);
|
||||
TbShopOpenId shopOpenId = new TbShopOpenId();
|
||||
shopOpenId.setOpenId(openId);
|
||||
shopOpenId.setCreateTime(DateUtil.date());
|
||||
shopOpenId.setShopId(Integer.valueOf(shopId));
|
||||
shopOpenId.setStatus(openCount > 0 ? count > 0 ? 1 : 0 : 0);
|
||||
shopOpenId.setNickname(nickName);
|
||||
shopOpenId.setAvatar(avatar);
|
||||
shopOpenId.setType(type);
|
||||
shopOpenIdMapper.insert(shopOpenId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -26,6 +27,10 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -136,25 +141,27 @@ public class ProductService {
|
||||
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
|
||||
//招牌菜
|
||||
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
||||
concurrentMap.put("hots", handleDate(tbProducts));
|
||||
concurrentMap.put("hots", handleDate(tbProducts,true,1));
|
||||
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
||||
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
||||
//热销
|
||||
TbProductGroup hot = new TbProductGroup();
|
||||
hot.setName("热销");
|
||||
List<TbProduct> hots = tbProductMapper.selectHot(shopId);
|
||||
hot.setProducts(handleDate(hots));
|
||||
hot.setProducts(handleDate(hots,true,1));
|
||||
//商品
|
||||
groupList.parallelStream().forEach(g -> {
|
||||
if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime()));
|
||||
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
|
||||
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
||||
// List<TbProduct> products = tbProductMapper.selectByIdIn(in);
|
||||
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
||||
g.setProducts(handleDate(products));
|
||||
g.setProducts(handleDate(products,false,g.getIsSale()));
|
||||
} else {
|
||||
g.setProducts(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
groupList.sort(Comparator.comparingInt(TbProductGroup::getIsSale).reversed());
|
||||
groupList.add(0, hot);
|
||||
concurrentMap.put("productInfo", groupList);
|
||||
}
|
||||
@@ -162,6 +169,44 @@ public class ProductService {
|
||||
return Result.success(CodeEnum.SUCCESS, concurrentMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否在可售时间内
|
||||
* @param startTimeStr HH:mm
|
||||
* @param endTimeStr HH:mm
|
||||
* @return 1 可售 0 不可售
|
||||
*/
|
||||
public Integer getIsSale(String startTimeStr,String endTimeStr) {
|
||||
// 定义时间格式
|
||||
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||
// 解析时间字符串为 LocalTime 对象
|
||||
LocalTime startTime = LocalTime.parse(startTimeStr, timeFormatter);
|
||||
LocalTime endTime = LocalTime.parse(endTimeStr, timeFormatter);
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 创建 LocalDateTime 对象
|
||||
LocalDateTime startDateTime = LocalDateTime.of(today, startTime);
|
||||
LocalDateTime endDateTime = LocalDateTime.of(today, endTime);
|
||||
// 如果结束时间早于开始时间,说明时间段跨日
|
||||
if (endDateTime.isBefore(startDateTime)) {
|
||||
endDateTime = endDateTime.plusDays(1);
|
||||
}
|
||||
// 获取当前日期时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.isBefore(startDateTime)) {
|
||||
// 将当前时间加上24小时(一天),进行比较
|
||||
LocalDateTime nowPlus24 = now.plusHours(24);
|
||||
//当前时间 小于开始时间,且结束时间小于开始时间
|
||||
if (nowPlus24.isBefore(endDateTime)) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (now.isBefore(endDateTime)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Object querySpec(QuerySpecDTO querySpecDTO) {
|
||||
TbProduct tbProduct = tbProductMapper.selectById(querySpecDTO.getProductId());
|
||||
if (tbProduct == null) {
|
||||
@@ -296,9 +341,28 @@ public class ProductService {
|
||||
}
|
||||
}
|
||||
|
||||
public List<TbProduct> handleDate(List<TbProduct> products){
|
||||
/**
|
||||
* 组装商品
|
||||
* @param products 商品列表
|
||||
* @param check 是否校验可售
|
||||
* @return
|
||||
*/
|
||||
public List<TbProduct> handleDate(List<TbProduct> products,boolean check,Integer isSale){
|
||||
if (!CollectionUtils.isEmpty(products)) {
|
||||
products.parallelStream().forEach(it -> {
|
||||
if(check){
|
||||
List<TbProductGroup> tbProductGroups = tbProductGroupMapper.selectByProductId(it.getShopId(), it.getId().toString());
|
||||
for (TbProductGroup g : tbProductGroups) {
|
||||
if (g.getUseTime()==1) {
|
||||
if (getIsSale(g.getSaleStartTime(), g.getSaleEndTime()) == 0) {
|
||||
it.setIsSale(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
it.setIsSale(isSale);
|
||||
}
|
||||
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
||||
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
|
||||
//购物车数量
|
||||
@@ -310,6 +374,7 @@ public class ProductService {
|
||||
// HashSet<String> specSet = new HashSet<>();
|
||||
AtomicDouble sum = new AtomicDouble(0.0);
|
||||
BigDecimal lowerPrice = null;
|
||||
BigDecimal lowMemberPrice = null;
|
||||
for (TbProductSku item : tbProductSkus) {
|
||||
if (item.getRealSalesNumber() != null) {
|
||||
sum.addAndGet(item.getRealSalesNumber());
|
||||
@@ -317,45 +382,24 @@ public class ProductService {
|
||||
if (lowerPrice == null || lowerPrice.compareTo(item.getSalePrice()) > 0) {
|
||||
lowerPrice = item.getSalePrice();
|
||||
}
|
||||
|
||||
String specSnap = item.getSpecSnap();
|
||||
// if (specSnap != null) {
|
||||
// specSet.addAll(Arrays.asList(specSnap.split(",")));
|
||||
// }
|
||||
if (lowMemberPrice == null || lowMemberPrice.compareTo(item.getMemberPrice()) > 0) {
|
||||
lowMemberPrice = item.getMemberPrice();
|
||||
}
|
||||
//销量
|
||||
}
|
||||
// 销量
|
||||
it.setStockNumber(sum.intValue());
|
||||
|
||||
// 售价
|
||||
if (lowerPrice == null) {
|
||||
lowerPrice = BigDecimal.ZERO;
|
||||
}
|
||||
//售价
|
||||
it.setLowPrice(lowerPrice);
|
||||
// String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
// if (tagSnap != null) {
|
||||
// JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
|
||||
// JSONObject snapJSON;
|
||||
// JSONArray finalSnap = new JSONArray();
|
||||
// for (Object snap : tagSnaps) {
|
||||
// snapJSON = (JSONObject) snap;
|
||||
// String values = snapJSON.getString("value");
|
||||
// String finalValues = "";
|
||||
// if (StrUtil.isNotBlank(values)) {
|
||||
// String[] valueList = values.split(",");
|
||||
// for (String value : valueList) {
|
||||
// if (specSet.contains(value)) {
|
||||
// finalValues = finalValues + (value) + ",";
|
||||
// }
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(finalValues)) {
|
||||
// finalValues = StrUtil.removeSuffix(finalValues, ",");
|
||||
// snapJSON.put("value", finalValues);
|
||||
// finalSnap.add(snapJSON);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //sku Result
|
||||
// skuResult.setTagSnap(finalSnap.toJSONString());
|
||||
// }
|
||||
|
||||
// 会员价
|
||||
if (lowMemberPrice == null) {
|
||||
lowMemberPrice = BigDecimal.ZERO;
|
||||
}
|
||||
it.setLowMemberPrice(lowMemberPrice);
|
||||
it.setProductSkuResult(skuResult);
|
||||
});
|
||||
return products;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表服务接口
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:17
|
||||
*/
|
||||
public interface TbShopAdService {
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<TbShopAd> shopAdList(Integer shopId);
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbReleaseFlow;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
@@ -23,14 +23,11 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
@@ -264,10 +261,35 @@ public class UserService {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
Resource resource = resourceLoader.getResource("classpath:/static/logo.jpg");
|
||||
InputStream inputStream = resource.getInputStream();
|
||||
QrCodeUtil.generate(wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId), -1), new QrConfig(500, 500).
|
||||
// String url = wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId), -1);
|
||||
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 fileService.uploadFileByInputStream("png", new ByteArrayInputStream(outputStream.toByteArray()));
|
||||
}
|
||||
|
||||
public Result openMember(OpenMemberVo memberVo) {
|
||||
TbUserInfo userInfo = new TbUserInfo();
|
||||
userInfo.setId(memberVo.getId());
|
||||
userInfo.setHeadImg(memberVo.getHeadImg());
|
||||
userInfo.setNickName(memberVo.getNickName());
|
||||
userInfo.setTelephone(memberVo.getTelephone());
|
||||
userInfo.setBirthDay(memberVo.getBirthDay());
|
||||
userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
List<TbShopUser> tbShopUsers = shopUserMapper.selectAllByUserId(memberVo.getId().toString());
|
||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
tbShopUser.setTelephone(memberVo.getTelephone());
|
||||
shopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(memberVo.getId().toString(), memberVo.getShopId().toString());
|
||||
tbShopUser.setName(memberVo.getNickName());
|
||||
tbShopUser.setHeadImg(memberVo.getHeadImg());
|
||||
tbShopUser.setTelephone(memberVo.getTelephone());
|
||||
tbShopUser.setBirthDay(memberVo.getBirthDay());
|
||||
tbShopUser.setIsVip(Byte.parseByte("1"));
|
||||
shopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopAdDao;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopAdService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表服务实现类
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:17
|
||||
*/
|
||||
@Service
|
||||
public class TbShopAdServiceImpl implements TbShopAdService {
|
||||
@Autowired
|
||||
private TbShopAdDao tbShopAdDao;
|
||||
|
||||
@Override
|
||||
public List<TbShopAd> shopAdList(Integer shopId) {
|
||||
System.out.println("shopId = " + shopId);
|
||||
return tbShopAdDao.shopAdList(shopId);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,10 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.Enum.ShopWxMsgTypeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopMsgState;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbShopMsgStateMapper;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -27,6 +30,8 @@ public class WxAccountUtil {
|
||||
@Value("${wx.ysk.warnMsgTmpId}")
|
||||
private static String msgTmpId = "C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0";
|
||||
|
||||
private final TbShopMsgStateMapper shopMsgStateMapper;
|
||||
|
||||
static LinkedHashMap<String,String> linkedHashMap=new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
@@ -98,7 +103,18 @@ public class WxAccountUtil {
|
||||
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
||||
}
|
||||
|
||||
public static JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId) {
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId, ShopWxMsgTypeEnum typeEnum, Integer shopId) {
|
||||
TbShopMsgState allState = shopMsgStateMapper.selectByType(ShopWxMsgTypeEnum.ALL_MSG.getType(), shopId);
|
||||
if (allState == null || allState.getState().equals(0)) {
|
||||
log.info("店铺未开启全局推送:{}", allState);
|
||||
return null;
|
||||
}
|
||||
TbShopMsgState shopMsgState = shopMsgStateMapper.selectByType(typeEnum.getType(), shopId);
|
||||
if (shopMsgState == null || shopMsgState.getState().equals(0)) {
|
||||
log.info("店铺未开启推送:{}", shopMsgState);
|
||||
return null;
|
||||
}
|
||||
|
||||
stock = stock < 0 ? 0 : stock;
|
||||
Integer finalStock = stock;
|
||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
<result column="detail" jdbcType="VARCHAR" property="detail" />
|
||||
<result column="style" jdbcType="VARCHAR" property="style" />
|
||||
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||
<result column="use_time" jdbcType="INTEGER" property="useTime" />
|
||||
<result column="sale_start_time" jdbcType="INTEGER" property="saleStartTime" />
|
||||
<result column="sale_end_time" jdbcType="INTEGER" property="saleEndTime" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
</resultMap>
|
||||
@@ -18,7 +21,7 @@
|
||||
<result column="product_ids" jdbcType="LONGVARCHAR" property="productIds" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, name, merchant_id, shop_id, pic, is_show, detail, style, sort, created_at, updated_at
|
||||
id, name, merchant_id, shop_id, pic, is_show, detail, style, sort, created_at, updated_at , use_time, sale_start_time, sale_end_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
product_ids
|
||||
@@ -234,4 +237,9 @@
|
||||
</if>
|
||||
order by sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectByProductId" resultMap="BaseResultMap">
|
||||
SELECT * FROM tb_product_group WHERE `shop_id` = #{shopId,jdbcType=VARCHAR} AND is_show = 1
|
||||
AND `product_ids` LIKE concat('%',#{productId,jdbcType=VARCHAR},'%')
|
||||
</select>
|
||||
</mapper>
|
||||
22
src/main/resources/mapper/TbShopAdDao.xml
Normal file
22
src/main/resources/mapper/TbShopAdDao.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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.chaozhanggui.system.cashierservice.dao.TbShopAdDao">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopAd" id="TbShopAdMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="imgUrl" column="img_url" jdbcType="VARCHAR"/>
|
||||
<result property="linkPath" column="link_path" jdbcType="VARCHAR"/>
|
||||
<result property="borderRadius" column="border_radius" jdbcType="INTEGER"/>
|
||||
<result property="showPosition" column="show_position" jdbcType="VARCHAR"/>
|
||||
<result property="frequency" column="frequency" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
<result column="provinces" jdbcType="VARCHAR" property="provinces"/>
|
||||
<result column="cities" jdbcType="VARCHAR" property="cities"/>
|
||||
<result column="districts" jdbcType="VARCHAR" property="districts"/>
|
||||
|
||||
<result column="is_custom" jdbcType="VARCHAR" property="isCustom" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
|
||||
type="com.chaozhanggui.system.cashierservice.entity.TbShopInfo">
|
||||
@@ -64,7 +66,7 @@
|
||||
detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type,
|
||||
industry, industry_name, business_start_day,business_end_day,business_time, post_time, post_amount_line, on_sale, settle_type,
|
||||
settle_time, enter_at, expire_at, status, average, order_wait_pay_minute, support_device_number,
|
||||
distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag,is_open_yhq,is_use_vip,provinces,cities,districts
|
||||
distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag,is_open_yhq,is_use_vip,provinces,cities,districts,is_custom
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
view
|
||||
|
||||
91
src/main/resources/mapper/TbShopMsgStateMapper.xml
Normal file
91
src/main/resources/mapper/TbShopMsgStateMapper.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?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.chaozhanggui.system.cashierservice.mapper.TbShopMsgStateMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="state" column="state" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,shop_id,type,
|
||||
state,create_time,update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_msg_state
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from tb_shop_msg_state
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState" useGeneratedKeys="true">
|
||||
insert into tb_shop_msg_state
|
||||
( id,shop_id,type
|
||||
,state,create_time,update_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER},#{shopId,jdbcType=INTEGER},#{type,jdbcType=INTEGER}
|
||||
,#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState" useGeneratedKeys="true">
|
||||
insert into tb_shop_msg_state
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="shopId != null">shop_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id,jdbcType=INTEGER},</if>
|
||||
<if test="shopId != null">#{shopId,jdbcType=INTEGER},</if>
|
||||
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
||||
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
||||
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState">
|
||||
update tb_shop_msg_state
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="state != null">
|
||||
state = #{state,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState">
|
||||
update tb_shop_msg_state
|
||||
set
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
type = #{type,jdbcType=INTEGER},
|
||||
state = #{state,jdbcType=INTEGER},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -130,6 +130,7 @@
|
||||
|
||||
SELECT
|
||||
f.*,
|
||||
u.`head_img`,
|
||||
u.`name`
|
||||
FROM
|
||||
tb_shop_user_flow f
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||
<result column="is_pwd" jdbcType="VARCHAR" property="isPwd" />
|
||||
<result column="pwd" jdbcType="VARCHAR" property="pwd" />
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score,
|
||||
|
||||
Reference in New Issue
Block a user