菜单 子集

存酒
购买须知
团购商品
用户列表
This commit is contained in:
wangw 2024-05-29 15:24:50 +08:00
parent 44509e1d32
commit b31148da52
33 changed files with 457 additions and 172 deletions

View File

@ -50,7 +50,7 @@ public class PageUtil extends cn.hutool.core.util.PageUtil {
map.put("totalElements",page.getTotalElements()); map.put("totalElements",page.getTotalElements());
return map; return map;
} }
public static Map<String,Object> toPlusPage(List<T> list, Integer total) { public static Map<String,Object> toPlusPage(List list, Integer total) {
Map<String,Object> map = new LinkedHashMap<>(2); Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",list); map.put("content",list);
map.put("totalElements",total); map.put("totalElements",total);

View File

@ -1,6 +1,7 @@
package cn.ysk.cashier.controller.shop; package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log; import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.dto.shop.ShopStorageGoodDto;
import cn.ysk.cashier.pojo.shop.TbShopStorageGood; import cn.ysk.cashier.pojo.shop.TbShopStorageGood;
import cn.ysk.cashier.dto.shop.TbShopStorageGoodQueryCriteria; import cn.ysk.cashier.dto.shop.TbShopStorageGoodQueryCriteria;
import cn.ysk.cashier.service.shop.TbShopStorageGoodService; import cn.ysk.cashier.service.shop.TbShopStorageGoodService;
@ -14,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**
@ -45,8 +47,9 @@ public class TbShopStorageGoodController {
@PostMapping @PostMapping
@Log("新增酒品") @Log("新增酒品")
@ApiOperation("新增酒品") @ApiOperation("新增酒品")
public ResponseEntity<Object> createTbShopStorageGood(@Validated @RequestBody TbShopStorageGood resources){ public ResponseEntity<Object> createTbShopStorageGood(@Validated @RequestBody ShopStorageGoodDto resources){
return new ResponseEntity<>(tbShopStorageGoodService.create(resources),HttpStatus.CREATED); tbShopStorageGoodService.create(resources);
return new ResponseEntity<>(HttpStatus.CREATED);
} }
@PutMapping @PutMapping

View File

@ -18,6 +18,9 @@ package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.pojo.shop.TbShopUser; import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.service.shop.TbShopUserService; import cn.ysk.cashier.service.shop.TbShopUserService;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria; import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.vo.ShopUserInfoVo;
import com.alipay.api.domain.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -57,14 +60,8 @@ public class TbShopUserController {
@GetMapping("queryAllShopUser") @GetMapping("queryAllShopUser")
@ApiOperation("查询商家用户") @ApiOperation("查询商家用户")
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable){ public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria){
Map<String, Object> stringObjectMap=new HashMap<>(); return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria),HttpStatus.OK);
if (criteria.getShopId().equals("1")) {
stringObjectMap = tbShopUserService.queryAllShopUser(criteria, pageable);
}else {
stringObjectMap = tbShopUserService.queryShopUser(criteria, pageable);
}
return new ResponseEntity<>(stringObjectMap,HttpStatus.OK);
} }

View File

@ -0,0 +1,24 @@
package cn.ysk.cashier.dto.shop;
import lombok.Data;
import java.util.List;
@Data
public class ShopStorageGoodDto {
/** 单位 */
private String unit;
/** 有效期(天) */
private Integer period;
/** 0:手动1:商品; */
private Integer source;
/** 商户Id */
private Integer shopId;
private List<DetailInfo> goods;
@Data
public static class DetailInfo {
private String name;
private String imgUrl;
}
}

View File

@ -175,6 +175,7 @@ public class TbShopInfoDto implements Serializable {
private String profiles; private String profiles;
private String isOpenYhq; private String isOpenYhq;
private Integer isUseVip;
/** /**
* 商家二维码 * 商家二维码
*/ */

View File

@ -31,6 +31,7 @@ public class TbShopStorageDto implements Serializable {
/** 用户Id */ /** 用户Id */
private Integer userid; private Integer userid;
private String headImg;
/** 用户昵称 */ /** 用户昵称 */
private String nickname; private String nickname;

View File

@ -8,17 +8,24 @@ import cn.ysk.cashier.annotation.Query;
* @date 2024-05-21 * @date 2024-05-21
**/ **/
@Data @Data
public class TbShopStorageGoodQueryCriteria{ public class TbShopStorageGoodQueryCriteria {
/** 模糊 */ /**
* 模糊
*/
@Query(type = Query.Type.INNER_LIKE) @Query(type = Query.Type.INNER_LIKE)
private String name; private String name;
/** 精确 */ /**
* 精确
*/
@Query @Query
private Integer shopId; private Integer shopId;
@Query
private Integer isDel = 0;
private Integer page=0;
private Integer size=10; private Integer page = 0;
private Integer size = 10;
} }

View File

@ -1,41 +1,32 @@
/* /*
* Copyright 2019-2020 Zheng Jie * Copyright 2019-2020 Zheng Jie
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.ysk.cashier.dto.shop; package cn.ysk.cashier.dto.shop;
import lombok.Data; import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-01
**/
@Data @Data
public class TbShopUserQueryCriteria{ public class TbShopUserQueryCriteria {
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String name; private String name;
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String telephone;
@Query
private String shopId; private String shopId;
@Query
private Integer isVip; private Integer isVip;
private Long page=1L;
private Long size=10L;
} }

View File

@ -0,0 +1,61 @@
package cn.ysk.cashier.mybatis.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import java.io.Serializable;
@SuppressWarnings("serial")
public class TagProductDepts extends Model<TagProductDepts> {
//标签id
private Integer tagId;
//商品id
private Integer productId;
//创建时间
private Date createTime=new Date();
public TagProductDepts() {
}
public TagProductDepts(Integer tagId, Integer productId) {
this.tagId = tagId;
this.productId = productId;
}
public TagProductDepts(Integer tagId, Integer productId, Date createTime) {
this.tagId = tagId;
this.productId = productId;
this.createTime = createTime;
}
public Integer getTagId() {
return tagId;
}
public void setTagId(Integer tagId) {
this.tagId = tagId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,33 @@
package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.vo.ShopUserInfoVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
public interface ShopUserMapper extends BaseMapper<TbShopUser> {
@Select("<script>" +
"SELECT su.id as id, u.head_img as headImg, u.nick_name as nickName, u.sex as sex, " +
"su.amount as amount, u.total_score as totalScore, u.telephone as telephone, " +
"u.birth_day as birthDay, su.is_vip as isVip, su.created_at as createAt, u.last_log_in_at as lastLoginAt " +
"FROM tb_shop_user su " +
"LEFT JOIN tb_user_info u ON su.user_id = u.id " +
"<where>" +
"<if test='param.shopId != null and param.shopId != &quot;&quot; and param.shopId != 1'>" +
"su.shop_id = #{param.shopId} " +
"</if>" +
"<if test='param.name != null and param.name != &quot;&quot;'>" +
"AND (u.nick_name like concat('%', #{param.name}, '%') or u.telephone like concat('%', #{param.name}, '%'))" +
"</if>" +
"<if test='param.isVip != null and param.isVip != &quot;&quot;'>" +
"AND su.is_vip=#{param.isVip}" +
"</if>" +
"</where>" +
"</script>")
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Page pageInfo);
}

View File

@ -0,0 +1,23 @@
package cn.ysk.cashier.mybatis.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* (TagProductDepts)表数据库访问层
*
* @author ww
* @since 2024-05-23 14:21:29
*/
public interface TagProductDeptsMapper extends BaseMapper<TagProductDepts> {
@Delete("delete FROM tag_product_depts WHERE product_id = #{productId}")
int delByProductIdAfter(Integer productId);
@Select("SELECT * FROM tag_product_depts WHERE product_id = #{productId}")
List<TagProductDepts> queryAllByProductId(Integer productId);
}

View File

@ -0,0 +1,8 @@
package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface TbShopUserMapper extends BaseMapper<TbShopUser> {
}

View File

@ -20,24 +20,7 @@ import org.springframework.web.bind.annotation.*;
public class StorageController { public class StorageController {
@Autowired @Autowired
private ShopService shopService; private ShopService shopService;
@PostMapping("/findStorage")
public ResponseEntity<Object> findStorage(@RequestParam Integer shopId,String account,Pageable pageable){
return new ResponseEntity<>(shopService.findStorage(shopId,account,pageable), HttpStatus.OK);
}
@PostMapping("/outStorage")
@Log("商品出库")
public ResponseEntity<Object> outStorage(@RequestParam Integer id,@RequestParam Integer num){
String userName = SecurityUtils.getCurrentUsername();
shopService.outStorage(id,userName,num);
return new ResponseEntity<>( HttpStatus.OK);
}
@PostMapping("/inStorage")
@Log("商品入库")
public ResponseEntity<Object> inStorage(@RequestBody StorageVo storageVo){
String userName = SecurityUtils.getCurrentUsername();
shopService.inStorage(storageVo,userName);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/findActivate") @GetMapping("/findActivate")
public ResponseEntity<Object> findActivate(@RequestParam String shopId){ public ResponseEntity<Object> findActivate(@RequestParam String shopId){
String userName = SecurityUtils.getCurrentUsername(); String userName = SecurityUtils.getCurrentUsername();

View File

@ -0,0 +1,21 @@
package cn.ysk.cashier.mybatis.service;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* (TagProductDepts)表服务接口
*
* @author ww
* @since 2024-05-23 14:21:29
*/
public interface TagProductDeptsService extends IService<TagProductDepts> {
void setTag(Integer tagId,Integer productId);
List<TagProductDepts> queryAllByProductId(Integer productId);
}

View File

@ -0,0 +1,37 @@
package cn.ysk.cashier.mybatis.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ysk.cashier.mybatis.mapper.TagProductDeptsMapper;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import cn.ysk.cashier.mybatis.service.TagProductDeptsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* (TagProductDepts)表服务实现类
*
* @author ww
* @since 2024-05-23 14:21:29
*/
@Service
public class TagProductDeptsServiceImpl extends ServiceImpl<TagProductDeptsMapper, TagProductDepts> implements TagProductDeptsService {
@Autowired
private TagProductDeptsMapper productDeptsMapper;
@Override
public void setTag(Integer tagId,Integer productId) {
productDeptsMapper.delByProductIdAfter(productId);
TagProductDepts tagProduct=new TagProductDepts(tagId,productId);
productDeptsMapper.insert(tagProduct);
}
@Override
public List<TagProductDepts> queryAllByProductId(Integer productId){
// productDeptsMapper.select
return productDeptsMapper.queryAllByProductId(productId);
}
}

View File

@ -228,7 +228,9 @@ public class TbShopInfo implements Serializable {
@Column(name = "is_open_yhq") @Column(name = "is_open_yhq")
@ApiModelProperty(value = "是否参与优惠券活动 true false") @ApiModelProperty(value = "是否参与优惠券活动 true false")
private String isOpenYhq; private String isOpenYhq;
@Column(name = "is_use_vip")
@ApiModelProperty(value = "是否支持会员支付 0否1是")
private Integer isUseVip;
@Column(name = "shop_qrcode") @Column(name = "shop_qrcode")
@ApiModelProperty(value = "商家二维码") @ApiModelProperty(value = "商家二维码")
private String shopQrcode; private String shopQrcode;

View File

@ -51,6 +51,10 @@ public class TbShopStorage implements Serializable {
@ApiModelProperty(value = "用户Id") @ApiModelProperty(value = "用户Id")
private Integer userid; private Integer userid;
@Column(name = "`head_img`")
@ApiModelProperty(value = "用户头像")
private String headImg;
@Column(name = "`nick_name`") @Column(name = "`nick_name`")
@ApiModelProperty(value = "用户昵称") @ApiModelProperty(value = "用户昵称")
private String nickname; private String nickname;

View File

@ -13,9 +13,9 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface TbPurchaseNoticeRepository extends JpaRepository<TbPurchaseNotice, Integer>, JpaSpecificationExecutor<TbPurchaseNotice> { public interface TbPurchaseNoticeRepository extends JpaRepository<TbPurchaseNotice, Integer>, JpaSpecificationExecutor<TbPurchaseNotice> {
/** /**
* 根据 couponId 查询 * 根据 proId 查询
* @param couponId couponId * @param proId
* @return / * @return /
*/ */
TbPurchaseNotice findByCouponId(Integer couponId); TbPurchaseNotice findByCouponId(Integer proId);
} }

View File

@ -35,26 +35,6 @@ import java.util.List;
**/ **/
public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>,JpaSpecificationExecutor<TbShopUser> { public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>,JpaSpecificationExecutor<TbShopUser> {
@Query("SELECT NEW cn.ysk.cashier.vo.ShopUserInfoVo(su.id, u.headImg, u.nickName, u.sex, u.amount, u.totalScore, u.telephone, u.birthDay, u.isVip, su.createdAt, u.lastLogInAt) " +
"FROM TbShopUser su " +
"LEFT JOIN TbUserInfo u " +
"on su.userId = CAST(u.id AS string) " +
"WHERE su.isVip = IFNULL(:isVip, su.isVip)" +
"AND (u.telephone = IFNULL(:phone, u.telephone))" +
"AND su.shopId = :shopId " +
"order by su.createdAt desc ")
Page<ShopUserInfoVo> findShopUserJoinUserInfo(String shopId,Integer isVip,String phone, Pageable pageable);
@Query("SELECT NEW cn.ysk.cashier.vo.ShopUserInfoVo(su.id, u.headImg, u.nickName, u.sex, u.amount, u.totalScore, u.telephone, u.birthDay, u.isVip, su.createdAt, u.lastLogInAt) " +
"FROM TbShopUser su " +
"LEFT JOIN TbUserInfo u " +
"on su.userId = CAST(u.id AS string) " +
"WHERE su.isVip = IFNULL(:isVip, su.isVip)" +
"AND (u.telephone = IFNULL(:phone, u.telephone))" +
"order by su.createdAt desc ")
Page<ShopUserInfoVo> findAllShopUserJoinUserInfo(Integer isVip,String phone, Pageable pageable);
@Query("SELECT count(0) from TbShopUser user where user.shopId = :shopId") @Query("SELECT count(0) from TbShopUser user where user.shopId = :shopId")
Tuple searchByCount(@Param("shopId") String shopId); Tuple searchByCount(@Param("shopId") String shopId);

View File

@ -25,6 +25,8 @@ public interface TbPlatformDictService {
List<TbPlatformDictDto> queryByType(String type); List<TbPlatformDictDto> queryByType(String type);
List<TbPlatformDictDto> queryByIds(List ids);
/** /**
* 根据ID查询 * 根据ID查询
* @param id ID * @param id ID

View File

@ -55,6 +55,11 @@ public class TbPlatformDictServiceImpl implements TbPlatformDictService {
return tbPlatformDictMapper.toDto(tbPlatformDictRepository.findAllByTypeAndIsShowCash(type,1)); return tbPlatformDictMapper.toDto(tbPlatformDictRepository.findAllByTypeAndIsShowCash(type,1));
} }
@Override
public List<TbPlatformDictDto> queryByIds(List ids){
return tbPlatformDictRepository.findAllById(ids);
}
@Override @Override
@Transactional @Transactional
public TbPlatformDictDto findById(Integer id) { public TbPlatformDictDto findById(Integer id) {

View File

@ -15,6 +15,7 @@ import cn.ysk.cashier.service.order.TbGroupOrderCouponService;
import cn.ysk.cashier.service.order.TbGroupOrderInfoService; import cn.ysk.cashier.service.order.TbGroupOrderInfoService;
import cn.ysk.cashier.service.shop.TbMerchantThirdApplyService; import cn.ysk.cashier.service.shop.TbMerchantThirdApplyService;
import cn.ysk.cashier.mybatis.service.TbOrderPaymentService; import cn.ysk.cashier.mybatis.service.TbOrderPaymentService;
import cn.ysk.cashier.thirdpay.resp.GroupOrderReturnResp;
import cn.ysk.cashier.thirdpay.resp.OrderReturnResp; import cn.ysk.cashier.thirdpay.resp.OrderReturnResp;
import cn.ysk.cashier.thirdpay.resp.PublicResp; import cn.ysk.cashier.thirdpay.resp.PublicResp;
import cn.ysk.cashier.thirdpay.service.ThirdPayService; import cn.ysk.cashier.thirdpay.service.ThirdPayService;
@ -181,10 +182,11 @@ public class TbGroupOrderInfoServiceImpl implements TbGroupOrderInfoService {
thirdApply.getAppToken()); thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) { if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
GroupOrderReturnResp returnInfo = JSONUtil.parseJSONStr2T(publicResp.getBizData(), GroupOrderReturnResp.class);
if ("000000".equals(publicResp.getCode())) { if ("000000".equals(publicResp.getCode())) {
//TRADE_REFUND //TRADE_REFUND
if (!"TRADE_SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) { if (!"SUCCESS".equals(returnInfo.getState()) && !"TRADE_SUCCESS".equals(returnInfo.getState()) && !returnInfo.getState().equals("ING")) {
throw new BadRequestException("退款渠道调用失败"); throw new BadRequestException("退款渠道调用失败,"+returnInfo.getNote());
} }
} else { } else {
throw new BadRequestException("退款渠道调用失败:" + publicResp.getMsg()); throw new BadRequestException("退款渠道调用失败:" + publicResp.getMsg());

View File

@ -17,18 +17,25 @@ package cn.ysk.cashier.service.impl.productimpl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.ysk.cashier.dto.TbPlatformDictDto;
import cn.ysk.cashier.dto.product.TbProductDto; import cn.ysk.cashier.dto.product.TbProductDto;
import cn.ysk.cashier.dto.product.TbProductQueryCriteria; import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
import cn.ysk.cashier.dto.shop.TbCouponCategoryDto; import cn.ysk.cashier.dto.shop.TbCouponCategoryDto;
import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.mapper.product.TbProductMapper; import cn.ysk.cashier.mapper.product.TbProductMapper;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import cn.ysk.cashier.mybatis.service.TagProductDeptsService;
import cn.ysk.cashier.pojo.product.*; import cn.ysk.cashier.pojo.product.*;
import cn.ysk.cashier.pojo.shop.TbPurchaseNotice;
import cn.ysk.cashier.pojo.shop.TbShopUnit; import cn.ysk.cashier.pojo.shop.TbShopUnit;
import cn.ysk.cashier.repository.product.*; import cn.ysk.cashier.repository.product.*;
import cn.ysk.cashier.repository.shop.TbPurchaseNoticeRepository;
import cn.ysk.cashier.repository.shop.TbShopUnitRepository; import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
import cn.ysk.cashier.repository.shop.TbShopUserDutyDetailRepository; import cn.ysk.cashier.repository.shop.TbShopUserDutyDetailRepository;
import cn.ysk.cashier.service.TbPlatformDictService;
import cn.ysk.cashier.service.product.TbProductService; import cn.ysk.cashier.service.product.TbProductService;
import cn.ysk.cashier.service.shop.TbCouponCategoryService; import cn.ysk.cashier.service.shop.TbCouponCategoryService;
import cn.ysk.cashier.service.shop.TbPurchaseNoticeService;
import cn.ysk.cashier.utils.*; import cn.ysk.cashier.utils.*;
import cn.ysk.cashier.vo.TbProductVo; import cn.ysk.cashier.vo.TbProductVo;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
@ -72,6 +79,9 @@ public class TbProductServiceImpl implements TbProductService {
private final TbShopCategoryRepository tbShopCategoryRepository; private final TbShopCategoryRepository tbShopCategoryRepository;
private final TbShopUserDutyDetailRepository tbShopUserDutyDetailRe; private final TbShopUserDutyDetailRepository tbShopUserDutyDetailRe;
private final TbCouponCategoryService tbCouponCategoryService; private final TbCouponCategoryService tbCouponCategoryService;
private final TbPlatformDictService tbPlatformDictService;
private final TagProductDeptsService tagProductService;
private final TbPurchaseNoticeRepository noticeRepository;
private final RedisUtils redisUtils; private final RedisUtils redisUtils;
@ -116,13 +126,13 @@ public class TbProductServiceImpl implements TbProductService {
} }
//分类 //分类
List<TbShopCategory> tbShopCategory = new ArrayList<>(); List<TbShopCategory> tbShopCategory = new ArrayList<>();
if (!categoryId.isEmpty()){ if (!categoryId.isEmpty()) {
List<Integer> categoryIdInt = ListUtil.stringChangeIntegerList(categoryId); List<Integer> categoryIdInt = ListUtil.stringChangeIntegerList(categoryId);
tbShopCategory = tbShopCategoryRepository.searchCategory(categoryIdInt); tbShopCategory = tbShopCategoryRepository.searchCategory(categoryIdInt);
} }
//销量 //销量
List<Object[]> objects = new ArrayList<>(); List<Object[]> objects = new ArrayList<>();
if (!productIdInt.isEmpty()){ if (!productIdInt.isEmpty()) {
objects = tbShopUserDutyDetailRe.searchUUserDutyDetail(productIdInt); objects = tbShopUserDutyDetailRe.searchUUserDutyDetail(productIdInt);
} }
//组装 //组装
@ -164,24 +174,24 @@ public class TbProductServiceImpl implements TbProductService {
} }
} }
//分类 //分类
if (tbShopCategory.isEmpty()){ if (tbShopCategory.isEmpty()) {
tbProductVo.setCategoryName(""); tbProductVo.setCategoryName("");
}else { } else {
for (TbShopCategory shopCategory :tbShopCategory) { for (TbShopCategory shopCategory : tbShopCategory) {
if (shopCategory.getId().toString().equals(product.getCategoryId())){ if (shopCategory.getId().toString().equals(product.getCategoryId())) {
tbProductVo.setCategoryName(shopCategory.getName()); tbProductVo.setCategoryName(shopCategory.getName());
} }
} }
} }
//销量 //销量
if (objects.isEmpty()){ if (objects.isEmpty()) {
tbProductVo.setRealSalesNumber(0.00); tbProductVo.setRealSalesNumber(0.00);
}else { } else {
for (Object[] o :objects) { for (Object[] o : objects) {
if (((Integer) o[1]).equals(product.getId())){ if (((Integer) o[1]).equals(product.getId())) {
BigDecimal bigDecimal = (BigDecimal) o[0]; BigDecimal bigDecimal = (BigDecimal) o[0];
tbProductVo.setRealSalesNumber(bigDecimal.doubleValue()); tbProductVo.setRealSalesNumber(bigDecimal.doubleValue());
} }
} }
} }
BeanUtils.copyProperties(product, tbProductVo); BeanUtils.copyProperties(product, tbProductVo);
@ -208,7 +218,7 @@ public class TbProductServiceImpl implements TbProductService {
Threads.call(tbProductSkus, tbProductSpec); Threads.call(tbProductSkus, tbProductSpec);
//组装 //组装
TbProductVo tbProductVo = new TbProductVo(); TbProductVo tbProductVo = new TbProductVo();
tbProductVo.setCategoryId(tbProduct.getCategoryId()); tbProductVo.setCategoryId(StringUtils.isNotBlank(tbProduct.getCategoryId())?Integer.valueOf(tbProduct.getCategoryId()):null);
//单位 //单位
// if (tbProduct.getUnitId() == null) { // if (tbProduct.getUnitId() == null) {
// tbProductVo.setUnitId(null); // tbProductVo.setUnitId(null);
@ -221,9 +231,9 @@ public class TbProductServiceImpl implements TbProductService {
tbProductVo.setGroupSnap(ListUtil.stringChangeList(tbProduct.getGroupSnap())); tbProductVo.setGroupSnap(ListUtil.stringChangeList(tbProduct.getGroupSnap()));
} }
BeanUtils.copyProperties(tbProduct, tbProductVo); BeanUtils.copyProperties(tbProduct, tbProductVo);
if(!org.apache.commons.lang3.StringUtils.isBlank(tbProduct.getImages())){ if (!org.apache.commons.lang3.StringUtils.isBlank(tbProduct.getImages())) {
tbProductVo.setImages(ListUtil.stringChangeList(tbProduct.getImages())); tbProductVo.setImages(ListUtil.stringChangeList(tbProduct.getImages()));
}else{ } else {
tbProductVo.setImages(new JSONArray()); tbProductVo.setImages(new JSONArray());
} }
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
@ -252,6 +262,16 @@ public class TbProductServiceImpl implements TbProductService {
tbProductVo.getGroupCategoryId().add(byId); tbProductVo.getGroupCategoryId().add(byId);
} }
} }
List<TagProductDepts> tagProductDepts = tagProductService.queryAllByProductId(tbProductVo.getId());
if (!CollectionUtils.isEmpty(tagProductDepts)) {
List<Integer> collect = tagProductDepts.stream().map(TagProductDepts::getTagId).collect(Collectors.toList());
List<TbPlatformDictDto> tags = tbPlatformDictService.queryByIds(collect);
tbProductVo.setTags(tags);
}
TbPurchaseNotice notice = noticeRepository.findByCouponId(id);
if (notice != null) {
tbProductVo.setNotices(notice);
}
} }
return tbProductVo; return tbProductVo;
} }
@ -286,20 +306,22 @@ public class TbProductServiceImpl implements TbProductService {
TbProduct product = new TbProduct(); TbProduct product = new TbProduct();
//组装 //组装
BeanUtil.copyProperties(resources, product, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(resources, product, CopyOptions.create().setIgnoreNullValue(true));
if (resources.getCategoryId() == null) { if (!"group".equals(resources.getTypeEnum())) {
throw new BadRequestException("必填内容未填写"); if (resources.getCategoryId() == null) {
} throw new BadRequestException("必填内容未填写");
if (resources.getIsShowMall() == 1) { }
for (TbProductSku sku : resources.getSkuList()) { if (resources.getIsShowMall() == 1) {
if (sku.getStockNumber() <= 0) { for (TbProductSku sku : resources.getSkuList()) {
throw new BadRequestException("上架区域包括小程序时,库存数量必须大于0。"); if (sku.getStockNumber() <= 0) {
throw new BadRequestException("上架区域包括小程序时,库存数量必须大于0。");
}
} }
} }
product.setCategoryId(String.valueOf(resources.getCategoryId()));
} }
if(!CollectionUtils.isEmpty(resources.getImages())){ if (!CollectionUtils.isEmpty(resources.getImages())) {
product.setImages(resources.getImages().toString()); product.setImages(resources.getImages().toString());
} }
product.setCategoryId(String.valueOf(resources.getCategoryId()));
product.setIsDel(0); product.setIsDel(0);
product.setIsDelete(0); product.setIsDelete(0);
product.setIsFreeFreight(1); product.setIsFreeFreight(1);
@ -309,16 +331,21 @@ public class TbProductServiceImpl implements TbProductService {
if (resources.getUnitId() != null) { if (resources.getUnitId() != null) {
product.setUnitId(resources.getUnitId()); product.setUnitId(resources.getUnitId());
} }
if("group".equals(resources.getTypeEnum())){ if ("group".equals(resources.getTypeEnum())) {
//套餐内容 //套餐内容
if (!resources.getGroupSnap().isEmpty()) { if (!resources.getGroupSnap().isEmpty()) {
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap())); product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
product.setIsCombo(1); product.setIsCombo(1);
} }
if(!CollectionUtils.isEmpty(resources.getGroupCategoryId())){ if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) {
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList()); List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
product.setGroupCategoryId(collect.toString()); product.setGroupCategoryId(collect.toString());
} }
if (!CollectionUtils.isEmpty(resources.getTags())) {
for (TbPlatformDictDto tag : resources.getTags()) {
tagProductService.setTag(tag.getId(), resources.getId());
}
}
} }
TbProduct save = tbProductRepository.save(product); TbProduct save = tbProductRepository.save(product);
@ -348,6 +375,16 @@ public class TbProductServiceImpl implements TbProductService {
productSkuResult.setTagSnap(resources.getSkuSnap()); productSkuResult.setTagSnap(resources.getSkuSnap());
productSkuResult.setId(save.getId()); productSkuResult.setId(save.getId());
tbProductSkuResultRepository.save(productSkuResult); tbProductSkuResultRepository.save(productSkuResult);
} else if ("group".equals(resources.getTypeEnum())) {
TbPurchaseNotice notices = resources.getNotices();
if (StringUtils.isBlank(notices.getDateUsed())
&& StringUtils.isBlank(notices.getAvailableTime())
&& StringUtils.isBlank(notices.getBookingType())
&& StringUtils.isBlank(notices.getRefundPolicy())) {
throw new BadRequestException("添加购买须知失败,必填项未填写");
}
resources.getNotices().setCouponId(save.getId());
noticeRepository.save(resources.getNotices());
} }
return resources; return resources;
} }
@ -366,16 +403,23 @@ public class TbProductServiceImpl implements TbProductService {
product.setUpdatedAt(Instant.now().toEpochMilli()); product.setUpdatedAt(Instant.now().toEpochMilli());
product.setCategoryId(resources.getCategoryId().toString()); product.setCategoryId(resources.getCategoryId().toString());
product.setImages(resources.getImages().toString()); product.setImages(resources.getImages().toString());
if("group".equals(resources.getTypeEnum())){ if ("group".equals(resources.getTypeEnum())) {
//套餐内容 //套餐内容
if (!resources.getGroupSnap().isEmpty()) { if (!resources.getGroupSnap().isEmpty()) {
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap())); product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
product.setIsCombo(1); product.setIsCombo(1);
} }
if(!CollectionUtils.isEmpty(resources.getGroupCategoryId())){ if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) {
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList()); List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
product.setGroupCategoryId(collect.toString()); product.setGroupCategoryId(collect.toString());
} }
if (!CollectionUtils.isEmpty(resources.getTags())) {
for (TbPlatformDictDto tag : resources.getTags()) {
tagProductService.setTag(tag.getId(), resources.getId());
}
}
noticeRepository.save(resources.getNotices());
} }
TbProduct save = tbProductRepository.save(product); TbProduct save = tbProductRepository.save(product);
@ -384,10 +428,10 @@ public class TbProductServiceImpl implements TbProductService {
List<TbProductSku> skuList = new ArrayList<>(); List<TbProductSku> skuList = new ArrayList<>();
for (TbProductSku sku : resources.getSkuList()) { for (TbProductSku sku : resources.getSkuList()) {
TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode()); TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode());
if (tbProductSku != null){ if (tbProductSku != null) {
tbProductSkuRepository.updateByBarCode(sku.getBarCode(),sku.getCostPrice(),sku.getCoverImg(),sku.getFirstShared(),sku.getMemberPrice(), tbProductSkuRepository.updateByBarCode(sku.getBarCode(), sku.getCostPrice(), sku.getCoverImg(), sku.getFirstShared(), sku.getMemberPrice(),
sku.getOriginPrice(),sku.getSalePrice(),sku.getSpecSnap(),tbProductSku.getId()); sku.getOriginPrice(), sku.getSalePrice(), sku.getSpecSnap(), tbProductSku.getId());
}else { } else {
if ("sku".equals(save.getTypeEnum())) { if ("sku".equals(save.getTypeEnum())) {
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId())); tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
} }

View File

@ -1,5 +1,6 @@
package cn.ysk.cashier.service.impl.shopimpl; package cn.ysk.cashier.service.impl.shopimpl;
import cn.ysk.cashier.dto.shop.ShopStorageGoodDto;
import cn.ysk.cashier.dto.shop.TbShopStorageGoodDto; import cn.ysk.cashier.dto.shop.TbShopStorageGoodDto;
import cn.ysk.cashier.dto.shop.TbShopStorageGoodQueryCriteria; import cn.ysk.cashier.dto.shop.TbShopStorageGoodQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopStorageGoodMapper; import cn.ysk.cashier.mapper.shop.TbShopStorageGoodMapper;
@ -25,9 +26,9 @@ import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
/** /**
* @author ww
* @website https://eladmin.vip * @website https://eladmin.vip
* @description 服务实现 * @description 服务实现
* @author ww
* @date 2024-05-21 * @date 2024-05-21
**/ **/
@Service @Service
@ -38,36 +39,56 @@ public class TbShopStorageGoodServiceImpl implements TbShopStorageGoodService {
private final TbShopStorageGoodMapper tbShopStorageGoodMapper; private final TbShopStorageGoodMapper tbShopStorageGoodMapper;
@Override @Override
public Map<String,Object> queryAll(TbShopStorageGoodQueryCriteria criteria, Pageable pageable){ public Map<String, Object> queryAll(TbShopStorageGoodQueryCriteria criteria, Pageable pageable) {
Page<TbShopStorageGood> page = tbShopStorageGoodRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page<TbShopStorageGood> page = tbShopStorageGoodRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
return PageUtil.toPage(page.map(tbShopStorageGoodMapper::toDto)); return PageUtil.toPage(page.map(tbShopStorageGoodMapper::toDto));
} }
@Override @Override
public List<TbShopStorageGoodDto> queryAll(TbShopStorageGoodQueryCriteria criteria){ public List<TbShopStorageGoodDto> queryAll(TbShopStorageGoodQueryCriteria criteria) {
return tbShopStorageGoodMapper.toDto(tbShopStorageGoodRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); return tbShopStorageGoodMapper.toDto(tbShopStorageGoodRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
} }
@Override @Override
@Transactional @Transactional
public TbShopStorageGoodDto findById(Integer id) { public TbShopStorageGoodDto findById(Integer id) {
TbShopStorageGood tbShopStorageGood = tbShopStorageGoodRepository.findById(id).orElseGet(TbShopStorageGood::new); TbShopStorageGood tbShopStorageGood = tbShopStorageGoodRepository.findById(id).orElseGet(TbShopStorageGood::new);
ValidationUtil.isNull(tbShopStorageGood.getId(),"TbShopStorageGood","id",id); ValidationUtil.isNull(tbShopStorageGood.getId(), "TbShopStorageGood", "id", id);
return tbShopStorageGoodMapper.toDto(tbShopStorageGood); return tbShopStorageGoodMapper.toDto(tbShopStorageGood);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public TbShopStorageGoodDto create(TbShopStorageGood resources) { public TbShopStorageGoodDto create(TbShopStorageGood resources) {
resources.setIsDel(0);
resources.setCreateTime(new Timestamp(System.currentTimeMillis())); resources.setCreateTime(new Timestamp(System.currentTimeMillis()));
return tbShopStorageGoodMapper.toDto(tbShopStorageGoodRepository.save(resources)); return tbShopStorageGoodMapper.toDto(tbShopStorageGoodRepository.save(resources));
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void create(ShopStorageGoodDto resources) {
List<TbShopStorageGood> storageGoodList = new ArrayList<>();
for (ShopStorageGoodDto.DetailInfo good : resources.getGoods()) {
TbShopStorageGood storageGood = new TbShopStorageGood();
storageGood.setIsDel(0);
storageGood.setCreateTime(new Timestamp(System.currentTimeMillis()));
storageGood.setName(good.getName());
storageGood.setImgUrl(good.getImgUrl());
storageGood.setPeriod(resources.getPeriod());
storageGood.setSource(resources.getSource());
storageGood.setUnit(resources.getUnit());
storageGood.setShopId(resources.getShopId());
storageGoodList.add(storageGood);
}
tbShopStorageGoodRepository.saveAll(storageGoodList);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(TbShopStorageGood resources) { public void update(TbShopStorageGood resources) {
TbShopStorageGood tbShopStorageGood = tbShopStorageGoodRepository.findById(resources.getId()).orElseGet(TbShopStorageGood::new); TbShopStorageGood tbShopStorageGood = tbShopStorageGoodRepository.findById(resources.getId()).orElseGet(TbShopStorageGood::new);
ValidationUtil.isNull( tbShopStorageGood.getId(),"TbShopStorageGood","id",resources.getId()); ValidationUtil.isNull(tbShopStorageGood.getId(), "TbShopStorageGood", "id", resources.getId());
tbShopStorageGood.copy(resources); tbShopStorageGood.copy(resources);
tbShopStorageGoodRepository.save(tbShopStorageGood); tbShopStorageGoodRepository.save(tbShopStorageGood);
} }
@ -83,13 +104,13 @@ public class TbShopStorageGoodServiceImpl implements TbShopStorageGoodService {
public void download(List<TbShopStorageGoodDto> all, HttpServletResponse response) throws IOException { public void download(List<TbShopStorageGoodDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
for (TbShopStorageGoodDto tbShopStorageGood : all) { for (TbShopStorageGoodDto tbShopStorageGood : all) {
Map<String,Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("酒品名", tbShopStorageGood.getName()); map.put("酒品名", tbShopStorageGood.getName());
map.put("图片地址", tbShopStorageGood.getImgUrl()); map.put("图片地址", tbShopStorageGood.getImgUrl());
map.put("单位", tbShopStorageGood.getUnit()); map.put("单位", tbShopStorageGood.getUnit());
map.put("有效期(天)", tbShopStorageGood.getPeriod()); map.put("有效期(天)", tbShopStorageGood.getPeriod());
map.put("0:未删除1:已删除", tbShopStorageGood.getIsDel()); map.put("0:未删除1:已删除", tbShopStorageGood.getIsDel());
map.put(" createTime", tbShopStorageGood.getCreateTime()); map.put(" createTime", tbShopStorageGood.getCreateTime());
map.put("0:手动1:商品;", tbShopStorageGood.getSource()); map.put("0:手动1:商品;", tbShopStorageGood.getSource());
map.put("商户Id", tbShopStorageGood.getShopId()); map.put("商户Id", tbShopStorageGood.getShopId());
list.add(map); list.add(map);

View File

@ -64,6 +64,7 @@ public class TbShopStorageServiceImpl implements TbShopStorageService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public TbShopStorageDto create(TbShopStorage resources) { public TbShopStorageDto create(TbShopStorage resources) {
resources.setStatus(1);
resources.setSavTime(new Timestamp(System.currentTimeMillis())); resources.setSavTime(new Timestamp(System.currentTimeMillis()));
resources.setExpTime(new Timestamp(System.currentTimeMillis() + 86400000 * resources.getExpDay())); resources.setExpTime(new Timestamp(System.currentTimeMillis() + 86400000 * resources.getExpDay()));
return tbShopStorageMapper.toDto(tbShopStorageRepository.save(resources)); return tbShopStorageMapper.toDto(tbShopStorageRepository.save(resources));

View File

@ -18,6 +18,9 @@ package cn.ysk.cashier.service.impl.shopimpl;
import cn.ysk.cashier.dto.shop.TbShopUserDto; import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria; import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopUserMapper; import cn.ysk.cashier.mapper.shop.TbShopUserMapper;
import cn.ysk.cashier.mybatis.entity.TbUserStorage;
import cn.ysk.cashier.mybatis.mapper.ShopUserMapper;
import cn.ysk.cashier.mybatis.mapper.TagProductDeptsMapper;
import cn.ysk.cashier.pojo.shop.TbShopUser; import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.repository.shop.TbShopUserRepository; import cn.ysk.cashier.repository.shop.TbShopUserRepository;
import cn.ysk.cashier.service.shop.TbShopUserService; import cn.ysk.cashier.service.shop.TbShopUserService;
@ -26,7 +29,10 @@ import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp; import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.ValidationUtil; import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.vo.ShopUserInfoVo; import cn.ysk.cashier.vo.ShopUserInfoVo;
import com.alipay.api.domain.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -52,25 +58,14 @@ public class TbShopUserServiceImpl implements TbShopUserService {
private final TbShopUserRepository tbShopUserRepository; private final TbShopUserRepository tbShopUserRepository;
private final TbShopUserMapper tbShopUserMapper; private final TbShopUserMapper tbShopUserMapper;
@Override @Autowired
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) { private ShopUserMapper shopUserMapper;
Page<ShopUserInfoVo> shopUserJoinUserInfo =
tbShopUserRepository.findShopUserJoinUserInfo(
criteria.getShopId(),
criteria.getIsVip(),
criteria.getTelephone(),
pageable);
return PageUtil.toPage(shopUserJoinUserInfo);
}
@Override @Override
public Map<String, Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) { public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria) {
Page<ShopUserInfoVo> shopUserJoinUserInfo = IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria,
tbShopUserRepository.findAllShopUserJoinUserInfo( new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()));
criteria.getIsVip(), return PageUtil.toPlusPage(iPage.getRecords(),Integer.valueOf(iPage.getTotal()+""));
criteria.getTelephone(),
pageable);
return PageUtil.toPage(shopUserJoinUserInfo);
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package cn.ysk.cashier.service.shop; package cn.ysk.cashier.service.shop;
import cn.ysk.cashier.dto.shop.ShopStorageGoodDto;
import cn.ysk.cashier.dto.shop.TbShopStorageGoodDto; import cn.ysk.cashier.dto.shop.TbShopStorageGoodDto;
import cn.ysk.cashier.dto.shop.TbShopStorageGoodQueryCriteria; import cn.ysk.cashier.dto.shop.TbShopStorageGoodQueryCriteria;
import cn.ysk.cashier.pojo.shop.TbShopStorageGood; import cn.ysk.cashier.pojo.shop.TbShopStorageGood;
@ -43,6 +44,7 @@ public interface TbShopStorageGoodService {
* @return TbShopStorageGoodDto * @return TbShopStorageGoodDto
*/ */
TbShopStorageGoodDto create(TbShopStorageGood resources); TbShopStorageGoodDto create(TbShopStorageGood resources);
void create(ShopStorageGoodDto resources);
/** /**
* 编辑 * 编辑

View File

@ -18,6 +18,9 @@ package cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopUser; import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.dto.shop.TbShopUserDto; import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria; import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.vo.ShopUserInfoVo;
import com.alipay.api.domain.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@ -36,12 +39,10 @@ public interface TbShopUserService {
/** /**
* 商家后台 用户管理 * 商家后台 用户管理
* @param criteria 条件 * @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object> * @return Map<String,Object>
*/ */
Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria, Pageable pageable); Map<String,Object> queryShopUser(TbShopUserQueryCriteria criteria);
Map<String, Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable);
/** /**
* 会员管理 * 会员管理

View File

@ -40,9 +40,10 @@ public interface DictRepository extends JpaRepository<Dict, Long>, JpaSpecificat
void deleteByReleId(Integer releId); void deleteByReleId(Integer releId);
List<Dict> findByReleId(Integer releId); List<Dict> findByReleId(Integer releId);
int countDictByReleId(Integer releId);
@Modifying @Modifying
@Query("update Dict dict set dict.isChild=1 where dict.id =:id") @Query("update Dict dict set dict.isChild=:isChild where dict.id =:id")
void updateByReleId(@Param("id")Integer id); void updateByReleId(@Param("id")Integer id,@Param("isChild")Integer isChild);
/** /**
* 查询 * 查询

View File

@ -77,7 +77,7 @@ public class DictServiceImpl implements DictService {
public void create(Dict resources) { public void create(Dict resources) {
resources.setIsChild(0); resources.setIsChild(0);
if (resources.getReleId() != null) { if (resources.getReleId() != null) {
dictRepository.updateByReleId(resources.getReleId()); dictRepository.updateByReleId(resources.getReleId(), 1);
} }
dictRepository.save(resources); dictRepository.save(resources);
} }
@ -94,13 +94,19 @@ public class DictServiceImpl implements DictService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Set<Integer> ids) { public void delete(Set<Integer> ids) {
List<Dict> dicts = dictRepository.findByIdIn(ids); List<Dict> dicts = dictRepository.findByIdIn(ids);
dictRepository.deleteByIdIn(ids);
for (Dict dict : dicts) { for (Dict dict : dicts) {
if (dict.getIsChild()==1) { if (dict.getIsChild() == 1) {
dictRepository.deleteByReleId(dict.getId()); dictRepository.deleteByReleId(dict.getId());
} else {
int x = dictRepository.countDictByReleId(dict.getReleId());
if (x != 0) {
dictRepository.updateByReleId(dict.getReleId(), 0);
}
} }
delCaches(dict); delCaches(dict);
} }
dictRepository.deleteByIdIn(ids);
} }
public void delCaches(Dict dict) { public void delCaches(Dict dict) {

View File

@ -0,0 +1,22 @@
package cn.ysk.cashier.thirdpay.resp;
import lombok.Data;
import java.io.Serializable;
@Data
public class GroupOrderReturnResp implements Serializable {
private String ifCode;
private String mchRefundNo;
private String mercNo;
private String note;
private Integer oriAmount;
private String oriPayOrderId;
private String payType;
private Integer refundAmt;
private String refundOrderId;
private String refundReason;
private Integer refundType;
private String state;
}

View File

@ -49,17 +49,21 @@ public class ShopUserInfoVo implements Serializable {
} }
} }
public ShopUserInfoVo(Integer id, String headImg, String nickName, Object sex, BigDecimal amount, Integer totalScore, String telephone, String birthDay, Integer isVip, long createAt, long lastLoginAt) { // 无参构造函数
this.id = id; public ShopUserInfoVo() {
this.headImg = headImg;
this.nickName = nickName;
setSex(sex);
this.amount = amount;
this.totalScore = totalScore;
this.telephone = telephone;
this.birthDay = birthDay;
this.isVip = isVip;
this.createAt = createAt;
this.lastLoginAt = lastLoginAt;
} }
// private ShopUserInfoVo(Integer id, String headImg, String nickName, Object sex, BigDecimal amount, Integer totalScore, String telephone, String birthDay, Integer isVip, long createAt, long lastLoginAt) {
// this.id = id;
// this.headImg = headImg;
// this.nickName = nickName;
// setSex(sex);
// this.amount = amount;
// this.totalScore = totalScore;
// this.telephone = telephone;
// this.birthDay = birthDay;
// this.isVip = isVip;
// this.createAt = createAt;
// this.lastLoginAt = lastLoginAt;
// }
} }

View File

@ -1,6 +1,8 @@
package cn.ysk.cashier.vo; package cn.ysk.cashier.vo;
import cn.ysk.cashier.dto.TbPlatformDictDto;
import cn.ysk.cashier.dto.shop.TbCouponCategoryDto; import cn.ysk.cashier.dto.shop.TbCouponCategoryDto;
import cn.ysk.cashier.pojo.shop.TbPurchaseNotice;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import lombok.Data; import lombok.Data;
import cn.ysk.cashier.pojo.product.TbProductSku; import cn.ysk.cashier.pojo.product.TbProductSku;
@ -45,8 +47,7 @@ public class TbProductVo {
private String coverImg; private String coverImg;
@NotNull(message ="缺少商品类信息") private Integer categoryId;
private String categoryId;
private String categoryName; private String categoryName;
@ -208,7 +209,7 @@ public class TbProductVo {
private List<TbProductSku> skuList; private List<TbProductSku> skuList;
private HashMap<String,String> specsInfo; private HashMap<String, String> specsInfo;
private String specInfo; private String specInfo;
@ -218,5 +219,7 @@ public class TbProductVo {
private String skuSnap; private String skuSnap;
private TbPurchaseNotice notices=new TbPurchaseNotice();
private List<TbCouponCategoryDto> groupCategoryId = new ArrayList<>(); private List<TbCouponCategoryDto> groupCategoryId = new ArrayList<>();
private List<TbPlatformDictDto> tags = new ArrayList<>();
} }