Conflicts:
	src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopInfo.java
	src/main/java/com/chaozhanggui/system/cashierservice/entity/TbSystemCoupons.java
	src/main/java/com/chaozhanggui/system/cashierservice/rabbit/RabbitConfig.java
	src/main/java/com/chaozhanggui/system/cashierservice/rabbit/RabbitProducer.java
	src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java
	src/main/java/com/chaozhanggui/system/cashierservice/util/RandomUtil.java
	src/main/resources/application-dev.yml
	src/main/resources/application-dev2.yml
	src/main/resources/application-prod.yml
	src/main/resources/application-prod2.yml
	src/main/resources/mapper/TbShopInfoMapper.xml
This commit is contained in:
19991905653 2024-04-15 15:20:17 +08:00
commit c84b9cc152
52 changed files with 1696 additions and 795 deletions

View File

@ -67,6 +67,7 @@ public class LoginFilter implements Filter {
chain.doFilter(req, resp);
return;
}
//environment 环境标识 wx app 后续environment不可为空
String environment = request.getHeader("environment");
//token校验目前只对app生效
@ -78,17 +79,24 @@ public class LoginFilter implements Filter {
// 判断用户TOKEN是否存在
String token = request.getHeader("token");
if (StringUtils.isBlank(token)) {
Result result = new Result(CodeEnum.TOKEN_EXEIST);
Result result = new Result(CodeEnum.TOKEN_EXPIRED);
String jsonString = JSONObject.toJSONString(result);
JSONObject jsonObject = JSONObject.parseObject(jsonString, JSONObject.class);
response.getWriter().print(jsonObject);
response.getWriter().flush();//流里边的缓存刷出
return;
}
//获取当前登录人的用户id
String loginName = TokenUtil.parseParamFromToken(token).getString("userId");
//获取redis中的token
String message = redisUtil.getMessage(RedisCst.ONLINE_APP_USER.concat(loginName));
String message = "";
if(environment.equals("app")){
//获取当前登录人的用户id
String loginName = TokenUtil.parseParamFromToken(token).getString("userId");
//获取redis中的token
message = redisUtil.getMessage(RedisCst.ONLINE_APP_USER.concat(loginName));
}else if(environment.equals("wx")){
//获取当前登录人的用户id
String openId = TokenUtil.parseParamFromToken(token).getString("openId");
message = redisUtil.getMessage(RedisCst.ONLINE_USER.concat(openId));
}
if (StringUtils.isBlank(message)) {
Result result = new Result(CodeEnum.TOKEN_EXPIRED);
String jsonString = JSONObject.toJSONString(result);

View File

@ -28,7 +28,7 @@ public class CorsFilter implements Filter {
response.setHeader("Access-Control-Allow-Origin", curOrigin == null ? "true" : curOrigin);
response.setHeader("Access-Control-Allow-Methods", "*");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,signature");
response.setHeader("Access-Control-Allow-Headers", "environment,type,version,token");
response.setHeader("Access-Control-Allow-Credentials", "true");
chain.doFilter(req, resp);
}

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper;
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
@ -221,6 +222,14 @@ public class LoginContoller {
return loginService.userInfo(userId, shopId);
}
@PostMapping("/upUserInfo")
public Result userInfo(@RequestHeader String token, @RequestBody TbUserInfo userInfo) {
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
userInfo.setId(Integer.valueOf(userId));
userInfo.setUpdatedAt(System.currentTimeMillis());
return loginService.upUserInfo(userInfo);
}
/**
* 用户注册

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.concurrent.ExecutionException;
@CrossOrigin(origins = "*")
@RestController
@ -40,5 +41,9 @@ public class ProductController {
return productService.queryProductSku(shopId,productId,spec_tag);
}
@GetMapping("/productInfo")
public Result productInfo(@RequestParam Integer productId) throws Exception {
return productService.productInfo(productId);
}
}

View File

@ -2,26 +2,17 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import com.chaozhanggui.system.cashierservice.entity.SysDictDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface SysDictDetailMapper {
int deleteByPrimaryKey(Long detailId);
int insert(SysDictDetail record);
int insertSelective(SysDictDetail record);
SysDictDetail selectByPrimaryKey(Long detailId);
List<SysDict> selectByAll();
List<SysDictDetail> selectByAllDetail(@Param("list") List<Long> dictId);
List<SysDictDetail> selectByDictId(@Param("dictId") Long dictId);
int updateByPrimaryKeySelective(SysDictDetail record);
int updateByPrimaryKey(SysDictDetail record);
}

View File

@ -0,0 +1,22 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.vo.TagProductVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* (TagProductDepts) 商品标签 表数据库访问层
*
* @author lyf
* @since 2024-04-08 15:03:49
*/
@Component
@Mapper
public interface TagProductDeptsMapper {
List<TagProductVO> queryTagAndProduct(@Param("list") List<Integer> list);
List<TagProductVO> queryTagByProductId(@Param("productId") String productId);
}

View File

@ -1,8 +1,13 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbMerchantCoupon;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
import com.chaozhanggui.system.cashierservice.entity.vo.CouAndShopVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
import java.util.List;
/**
@ -11,6 +16,8 @@ import java.util.List;
* @author lyf
* @since 2024-04-02 09:24:16
*/
@Component
@Mapper
public interface TbMerchantCouponMapper {
/**
@ -31,7 +38,9 @@ public interface TbMerchantCouponMapper {
List<TbMerchantCoupon> queryAllByLimit(TbMerchantCoupon tbMerchantCoupon, @Param("pageable") Pageable pageable);
List<TbMerchantCoupon> queryAllByPage(@Param("page")Integer page, @Param("size")Integer size);
List<CouAndShopVo> queryAllByPage(@Param("pageable")Integer page, @Param("sizeable")Integer size, @Param("rightTopLng") Double rightTopLng,
@Param("rightTopLat")Double rightTopLat, @Param("leftBottomLng")Double leftBottomLng, @Param("leftBottomLat")Double leftBottomLat,
@Param("cities")String cities, @Param("order")String order,@Param("lng")String lng,@Param("lat")String lat);
/**
* 统计总行数
*

View File

@ -22,64 +22,9 @@ public interface TbPlatformDictMapper {
*/
TbPlatformDict queryById(Integer id);
/**
* 查询指定行数据
*
* @param tbPlatformDict 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<TbPlatformDict> queryAllByLimit(TbPlatformDict tbPlatformDict, @Param("pageable") Pageable pageable);
List<TbPlatformDict> queryByIdList(@Param("idList")List<Integer> idList);
List<TbPlatformDict> queryAllByType(@Param("type") String type,@Param("environment") String environment);
/**
* 统计总行数
*
* @param tbPlatformDict 查询条件
* @return 总行数
*/
long count(TbPlatformDict tbPlatformDict);
/**
* 新增数据
*
* @param tbPlatformDict 实例对象
* @return 影响行数
*/
int insert(TbPlatformDict tbPlatformDict);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<TbPlatformDict> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TbPlatformDict> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<TbPlatformDict> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<TbPlatformDict> entities);
/**
* 修改数据
*
* @param tbPlatformDict 实例对象
* @return 影响行数
*/
int update(TbPlatformDict tbPlatformDict);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.TbSystemCoupons;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
@ -32,4 +33,6 @@ public interface TbProductMapper {
List<TbProduct> selectByIds(@Param("list") List<String> ids);
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
TbSystemCoupons selectLimit();
}

View File

@ -38,4 +38,5 @@ public interface TbProductSkuMapper {
List<TbProductSku> selectDownSku(@Param("list") List<Integer> productId);
List<TbProductSku> selectSkus(@Param("list") List<String> productId);
List<TbProductSku> selectSku(@Param("productId") String productId);
}

View File

@ -0,0 +1,22 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbPurchaseNotice;
/**
* 购买须知(关联tb_merchant_coupon)(TbPurchaseNotice)表数据库访问层
*
* @author ww
* @since 2024-04-11 10:00:23
*/
public interface TbPurchaseNoticeMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TbPurchaseNotice queryById(Integer id);
}

View File

@ -0,0 +1,32 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbShopVideo;
import java.util.List;
/**
* (TbShopVideo)表数据库访问层
*
* @author ww
* @since 2024-04-12 14:50:09
*/
public interface TbShopVideoMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TbShopVideo queryById(Integer id);
/**
* 查询数据
*
* @param tbShopVideo 查询条件
* @return 对象列表
*/
List<TbShopVideo> queryAll(TbShopVideo tbShopVideo);
}

View File

@ -0,0 +1,87 @@
package com.chaozhanggui.system.cashierservice.entity.Enum;
import com.github.pagehelper.util.StringUtil;
/**
* @author 12847
*/
public enum LogoEnum {
url1(1,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/IMG_0299.PNG"),
url2(2,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/ffaab08f6a62103593646bf36dbaa24c.jpeg"),
url3(3,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/fe6c4572004f9aa7716bff89c4c56783.jpeg"),
url4(4,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/fb56ef7c59d46835e6ff4b5c494aed5a.jpeg"),
url5(5,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f8469a7760c7f584ab55e47b60cd3829.jpeg"),
url6(6,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f73810e20530a70dd068e0e0a82677d4.jpeg"),
url7(7,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f66361c48515ba9b2a03d9d72829d675.jpeg"),
url8(8,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f2be456f85849922ba838e7eb4694272.jpeg"),
url9(9,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e9fca54f0320644291848338184b6c08.jpeg"),
url10(10,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e9e574fdedb43831801697a610603044.jpeg"),
url11(11,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e913ec3afe3520b9a638e16d298b401f.jpeg"),
url12(12,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e87d19da0cb5af9b53f485117b665cc9.jpeg"),
url13(13,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e847667f37d86dc4a48ffcf69bb1a964.jpeg"),
url14(14,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e731f8a883ab1ef2a71487f2eb5b0e38.jpeg"),
url15(15,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e681a9a281760f275f4b9d11c01a5869.jpeg"),
url16(16,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e41fa3916c86d43904a66d1174b81080.jpeg"),
url17(17,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e138425037e7ba3eded9ab828e3f39d2.jpeg"),
url18(18,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e0d4e933083418e6c4795fb6bf5db628.jpeg"),
url19(19,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e07b1933b0ad75f428339ffc79ee4fef.jpeg"),
url20(20,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/d4ac63680f417b49210aa54cf6e03e77.jpeg"),
url21(21,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/d44a8bccd46f4fa6c340e825bba5c338.jpeg"),
url22(22,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/cd794c0c5dd3b212e7c46eaa7c3a85cc.jpeg"),
url23(23,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/ccf1f255cd30c2aed0b421213df01863.jpeg"),
url24(24,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/cbe7897bee2d057eaaeaa1604d5bd167.jpeg"),
url25(25,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/cae19ed2c2c1c749e388730ef1cbb596.jpeg"),
url26(26,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c90a7e5d7a9a95a48dac8aecfab5c8e1.jpeg"),
url27(27,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c72ec32dbb7c0a42ca6a0a483a0d99ab.jpeg"),
url28(28,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c72ec32dbb7c0a42ca6a0a483a0d99ab.jpeg"),
url29(29,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c451f57dde1fcbbe4afe5766184084da.jpeg"),
url30(30,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a9a9e9eb047009f79bc22290470c2932.jpeg"),
url31(31,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/aef489a444793e37e2f33aeb3fe1fe13.jpeg"),
url32(32,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/b0f4a2d7ab851fb2ea01446b722c5631.jpeg"),
url33(33,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/b2d643c11850042ff2932451c84940c3.jpeg"),
url34(34,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/bdf1ebd620f759f703631b805216ca11.jpeg"),
url35(35,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/be1e70097583d1a08a9951925d66ef33.jpeg"),
url36(36,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c3f38f6604713f13474a5e2f1145e481.jpeg"),
url37(37,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c27da8b2c154998ebf7300c49cef649a.jpeg"),
url38(38,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c26400a670209b60abcd28bfc6d22171.jpeg"),
url39(39,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a906414986b1bee60cec709dabf2103b.jpeg"),
url40(40,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a6d8629c155b59814e4d772fb5e6ec6a.jpeg"),
url41(41,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a6a78d2a64c49cf62e37475eb66e351c.jpeg"),
url42(42,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a571ccde02b075656f354b593533b00c.jpeg"),
url43(43,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a0be3632c238d1a8e24e51ff8942efc6.jpeg"),
url44(44,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/9fca88b43ed09ddbeb4803ceab4f356f.jpeg"),
url45(45,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/86ad712e29369b9f56ca93a94f7a5d67.jpeg"),
url46(46,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/88d4ca4146196992b48a52f62a690bf0.jpeg"),
;
private Integer key;
private String url;
public Integer getKey() {
return key;
}
public String getUrl() {
return url;
}
LogoEnum(Integer key, String url) {
this.key = key;
this.url = url;
}
public static String getValueByKey(Integer key) {
if(key == null){
return "";
}
LogoEnum[] urlEnums = values();
for (LogoEnum logo : urlEnums) {
if (logo.key.equals(key)) {
return logo.getUrl();
}
}
return "";
}
}

View File

@ -1,88 +1,19 @@
package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class SysDict implements Serializable {
private Long dictId;
private String dictName;
private String name;
private String description;
private String createBy;
private String updateBy;
private Date createTime;
private Date updateTime;
private Integer isChild;
private static final long serialVersionUID = 1L;
public Integer getIsChild() {
return isChild;
}
public void setIsChild(Integer isChild) {
this.isChild = isChild;
}
public Long getDictId() {
return dictId;
}
public void setDictId(Long dictId) {
this.dictId = dictId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -1,98 +1,15 @@
package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class SysDictDetail implements Serializable {
private Long detailId;
private Long dictId;
private String dictName;
private String label;
private String value;
private Integer dictSort;
private String createBy;
private String updateBy;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public Long getDetailId() {
return detailId;
}
public void setDetailId(Long detailId) {
this.detailId = detailId;
}
public Long getDictId() {
return dictId;
}
public void setDictId(Long dictId) {
this.dictId = dictId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label == null ? null : label.trim();
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value == null ? null : value.trim();
}
public Integer getDictSort() {
return dictSort;
}
public void setDictSort(Integer dictSort) {
this.dictSort = dictSort;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -135,6 +135,7 @@ public class TbMerchantCoupon implements Serializable {
private String merchantId;
public Integer getId() {
return id;
}

View File

@ -12,10 +12,16 @@ public class TbPlatformDict implements Serializable {
private static final long serialVersionUID = -34581903392247717L;
private Integer id;
/**
* 标签前图标
*/
private String shareImg;
/**
* 描述 同类型下 name唯一
*/
private String name;
private String fontColor;
private String backColor;
/**
* homeDistrict--金刚区首页 carousel--轮播图 tag--标签
*/
@ -24,10 +30,6 @@ public class TbPlatformDict implements Serializable {
* 封面图
*/
private String coverImg;
/**
* 分享图
*/
private String shareImg;
/**
* 视频URL地址
*/
@ -36,10 +38,8 @@ public class TbPlatformDict implements Serializable {
* 视频封面图
*/
private String videoCoverImg;
/**
* 相对跳转地址
*/
private String relUrl;
private String jumpType;
/**
* 绝对跳转地址
*/
@ -78,6 +78,22 @@ public class TbPlatformDict implements Serializable {
this.id = id;
}
public String getFontColor() {
return fontColor;
}
public void setFontColor(String fontColor) {
this.fontColor = fontColor;
}
public String getBackColor() {
return backColor;
}
public void setBackColor(String backColor) {
this.backColor = backColor;
}
public String getName() {
return name;
}
@ -126,12 +142,12 @@ public class TbPlatformDict implements Serializable {
this.videoCoverImg = videoCoverImg;
}
public String getRelUrl() {
return relUrl;
public String getJumpType() {
return jumpType;
}
public void setRelUrl(String relUrl) {
this.relUrl = relUrl;
public void setJumpType(String jumpType) {
this.jumpType = jumpType;
}
public String getAbsUrl() {

View File

@ -40,6 +40,8 @@ public class TbProduct implements Serializable {
private String shareImg;
private String images;
private String videoCoverImg;
private Integer sort;
@ -128,6 +130,14 @@ public class TbProduct implements Serializable {
private String cartNumber="0";
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public String getCartNumber() {
return cartNumber;
}

View File

@ -0,0 +1,160 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
/**
* 购买须知(关联tb_merchant_coupon)(TbPurchaseNotice)实体类
*
* @author ww
* @since 2024-04-11 10:00:23
*/
public class TbPurchaseNotice implements Serializable {
private static final long serialVersionUID = 811103518413221387L;
/**
* 自增
*/
private Integer id;
/**
* 商户卷Id
*/
private Integer couponId;
/**
* 使用日期说明
*/
private String dateUsed;
/**
* 可用时间说明
*/
private String availableTime;
/**
* 预约方式
*/
private String bookingType;
/**
* 退款说明
*/
private String refundPolicy;
/**
* 使用规则
*/
private String usageRules;
/**
* 发票说明
*/
private String invoiceInfo;
/**
* 团购价说明
*/
private String groupPurInfo;
/**
* 门市价/划线价说明
*/
private String marketPriceInfo;
/**
* 折扣说明
*/
private String discountInfo;
/**
* 平台温馨提示
*/
private String platformTips;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCouponId() {
return couponId;
}
public void setCouponId(Integer couponId) {
this.couponId = couponId;
}
public String getDateUsed() {
return dateUsed;
}
public void setDateUsed(String dateUsed) {
this.dateUsed = dateUsed;
}
public String getAvailableTime() {
return availableTime;
}
public void setAvailableTime(String availableTime) {
this.availableTime = availableTime;
}
public String getBookingType() {
return bookingType;
}
public void setBookingType(String bookingType) {
this.bookingType = bookingType;
}
public String getRefundPolicy() {
return refundPolicy;
}
public void setRefundPolicy(String refundPolicy) {
this.refundPolicy = refundPolicy;
}
public String getUsageRules() {
return usageRules;
}
public void setUsageRules(String usageRules) {
this.usageRules = usageRules;
}
public String getInvoiceInfo() {
return invoiceInfo;
}
public void setInvoiceInfo(String invoiceInfo) {
this.invoiceInfo = invoiceInfo;
}
public String getGroupPurInfo() {
return groupPurInfo;
}
public void setGroupPurInfo(String groupPurInfo) {
this.groupPurInfo = groupPurInfo;
}
public String getMarketPriceInfo() {
return marketPriceInfo;
}
public void setMarketPriceInfo(String marketPriceInfo) {
this.marketPriceInfo = marketPriceInfo;
}
public String getDiscountInfo() {
return discountInfo;
}
public void setDiscountInfo(String discountInfo) {
this.discountInfo = discountInfo;
}
public String getPlatformTips() {
return platformTips;
}
public void setPlatformTips(String platformTips) {
this.platformTips = platformTips;
}
}

View File

@ -100,4 +100,11 @@ public class TbShopInfo implements Serializable {
*/
private String shopQrcode;
private String isOpenYhq;
/**
* 商户标签
*/
private String tag;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,159 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.util.Date;
import java.io.Serializable;
/**
* 商户视频号(TbShopVideo)实体类
*
* @author ww
* @since 2024-04-12 14:50:09
*/
public class TbShopVideo implements Serializable {
private static final long serialVersionUID = 521986900418854409L;
private Integer id;
/**
* 店铺id
*/
private Integer shopId;
/**
* 1-公众号2-小程序3-视频号
*/
private Integer type;
/**
* 描述信息
*/
private String name;
/**
* 渠道id(视频号id)
*/
private Integer channelId;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 资源Id(视频号id)(公众号id)
*/
private Integer sourceId;
/**
* 资源地址
*/
private String sourceUrl;
/**
* 0:关闭1开启
*/
private Integer status;
/**
* 视频id
*/
private Integer videoId;
/**
* 视频地址
*/
private String videoUrl;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getChannelId() {
return channelId;
}
public void setChannelId(Integer channelId) {
this.channelId = channelId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getSourceId() {
return sourceId;
}
public void setSourceId(Integer sourceId) {
this.sourceId = sourceId;
}
public String getSourceUrl() {
return sourceUrl;
}
public void setSourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
}

View File

@ -1,76 +1,37 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
/**
* @author 12847
*/
@Data
public class HomeDto {
/**
* 地址
*/
private String address;
/**
* 品类
* 经度
*/
private String lat;
/**
* 纬度
*/
private String lng;
/**
* 品类 1.附近1Km
*/
private String type;
/**
* 1.理我最近 2.销量优先 3.价格优先
* 1.我最近 2.销量优先 3.价格优先
*/
private Integer orderBy;
/**
* 附近1KM 1选中 0未选中
*/
private Integer distance;
private Integer other;
private Integer page;
private Integer size;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getOrderBy() {
return orderBy;
}
public void setOrderBy(Integer orderBy) {
this.orderBy = orderBy;
}
public Integer getDistance() {
return distance;
}
public void setDistance(Integer distance) {
this.distance = distance;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
}

View File

@ -0,0 +1,43 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author lyf
*/
@Data
public class BannerInfoVo {
/**
* 昵称
*/
private String name;
/**
* 昵称
*/
private String logo;
/**
* 免单了多少钱
*/
private BigDecimal money;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo;
}
}

View File

@ -0,0 +1,33 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import java.util.List;
/**
* @author 12847
*/
public class BannerVO {
/**
* 有多少人参与了免单
*/
private String coupons;
private List<BannerInfoVo> counponsInfo;
public String getCoupons() {
return coupons;
}
public void setCoupons(String coupons) {
this.coupons = coupons;
}
public List<BannerInfoVo> getCounponsInfo() {
return counponsInfo;
}
public void setCounponsInfo(List<BannerInfoVo> counponsInfo) {
this.counponsInfo = counponsInfo;
}
}

View File

@ -0,0 +1,41 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import lombok.Data;
/**
* @author lyf
*/
@Data
public class CouAndShopVo {
/**
* 自增
*/
private Integer id;
/**
* 优惠券名称
*/
private String title;
private String shopId;
/**
* 优惠金额
*/
private Double amount;
/**
* 发放数量
*/
private Integer number;
/**
* 折扣 一位小数
*/
private Float ratio;
/**
* 关联商品Id
*/
private String relationIds;
private String shopName;
private String logo;
}

View File

@ -9,18 +9,27 @@ import java.util.List;
*/
public class DicDetailVO {
private String name;
private String dictName;
private String description;
private List<SysDictDetail> detail;
private Integer isChild;
private Boolean isChild;
public Integer getIsChild() {
public String getDictName() {
return dictName;
}
public void setDictName(String dictName) {
this.dictName = dictName;
}
public Boolean getIsChild() {
return isChild;
}
public void setIsChild(Integer isChild) {
public void setIsChild(Boolean isChild) {
this.isChild = isChild;
}

View File

@ -0,0 +1,31 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
/**
* 轮播图VO
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class HomeCarouselVo {
/**
* 描述 同类型下 name唯一
*/
private String name;
/**
* 轮播图url
*/
private String coverImg;
/**
* 跳转类型 拉起相机 跳转小程序 跳转第三方url
*/
private String jumpType;
/**
* 绝对跳转地址
*/
private String absUrl;
}

View File

@ -0,0 +1,33 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
/**
* 首页金刚区Vo
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class HomeDistrictVo{
/**
* 展示图url
*/
private String coverImg;
/**
* 描述 同类型下 name唯一
*/
private String name;
/**
* 字体颜色
*/
private String fontColor;
/**
* 类型: scan拉起相机relative内部页面absolute外链url
*/
private String jumpType;
/**
* 绝对跳转地址
*/
private String absUrl;
}

View File

@ -1,8 +1,6 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import lombok.Data;
import java.util.List;
@ -14,11 +12,11 @@ public class HomeUpVO {
/**
* 轮播图
*/
List<TbPlatformDict> carousel;
List<HomeCarouselVo> carousel;
/**
* 金刚区
*/
List<TbPlatformDict> district;
List<HomeDistrictVo> district;
/**
* 条件查询
*/
@ -31,6 +29,18 @@ public class HomeUpVO {
* 销量飙升
*/
HotRankingVO salesList;
/**
* 小横幅
*/
BannerVO bannerVO;
public BannerVO getBannerVO() {
return bannerVO;
}
public void setBannerVO(BannerVO bannerVO) {
this.bannerVO = bannerVO;
}
public TodayRankingVO getTodayList() {
return todayList;
@ -48,19 +58,19 @@ public class HomeUpVO {
this.salesList = salesList;
}
public List<TbPlatformDict> getCarousel() {
public List<HomeCarouselVo> getCarousel() {
return carousel;
}
public void setCarousel(List<TbPlatformDict> carousel) {
public void setCarousel(List<HomeCarouselVo> carousel) {
this.carousel = carousel;
}
public List<TbPlatformDict> getDistrict() {
public List<HomeDistrictVo> getDistrict() {
return district;
}
public void setDistrict(List<TbPlatformDict> district) {
public void setDistrict(List<HomeDistrictVo> district) {
this.district = district;
}

View File

@ -1,6 +1,8 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author lyf
@ -10,6 +12,11 @@ public class HomeVO {
* 店铺名称
*/
private String shopName;
/**
* 店铺名称
*/
private String shopImage;
/**
* 商品名称
*/
@ -29,7 +36,7 @@ public class HomeVO {
/**
* 折扣
*/
private Float discount;
private BigDecimal discount;
/**
* 共省金额
*/
@ -44,17 +51,37 @@ public class HomeVO {
/**
* 店铺标签
*/
private String shopTag;
private List<TagVo> shopTag;
/**
* 商品标签
*/
private String proTag;
private List<TagProductVO> proTag=new ArrayList<>();
/**
* 距离
*/
private String distances ="100";
private Integer id;
/**
* 结束时间
*/
private Long endTime;
public String getShopImage() {
return shopImage;
}
public void setShopImage(String shopImage) {
this.shopImage = shopImage;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public Integer getId() {
return id;
@ -72,19 +99,19 @@ public class HomeVO {
this.distances = distances;
}
public String getShopTag() {
public List<TagVo> getShopTag() {
return shopTag;
}
public void setShopTag(String shopTag) {
public void setShopTag(List<TagVo> shopTag) {
this.shopTag = shopTag;
}
public String getProTag() {
public List<TagProductVO> getProTag() {
return proTag;
}
public void setProTag(String proTag) {
public void setProTag(List<TagProductVO> proTag) {
this.proTag = proTag;
}
@ -137,11 +164,11 @@ public class HomeVO {
this.salePrice = salePrice;
}
public Float getDiscount() {
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(Float discount) {
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}

View File

@ -0,0 +1,73 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.alibaba.fastjson.JSONArray;
import com.chaozhanggui.system.cashierservice.entity.TbPurchaseNotice;
import lombok.Data;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author lyf
*/
@Data
public class ProductInfoVo {
/**
* 商品图片
*/
private JSONArray images;
/**
* 现价
*/
private BigDecimal salePrice;
/**
* 折扣
*/
private Float discount;
/**
* 原价
*/
private BigDecimal originPrice;
/**
* 销量
*/
private BigDecimal realSalesNumber;
/**
* 商品名称
*/
private String productName;
/**
* 店铺名称
*/
private String shopName;
/**
* 联系方式
*/
private String phone;
/**
* 营业时间
*/
private String businessTime;
/**
* 距离
*/
private String distances = "100";
/**
* 地址
*/
private String address;
/**
* 套餐详情
*/
List<ProductVo> productList = new ArrayList<>();
/**
* 购买须知/价格说明
*/
private TbPurchaseNotice purchaseNotice;
}

View File

@ -0,0 +1,30 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Data
public class ProductVo {
//选几个
private Integer number;
//类别
private String title;
//食物
private List<Food> foods=new ArrayList<>(); // 食品列表
@Data
public static class Food {
private String name; // 商品名称
private BigDecimal price; // 售价
private String unit; // 单位
/**
* 商品标签
*/
private List<TagProductVO> proTag=new ArrayList<>();
}
}

View File

@ -0,0 +1,22 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import lombok.Data;
/**
* 商品 标签
* @author lyf
*/
@Data
public class TagProductVO {
//商品id
private Integer productId;
//标签前 小图标
private String shareImg;
//标签 名称
private String name;
//字体颜色
private String fontColor;
//背景色
private String backColor;
}

View File

@ -0,0 +1,25 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class TagVo {
/**
* 标签前 小图标
*/
private String shareImg;
/**
* 描述 同类型下 name唯一
*/
private String name;
/**
* 字体颜色
*/
private String fontColor;
/**
* 背景色
*/
private String backColor;
}

View File

@ -2,21 +2,29 @@ package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.Enum.LogoEnum;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
import com.chaozhanggui.system.cashierservice.entity.vo.*;
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.*;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
import com.chaozhanggui.system.cashierservice.util.Threads;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
* @author lyf
@ -36,23 +44,39 @@ public class HomePageService {
private TbProductMapper productMapper;
@Resource
private SysDictDetailMapper sysDictDetailMapper;
@Resource
private TagProductDeptsMapper tagProductDeptsMapper;
@Autowired
private RedisUtil redisUtil;
public Result homePage(HomeDto homeDto,String environmen) throws ExecutionException, InterruptedException {
public Result homePage(HomeDto homeDto, String environmen) throws ExecutionException, InterruptedException {
int beginNo;
if(homeDto.getPage() <=0){
if (homeDto.getPage() <= 0) {
beginNo = 0;
}else{
} else {
beginNo = (homeDto.getPage() - 1) * homeDto.getSize();
}
//优惠卷
List<TbMerchantCoupon> tbMerchantCoupons = merchantCouponMapper.queryAllByPage(beginNo, homeDto.getSize());
//经纬度(附近一km)
Map<String, double[]> topAndBottomMap = new HashMap<>();
List<CouAndShopVo> tbMerchantCoupons = new ArrayList<>();
if (homeDto.getOther() != null && homeDto.getOther() == 1){
topAndBottomMap = LocationUtils.returnLLSquarePoint(Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), 1);
tbMerchantCoupons = merchantCouponMapper.queryAllByPage(beginNo, homeDto.getSize(), topAndBottomMap.get("rightTopPoint")[0],topAndBottomMap.get("rightTopPoint")[1],
topAndBottomMap.get("leftBottomPoint")[0],topAndBottomMap.get("leftBottomPoint")[1],homeDto.getAddress(),homeDto.getOrderBy().toString(),homeDto.getLng(),homeDto.getLat());
}else {
tbMerchantCoupons = merchantCouponMapper.queryAllByPage(beginNo, homeDto.getSize(), null,null,null,null,
homeDto.getAddress(),homeDto.getOrderBy().toString(),homeDto.getLng(),homeDto.getLat());
}
//统计shopId以及productId
List<String> shopIds = new ArrayList<>();
List<String> productIds = new ArrayList<>();
for (TbMerchantCoupon coupon : tbMerchantCoupons) {
List<Integer> productIdsInt = new ArrayList<>();
for (CouAndShopVo coupon : tbMerchantCoupons) {
shopIds.add(coupon.getShopId());
productIds.add(coupon.getRelationIds());
productIdsInt.add(Integer.valueOf(coupon.getRelationIds()));
}
CompletableFuture<List<TbShopInfo>> shopInfo = CompletableFuture.supplyAsync(() ->
shopInfoMapper.selectByIds(shopIds));
@ -60,68 +84,87 @@ public class HomePageService {
productMapper.selectByIds((productIds)));
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
productSkuMapper.selectSkus((productIds)));
CompletableFuture<List<TbPlatformDict>> dictPro = CompletableFuture.supplyAsync(() ->
platformDictMapper.queryAllByType("proTag",environmen));
CompletableFuture<List<TbPlatformDict>> dictShop = CompletableFuture.supplyAsync(() ->
platformDictMapper.queryAllByType("shopTag",environmen));
Threads.call(shopInfo,product,productSku,dictPro,dictShop);
boolean isFirstAdded = true;
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
tagProductDeptsMapper.queryTagAndProduct(productIdsInt));
Threads.call(shopInfo,product,productSku,dictPro);
//组装
List<HomeVO> homeVOList = new ArrayList<>();
for (TbMerchantCoupon o :tbMerchantCoupons) {
for (CouAndShopVo o : tbMerchantCoupons) {
HomeVO homeVO = new HomeVO();
homeVO.setDiscount(o.getRatio());
if (isFirstAdded){
homeVO.setShopTag(dictShop.get().get(0).getName());
homeVO.setProTag(dictPro.get().get(0).getName());
isFirstAdded = false;
}
homeVO.setId(o.getId());
for (TbShopInfo tbShopInfo : shopInfo.get()) {
if (o.getShopId().equals(tbShopInfo.getId().toString())) {
homeVO.setShopName(tbShopInfo.getShopName());
homeVO.setImage(tbShopInfo.getLogo());
if (StringUtils.isBlank(tbShopInfo.getTag())){
homeVO.setShopTag(new ArrayList<>());
}else {
List<Integer> shopTagIds = Arrays.stream(tbShopInfo.getTag().split(","))
.map(Integer::parseInt)
.collect(Collectors.toList());
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryByIdList(shopTagIds);
homeVO.setShopTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
}
}
}
for (TbProduct tbProduct :product.get()) {
for (TbProduct tbProduct : product.get()) {
if (o.getRelationIds().equals(tbProduct.getId().toString())) {
homeVO.setProductName(tbProduct.getName());
homeVO.setProductName(o.getTitle());
homeVO.setImage(tbProduct.getCoverImg());
homeVO.setId(tbProduct.getId());
homeVO.setProductId(tbProduct.getId());
}
}
for (TbProductSku tbProductSku :productSku.get()) {
for (TbProductSku tbProductSku : productSku.get()) {
if (o.getRelationIds().equals(tbProductSku.getProductId())) {
homeVO.setOriginPrice(tbProductSku.getSalePrice());
homeVO.setRealSalesNumber(tbProductSku.getRealSalesNumber() == null?BigDecimal.ZERO: new BigDecimal(tbProductSku.getRealSalesNumber()));
Float discount = homeVO.getDiscount();
BigDecimal discountDecimal = new BigDecimal(discount);
homeVO.setSalePrice(tbProductSku.getSalePrice().multiply((discountDecimal.multiply(new BigDecimal("0.1")))));
//原价
if (tbProductSku.getSalePrice().compareTo(BigDecimal.ZERO)==0){
homeVO.setOriginPrice(BigDecimal.ZERO);
homeVO.setDiscount(BigDecimal.ZERO);
}else {
homeVO.setOriginPrice(tbProductSku.getSalePrice());
homeVO.setDiscount(new BigDecimal(o.getAmount()).divide(tbProductSku.getSalePrice(),2,RoundingMode.DOWN).multiply(BigDecimal.TEN));
}
//销量
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
//现价
homeVO.setSalePrice(new BigDecimal(o.getAmount().toString()));
// 共省金额
homeVO.setSave(homeVO.getOriginPrice().subtract(homeVO.getSalePrice()));
}
}
for (TagProductVO tagProductVO :dictPro.get()) {
if (o.getRelationIds().equals(tagProductVO.getProductId().toString())){
homeVO.getProTag().add(tagProductVO);
}
}
homeVO.setEndTime(DateUtils.getDayEndLong());
homeVOList.add(homeVO);
}
return Result.success(CodeEnum.SUCCESS,homeVOList);
return Result.success(CodeEnum.SUCCESS, homeVOList);
}
public Result homePageUp(String environment){
public Result homePageUp(String environment) {
HomeUpVO homeUpVO = new HomeUpVO();
//轮播图
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("carousel",environment);
homeUpVO.setCarousel(carouselList);
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("carousel", environment);
homeUpVO.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
//金刚区
List<TbPlatformDict> districtList = platformDictMapper.queryAllByType("homeDistrict",environment);
homeUpVO.setDistrict(districtList);
List<TbPlatformDict> districtList = platformDictMapper.queryAllByType("homeDistrict", environment);
homeUpVO.setDistrict(JSONUtil.parseListTNewList(districtList, HomeDistrictVo.class));
//菜单
List<SysDict> sysDicts = sysDictDetailMapper.selectByAll();
List<DicDetailVO> dicDetailVO = new ArrayList<>();
for (SysDict sysDictsList : sysDicts) {
DicDetailVO dicDetailVOList = new DicDetailVO();
dicDetailVOList.setDictName(sysDictsList.getDictName());
dicDetailVOList.setName(sysDictsList.getName());
dicDetailVOList.setDescription(sysDictsList.getDescription());
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
dicDetailVOList.setIsChild(sysDictsList.getIsChild());
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
dicDetailVO.add(dicDetailVOList);
}
homeUpVO.setMenu(dicDetailVO);
@ -131,10 +174,10 @@ public class HomePageService {
List<HomeVO> homeVOs = productSkuMapper.selectSale();
for (HomeVO o : homeVOs) {
BigDecimal originPrice = o.getOriginPrice();
if (originPrice.compareTo(BigDecimal.ZERO)!= 0){
BigDecimal multiply = o.getSalePrice().divide(o.getOriginPrice(),2,RoundingMode.DOWN).multiply(BigDecimal.TEN);
o.setDiscount(multiply.floatValue());
}else {
if (originPrice.compareTo(BigDecimal.ZERO) != 0) {
BigDecimal multiply = o.getSalePrice().divide(o.getOriginPrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN);
o.setDiscount(multiply);
} else {
o.setDiscount(null);
}
}
@ -149,8 +192,34 @@ public class HomePageService {
TodayRankingVO todayRankingVO = new TodayRankingVO();
todayRankingVO.setTodayList(homeVODay);
homeUpVO.setTodayList(todayRankingVO);
return Result.success(CodeEnum.SUCCESS,homeUpVO);
/**
* 小条幅
*/
homeUpVO.setBannerVO(bannerVoRandom());
return Result.success(CodeEnum.SUCCESS, homeUpVO);
}
/**
* 小条幅随机数据
* @return
*/
private BannerVO bannerVoRandom(){
BannerVO bannerVO = new BannerVO();
List<BannerInfoVo> bannerInfoList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
BannerInfoVo bannerInfoVo = new BannerInfoVo();
bannerInfoVo.setName(StringUtil.generateRandomNickname(5));
bannerInfoVo.setLogo(LogoEnum.getValueByKey(RandomUtil.randomInt()));
bannerInfoVo.setMoney(RandomUtil.randomDecimalGenerator());
bannerInfoList.add(bannerInfoVo);
}
bannerVO.setCounponsInfo(bannerInfoList);
bannerVO.setCoupons(redisUtil.getMessage("num"));
return bannerVO;
}
}

View File

@ -123,7 +123,11 @@ public class LoginService {
tbShopUser.setUserId(userInfo.getId().toString());
tbShopUser.setMiniOpenId(openId);
tbShopUser.setCreatedAt(System.currentTimeMillis());
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.insert(tbShopUser);
}else {
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
}
shopMap.put("shopId", tbShopUser.getShopId());
shopMap.put("name", tbShopInfo.getShopName());
@ -156,11 +160,6 @@ public class LoginService {
}
return Result.fail("登录失败");
}
public static void main(String[] args) throws Exception {
String token = TokenUtil.generateToken(19, "or1l8654IFK6GIBQjK1ZKaPH3x0M",
"19191703856", "微信用户");
System.out.println(token);
}
public TbUserInfo register(String phone, String password, String nickName) {
@ -172,7 +171,7 @@ public class LoginService {
userInfo.setConsumeAmount(BigDecimal.ZERO);
userInfo.setTotalScore(0);
userInfo.setLockScore(0);
userInfo.setHeadImg("");
userInfo.setHeadImg("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240411/a2be5869bfa24d72a4782f695cc53ed1.png");//默认头像
userInfo.setNickName(nickName);
userInfo.setTelephone(phone);
userInfo.setStatus(Byte.parseByte("1"));
@ -309,5 +308,14 @@ public class LoginService {
return Result.success(CodeEnum.ENCRYPT, map);
}
public Result upUserInfo(TbUserInfo userInfo){
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
return Result.success(CodeEnum.SUCCESS);
}
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
System.out.println(RandomUtil.randomNumbers(10));
}
}
}

View File

@ -2,21 +2,32 @@ package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.vo.ProductInfoVo;
import com.chaozhanggui.system.cashierservice.entity.vo.ProductVo;
import com.chaozhanggui.system.cashierservice.entity.vo.TagProductVO;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.socket.AppWebSocketServer;
import com.chaozhanggui.system.cashierservice.util.Threads;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
@Service
@Slf4j
@ -37,85 +48,165 @@ public class ProductService {
@Autowired
private TbShopTableMapper tbShopTableMapper;
@Resource
private TagProductDeptsMapper tagProductDeptsMapper;
@Resource
private TbMerchantCouponMapper merchantCouponMapper;
@Resource
private TbPlatformDictMapper platformDictMapper;
@Resource
private TbShopUnitMapper unitMapper;
@Resource
private TbShopCategoryMapper categoryMapper;
@Resource
private TbPurchaseNoticeMapper purchaseNoticeMapper;
@Autowired
TbProductSkuMapper tbProductSkuMapper;
public Result queryProduct(String code, String productGroupId) {
ConcurrentMap<String, Object> concurrentMap = new ConcurrentHashMap<>();
public Result queryProduct(String code,String productGroupId){
ConcurrentMap<String,Object> concurrentMap=new ConcurrentHashMap<>();
TbShopTable tbShopTable= tbShopTableMapper.selectQRcode(code);
if(ObjectUtil.isEmpty(tbShopTable)||ObjectUtil.isNull(tbShopTable)){
TbShopTable tbShopTable = tbShopTableMapper.selectQRcode(code);
if (ObjectUtil.isEmpty(tbShopTable) || ObjectUtil.isNull(tbShopTable)) {
return Result.fail("台桌信息不存在");
}
Integer id= ObjectUtil.isNotEmpty(productGroupId)?Integer.valueOf(productGroupId):null;
List<TbProductGroup> groupList=tbProductGroupMapper.selectByQrcode(code,id);
if(ObjectUtil.isNotEmpty(groupList)&&groupList.size()>0){
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
List<TbProductGroup> groupList = tbProductGroupMapper.selectByQrcode(code, id);
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
TbProductGroup group= groupList.get(0);
TbShopInfo shopInfo= tbShopInfoMapper.selectByPrimaryKey(group.getShopId()) ;
concurrentMap.put("shopTableInfo",tbShopTable);
concurrentMap.put("storeInfo",shopInfo);
groupList.parallelStream().forEach(g->{
String in=g.getProductIds().substring(1,g.getProductIds().length()-1);
TbProductGroup group = groupList.get(0);
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(group.getShopId());
concurrentMap.put("shopTableInfo", tbShopTable);
concurrentMap.put("storeInfo", shopInfo);
groupList.parallelStream().forEach(g -> {
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
if(ObjectUtil.isNotEmpty(in)&&ObjectUtil.isNotNull(in)){
log.info("请求参数:{}",in);
List<TbProduct> products= tbProductMapper.selectByIdIn(in);
if(ObjectUtil.isNotEmpty(products)&&products.size()>0){
products.parallelStream().forEach(it->{
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
log.info("请求参数:{}", in);
List<TbProduct> products = tbProductMapper.selectByIdIn(in);
if (ObjectUtil.isNotEmpty(products) && products.size() > 0) {
products.parallelStream().forEach(it -> {
Integer sum = 0;
if (AppWebSocketServer.userMap.containsKey(code)){
if (AppWebSocketServer.userMap.containsKey(code)) {
Set<String> userSet = AppWebSocketServer.userMap.get(code);
if (userSet.isEmpty()){
sum= tbProductMapper.selectByQcode(code,it.getId(),it.getShopId());
}else {
if (userSet.isEmpty()) {
sum = tbProductMapper.selectByQcode(code, it.getId(), it.getShopId());
} else {
List<String> userList = new ArrayList<>(userSet);
sum= tbProductMapper.selectByNewQcode(code,it.getId(),it.getShopId(),userList);
sum = tbProductMapper.selectByNewQcode(code, it.getId(), it.getShopId(), userList);
}
}else {
sum= tbProductMapper.selectByQcode(code,it.getId(),it.getShopId());
} else {
sum = tbProductMapper.selectByQcode(code, it.getId(), it.getShopId());
}
it.setCartNumber(sum==null?"0":String.valueOf(sum));
TbProductSkuResult skuResult= tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
it.setCartNumber(sum == null ? "0" : String.valueOf(sum));
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
it.setProductSkuResult(skuResult);
});
g.setProducts(products);
}else {
} else {
g.setProducts(new ArrayList<>());
}
}else {
} else {
g.setProducts(new ArrayList<>());
}
});
concurrentMap.put("productInfo",groupList);
concurrentMap.put("productInfo", groupList);
}
return Result.success(CodeEnum.SUCCESS,concurrentMap);
return Result.success(CodeEnum.SUCCESS, concurrentMap);
}
public Result queryProductSku(String shopId, String productId, String spec_tag){
if(ObjectUtil.isEmpty(shopId)||ObjectUtil.isEmpty(productId)){
public Result queryProductSku(String shopId, String productId, String spec_tag) {
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId)) {
return Result.fail("参数错误");
}
TbProductSkuWithBLOBs tbProductSkuWithBLOBs= tbProductSkuMapper.selectByShopIdAndProductIdAndSpec(shopId,productId,spec_tag);
return Result.success(CodeEnum.SUCCESS,tbProductSkuWithBLOBs);
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByShopIdAndProductIdAndSpec(shopId, productId, spec_tag);
return Result.success(CodeEnum.SUCCESS, tbProductSkuWithBLOBs);
}
public Result productInfo(Integer productId) throws Exception {
TbMerchantCoupon tbMerchantCoupon = merchantCouponMapper.queryById(productId);
CompletableFuture<TbShopInfo> shopInfo = CompletableFuture.supplyAsync(() ->
tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbMerchantCoupon.getShopId())));
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
tbProductMapper.selectById(Integer.valueOf(tbMerchantCoupon.getRelationIds())));
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
tbProductSkuMapper.selectSku(tbMerchantCoupon.getRelationIds()));
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
tagProductDeptsMapper.queryTagByProductId(tbMerchantCoupon.getRelationIds()));
CompletableFuture<TbPurchaseNotice> purchaseNotice = CompletableFuture.supplyAsync(() ->
purchaseNoticeMapper.queryById(tbMerchantCoupon.getId()));
Threads.call(shopInfo, product, productSku, dictPro);
ProductInfoVo productInfo = new ProductInfoVo();
// 图片组装
TbProduct tbProduct = product.get();
TbShopInfo tbShopInfo = shopInfo.get();
if (StringUtils.isNotBlank(tbProduct.getImages())) {
productInfo.setImages(JSON.parseArray(tbProduct.getImages()));
} else {
productInfo.setImages(new JSONArray());
}
//折扣
productInfo.setDiscount(tbMerchantCoupon.getRatio());
//价格组装
for (TbProductSku tbProductSku : productSku.get()) {
productInfo.setOriginPrice(tbProductSku.getSalePrice());
productInfo.setRealSalesNumber(tbProductSku.getRealSalesNumber() == null ? BigDecimal.ZERO : new BigDecimal(tbProductSku.getRealSalesNumber()));
Float discount = productInfo.getDiscount();
BigDecimal discountDecimal = new BigDecimal(discount);
productInfo.setSalePrice(tbProductSku.getSalePrice().multiply((discountDecimal.multiply(new BigDecimal("0.1")))));
}
//名称
productInfo.setProductName(tbProduct.getName());
//店铺
productInfo.setShopName(tbShopInfo.getShopName() + (StringUtils.isNotBlank(tbShopInfo.getChainName()) ? "(" + tbShopInfo.getChainName() + ")" : ""));
productInfo.setPhone(tbShopInfo.getPhone());
productInfo.setBusinessTime(tbShopInfo.getBusinessTime());
// productInfo.setDistances();//距离
productInfo.setAddress(tbShopInfo.getAddress());
//商品 暂时只做单商品
ProductVo productVo = new ProductVo();
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getUnitId()));
TbShopCategory tbShopCategory = categoryMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getCategoryId()));
productVo.setTitle(tbShopCategory.getName());
productVo.setNumber(1);
ProductVo.Food food = new ProductVo.Food();
food.setName(tbProduct.getName());
food.setUnit(tbShopUnit.getName());
food.setPrice(tbProduct.getLowPrice());
for (TagProductVO tagProductVO : dictPro.get()) {
food.getProTag().add(tagProductVO);
}
productVo.getFoods().add(food);
productInfo.getProductList().add(productVo);
productInfo.setPurchaseNotice(purchaseNotice.get());
return Result.success(CodeEnum.SUCCESS, productInfo);
}
private List<String> tagList(String tag) {
if (tag == null) {
return new ArrayList<>();
} else {
String[] arr = tag.split(",");
return new ArrayList<>(Arrays.asList(arr));
}
}
}

View File

@ -0,0 +1,38 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.dao.TbShopVideoMapper;
import com.chaozhanggui.system.cashierservice.entity.TbShopVideo;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import javax.annotation.Resource;
/**
* 视频号 公众号
* @author ww
* @since 2024-04-12 14:50:10
*/
public class TbShopVideoService {
@Resource
private TbShopVideoMapper tbShopVideoMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
public Result queryById(Integer id) {
return Result.success(CodeEnum.ENCRYPT,tbShopVideoMapper.queryById(id));
}
/**
* @param tbShopVideo 筛选条件
* @return 查询结果
*/
public Result queryAll(TbShopVideo tbShopVideo) {
tbShopVideo.setStatus(1);
return Result.success(CodeEnum.ENCRYPT,tbShopVideoMapper.queryAll(tbShopVideo));
}
}

View File

@ -3,8 +3,14 @@ package com.chaozhanggui.system.cashierservice.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* Created by SEELE on 2018/4/19.
@ -244,6 +250,48 @@ public class DateUtils {
return date;
}
/**
* 今天结束时间
* @return
*/
public static Date getDayEnd() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
cal.set(Calendar.MILLISECOND, 999);
return cal.getTime();
}
public static Long getDayEndLong() {
// 获取今天的日期和时间00:00:00
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();
// 将时间设置为今天的结束时间23:59:59.999999999
LocalDateTime endOfDay = todayStart.plusDays(1).minusNanos(1);
// 转换为UTC时间戳毫秒
long timestampInMillis = endOfDay.toInstant(ZoneOffset.UTC).toEpochMilli();
return timestampInMillis;
}
public static String getTodayEndTimeAsString() {
// 获取今天的日期
LocalDate today = LocalDate.now();
// 创建今天的结束时间23:59:59.999
LocalTime endTime = LocalTime.of(23, 59, 59, 999_000_000);
// 组合日期和时间
LocalDateTime todayEndTime = LocalDateTime.of(today, endTime);
// 格式化时间
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
// 转换为字符串
return todayEndTime.format(formatter);
}
/**
* 得到n天之后是周几
* @param days

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.*;
@ -172,6 +173,26 @@ public class JSONUtil {
}
}
/**
* @param list 某集合
* @param clazz 要转成的实体
* 需要在目标实体增加注解 忽略未知属性 @JsonIgnoreProperties(ignoreUnknown = true)
* @return
* @param <T>
*/
public static <T> List<T> parseListTNewList(List<?> list, Class<T> clazz) {
ObjectMapper objectMapper = new ObjectMapper(); // 创建JSON转换器
try {
// 将List<?>转换为JSON字符串
String json = objectMapper.writeValueAsString(list);
// 将JSON字符串转换为List<T>
return objectMapper.readValue(json, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static class JSONEntity {
public JSONEntity() {
}

View File

@ -9,30 +9,18 @@ import static java.lang.Math.sin;
public class LocationUtils {
public static String district(String keywords) {
Map<String, String> param=new HashMap<>();
Map<String, String> param = new HashMap<>();
//超掌柜生活-用户端
param.put("key","7a7f2e4790ea222660a027352ee3af39");
param.put("keywords",keywords);
param.put("subdistrict","1");
param.put("extensions","base");
param.put("key", "7a7f2e4790ea222660a027352ee3af39");
param.put("keywords", keywords);
param.put("subdistrict", "2");
param.put("extensions", "base");
String s = HttpClientUtil.doGet("https://restapi.amap.com/v3/config/district", param);
return s;
}
/**
* 将角度转化为弧度
*/
public static double radians(double d) {
return d * Math.PI / 180.0;
}
/**
* 根据两点经纬度坐标计算直线距离
* <p>
* S = 2arcsinsin²(a/2)+cos(lat1)*cos(lat2)*sin²(b/2)*6378.137
* <p>
* 1. lng1 lat1 表示A点经纬度lng2 lat2 表示B点经纬度<br>
* 2. a=lat1 lat2 为两点纬度之差 b=lng1 -lng2 为两点经度之差<br>
* 3. 6378.137为地球赤道半径单位为千米
*
* @param lng1 点1经度
* @param lat1 点1纬度
@ -43,7 +31,7 @@ public class LocationUtils {
*/
public static double getDistanceFrom2LngLat(double lng1, double lat1, double lng2, double lat2) {
//将角度转化为弧度
double radLng1 = radians(lng1);
double radLng1 = radians(lng1);//d * Math.PI / 180.0;
double radLat1 = radians(lat1);
double radLng2 = radians(lng2);
double radLat2 = radians(lat2);
@ -54,16 +42,65 @@ public class LocationUtils {
return 2 * asin(sqrt(sin(a / 2) * sin(a / 2) + cos(radLat1) * cos(radLat2) * sin(b / 2) * sin(b / 2))) * 6378.137;
}
/**
* @param longitude 经度 108
* @param latitude 纬度 34
* @param distanceInKm 范围千米
* 大于左下的经度lat小于右上的经度lat
* 大于左下的纬度lng小于右上的纬度lng
* return Map<String, double[]> stringMap
* 右上顶点 double[] leftTopPoints = stringMap.get("rightTopPoint");
* 左下点 double[] leftBottomPoints = stringMap.get("leftBottomPoint");
*/
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, double distanceInKm) {
Map<String, double[]> squareMap = new HashMap<>();
// 地球平均半径单位千米
double earthRadius = 6378.137;
// 将距离转换为弧度
double radialDistance = distanceInKm / earthRadius;
// 计算纬度上变化对应的角度
double dLatitude = Math.toDegrees(2 * Math.asin(Math.sin(radialDistance / 2) / Math.cos(Math.toRadians(latitude))));
// 计算经度上变化对应的角度这里需要考虑纬度对距离的影响
// 使用Haversine公式来估算在给定纬度上距离对应的经度变化
double estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, longitude + 0.01); // 假设0.01度经度变化对应的距离
double dLongitude = distanceInKm / estimatedLongitudeDistance * 0.0192736; // 根据比例计算经度变化
// 正方形四个顶点的坐标
double[] rightTopPoint = {latitude + dLatitude / 2, longitude + dLongitude / 2};
double[] leftBottomPoint = {latitude - dLatitude / 2, longitude - dLongitude / 2};
squareMap.put("rightTopPoint", rightTopPoint);
squareMap.put("leftBottomPoint", leftBottomPoint);
// 打印结果rightTopPoint[0]纬度lngrightTopPoint[1]经度lat
System.out.println("rightTop" + rightTopPoint[0] + "======" + rightTopPoint[1]);
System.out.println("leftBottom" + leftBottomPoint[0] + "======" + leftBottomPoint[1]);
return squareMap;
}
/**
* 将角度转化为弧度
*/
public static double radians(double d) {
return d * Math.PI / 180.0;
}
//1KM
public static void main(String[] args) {
Map<String, double[]> stringMap = returnLLSquarePoint(108.954398, 34.308687, 1);
double[] leftTopPoints = stringMap.get("rightTopPoint");
double[] leftBottomPoints = stringMap.get("leftBottomPoint");
double lat2 = 108.975418;
double lon2 = 34.280890;
double distance3 = getDistanceFrom2LngLat(109.019993, 34.342849, lat2, lon2);
System.out.println(distance3);
// 计算距离
double distance1 = getDistanceFrom2LngLat(leftTopPoints[1], leftTopPoints[0], lat2, lon2);
double distance2 = getDistanceFrom2LngLat(leftBottomPoints[1], leftBottomPoints[0], lat2, lon2);
System.out.println("Distance between the two points is: " + distance1 + " km");
System.out.println("Distance between the two points is: " + distance2 + " km");
}
// public static void main(String[] args) {
// // 示例经纬度坐标
// double lat1 = 108.954398;
// double lon1 = 34.308687;
// Map<String, double[]> stringMap = returnLLSquarePoint(34.342849, 109.019993, 1);
//
// double lat2 = 108.953555;
// double lon2 = 34.276169;
//
// // 计算距离
// double distance = getDistanceFrom2LngLat(lat1, lon1, lat2, lon2);
// System.out.println("Distance between the two points is: " + distance + " km");
// }
}

View File

@ -23,9 +23,37 @@ public class RandomUtil {
Random random = new Random();
int randomIndex = random.nextInt(list.size()); // 生成一个随机的索引值
TbOrderInfo orderInfo = list.get(randomIndex);
if (map.containsKey(orderInfo.getId())){
return selectWinner(list,map);
if (map.containsKey(orderInfo.getId())) {
return selectWinner(list, map);
}
return list.get(randomIndex); // 返回对应索引的用户
}
public static BigDecimal randomDecimalGenerator(){
double number = generateRandomInt(2, 40);
BigDecimal bdNumber = BigDecimal.valueOf(number);
BigDecimal bdMultiplier = BigDecimal.valueOf(5);
BigDecimal result = bdNumber.setScale(1, RoundingMode.HALF_UP);
BigDecimal multiply = result.multiply(bdMultiplier);
return multiply;
}
private static double generateRandomInt(double min, double max) {
Random random = new Random();
return min + (max-min) * random.nextDouble();
}
public static void main(String[] args) {
for (int i = 0; i < 20; i++) {
System.out.println("随机数为"+randomDecimalGenerator());
}
}
public static Integer randomInt() {
Random random = new Random();
// 生成1到27之间的随机整数包括1和27
return random.nextInt(46) + 1;
}
}

View File

@ -61,4 +61,26 @@ public class StringUtil {
return result;
}
private static final String CHINESE_CHARS = "你我他她它们这里那里多少是否好坏快慢上下左右前后高低大小长短方圆胖瘦黑白红绿蓝黄紫粉红桔红橙黄棕灰褐";
// 生成随机中文昵称
public static String generateRandomNickname(int length) {
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
int index = random.nextInt(CHINESE_CHARS.length());
char randomChar = CHINESE_CHARS.charAt(index);
sb.append(randomChar);
}
return desensitizeNickname(sb.toString());
}
// 对昵称进行脱敏处理
public static String desensitizeNickname(String nickname) {
if (nickname == null || nickname.length() != 5) {
return nickname;
}
return nickname.charAt(0) + "***" + nickname.charAt(4);
}
}

View File

@ -1,155 +1,13 @@
<?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.SysDictDetailMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
<id column="detail_id" jdbcType="BIGINT" property="detailId" />
<result column="dict_id" jdbcType="BIGINT" property="dictId" />
<result column="label" jdbcType="VARCHAR" property="label" />
<result column="value" jdbcType="VARCHAR" property="value" />
<result column="dict_sort" jdbcType="INTEGER" property="dictSort" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
detail_id, dict_id, label, value, dict_sort, create_by, update_by, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_dict_detail
where detail_id = #{detailId,jdbcType=BIGINT}
</select>
<select id="selectByAll" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
select * from sys_dict
</select>
<select id="selectByAllDetail" resultType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
select * from sys_dict_detail
where dict_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectByDictId" resultType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
select * from sys_dict_detail
where dict_id = #{dictId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from sys_dict_detail
where detail_id = #{detailId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
insert into sys_dict_detail (detail_id, dict_id, label,
value, dict_sort, create_by,
update_by, create_time, update_time
)
values (#{detailId,jdbcType=BIGINT}, #{dictId,jdbcType=BIGINT}, #{label,jdbcType=VARCHAR},
#{value,jdbcType=VARCHAR}, #{dictSort,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR},
#{updateBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
insert into sys_dict_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="detailId != null">
detail_id,
</if>
<if test="dictId != null">
dict_id,
</if>
<if test="label != null">
label,
</if>
<if test="value != null">
value,
</if>
<if test="dictSort != null">
dict_sort,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="detailId != null">
#{detailId,jdbcType=BIGINT},
</if>
<if test="dictId != null">
#{dictId,jdbcType=BIGINT},
</if>
<if test="label != null">
#{label,jdbcType=VARCHAR},
</if>
<if test="value != null">
#{value,jdbcType=VARCHAR},
</if>
<if test="dictSort != null">
#{dictSort,jdbcType=INTEGER},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</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.SysDictDetail">
update sys_dict_detail
<set>
<if test="dictId != null">
dict_id = #{dictId,jdbcType=BIGINT},
</if>
<if test="label != null">
label = #{label,jdbcType=VARCHAR},
</if>
<if test="value != null">
value = #{value,jdbcType=VARCHAR},
</if>
<if test="dictSort != null">
dict_sort = #{dictSort,jdbcType=INTEGER},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where detail_id = #{detailId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
update sys_dict_detail
set dict_id = #{dictId,jdbcType=BIGINT},
label = #{label,jdbcType=VARCHAR},
value = #{value,jdbcType=VARCHAR},
dict_sort = #{dictSort,jdbcType=INTEGER},
create_by = #{createBy,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where detail_id = #{detailId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,40 @@
<?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.TagProductDeptsMapper">
<select id="queryTagAndProduct" resultType="com.chaozhanggui.system.cashierservice.entity.vo.TagProductVO">
SELECT
depts.product_id AS productId,
dict.share_img AS shareImg,
dict.name AS name,
dict.font_color AS fontColor,
dict.back_color AS backColor
FROM
tag_product_depts AS depts
LEFT JOIN tb_platform_dict AS dict ON dict.id = depts.tag_id
WHERE
dict.type='proTag' AND
depts.product_id IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
order by dict.sort
</select>
<select id="queryTagByProductId" resultType="com.chaozhanggui.system.cashierservice.entity.vo.TagProductVO">
SELECT
depts.product_id AS productId,
dict.share_img AS shareImg,
dict.name AS name,
dict.font_color AS fontColor,
dict.back_color AS backColor
FROM
tag_product_depts AS depts
LEFT JOIN tb_platform_dict AS dict ON dict.id = depts.tag_id
WHERE
depts.product_id=#{productId}
ORDER BY dict.sort
</select>
</mapper>

View File

@ -268,13 +268,45 @@
</if>
</where>
</select>
<select id="queryAllByPage" resultType="com.chaozhanggui.system.cashierservice.entity.TbMerchantCoupon">
select
id, status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id
from tb_merchant_coupon
where class_type ='product'
AND ratio IS NOT NULL
limit #{page}, #{size}
<select id="queryAllByPage" resultType="com.chaozhanggui.system.cashierservice.entity.vo.CouAndShopVo">
SELECT
cou.id as id,
cou.title as title,
cou.shop_id as shopId,
cou.amount as amount,
cou.number as number,
cou.ratio as ratio,
cou.relation_ids as relationIds,
info.shop_name as shopName,
info.logo
FROM
tb_merchant_coupon as cou
LEFT JOIN tb_shop_info as info ON cou.shop_id = info.id
<where>
cou.class_type = 'product'
AND cou.`status` = 1
AND info.cities =#{cities}
<if test="rightTopLng != null and rightTopLng != '' and leftBottomLng != null and leftBottomLng != ''">
AND info.lng BETWEEN #{leftBottomLng} AND #{rightTopLng}
AND info.lat BETWEEN #{leftBottomLat} AND #{rightTopLat}
</if>
</where>
<choose>
<when test="order == '1'">
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
</when>
<when test="order == '2'">
ORDER BY cou.number ASC
</when>
<when test="order == '3'">
ORDER BY cou.amount ASC
</when>
<otherwise>
ORDER BY cou.id ASC
</otherwise>
</choose>
limit #{pageable}, #{sizeable}
</select>
<!--新增所有列-->

View File

@ -4,13 +4,15 @@
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict" id="TbPlatformDictMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="fontColor" column="font_color" jdbcType="VARCHAR"/>
<result property="backColor" column="back_color" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="coverImg" column="cover_img" jdbcType="VARCHAR"/>
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
<result property="video" column="video" jdbcType="VARCHAR"/>
<result property="videoCoverImg" column="video_cover_img" jdbcType="VARCHAR"/>
<result property="relUrl" column="rel_url" jdbcType="VARCHAR"/>
<result property="jumpType" column="jump_type" jdbcType="VARCHAR"/>
<result property="absUrl" column="abs_url" jdbcType="VARCHAR"/>
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
@ -23,121 +25,25 @@
<!--查询单个-->
<select id="queryById" resultMap="TbPlatformDictMap">
select
id, name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
id, name, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
from tb_platform_dict
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TbPlatformDictMap">
<select id="queryByIdList" resultMap="TbPlatformDictMap">
select
id, name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
id, name, type, font_color, back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
from tb_platform_dict
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="coverImg != null and coverImg != ''">
and cover_img = #{coverImg}
</if>
<if test="shareImg != null and shareImg != ''">
and share_img = #{shareImg}
</if>
<if test="video != null and video != ''">
and video = #{video}
</if>
<if test="videoCoverImg != null and videoCoverImg != ''">
and video_cover_img = #{videoCoverImg}
</if>
<if test="relUrl != null and relUrl != ''">
and rel_url = #{relUrl}
</if>
<if test="absUrl != null and absUrl != ''">
and abs_url = #{absUrl}
</if>
<if test="createdAt != null">
and created_at = #{createdAt}
</if>
<if test="updatedAt != null">
and updated_at = #{updatedAt}
</if>
<if test="isShowCash != null">
and is_show_cash = #{isShowCash}
</if>
<if test="isShowMall != null">
and is_show_mall = #{isShowMall}
</if>
<if test="isShowApp != null">
and is_show_app = #{isShowApp}
</if>
<if test="sort != null">
and sort = #{sort}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
where id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from tb_platform_dict
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="coverImg != null and coverImg != ''">
and cover_img = #{coverImg}
</if>
<if test="shareImg != null and shareImg != ''">
and share_img = #{shareImg}
</if>
<if test="video != null and video != ''">
and video = #{video}
</if>
<if test="videoCoverImg != null and videoCoverImg != ''">
and video_cover_img = #{videoCoverImg}
</if>
<if test="relUrl != null and relUrl != ''">
and rel_url = #{relUrl}
</if>
<if test="absUrl != null and absUrl != ''">
and abs_url = #{absUrl}
</if>
<if test="createdAt != null">
and created_at = #{createdAt}
</if>
<if test="updatedAt != null">
and updated_at = #{updatedAt}
</if>
<if test="isShowCash != null">
and is_show_cash = #{isShowCash}
</if>
<if test="isShowMall != null">
and is_show_mall = #{isShowMall}
</if>
<if test="isShowApp != null">
and is_show_app = #{isShowApp}
</if>
<if test="sort != null">
and sort = #{sort}
</if>
</where>
</select>
<select id="queryAllByType" resultType="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict">
select
id, name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
id, name, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
from tb_platform_dict
<where>
<if test="type != null and type != ''">
@ -151,98 +57,5 @@
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_platform_dict(name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort)
values (#{name}, #{type}, #{coverImg}, #{shareImg}, #{video}, #{videoCoverImg}, #{relUrl}, #{absUrl}, #{createdAt}, #{updatedAt}, #{isShowCash}, #{isShowMall}, #{isShowApp}, #{sort})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_platform_dict(name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.type}, #{entity.coverImg}, #{entity.shareImg}, #{entity.video}, #{entity.videoCoverImg}, #{entity.relUrl}, #{entity.absUrl}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.isShowCash}, #{entity.isShowMall}, #{entity.isShowApp}, #{entity.sort})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_platform_dict(name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.type}, #{entity.coverImg}, #{entity.shareImg}, #{entity.video}, #{entity.videoCoverImg}, #{entity.relUrl}, #{entity.absUrl}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.isShowCash}, #{entity.isShowMall}, #{entity.isShowApp}, #{entity.sort})
</foreach>
on duplicate key update
name = values(name),
type = values(type),
cover_img = values(cover_img),
share_img = values(share_img),
video = values(video),
video_cover_img = values(video_cover_img),
rel_url = values(rel_url),
abs_url = values(abs_url),
created_at = values(created_at),
updated_at = values(updated_at),
is_show_cash = values(is_show_cash),
is_show_mall = values(is_show_mall),
is_show_app = values(is_show_app),
sort = values(sort)
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_platform_dict
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="type != null and type != ''">
type = #{type},
</if>
<if test="coverImg != null and coverImg != ''">
cover_img = #{coverImg},
</if>
<if test="shareImg != null and shareImg != ''">
share_img = #{shareImg},
</if>
<if test="video != null and video != ''">
video = #{video},
</if>
<if test="videoCoverImg != null and videoCoverImg != ''">
video_cover_img = #{videoCoverImg},
</if>
<if test="relUrl != null and relUrl != ''">
rel_url = #{relUrl},
</if>
<if test="absUrl != null and absUrl != ''">
abs_url = #{absUrl},
</if>
<if test="createdAt != null">
created_at = #{createdAt},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt},
</if>
<if test="isShowCash != null">
is_show_cash = #{isShowCash},
</if>
<if test="isShowMall != null">
is_show_mall = #{isShowMall},
</if>
<if test="isShowApp != null">
is_show_app = #{isShowApp},
</if>
<if test="sort != null">
sort = #{sort},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from tb_platform_dict where id = #{id}
</delete>
</mapper>

View File

@ -933,4 +933,7 @@
#{item}
</foreach>
</select>
<select id="selectLimit" resultType="com.chaozhanggui.system.cashierservice.entity.TbSystemCoupons">
select * from tb_system_coupons limit 1
</select>
</mapper>

View File

@ -381,6 +381,14 @@
GROUP BY
product_id
</select>
<select id="selectSku" resultType="com.chaozhanggui.system.cashierservice.entity.TbProductSku">
SELECT
*
FROM
tb_product_sku
WHERE
product_id = #{productId}
</select>
<select id="selectSale" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
SELECT
pro.id as id,

View File

@ -0,0 +1,34 @@
<?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.TbPurchaseNoticeMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbPurchaseNotice" id="TbPurchaseNoticeMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="couponId" column="coupon_id" jdbcType="INTEGER"/>
<result property="dateUsed" column="date_used" jdbcType="VARCHAR"/>
<result property="availableTime" column="available_time" jdbcType="VARCHAR"/>
<result property="bookingType" column="booking_type" jdbcType="VARCHAR"/>
<result property="refundPolicy" column="refund_policy" jdbcType="VARCHAR"/>
<result property="usageRules" column="usage_rules" jdbcType="VARCHAR"/>
<result property="invoiceInfo" column="invoice_info" jdbcType="VARCHAR"/>
<result property="groupPurInfo" column="group_pur_info" jdbcType="VARCHAR"/>
<result property="marketPriceInfo" column="market_price_Info" jdbcType="VARCHAR"/>
<result property="discountInfo" column="discount_Info" jdbcType="VARCHAR"/>
<result property="platformTips" column="platform_tips" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id
, coupon_id, date_used, available_time, booking_type, refund_policy, usage_rules, invoice_info, group_pur_info, market_price_Info, discount_Info, platform_tips </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbPurchaseNoticeMap">
select
<include refid="Base_Column_List"/>
from tb_purchase_notice
where id = #{id}
</select>
</mapper>

View File

@ -55,8 +55,8 @@
front_img, contact_name, phone, logo, is_deposit, is_supply, cover_img, share_img,
detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type,
industry, industry_name, 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,is_open_yhq
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
</sql>
<sql id="Blob_Column_List">
view

View File

@ -0,0 +1,78 @@
<?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.TbShopVideoMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopVideo" id="TbShopVideoMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="channelId" column="channel_id" jdbcType="INTEGER"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="sourceId" column="source_id" jdbcType="INTEGER"/>
<result property="sourceUrl" column="source_url" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id
, shop_id, type, name, channel_id, source_id, source_url, status ,created_time, update_time</sql>
<!--查询单个-->
<select id="queryById" resultMap="TbShopVideoMap">
select
<include refid="Base_Column_List"/>
from tb_shop_video
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbShopVideoMap">
select
<include refid="Base_Column_List"/>
from tb_shop_video
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="shopId != null">
and shop_id = #{shopId}
</if>
<if test="type != null">
and type = #{type}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="channelId != null">
and channel_id = #{channelId}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="sourceId != null">
and source_id = #{sourceId}
</if>
<if test="sourceUrl != null and sourceUrl != ''">
and source_url = #{sourceUrl}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="videoId != null">
and video_id = #{videoId}
</if>
<if test="videoUrl != null and videoUrl != ''">
and video_url = #{videoUrl}
</if>
</where>
</select>
</mapper>