菜单 子集

存酒
购买须知
团购商品
用户列表
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());
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.put("content",list);
map.put("totalElements",total);

View File

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

View File

@ -18,6 +18,9 @@ package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.service.shop.TbShopUserService;
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 lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
@ -57,14 +60,8 @@ public class TbShopUserController {
@GetMapping("queryAllShopUser")
@ApiOperation("查询商家用户")
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable){
Map<String, Object> stringObjectMap=new HashMap<>();
if (criteria.getShopId().equals("1")) {
stringObjectMap = tbShopUserService.queryAllShopUser(criteria, pageable);
}else {
stringObjectMap = tbShopUserService.queryShopUser(criteria, pageable);
}
return new ResponseEntity<>(stringObjectMap,HttpStatus.OK);
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria){
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria),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 isOpenYhq;
private Integer isUseVip;
/**
* 商家二维码
*/

View File

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

View File

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

View File

@ -16,26 +16,17 @@
package cn.ysk.cashier.dto.shop;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-01
**/
@Data
public class TbShopUserQueryCriteria {
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String name;
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String telephone;
@Query
private String shopId;
@Query
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 {
@Autowired
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")
public ResponseEntity<Object> findActivate(@RequestParam String shopId){
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")
@ApiModelProperty(value = "是否参与优惠券活动 true false")
private String isOpenYhq;
@Column(name = "is_use_vip")
@ApiModelProperty(value = "是否支持会员支付 0否1是")
private Integer isUseVip;
@Column(name = "shop_qrcode")
@ApiModelProperty(value = "商家二维码")
private String shopQrcode;

View File

@ -51,6 +51,10 @@ public class TbShopStorage implements Serializable {
@ApiModelProperty(value = "用户Id")
private Integer userid;
@Column(name = "`head_img`")
@ApiModelProperty(value = "用户头像")
private String headImg;
@Column(name = "`nick_name`")
@ApiModelProperty(value = "用户昵称")
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> {
/**
* 根据 couponId 查询
* @param couponId couponId
* 根据 proId 查询
* @param proId
* @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> {
@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")
Tuple searchByCount(@Param("shopId") String shopId);

View File

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

View File

@ -55,6 +55,11 @@ public class TbPlatformDictServiceImpl implements TbPlatformDictService {
return tbPlatformDictMapper.toDto(tbPlatformDictRepository.findAllByTypeAndIsShowCash(type,1));
}
@Override
public List<TbPlatformDictDto> queryByIds(List ids){
return tbPlatformDictRepository.findAllById(ids);
}
@Override
@Transactional
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.shop.TbMerchantThirdApplyService;
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.PublicResp;
import cn.ysk.cashier.thirdpay.service.ThirdPayService;
@ -181,10 +182,11 @@ public class TbGroupOrderInfoServiceImpl implements TbGroupOrderInfoService {
thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
GroupOrderReturnResp returnInfo = JSONUtil.parseJSONStr2T(publicResp.getBizData(), GroupOrderReturnResp.class);
if ("000000".equals(publicResp.getCode())) {
//TRADE_REFUND
if (!"TRADE_SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
throw new BadRequestException("退款渠道调用失败");
if (!"SUCCESS".equals(returnInfo.getState()) && !"TRADE_SUCCESS".equals(returnInfo.getState()) && !returnInfo.getState().equals("ING")) {
throw new BadRequestException("退款渠道调用失败,"+returnInfo.getNote());
}
} else {
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.copier.CopyOptions;
import cn.ysk.cashier.dto.TbPlatformDictDto;
import cn.ysk.cashier.dto.product.TbProductDto;
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
import cn.ysk.cashier.dto.shop.TbCouponCategoryDto;
import cn.ysk.cashier.exception.BadRequestException;
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.shop.TbPurchaseNotice;
import cn.ysk.cashier.pojo.shop.TbShopUnit;
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.TbShopUserDutyDetailRepository;
import cn.ysk.cashier.service.TbPlatformDictService;
import cn.ysk.cashier.service.product.TbProductService;
import cn.ysk.cashier.service.shop.TbCouponCategoryService;
import cn.ysk.cashier.service.shop.TbPurchaseNoticeService;
import cn.ysk.cashier.utils.*;
import cn.ysk.cashier.vo.TbProductVo;
import com.alibaba.fastjson.JSONArray;
@ -72,6 +79,9 @@ public class TbProductServiceImpl implements TbProductService {
private final TbShopCategoryRepository tbShopCategoryRepository;
private final TbShopUserDutyDetailRepository tbShopUserDutyDetailRe;
private final TbCouponCategoryService tbCouponCategoryService;
private final TbPlatformDictService tbPlatformDictService;
private final TagProductDeptsService tagProductService;
private final TbPurchaseNoticeRepository noticeRepository;
private final RedisUtils redisUtils;
@ -208,7 +218,7 @@ public class TbProductServiceImpl implements TbProductService {
Threads.call(tbProductSkus, tbProductSpec);
//组装
TbProductVo tbProductVo = new TbProductVo();
tbProductVo.setCategoryId(tbProduct.getCategoryId());
tbProductVo.setCategoryId(StringUtils.isNotBlank(tbProduct.getCategoryId())?Integer.valueOf(tbProduct.getCategoryId()):null);
//单位
// if (tbProduct.getUnitId() == null) {
// tbProductVo.setUnitId(null);
@ -252,6 +262,16 @@ public class TbProductServiceImpl implements TbProductService {
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;
}
@ -286,6 +306,7 @@ public class TbProductServiceImpl implements TbProductService {
TbProduct product = new TbProduct();
//组装
BeanUtil.copyProperties(resources, product, CopyOptions.create().setIgnoreNullValue(true));
if (!"group".equals(resources.getTypeEnum())) {
if (resources.getCategoryId() == null) {
throw new BadRequestException("必填内容未填写");
}
@ -296,10 +317,11 @@ public class TbProductServiceImpl implements TbProductService {
}
}
}
product.setCategoryId(String.valueOf(resources.getCategoryId()));
}
if (!CollectionUtils.isEmpty(resources.getImages())) {
product.setImages(resources.getImages().toString());
}
product.setCategoryId(String.valueOf(resources.getCategoryId()));
product.setIsDel(0);
product.setIsDelete(0);
product.setIsFreeFreight(1);
@ -319,6 +341,11 @@ public class TbProductServiceImpl implements TbProductService {
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
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);
@ -348,6 +375,16 @@ public class TbProductServiceImpl implements TbProductService {
productSkuResult.setTagSnap(resources.getSkuSnap());
productSkuResult.setId(save.getId());
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;
}
@ -376,6 +413,13 @@ public class TbProductServiceImpl implements TbProductService {
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
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);

View File

@ -1,5 +1,6 @@
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.TbShopStorageGoodQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopStorageGoodMapper;
@ -25,9 +26,9 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @author ww
* @website https://eladmin.vip
* @description 服务实现
* @author ww
* @date 2024-05-21
**/
@Service
@ -59,10 +60,30 @@ public class TbShopStorageGoodServiceImpl implements TbShopStorageGoodService {
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopStorageGoodDto create(TbShopStorageGood resources) {
resources.setIsDel(0);
resources.setCreateTime(new Timestamp(System.currentTimeMillis()));
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
@Transactional(rollbackFor = Exception.class)
public void update(TbShopStorageGood resources) {

View File

@ -64,6 +64,7 @@ public class TbShopStorageServiceImpl implements TbShopStorageService {
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopStorageDto create(TbShopStorage resources) {
resources.setStatus(1);
resources.setSavTime(new Timestamp(System.currentTimeMillis()));
resources.setExpTime(new Timestamp(System.currentTimeMillis() + 86400000 * resources.getExpDay()));
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.TbShopUserQueryCriteria;
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.repository.shop.TbShopUserRepository;
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.ValidationUtil;
import cn.ysk.cashier.vo.ShopUserInfoVo;
import com.alipay.api.domain.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -52,25 +58,14 @@ public class TbShopUserServiceImpl implements TbShopUserService {
private final TbShopUserRepository tbShopUserRepository;
private final TbShopUserMapper tbShopUserMapper;
@Override
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) {
Page<ShopUserInfoVo> shopUserJoinUserInfo =
tbShopUserRepository.findShopUserJoinUserInfo(
criteria.getShopId(),
criteria.getIsVip(),
criteria.getTelephone(),
pageable);
return PageUtil.toPage(shopUserJoinUserInfo);
}
@Autowired
private ShopUserMapper shopUserMapper;
@Override
public Map<String, Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) {
Page<ShopUserInfoVo> shopUserJoinUserInfo =
tbShopUserRepository.findAllShopUserJoinUserInfo(
criteria.getIsVip(),
criteria.getTelephone(),
pageable);
return PageUtil.toPage(shopUserJoinUserInfo);
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria) {
IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria,
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()));
return PageUtil.toPlusPage(iPage.getRecords(),Integer.valueOf(iPage.getTotal()+""));
}
@Override

View File

@ -1,5 +1,6 @@
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.TbShopStorageGoodQueryCriteria;
import cn.ysk.cashier.pojo.shop.TbShopStorageGood;
@ -43,6 +44,7 @@ public interface TbShopStorageGoodService {
* @return TbShopStorageGoodDto
*/
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.dto.shop.TbShopUserDto;
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 java.util.Map;
import java.util.List;
@ -36,12 +39,10 @@ public interface TbShopUserService {
/**
* 商家后台 用户管理
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria, Pageable pageable);
Map<String, Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable);
Map<String,Object> queryShopUser(TbShopUserQueryCriteria criteria);
/**
* 会员管理

View File

@ -40,9 +40,10 @@ public interface DictRepository extends JpaRepository<Dict, Long>, JpaSpecificat
void deleteByReleId(Integer releId);
List<Dict> findByReleId(Integer releId);
int countDictByReleId(Integer releId);
@Modifying
@Query("update Dict dict set dict.isChild=1 where dict.id =:id")
void updateByReleId(@Param("id")Integer id);
@Query("update Dict dict set dict.isChild=:isChild where dict.id =: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) {
resources.setIsChild(0);
if (resources.getReleId() != null) {
dictRepository.updateByReleId(resources.getReleId());
dictRepository.updateByReleId(resources.getReleId(), 1);
}
dictRepository.save(resources);
}
@ -94,13 +94,19 @@ public class DictServiceImpl implements DictService {
@Transactional(rollbackFor = Exception.class)
public void delete(Set<Integer> ids) {
List<Dict> dicts = dictRepository.findByIdIn(ids);
dictRepository.deleteByIdIn(ids);
for (Dict dict : dicts) {
if (dict.getIsChild() == 1) {
dictRepository.deleteByReleId(dict.getId());
} else {
int x = dictRepository.countDictByReleId(dict.getReleId());
if (x != 0) {
dictRepository.updateByReleId(dict.getReleId(), 0);
}
}
delCaches(dict);
}
dictRepository.deleteByIdIn(ids);
}
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;
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;
// 无参构造函数
public ShopUserInfoVo() {
}
// 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;
import cn.ysk.cashier.dto.TbPlatformDictDto;
import cn.ysk.cashier.dto.shop.TbCouponCategoryDto;
import cn.ysk.cashier.pojo.shop.TbPurchaseNotice;
import com.alibaba.fastjson.JSONArray;
import lombok.Data;
import cn.ysk.cashier.pojo.product.TbProductSku;
@ -45,8 +47,7 @@ public class TbProductVo {
private String coverImg;
@NotNull(message ="缺少商品类信息")
private String categoryId;
private Integer categoryId;
private String categoryName;
@ -218,5 +219,7 @@ public class TbProductVo {
private String skuSnap;
private TbPurchaseNotice notices=new TbPurchaseNotice();
private List<TbCouponCategoryDto> groupCategoryId = new ArrayList<>();
private List<TbPlatformDictDto> tags = new ArrayList<>();
}