Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33b0c2bb10 | ||
|
|
d7ba8509d5 |
@@ -76,6 +76,4 @@ public interface CacheKey {
|
||||
String SONG_URL = "song:";
|
||||
|
||||
String VIPCODE = "VIPCODE:";
|
||||
|
||||
String INVOICE_SD_TYPE = "invoice:sd_type:";
|
||||
}
|
||||
|
||||
@@ -102,13 +102,10 @@ public class ListUtil {
|
||||
}
|
||||
|
||||
|
||||
public static <T> String listToJsonString(List<T> list) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
return objectMapper.writeValueAsString(list);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
public static<T> String listChangeString(List<T> listString){
|
||||
return listString.stream()
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
public static String mapToString(Map<String, String> map) {
|
||||
|
||||
@@ -1,45 +1,38 @@
|
||||
|
||||
package cn.ysk.cashier.config.security.rest;
|
||||
|
||||
import cn.hutool.core.comparator.CompareUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousDeleteMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.config.RsaProperties;
|
||||
import cn.ysk.cashier.config.security.config.bean.LoginCodeEnum;
|
||||
import cn.ysk.cashier.config.security.config.bean.LoginProperties;
|
||||
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.config.security.service.OnlineUserService;
|
||||
import cn.ysk.cashier.config.security.service.dto.AuthUserDto;
|
||||
import cn.ysk.cashier.config.security.service.dto.JwtUserDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.mapper.MpShopInfoMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbMerchantAccountMapper;
|
||||
import cn.ysk.cashier.mybatis.service.MpShopUserService;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.repository.TbTokenRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import cn.ysk.cashier.utils.RsaUtils;
|
||||
import cn.ysk.cashier.utils.SecurityUtils;
|
||||
import cn.ysk.cashier.utils.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousDeleteMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.config.RsaProperties;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
|
||||
import cn.ysk.cashier.config.security.config.bean.LoginProperties;
|
||||
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
|
||||
import cn.ysk.cashier.config.security.service.dto.AuthUserDto;
|
||||
import cn.ysk.cashier.config.security.service.dto.JwtUserDto;
|
||||
import cn.ysk.cashier.config.security.service.OnlineUserService;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@@ -49,9 +42,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -73,11 +66,6 @@ public class AuthorizationController {
|
||||
private final TbShopInfoRepository tbShopInfoRepository;
|
||||
private final TbPlussShopStaffRepository staffRepository;
|
||||
private final TbMerchantAccountRepository tbMerchantAccountRepository;
|
||||
private final TbMerchantAccountMapper tbMerchantAccountMapper;
|
||||
private final TbTokenRepository tbTokenRepository;
|
||||
private final MpShopUserService shopUserService;
|
||||
private final MpShopInfoMapper shopInfoMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private LoginProperties loginProperties;
|
||||
@@ -97,8 +85,8 @@ public class AuthorizationController {
|
||||
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
|
||||
throw new BadRequestException("验证码错误");
|
||||
}
|
||||
String loginpre = "";
|
||||
String shopId = "";
|
||||
String loginpre="";
|
||||
String shopId="";
|
||||
// 判断是否是员工登录
|
||||
if (authUser.getLoginType() != null && "staff".equals(authUser.getLoginType())) {
|
||||
if (StrUtil.isBlank(authUser.getMerchantName())) {
|
||||
@@ -115,7 +103,7 @@ public class AuthorizationController {
|
||||
|
||||
//生成token
|
||||
UsernamePasswordAuthenticationToken authenticationToken =
|
||||
new UsernamePasswordAuthenticationToken(loginpre + authUser.getUsername(), password);
|
||||
new UsernamePasswordAuthenticationToken(loginpre+authUser.getUsername(), password);
|
||||
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
// 生成令牌与第三方系统获取令牌方式
|
||||
@@ -126,7 +114,7 @@ public class AuthorizationController {
|
||||
// TbShopInfo byAccount = tbShopInfoRepository.findByAccount(jwtUserDto.getUsername());
|
||||
TbPlussShopStaff tbPlussShopStaff;
|
||||
if (authUser.getLoginType() != null && "staff".equals(authUser.getLoginType())) {
|
||||
tbPlussShopStaff = staffRepository.queryByAccount(authUser.getUsername(), shopId);
|
||||
tbPlussShopStaff = staffRepository.queryByAccount(authUser.getUsername(),shopId);
|
||||
} else {
|
||||
tbPlussShopStaff = staffRepository.queryByAccount(authUser.getUsername());
|
||||
}
|
||||
@@ -149,8 +137,7 @@ public class AuthorizationController {
|
||||
put("user", jwtUserDto);
|
||||
if (byAccount != null) {
|
||||
put("shopId", byAccount.getId());
|
||||
put("mainId", org.apache.commons.lang3.StringUtils.isNotBlank(byAccount.getMainId()) ? byAccount.getMainId() : byAccount.getId());
|
||||
put("loginType", org.apache.commons.lang3.StringUtils.isNotBlank(authUser.getLoginType()) ? authUser.getLoginType() : "merchant");
|
||||
put("loginType", org.apache.commons.lang3.StringUtils.isNotBlank(authUser.getLoginType())?authUser.getLoginType():"merchant");
|
||||
put("shopName", byAccount.getShopName());
|
||||
put("logo", byAccount.getLogo());
|
||||
}
|
||||
@@ -163,49 +150,9 @@ public class AuthorizationController {
|
||||
//踢掉之前已经登录的token
|
||||
onlineUserService.checkLoginOnUser(authUser.getUsername(), token);
|
||||
}
|
||||
// 店铺使用有效期是否过期
|
||||
authInfo.put("expireDate", null);
|
||||
if (tbPlussShopStaff != null) {
|
||||
TbShopInfo shopInfo = shopInfoMapper.selectById(tbPlussShopStaff.getShopId());
|
||||
if (shopInfo != null && shopInfo.getExpireAt() != null) {
|
||||
Long expireAt = shopInfo.getExpireAt();
|
||||
Date time = DateUtil.calendar(expireAt).getTime();
|
||||
authInfo.put("expireDate", DateUtil.formatDateTime(time));
|
||||
if (CompareUtil.compare(time, new Date()) < 0) {
|
||||
throw new BadRequestException("店铺已到期,请联系区域经理续费");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok(authInfo);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/userInfo")
|
||||
public ResponseEntity<Object> getUserInfo(HttpServletRequest request) {
|
||||
String token = tokenProvider.getToken(request);
|
||||
JSONObject userInfo = JSON.parseObject(JSON.toJSONString(redisUtils.get("online-token-" + token)));
|
||||
String userName = userInfo.getString("userName");
|
||||
String shopId = userInfo.getString("shopId");
|
||||
TbShopInfo shopInfo = shopInfoMapper.selectById(shopId);
|
||||
TbPlussShopStaff shopStaff;
|
||||
if (userName.contains("@")) {
|
||||
shopStaff = staffRepository.queryMasterAccount(shopId);
|
||||
} else {
|
||||
shopStaff = staffRepository.queryByAccount(userName, shopId);
|
||||
}
|
||||
// TbMerchantAccount merchantAccount = tbMerchantAccountMapper.selectOne(Wrappers.<TbMerchantAccount>lambdaQuery()
|
||||
// .eq(TbMerchantAccount::getAccount, shopStaff.getAccount()));
|
||||
// Integer accountId = merchantAccount.getId();
|
||||
// Integer staffId = shopStaff.getId();
|
||||
// List<TbToken> onlineUserList = tbTokenRepository.findListByAccountIdAndStaffId(accountId, staffId);
|
||||
shopStaff.setPassword(null);
|
||||
return ResponseEntity.ok(new HashMap<String, Object>() {{
|
||||
put("shopInfo", shopInfo);
|
||||
put("shopStaff", shopStaff);
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
*
|
||||
@@ -242,19 +189,6 @@ public class AuthorizationController {
|
||||
//踢掉之前已经登录的token
|
||||
onlineUserService.checkLoginOnUser(authUser.getUsername(), token);
|
||||
}
|
||||
// 店铺使用有效期是否过期
|
||||
authInfo.put("expireDate", null);
|
||||
if (byAccount != null) {
|
||||
TbShopInfo shopInfo = shopInfoMapper.selectById(byAccount.getId());
|
||||
if (shopInfo != null && shopInfo.getExpireAt() != null) {
|
||||
Long expireAt = shopInfo.getExpireAt();
|
||||
Date time = DateUtil.calendar(expireAt).getTime();
|
||||
authInfo.put("expireDate", DateUtil.formatDateTime(time));
|
||||
if (DateUtil.compare(time, new Date()) > 0) {
|
||||
throw new BadRequestException("店铺已到期,请联系区域经理续费");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok(authInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,16 +73,6 @@ public class TokenProvider implements InitializingBean {
|
||||
.compact();
|
||||
}
|
||||
|
||||
public String createToken(String name,String shopId) {
|
||||
return jwtBuilder
|
||||
// 加入ID确保生成的 Token 都不一致
|
||||
.setId(IdUtil.simpleUUID())
|
||||
.claim(AUTHORITIES_KEY, name)
|
||||
.claim("shopId",shopId)
|
||||
.setSubject(name)
|
||||
.compact();
|
||||
}
|
||||
|
||||
/**
|
||||
* 依据Token 获取鉴权信息
|
||||
*
|
||||
|
||||
@@ -50,19 +50,6 @@ public class OnlineUserService {
|
||||
redisUtils.set(properties.getOnlineKey() + token, onlineUserDto, properties.getTokenValidityInSeconds()/1000);
|
||||
}
|
||||
|
||||
public void save(String username, String nickName, String token, HttpServletRequest request,Integer shopId){
|
||||
String ip = StringUtils.getIp(request);
|
||||
String browser = StringUtils.getBrowser(request);
|
||||
String address = StringUtils.getCityInfo(ip);
|
||||
OnlineUserDto onlineUserDto = null;
|
||||
try {
|
||||
onlineUserDto = new OnlineUserDto(shopId,username, nickName, null, browser , ip, address, EncryptUtils.desEncrypt(token), new Date());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
redisUtils.set(properties.getOnlineKey() + token, onlineUserDto, properties.getTokenValidityInSeconds()/1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* @param filter /
|
||||
|
||||
@@ -20,35 +20,6 @@ public interface TableConstant {
|
||||
}
|
||||
}
|
||||
|
||||
class Product {
|
||||
@Getter
|
||||
public enum Type {
|
||||
NORMAL("normal"), PACKAGE("package");
|
||||
private final String value;
|
||||
|
||||
Type(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean equalsVals(String value) {
|
||||
return this.value.equals(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ThirdPartyCoupon {
|
||||
@Getter
|
||||
public enum Plat {
|
||||
MEI_TUAN("meituan");
|
||||
private final String value;
|
||||
|
||||
Plat(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CashierCart {
|
||||
public static final String ID = "-999";
|
||||
|
||||
@@ -99,35 +70,6 @@ public interface TableConstant {
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
public enum OrderType {
|
||||
COUPON("coupon");
|
||||
private final String value;
|
||||
|
||||
OrderType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean equalsVals(String value) {
|
||||
return this.value.equals(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
public enum PayType {
|
||||
CREDIT_BUYER("creditBuyer");
|
||||
private final String value;
|
||||
|
||||
PayType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
public boolean equalsVals(String value) {
|
||||
return this.value.equals(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
public enum UseType {
|
||||
TAKEOUT("takeout"),
|
||||
|
||||
@@ -30,7 +30,6 @@ public class SuppFlow implements Serializable {
|
||||
@Data
|
||||
public static class ConInfos{
|
||||
private Integer conInfoId;
|
||||
private String name;
|
||||
|
||||
private String unit;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
@@ -35,15 +34,4 @@ public interface TbConsInfoRepository extends JpaRepository<TbConsInfo, Integer>
|
||||
" where conPro.con_info_id = :conInfoId " +
|
||||
" group by conPro.product_id ",nativeQuery = true)
|
||||
List<Map<Integer, Object>> queryAllAndPro(@Param("shopId") Integer shopId, @Param("conInfoId")Integer conInfoId);
|
||||
|
||||
@Query(value =
|
||||
"SELECT *" +
|
||||
" FROM" +
|
||||
" tb_cons_info conPro" +
|
||||
" where conPro.shop_id = :shopId ",nativeQuery = true)
|
||||
List<TbConsInfo> searchConsInfoByShopId(Integer shopId);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "delete FROM tb_prosku_con conPro where conPro.shop_id = :shopId ",nativeQuery = true)
|
||||
void clearShopCons(Integer shopId);
|
||||
}
|
||||
@@ -3,11 +3,8 @@ package cn.ysk.cashier.cons.repository;
|
||||
import cn.ysk.cashier.cons.domain.TbConsType;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author admin
|
||||
@@ -19,13 +16,6 @@ public interface TbConsTypeRepository extends JpaRepository<TbConsType, Integer>
|
||||
|
||||
TbConsType findByConTypeCode(String conTypeCode);
|
||||
|
||||
@Query("SELECT c FROM TbConsType c WHERE c.shopId = :shopId")
|
||||
List<TbConsType> searchConsTypeByShopId(Integer shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("delete FROM TbProskuCon c WHERE c.shopId = :shopId")
|
||||
void clearShopConType(Integer shopId);
|
||||
|
||||
@Query("SELECT count(*) FROM TbProskuCon c LEFT JOIN TbConsInfo i ON c.conInfoId = i.id WHERE i.conTypeId = :id")
|
||||
int countProByTypeId(Integer id);
|
||||
}
|
||||
|
||||
@@ -30,11 +30,4 @@ public interface TbProskuConRepository extends JpaRepository<TbProskuCon, Intege
|
||||
|
||||
List<TbProskuCon> searchAllByProductId(Integer productId);
|
||||
|
||||
@Query(value = "select * from tb_prosku_con where shop_id=?1 ",nativeQuery = true)
|
||||
List<TbProskuCon> searchConsProByShopId(Integer shopId);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "delete from tb_prosku_con where shop_id = :shopId",nativeQuery = true)
|
||||
void clearShopConPro(Integer shopId);
|
||||
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class TbConCheckServiceImpl implements TbConCheckService {
|
||||
flow.setConsId(consInfo.getId());
|
||||
flow.setShopId(consInfo.getShopId());
|
||||
flow.setConName(consInfo.getConName());
|
||||
flow.setAmount(resources.getLpNum().abs());
|
||||
flow.setAmount(resources.getLpNum());
|
||||
flow.setBalance(resources.getStockNumber());
|
||||
flow.setOperator(SecurityUtils.getCurrentUserNickName());
|
||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
@@ -113,8 +113,8 @@ public class TbConCheckServiceImpl implements TbConCheckService {
|
||||
conCheck.setPrice(consInfo.getPrice());
|
||||
conCheck.setAcStockNumber(resources.getStockNumber());
|
||||
conCheck.setStockNumber(resources.getStockNumber());
|
||||
conCheck.setLpAmount(consInfo.getPrice().multiply(resources.getLpNum()));
|
||||
conCheck.setLpNum(resources.getLpNum());
|
||||
conCheck.setLpAmount(consInfo.getPrice().multiply(resources.getLpNum()));
|
||||
conCheck.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
conCheck.setRemark(resources.getRemark());
|
||||
return tbConCheckMapper.toDto(tbConCheckRepository.save(conCheck));
|
||||
|
||||
@@ -67,6 +67,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
private final TbProductStockOperateRepository tbProductStockOperateRepository;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TbConsInfoQueryCriteria criteria, Pageable pageable) {
|
||||
Page<TbConsInfo> page = tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
@@ -76,7 +77,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
@Override
|
||||
public Map<String, Object> queryAllAndPro(TbConsInfoQueryCriteria criteria) {
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
||||
if (StringUtils.isNotBlank(criteria.getSort())) {
|
||||
if(StringUtils.isNotBlank(criteria.getSort())){
|
||||
String[] sortParams = criteria.getSort().split(",");
|
||||
String sortField = sortParams[0];
|
||||
Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]);
|
||||
@@ -111,7 +112,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbConsInfoDto create(List<TbConsInfo> resources) {
|
||||
public TbConsInfoDto create(List<TbConsInfo> resources){
|
||||
|
||||
|
||||
for (TbConsInfo resource : resources) {
|
||||
@@ -124,8 +125,8 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
// if (count > 0) {
|
||||
// throw new Exception("耗材代码不允许重复");
|
||||
// }
|
||||
if (StringUtils.isBlank(resource.getConUnit())) {
|
||||
throw new BadRequestException(resource.getConName() + "的单位不允许为空");
|
||||
if(StringUtils.isBlank(resource.getConUnit())){
|
||||
throw new BadRequestException(resource.getConName()+ "的单位不允许为空");
|
||||
}
|
||||
resource.setConCode(StringCodeUtil.getRandom(8, LETTER_CAPITAL_NUMBER));
|
||||
resource.setConTypeName(tbConsType.getConTypeName());
|
||||
@@ -149,7 +150,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
if (Objects.isNull(tbConsInfo)) {
|
||||
throw new Exception("耗材信息不存在");
|
||||
}
|
||||
BeanUtil.copyProperties(resource, tbConsInfo, CopyOptions.create().setIgnoreNullValue(true));
|
||||
BeanUtil.copyProperties(resource,tbConsInfo, CopyOptions.create().setIgnoreNullValue(true));
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoRepository.save(tbConsInfo);
|
||||
}
|
||||
@@ -219,6 +220,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
|
||||
JSONArray array = new JSONArray();
|
||||
|
||||
|
||||
for (SuppFlow.ConInfos conInfos : resources.getList()) {
|
||||
JSONObject object = new JSONObject();
|
||||
|
||||
@@ -227,29 +229,34 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
log.info("耗材信息不存在");
|
||||
continue;
|
||||
}
|
||||
conInfos.setName(info.getConName());
|
||||
BigDecimal changeStock = conInfos.getStockNumber();
|
||||
//副单位的实际修改值
|
||||
if (StringUtils.isNotBlank(conInfos.getUnit())) {
|
||||
info.setDefaultUnit(conInfos.getUnit());
|
||||
conInfos.setUnit(conInfos.getUnit());
|
||||
if (conInfos.getUnit().equals(info.getConUnitTwo())) {
|
||||
changeStock = conInfos.getStockNumber().multiply(info.getConUnitTwoConvert()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
} else if(StringUtils.isNotBlank(info.getDefaultUnit())){
|
||||
info.setDefaultUnit(info.getDefaultUnit());
|
||||
conInfos.setUnit(info.getDefaultUnit());
|
||||
if(StringUtils.isNotBlank(info.getConUnitTwo())&& info.getConUnitTwo().equals(info.getDefaultUnit())){
|
||||
changeStock = conInfos.getStockNumber().multiply(info.getConUnitTwoConvert()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
} else {
|
||||
info.setDefaultUnit(info.getConUnit());
|
||||
conInfos.setUnit(info.getConUnit());
|
||||
} else if (StringUtils.isNotBlank(info.getConUnitTwo())
|
||||
&& StringUtils.isNotBlank(info.getDefaultUnit())
|
||||
&& info.getConUnitTwo().equals(info.getDefaultUnit())) {
|
||||
info.setDefaultUnit(info.getConUnitTwo());
|
||||
changeStock = conInfos.getStockNumber().multiply(info.getConUnitTwoConvert()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TbConsSuppFlow suppFlow = new TbConsSuppFlow();
|
||||
|
||||
TbConsInfoFlow flow = new TbConsInfoFlow();
|
||||
|
||||
TbShopPurveyorTransact purveyorTransact = new TbShopPurveyorTransact();
|
||||
purveyorTransact.setShopId(tbShopInfo.getId().toString());
|
||||
purveyorTransact.setPurveyorName(Objects.isNull(purveyor) ? "" : purveyor.getPurveyorName());
|
||||
purveyorTransact.setPurveyorId(Objects.isNull(purveyor) ? "" : purveyor.getId().toString());
|
||||
purveyorTransact.setRemark(resources.getRemark());
|
||||
purveyorTransact.setCreatedAt(System.currentTimeMillis());
|
||||
purveyorTransact.setUpdatedAt(System.currentTimeMillis());
|
||||
|
||||
suppFlow.setConInfoId(info.getConTypeId());
|
||||
suppFlow.setShopId(resources.getShopId());
|
||||
suppFlow.setSupplierId(Objects.isNull(resources.getSupplierId()) ? 0 : resources.getSupplierId());
|
||||
@@ -258,17 +265,27 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
//实际库存
|
||||
BigDecimal amount = info.getStockNumber().subtract(info.getStockConsume());
|
||||
|
||||
|
||||
if ("in".equals(resources.getType())) {
|
||||
stockOperate.setSubType(1);
|
||||
info.setStockNumber(info.getStockNumber().add(changeStock));
|
||||
info.setLasterInStock(changeStock);
|
||||
|
||||
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).add(changeStock));
|
||||
|
||||
|
||||
flow.setBizCode("stockIn");
|
||||
flow.setBizName("耗材入库");
|
||||
flow.setBizType("+");
|
||||
|
||||
purveyorTransact.setTotalAmount(resources.getAccountsPayable());
|
||||
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())));
|
||||
purveyorTransact.setType("cons_in");
|
||||
|
||||
object.put("number", changeStock);
|
||||
} else if ("out".equals(resources.getType())) {
|
||||
}
|
||||
else if ("out".equals(resources.getType())) {
|
||||
stockOperate.setSubType(-1);
|
||||
|
||||
if (changeStock.compareTo(amount) > 0) {
|
||||
@@ -276,12 +293,23 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
}
|
||||
|
||||
info.setStockNumber(info.getStockNumber().subtract(changeStock));
|
||||
|
||||
|
||||
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(changeStock));
|
||||
|
||||
|
||||
flow.setBizCode("stockout");
|
||||
flow.setBizName("耗材出库");
|
||||
flow.setBizType("-");
|
||||
|
||||
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||
purveyorTransact.setTotalAmount(resources.getAccountsPayable().negate());
|
||||
|
||||
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate());
|
||||
purveyorTransact.setType("cons_out");
|
||||
object.put("number", changeStock);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new BadRequestException("错误操作类型");
|
||||
}
|
||||
|
||||
@@ -298,6 +326,21 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
suppFlow.setActualPayment(resources.getActualPayment());
|
||||
suppFlow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
|
||||
|
||||
if (resources.getAccountsPayable().compareTo(resources.getActualPayment()) <= 0) {
|
||||
purveyorTransact.setStatus(1);
|
||||
} else {
|
||||
purveyorTransact.setStatus(0);
|
||||
}
|
||||
|
||||
purveyorTransact.setPaidAt(System.currentTimeMillis());
|
||||
//供应商
|
||||
purveyorTransactRepository.save(purveyorTransact);
|
||||
if (resources.getSupplierId() != null) {
|
||||
tbShopPurveyorRepository.upLastTransactAt(resources.getSupplierId().toString());
|
||||
}
|
||||
|
||||
|
||||
tbConsInfoRepository.save(info);
|
||||
tbConsSuppFlowRepository.save(suppFlow);
|
||||
|
||||
@@ -316,39 +359,6 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
stockOperate.setBatchNumber("");
|
||||
stockOperate.setStockSnap(array.toJSONString());
|
||||
tbProductStockOperateRepository.save(stockOperate);
|
||||
|
||||
if (resources.getSupplierId() != null) {
|
||||
TbShopPurveyorTransact purveyorTransact = new TbShopPurveyorTransact();
|
||||
purveyorTransact.setShopId(tbShopInfo.getId().toString());
|
||||
purveyorTransact.setPurveyorName(Objects.isNull(purveyor) ? "" : purveyor.getPurveyorName());
|
||||
purveyorTransact.setPurveyorId(Objects.isNull(purveyor) ? "" : purveyor.getId().toString());
|
||||
purveyorTransact.setRemark(resources.getRemark());
|
||||
purveyorTransact.setCreatedAt(System.currentTimeMillis());
|
||||
purveyorTransact.setUpdatedAt(System.currentTimeMillis());
|
||||
purveyorTransact.setPaidAt(System.currentTimeMillis());
|
||||
purveyorTransact.setConInfos(JSONUtil.toJSONString(resources.getList()));
|
||||
if ("in".equals(resources.getType())) {
|
||||
purveyorTransact.setTotalAmount(resources.getAccountsPayable());
|
||||
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())));
|
||||
purveyorTransact.setType("cons_in");
|
||||
} else if ("out".equals(resources.getType())) {
|
||||
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||
purveyorTransact.setTotalAmount(resources.getAccountsPayable().negate());
|
||||
|
||||
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate());
|
||||
purveyorTransact.setType("cons_out");
|
||||
}
|
||||
|
||||
if (resources.getAccountsPayable().compareTo(resources.getActualPayment()) <= 0) {
|
||||
purveyorTransact.setStatus(1);
|
||||
} else {
|
||||
purveyorTransact.setStatus(0);
|
||||
}
|
||||
//供应商
|
||||
purveyorTransactRepository.save(purveyorTransact);
|
||||
tbShopPurveyorRepository.upLastTransactAt(resources.getSupplierId().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,12 +4,10 @@ import cn.ysk.cashier.service.TbPlatformDictService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@@ -21,12 +19,10 @@ public class AppCenterController {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("获取应用中心列表")
|
||||
public ResponseEntity<Object> queryBotButtonConfig(@RequestParam(required = false, defaultValue = "appCenter") String type){
|
||||
return new ResponseEntity<>(tbPlatformDictService.queryByType(type), HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryBotButtonConfig(){
|
||||
return new ResponseEntity<>(tbPlatformDictService.queryByType("appCenter"), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class TbShopShareController {
|
||||
private TbShopShareRecordService tbShopShareRecordService;
|
||||
|
||||
@PostMapping("byShare")
|
||||
@AnonymousPostMapping
|
||||
@ApiOperation("分页查询")
|
||||
public ResponseEntity<Object> selectAllByShare(@RequestBody TbShopShareRecordQueryCriteria criteria) {
|
||||
return new ResponseEntity<>(tbShopShareRecordService.selectAllByShare(criteria), HttpStatus.OK);
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
package cn.ysk.cashier.controller;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.TbShopSyncInfoQueryCriteria;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSyncInfo;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopSyncInfoMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopSyncInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 店铺信息同步记录表(TbShopSyncInfo)表控制层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-25 16:46:12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/tbShopSyncInfo")
|
||||
public class TbShopSyncInfoController {
|
||||
|
||||
@Resource
|
||||
private TbShopSyncInfoService tbShopSyncInfoService;
|
||||
|
||||
@Autowired
|
||||
private TbShopSyncInfoMapper tbShopSyncInfomapper;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询同步数据情况")
|
||||
public ResponseEntity<Object> selectAll(TbShopSyncInfoQueryCriteria criteria) {
|
||||
return new ResponseEntity<>(tbShopSyncInfoService.queryByShopId(criteria), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sync")
|
||||
@ApiOperation("同步")
|
||||
public ResponseEntity<Object> sync(@RequestBody TbShopSyncInfo tbShopSyncInfo) {
|
||||
TbShopSyncInfoQueryCriteria criteria = new TbShopSyncInfoQueryCriteria();
|
||||
criteria.setPointShopId(tbShopSyncInfo.getPointShopId());
|
||||
TbShopSyncInfo tbShopSyncInfo1 = tbShopSyncInfoService.queryByShopId(criteria);
|
||||
if (tbShopSyncInfo1 != null) {
|
||||
throw new RuntimeException("已同步 请勿重复操作");
|
||||
}
|
||||
tbShopSyncInfo.setSyncTime(new Date());
|
||||
tbShopSyncInfo.setStatus(1);
|
||||
tbShopSyncInfomapper.insert(tbShopSyncInfo);
|
||||
tbShopSyncInfoService.sync(tbShopSyncInfo);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@AnonymousPostMapping("/clear")
|
||||
@ApiOperation("一键清除店铺数据")
|
||||
public ResponseEntity<Object> clear(@RequestBody TbShopSyncInfo tbShopSyncInfo){
|
||||
TbShopSyncInfoQueryCriteria criteria = new TbShopSyncInfoQueryCriteria();
|
||||
criteria.setPointShopId(tbShopSyncInfo.getPointShopId());
|
||||
TbShopSyncInfo tbShopSyncInfo1 = tbShopSyncInfoService.queryByShopId(criteria);
|
||||
if(tbShopSyncInfo1 != null){
|
||||
long between = DateUtil.between(new Date(), tbShopSyncInfo1.getSyncTime(), DateUnit.HOUR);
|
||||
if(between > 24){
|
||||
throw new RuntimeException("数据同步已超过一天 无法清除");
|
||||
}
|
||||
tbShopSyncInfoService.clear(tbShopSyncInfo);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package cn.ysk.cashier.controller;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.dto.TbVersionQueryCriteria;
|
||||
import cn.ysk.cashier.pojo.TbVersion;
|
||||
import cn.ysk.cashier.service.TbVersionService;
|
||||
@@ -28,12 +27,6 @@ public class TbVersionController {
|
||||
return new ResponseEntity<>(tbVersionService.queryAllPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@AnonymousGetMapping("findBySource")
|
||||
@ApiOperation("查询所属渠道升级版本")
|
||||
public ResponseEntity<Object> findBySource(String source){
|
||||
return new ResponseEntity<>(tbVersionService.findBySource(source),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("版本管理 新增")
|
||||
@ApiOperation("新增版本")
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
package cn.ysk.cashier.controller;
|
||||
|
||||
import cn.ysk.cashier.dto.thirdcoupon.BaseQueryDTO;
|
||||
import cn.ysk.cashier.dto.thirdcoupon.CheckCouponDTO;
|
||||
import cn.ysk.cashier.service.ThirdPartyCouponService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 三方团购券
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/thirdPartyCoupon")
|
||||
public class ThirdPartyCouponController {
|
||||
|
||||
private final ThirdPartyCouponService thirdPartyCouponService;
|
||||
|
||||
public ThirdPartyCouponController(ThirdPartyCouponService thirdPartyCouponService) {
|
||||
this.thirdPartyCouponService = thirdPartyCouponService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定状态
|
||||
* @return 绑定状态
|
||||
*/
|
||||
@GetMapping("/state")
|
||||
public ResponseEntity<Map<String, Object>> getState(@RequestParam Integer shopId) {
|
||||
return ResponseEntity.ok(thirdPartyCouponService.getState(shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取美团绑定链接
|
||||
* @return 美团绑定链接
|
||||
*/
|
||||
@GetMapping("bindUrl")
|
||||
public ResponseEntity<String> getBindUrl(@RequestParam Integer shopId) {
|
||||
return ResponseEntity.ok(thirdPartyCouponService.getBindUrl(shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑美团商家
|
||||
* @return 美团解绑链接
|
||||
*/
|
||||
@GetMapping("unBindUrl")
|
||||
public ResponseEntity<String> getUnBindUrl(@RequestParam Integer shopId) {
|
||||
return ResponseEntity.ok(thirdPartyCouponService.getUnBindUrl(shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门店客核销券
|
||||
* @return 所有券
|
||||
*/
|
||||
@GetMapping("list")
|
||||
public ResponseEntity<Map<String, Object>> getActivateCoupon(@RequestParam Integer shopId, @RequestParam String code) {
|
||||
return ResponseEntity.ok(thirdPartyCouponService.getActivateCoupon(shopId, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销券
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<Map<String, Object>> checkCoupon(@RequestBody CheckCouponDTO checkCouponDTO) {
|
||||
return ResponseEntity.ok(thirdPartyCouponService.checkCoupon(checkCouponDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销券核销
|
||||
*/
|
||||
@DeleteMapping("revoke")
|
||||
public ResponseEntity<Map<String, Object>> revokeCoupon(@RequestBody CheckCouponDTO checkCouponDTO) {
|
||||
return ResponseEntity.ok(thirdPartyCouponService.revokeCoupon(checkCouponDTO));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package cn.ysk.cashier.controller.booking;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.ysk.cashier.dto.booking.ShopTableBookingDTO;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopTableBookingService;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopArea;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 店铺台桌预订
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/booking/shop-table")
|
||||
@Api(tags = "店铺台桌预订")
|
||||
public class TbShopTableBookingController {
|
||||
|
||||
@Resource
|
||||
private TbShopTableBookingService tbShopTableBookingService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
public ResponseEntity page(@RequestParam Map<String, Object> params) {
|
||||
Map<String, Object> data = tbShopTableBookingService.page(params);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("信息")
|
||||
public ResponseEntity get(@PathVariable("id") Long id) {
|
||||
TbShopTableBooking data = tbShopTableBookingService.getById(id);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("预订")
|
||||
public ResponseEntity booking(@RequestBody TbShopTableBooking dto) {
|
||||
String orderNo = tbShopTableBookingService.booking(dto);
|
||||
tbShopTableBookingService.markSubscribe(dto.getShopTableId());
|
||||
Map<String, Object> data = new HashMap<>(2);
|
||||
data.put("id", dto.getId());
|
||||
data.put("orderNo", orderNo);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改预订信息")
|
||||
public ResponseEntity update(@RequestBody TbShopTableBooking dto) {
|
||||
boolean ret = tbShopTableBookingService.update(dto);
|
||||
tbShopTableBookingService.markSubscribe(dto.getShopTableId());
|
||||
return ResponseEntity.ok().body(ret);
|
||||
}
|
||||
|
||||
@PostMapping("mark-status")
|
||||
@ApiOperation("修改预订状态")
|
||||
public ResponseEntity markStatus(@RequestBody TbShopTableBooking dto) {
|
||||
tbShopTableBookingService.markStatus(dto.getId(), dto.getStatus());
|
||||
if(dto.getStatus() == -1){
|
||||
TbShopTableBooking entity = tbShopTableBookingService.getById(dto.getId());
|
||||
tbShopTableBookingService.cancelSubscribe(entity.getShopTableId());
|
||||
}
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@ApiOperation("删除")
|
||||
public ResponseEntity delete(@PathVariable("id") Long id) {
|
||||
tbShopTableBookingService.delete(id);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@GetMapping("sms")
|
||||
@ApiOperation("获取待发送的短信内容")
|
||||
public ResponseEntity sms(@RequestParam("shopId") Integer shopId) {
|
||||
String smsContent = tbShopTableBookingService.getBookingSms(shopId);
|
||||
return ResponseEntity.ok().body(smsContent);
|
||||
}
|
||||
|
||||
@GetMapping("area")
|
||||
@ApiOperation("获取区域列表")
|
||||
public ResponseEntity areaList(@RequestParam Integer shopId) {
|
||||
List<TbShopArea> list = tbShopTableBookingService.findShopAreaList(shopId);
|
||||
return ResponseEntity.ok().body(list);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("获取台桌列表")
|
||||
public ResponseEntity list(@RequestParam Map<String, Object> params) {
|
||||
List<ShopTableBookingDTO> list = tbShopTableBookingService.findShopTableList(params);
|
||||
return ResponseEntity.ok().body(list);
|
||||
}
|
||||
|
||||
@PostMapping("summary")
|
||||
@ApiOperation("根据电话号码统计历史预订信息")
|
||||
public ResponseEntity summary(@RequestBody Map<String, Object> params) {
|
||||
MapProxy proxy = MapUtil.createProxy(params);
|
||||
Integer shopId = proxy.getInt("shopId");
|
||||
String[] phoneNos = Convert.toStrArray(proxy.get("phoneNos"));
|
||||
Map<String, Object> data = tbShopTableBookingService.summary(shopId, phoneNos);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package cn.ysk.cashier.controller.credit;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyer;
|
||||
import cn.ysk.cashier.mybatis.service.TbCreditBuyerService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 挂账人
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/credit/buyer")
|
||||
@Tag(name = "挂账人")
|
||||
public class TbCreditBuyerController {
|
||||
|
||||
@Resource
|
||||
private TbCreditBuyerService tbCreditBuyerService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
public ResponseEntity page(@RequestParam Map<String, Object> params){
|
||||
Map<String, Object> page = tbCreditBuyerService.page(params);
|
||||
return ResponseEntity.ok().body(page);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("信息")
|
||||
public ResponseEntity get(@PathVariable("id") String id){
|
||||
TbCreditBuyer data = tbCreditBuyerService.getById(id);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("保存")
|
||||
public ResponseEntity save(@RequestBody TbCreditBuyer entity){
|
||||
boolean ret = tbCreditBuyerService.save(entity);
|
||||
return ResponseEntity.ok().body(ret);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
public ResponseEntity update(@RequestBody TbCreditBuyer dto){
|
||||
boolean ret = tbCreditBuyerService.update(dto);
|
||||
return ResponseEntity.ok().body(ret);
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
@ApiOperation("删除")
|
||||
public ResponseEntity delete(@PathVariable("id") String id){
|
||||
tbCreditBuyerService.delete(id);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping("repayment")
|
||||
@ApiOperation("还款")
|
||||
public ResponseEntity repayment(@RequestBody Map<String, Object> params) {
|
||||
Map<String, Object> data = tbCreditBuyerService.repayment(params);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package cn.ysk.cashier.controller.credit;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditPaymentRecord;
|
||||
import cn.ysk.cashier.mybatis.service.TbCreditBuyerOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 挂账账单
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/credit/buyer-order")
|
||||
@Api(tags = "挂账账单")
|
||||
public class TbCreditBuyerOrderController {
|
||||
|
||||
@Resource
|
||||
private TbCreditBuyerOrderService tbCreditBuyerOrderService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
public ResponseEntity page(@RequestParam Map<String, Object> params) {
|
||||
Map<String, Object> page = tbCreditBuyerOrderService.page(params);
|
||||
return ResponseEntity.ok().body(page);
|
||||
}
|
||||
|
||||
@PostMapping("pay")
|
||||
@ApiOperation("付款")
|
||||
public ResponseEntity pay(@RequestBody TbCreditPaymentRecord record) {
|
||||
tbCreditBuyerOrderService.pay(record);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@GetMapping("summary")
|
||||
@ApiOperation("统计")
|
||||
public ResponseEntity summary(@RequestParam Map<String, Object> params) {
|
||||
Map<String, Object> data = tbCreditBuyerOrderService.summary(params);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package cn.ysk.cashier.controller.credit;
|
||||
|
||||
import cn.ysk.cashier.mybatis.service.TbCreditPaymentRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 挂账账单付款记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/credit/payment-record")
|
||||
@Api(tags = "挂账账单付款记录")
|
||||
public class TbCreditPaymentRecordController {
|
||||
|
||||
@Resource
|
||||
private TbCreditPaymentRecordService tbCreditPaymentRecordService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
public ResponseEntity page(@RequestParam Map<String, Object> params){
|
||||
Map<String, Object> page = tbCreditPaymentRecordService.page(params);
|
||||
return ResponseEntity.ok().body(page);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package cn.ysk.cashier.controller.product;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.Limit;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.dto.shoptable.*;
|
||||
@@ -19,7 +18,6 @@ import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.service.shop.TbShopTableService;
|
||||
import cn.ysk.cashier.utils.RabbitMsgUtils;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import cn.ysk.cashier.utils.Utils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -78,16 +76,6 @@ public class TbPlaceController {
|
||||
return ResponseEntity.ok(tbShopTableService.addCartForUser(addCartDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/temporaryDishes")
|
||||
public ResponseEntity<TbCashierCart> addTemporaryDishes(@Valid @RequestBody AddTemporaryDishesDTO temporaryDishesDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.addTemporaryDishes(temporaryDishesDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/updatePrice")
|
||||
public ResponseEntity<TbCashierCart> updatePrice(@Valid @RequestBody UpdatePriceDTO updatePriceDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.updatePrice(updatePriceDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/choseModel")
|
||||
@ApiOperation("代客下单/shop/table")
|
||||
public ResponseEntity<?> choseModel(@Valid @RequestBody ChoseModelDTO choseModelDTO) {
|
||||
@@ -117,7 +105,8 @@ public class TbPlaceController {
|
||||
@PutMapping("/returnCart")
|
||||
@ApiOperation("代客下单 清空购物车 /shop/table")
|
||||
public ResponseEntity<Object> returnOrder(@Validated @RequestBody ReturnCartDTO ReturnCartDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.returnCart(ReturnCartDTO));
|
||||
tbShopTableService.returnCart(ReturnCartDTO);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping("/clearCart")
|
||||
@@ -157,9 +146,8 @@ public class TbPlaceController {
|
||||
|
||||
@PostMapping("/order")
|
||||
@ApiOperation("代客下单 查询购物车 /shop/table")
|
||||
public ResponseEntity<Object> createOrder(HttpServletRequest request, @RequestBody CreateOrderDTO createOrderDTO) {
|
||||
Utils.checkLimit(tokenProvider.getToken(request), 1, 400);
|
||||
return ResponseEntity.ok(tbShopTableService.createOrder(createOrderDTO, false, true));
|
||||
public ResponseEntity<Object> createOrder(@RequestBody CreateOrderDTO createOrderDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.createOrder(createOrderDTO, false));
|
||||
}
|
||||
|
||||
@PostMapping("/pending")
|
||||
@@ -208,11 +196,6 @@ public class TbPlaceController {
|
||||
return ResponseEntity.ok(tbShopTableService.pay(payDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/waitCall")
|
||||
public ResponseEntity<?> waitCall(@Valid @RequestBody WaitCallDTO waitCallDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.waitCall(waitCallDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/returnOrder")
|
||||
public ResponseEntity<?> returnOrder(@RequestBody ReturnOrderDTO returnOrderDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.returnOrder(returnOrderDTO));
|
||||
@@ -238,11 +221,6 @@ public class TbPlaceController {
|
||||
return ResponseEntity.ok(tbShopTableService.choseCount(choseCountDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/switch")
|
||||
public ResponseEntity<?> switchTable(@Validated @RequestBody SwitchTableDTO switchTableDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.switchTable(switchTableDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/updateVip")
|
||||
@ApiOperation("代客下单 查询购物车 /shop/table")
|
||||
public ResponseEntity<Object> updateVip(@Validated @RequestBody UpdateVipDTO updateVipDTO) {
|
||||
@@ -262,14 +240,6 @@ public class TbPlaceController {
|
||||
return ResponseEntity.ok(tbShopTableService.printDishes(baseTableDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 美团核销
|
||||
*/
|
||||
@PostMapping("checkCoupon")
|
||||
public ResponseEntity<Object> checkCoupon(@Validated @RequestBody ThirdCouponCheckDTO checkDTO) {
|
||||
return ResponseEntity.ok(tbShopTableService.checkCoupon(checkDTO));
|
||||
}
|
||||
|
||||
@AnonymousAccess
|
||||
@GetMapping("/test")
|
||||
public void test(
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
package cn.ysk.cashier.controller.shop;
|
||||
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.BindingDto;
|
||||
import cn.ysk.cashier.service.BindService;
|
||||
import cn.ysk.cashier.service.shop.TbShopInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/invoice")
|
||||
public class ShopInvoiceController {
|
||||
|
||||
@Resource
|
||||
private TbShopInfoService shopInfoService;
|
||||
@Resource
|
||||
private BindService bindService;
|
||||
|
||||
@PostMapping("binding")
|
||||
@ApiOperation("绑定开票信息")
|
||||
public ResponseEntity<Object> binding(@Validated @RequestBody BindingDto bindingDto){
|
||||
return new ResponseEntity<>(shopInfoService.binding(bindingDto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("subInvoicing")
|
||||
@ApiOperation("提交开票")
|
||||
public ResponseEntity<Object> subInvoicing(@RequestBody Map<String, Object> params){
|
||||
return new ResponseEntity<>(bindService.subInvoicing(params), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("industry")
|
||||
@ApiOperation("获取项目分类")
|
||||
@AnonymousPostMapping("industry")
|
||||
public ResponseEntity<Object> industry(@RequestBody BindingDto bindingDto){
|
||||
return new ResponseEntity<>(bindService.industry(bindingDto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("digitalInvoice")
|
||||
@ApiOperation("数电发票类型")
|
||||
@AnonymousPostMapping("digitalInvoice")
|
||||
public ResponseEntity<Object> digitalInvoice(){
|
||||
return new ResponseEntity<>(bindService.digitalInvoice(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("storeSe")
|
||||
@ApiOperation("计算税额")
|
||||
@AnonymousPostMapping("storeSe")
|
||||
public ResponseEntity<Object> storeSe(@RequestBody Map<String, Object> params){
|
||||
return new ResponseEntity<>(bindService.storeSe(params), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,22 +1,17 @@
|
||||
package cn.ysk.cashier.controller.shop;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.config.security.service.OnlineUserService;
|
||||
import cn.ysk.cashier.dto.BindingDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.service.shop.TbShopInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -24,7 +19,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -42,38 +36,14 @@ public class TbShopInfoController {
|
||||
private final TbShopInfoService tbShopInfoService;
|
||||
private final OnlineUserService onlineUserService;
|
||||
private final TokenProvider tokenProvider;
|
||||
private final SecurityProperties properties;
|
||||
|
||||
@PostMapping("changChildShop")
|
||||
@ApiOperation("切换子店铺")
|
||||
public ResponseEntity<Object> changChildShop(@RequestBody TbShopInfoQueryCriteria criteria, HttpServletRequest request) {
|
||||
TbShopInfoDto shopInfo = tbShopInfoService.findById(criteria.getId());
|
||||
if (shopInfo != null) {
|
||||
//生成token
|
||||
String token = tokenProvider.createToken(shopInfo.getAccount(), criteria.getId().toString());
|
||||
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
|
||||
put("token", properties.getTokenStartWith() + token);
|
||||
if (shopInfo != null) {
|
||||
put("shopId", shopInfo.getId());
|
||||
put("mainId", StringUtils.isNotBlank(shopInfo.getMainId())?shopInfo.getId():shopInfo.getMainId());
|
||||
put("loginType", "merchant");
|
||||
put("shopName", shopInfo.getShopName());
|
||||
put("logo", shopInfo.getLogo());
|
||||
}
|
||||
}};
|
||||
// 保存在线信息
|
||||
onlineUserService.save(shopInfo.getAccount(), shopInfo.getShopName(), token, request, shopInfo.getId());
|
||||
return ResponseEntity.ok(authInfo);
|
||||
} else {
|
||||
throw new BadRequestException("店铺信息不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("queryChildShop")
|
||||
@ApiOperation("查询子店铺")
|
||||
public ResponseEntity<Object> queryChildShop(TbShopInfoQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbShopInfoService.queryChildShop(criteria),HttpStatus.OK);
|
||||
}
|
||||
// @Log("导出数据")
|
||||
// @ApiOperation("导出数据")
|
||||
// @GetMapping(value = "/download")
|
||||
// @PreAuthorize("@el.check('tbShopInfo:list')")
|
||||
// public void exportTbShopInfo(HttpServletResponse response, TbShopInfoQueryCriteria criteria) throws IOException {
|
||||
// tbShopInfoService.download(tbShopInfoService.queryAll(criteria), response);
|
||||
// }
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询/shop/list")
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package cn.ysk.cashier.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BindingDto {
|
||||
private Integer shopId;
|
||||
private String account;
|
||||
|
||||
// 项目分类
|
||||
private String article;
|
||||
|
||||
// 数电发票类型
|
||||
private String sdType;
|
||||
|
||||
// 税率
|
||||
private String taxAmount;
|
||||
|
||||
private Integer page = 1;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package cn.ysk.cashier.dto;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord;
|
||||
import cn.ysk.cashier.vo.OrderInfoUserCouponVo;
|
||||
import cn.ysk.cashier.vo.TbUserCouponVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderInfoCouponInfoDTO {
|
||||
private List<TbActivateOutRecord> outRecordList;
|
||||
private Collection<OrderInfoUserCouponVo> fullReductionCoupon;
|
||||
private Collection<OrderInfoUserCouponVo> productCoupon;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package cn.ysk.cashier.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 店铺信息同步记录表(TbShopSyncInfo)表查询类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-25 16:46:12
|
||||
*/
|
||||
@Data
|
||||
public class TbShopSyncInfoQueryCriteria {
|
||||
|
||||
//目的shop
|
||||
private Integer pointShopId;
|
||||
//1-正在 2-完成
|
||||
private Integer status;
|
||||
|
||||
private long page = 1;
|
||||
private long size = 10;
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package cn.ysk.cashier.dto.booking;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopTable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 店铺台桌及预订信息
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2024-11-22 11:24
|
||||
*/
|
||||
@Data
|
||||
public class ShopTableBookingDTO extends TbShopTable {
|
||||
private TbShopTableBooking bookingInfo;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package cn.ysk.cashier.dto.credit;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 挂账账单
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Data
|
||||
public class CreditBuyerOrderDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 挂账人编码
|
||||
*/
|
||||
private String creditBuyerId;
|
||||
/**
|
||||
* 应付金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
/**
|
||||
* 已付金额
|
||||
*/
|
||||
private BigDecimal paidAmount;
|
||||
/**
|
||||
* 未付金额
|
||||
*/
|
||||
private BigDecimal unpaidAmount;
|
||||
/**
|
||||
* 状态 unpaid-未付款 partial-部分支付 paid-已付款
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 最近一次付款时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date lastPaymentTime;
|
||||
/**
|
||||
* 最近一次付款方式
|
||||
*/
|
||||
private String lastPaymentMethod;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -12,8 +12,6 @@ public class OrderPriceDTO {
|
||||
private BigDecimal originAmount = BigDecimal.ZERO;
|
||||
private BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
private BigDecimal packAmount = BigDecimal.ZERO;
|
||||
// 打折折扣金额
|
||||
private BigDecimal discountAmount = BigDecimal.ZERO;
|
||||
private boolean hasNewInfo = false;
|
||||
private List<TbOrderDetail> newOrderDetailList = new ArrayList<>();
|
||||
private List<TbOrderDetail> removeOrderDetailList = new ArrayList<>();
|
||||
|
||||
@@ -37,7 +37,6 @@ public class TbShopInfoDto implements Serializable {
|
||||
|
||||
/** 自增id */
|
||||
private Integer id;
|
||||
private String mainId;
|
||||
|
||||
/** 店铺帐号 */
|
||||
@NotBlank(message = "店铺账号不能为空")
|
||||
@@ -102,8 +101,6 @@ public class TbShopInfoDto implements Serializable {
|
||||
/** 未用 */
|
||||
private String mchId;
|
||||
|
||||
private Integer tubeType;
|
||||
|
||||
private String registerType;
|
||||
|
||||
/** 是否独立的微信小程序 */
|
||||
@@ -115,7 +112,7 @@ public class TbShopInfoDto implements Serializable {
|
||||
/** 类似于这种规则51.51.570 */
|
||||
private String city;
|
||||
|
||||
/** 店铺类型 单店--only 连锁店--chain--加盟店join*/
|
||||
/** 店铺类型 超市--MARKET---其它店SHOP */
|
||||
private String type;
|
||||
|
||||
/** 行业 */
|
||||
|
||||
@@ -17,7 +17,6 @@ package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -36,12 +35,9 @@ public class TbShopInfoQueryCriteria{
|
||||
private String account;
|
||||
|
||||
/** 精确 */
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
@Query(type = Query.Type.LEFT_LIKE)
|
||||
private String shopName;
|
||||
|
||||
@Query
|
||||
private String type;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String phone;
|
||||
@@ -75,16 +71,4 @@ public class TbShopInfoQueryCriteria{
|
||||
private Integer size;
|
||||
|
||||
private String sort;
|
||||
|
||||
public void setType(String type) {
|
||||
if(StringUtils.isNotBlank(type)){
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
public void setShopName(String shopName) {
|
||||
if(StringUtils.isNotBlank(shopName)){
|
||||
this.shopName = shopName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
import cn.ysk.cashier.enums.TableStateEnum;
|
||||
import lombok.Data;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -42,32 +43,8 @@ public class TbShopTableQueryCriteria{
|
||||
|
||||
@Query
|
||||
private Long qrcode;
|
||||
|
||||
/**
|
||||
* 是否接受网络预订
|
||||
*/
|
||||
@Query
|
||||
private Integer isPredate;
|
||||
private String state;
|
||||
|
||||
private Integer page = 1;
|
||||
private Integer size = 99999;
|
||||
|
||||
/**
|
||||
* 预约日期 yyyy-MM-dd
|
||||
*/
|
||||
private String bookingDate;
|
||||
/**
|
||||
* 预约类型 lunch-午餐 dinner-晚餐
|
||||
*/
|
||||
private String bookingType;
|
||||
|
||||
public Integer getIsPredate() {
|
||||
return isPredate;
|
||||
}
|
||||
|
||||
public void setIsPredate(Integer isPredate) {
|
||||
this.isPredate = isPredate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class AddCartDTO {
|
||||
@@ -18,16 +19,13 @@ public class AddCartDTO {
|
||||
private Integer shopId;
|
||||
private String tableId;
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01", message = "数量最小为0.01")
|
||||
private BigDecimal num;
|
||||
@Min(1)
|
||||
private Integer num;
|
||||
private boolean isPack;
|
||||
private boolean isGift;
|
||||
private Integer cartId;
|
||||
private String note;
|
||||
|
||||
// 套餐商品选择的id信息
|
||||
private List<Integer> groupProductIdList;
|
||||
|
||||
// 用餐类型
|
||||
@NotBlank
|
||||
private String useType;
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class AddTemporaryDishesDTO {
|
||||
@NotEmpty
|
||||
private String masterId;
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private String tableId;
|
||||
@NotBlank(message = "菜品名不为空")
|
||||
private String name;
|
||||
@NotNull(message = "分类不为空")
|
||||
private Integer categoryId;
|
||||
@Min(value = 0, message = "价格最低为0")
|
||||
private BigDecimal price;
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01")
|
||||
private BigDecimal num;
|
||||
@NotBlank(message = "单位不为空")
|
||||
private String unit;
|
||||
private String note;
|
||||
// 用餐类型
|
||||
@NotBlank
|
||||
private String useType;
|
||||
private Integer vipUserId;
|
||||
}
|
||||
@@ -29,6 +29,5 @@ public class CreateOrderDTO {
|
||||
private List<UserCouponInfoDTO> userCouponInfos = new ArrayList<>();
|
||||
// 使用的积分抵扣数量
|
||||
private Integer pointsNum;
|
||||
private Integer isWaitCall;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ import cn.ysk.cashier.dto.order.UserCouponInfoDTO;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,12 +19,11 @@ public class PayDTO {
|
||||
private Integer orderId;
|
||||
@NotEmpty
|
||||
private String payType;
|
||||
@DecimalMin("0")
|
||||
@DecimalMax("1")
|
||||
private BigDecimal discount;
|
||||
@Min(0)
|
||||
@Max(1)
|
||||
private Double discount;
|
||||
private Integer vipUserId;
|
||||
private String code;
|
||||
private Integer num;
|
||||
private String token;
|
||||
// 使用的优惠券
|
||||
@Valid
|
||||
@@ -31,6 +32,5 @@ public class PayDTO {
|
||||
private Integer pointsNum;
|
||||
private Integer staffId;
|
||||
private String loginName;
|
||||
private String creditBuyerId;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,8 @@ package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ReturnCartDTO {
|
||||
@@ -15,7 +13,7 @@ public class ReturnCartDTO {
|
||||
private Integer shopId;
|
||||
private Long tableId;
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01", message = "最小数量为0.01")
|
||||
private BigDecimal num;
|
||||
@Min(value = 1, message = "最小数量为1")
|
||||
private Integer num;
|
||||
private String note;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -18,7 +17,7 @@ public class ReturnOrderDTO {
|
||||
private Integer id;
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private BigDecimal num;
|
||||
private Integer num;
|
||||
}
|
||||
@NotNull
|
||||
private Integer orderId;
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SwitchTableDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotEmpty(message = "取餐码不为空")
|
||||
private String masterId;
|
||||
@NotBlank
|
||||
private String useType;
|
||||
private Integer orderId;
|
||||
private List<Integer> cartIds;
|
||||
private boolean isFull;
|
||||
@NotEmpty(message = "当前台桌id不为空")
|
||||
private String currentTableId;
|
||||
@NotEmpty(message = "目标台桌id不为空")
|
||||
private String targetTableId;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ThirdCouponCheckDTO {
|
||||
private String type = "meituan";
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotBlank
|
||||
private String code;
|
||||
@Min(1)
|
||||
private Integer num;
|
||||
@NotNull
|
||||
private Integer orderId;
|
||||
// 核销的对应商品
|
||||
@NotEmpty
|
||||
private List<Integer> cartId;
|
||||
}
|
||||
@@ -2,33 +2,25 @@ package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UpdateCartDTO {
|
||||
@NotNull
|
||||
private Integer cartId;
|
||||
@NotNull
|
||||
private Integer skuId;
|
||||
@NotNull
|
||||
private Integer productId;
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
@DecimalMin("0")
|
||||
private BigDecimal num;
|
||||
@Min(0)
|
||||
private Integer num;
|
||||
private String note;
|
||||
private Boolean isPack;
|
||||
private Boolean isGift;
|
||||
// 是否打印
|
||||
private Boolean isPrint;
|
||||
// 是否等叫
|
||||
private Integer isWaitCall;
|
||||
|
||||
// 套餐商品选择的id信息
|
||||
private List<Integer> groupProductIdList;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class UpdatePriceDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
private Integer cartId;
|
||||
@DecimalMin(value = "0.01", message = "改价不能低于0.01元")
|
||||
@NotNull
|
||||
private BigDecimal saleAmount;
|
||||
@NotBlank(message = "折扣原因不能为空")
|
||||
private String note;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class WaitCallDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
private Integer isWaitCall;
|
||||
private Integer orderId;
|
||||
@NotBlank
|
||||
private String masterId;
|
||||
@NotBlank
|
||||
private String useType;
|
||||
private String tableId;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package cn.ysk.cashier.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class BaseQueryDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package cn.ysk.cashier.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class CheckCouponDTO extends BaseQueryDTO {
|
||||
@NotBlank
|
||||
private String couponCode;
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private Integer num;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package cn.ysk.cashier.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class GetActivateCouponDTO extends BaseQueryDTO{
|
||||
@NotBlank
|
||||
private String code;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package cn.ysk.cashier.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class RevokeCouponDTO extends BaseQueryDTO{
|
||||
@NotBlank
|
||||
private String couponCode;
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package cn.ysk.cashier.enums;
|
||||
|
||||
public enum TableStateEnum {
|
||||
IDLE("idle"),
|
||||
SUBSCRIBE("subscribe"),
|
||||
CLOSED("closed"), PAYING("paying"), PENDING("pending"), USING("using"), CLEANING("cleaning");
|
||||
private String state = "closed";
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 挂账人
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("tb_credit_buyer")
|
||||
public class TbCreditBuyer {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 挂账编码
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 状态 1-启用 0-停用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 挂账人
|
||||
*/
|
||||
private String debtor;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 职务
|
||||
*/
|
||||
private String position;
|
||||
/**
|
||||
* 挂账额度
|
||||
*/
|
||||
private BigDecimal creditAmount;
|
||||
/**
|
||||
* 账户余额
|
||||
*/
|
||||
private BigDecimal accountBalance;
|
||||
/**
|
||||
* 还款方式 total-按总金额还款 order-按订单还款
|
||||
*/
|
||||
private String repaymentMethod;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private String paymentMethod;
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
private String responsiblePerson;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标志 0-正常 1-删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
/**
|
||||
* 已挂账金额
|
||||
*/
|
||||
@TableField(value = "(select ifnull(sum(unpaid_amount),0) from view_credit_buyer_order where credit_buyer_id = tb_credit_buyer.id)", select = false, insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
|
||||
private BigDecimal owedAmount;
|
||||
|
||||
/**
|
||||
* 剩余挂账额度
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal remainingAmount;
|
||||
|
||||
/**
|
||||
* 累计挂账金额
|
||||
*/
|
||||
@TableField(value = "(select ifnull(sum(pay_amount),0) from view_credit_buyer_order where credit_buyer_id = tb_credit_buyer.id)", select = false, insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
|
||||
private BigDecimal accumulateAmount;
|
||||
|
||||
/**
|
||||
* 适用门店
|
||||
*/
|
||||
@TableField(value = "(select shop_name from tb_shop_info where id = tb_credit_buyer.shop_id)", select = false, insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
|
||||
private String shopName;
|
||||
|
||||
/**
|
||||
* 剩余挂账额度
|
||||
*/
|
||||
public BigDecimal getRemainingAmount() {
|
||||
return NumberUtil.sub(creditAmount, NumberUtil.null2Zero(owedAmount));
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 挂账账单
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("tb_credit_buyer_order")
|
||||
public class TbCreditBuyerOrder {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 挂账人编码
|
||||
*/
|
||||
private String creditBuyerId;
|
||||
/**
|
||||
* 已付金额
|
||||
*/
|
||||
private BigDecimal paidAmount;
|
||||
/**
|
||||
* 状态 unpaid-未付款 partial-部分支付 paid-已付款
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 最近一次付款时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date lastPaymentTime;
|
||||
/**
|
||||
* 最近一次付款方式
|
||||
*/
|
||||
private String lastPaymentMethod;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "remark", updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String remark;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 挂账账单付款记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("tb_credit_payment_record")
|
||||
public class TbCreditPaymentRecord {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 挂账人编码
|
||||
*/
|
||||
private String creditBuyerId;
|
||||
/**
|
||||
* 还款金额
|
||||
*/
|
||||
private BigDecimal repaymentAmount;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private String paymentMethod;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 还款时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date paymentTime;
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 店铺信息同步记录表(TbShopSyncInfo)表实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-25 16:46:12
|
||||
*/
|
||||
@Data
|
||||
@SuppressWarnings("serial")
|
||||
public class TbShopSyncInfo extends Model<TbShopSyncInfo> {
|
||||
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//源shop
|
||||
private Integer sourceShopId;
|
||||
//目的shop
|
||||
private Integer pointShopId;
|
||||
//分组同步数量
|
||||
private Integer proGroup;
|
||||
//规格同步数量
|
||||
private Integer proSpec;
|
||||
//单位同步数量
|
||||
private Integer proUnit;
|
||||
//分类同步数量
|
||||
private Integer proCategory;
|
||||
//商品同步数量
|
||||
private Integer product;
|
||||
//规格同步数量
|
||||
private Integer proSku;
|
||||
//商品同步数量
|
||||
private Integer proSkuResult;
|
||||
//耗材类型同步数量
|
||||
private Integer consType;
|
||||
//耗材信息同步数量
|
||||
private Integer consInfo;
|
||||
//商品耗材关联同步数量
|
||||
private Integer consPro;
|
||||
//1-正在 2-完成
|
||||
private Integer status;
|
||||
//同步时间
|
||||
private Date syncTime;
|
||||
}
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 店铺台桌预订
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("tb_shop_table_booking")
|
||||
public class TbShopTableBooking {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺桌台id
|
||||
*/
|
||||
private Integer shopTableId;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 预约日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JSONField(format = "yyyy-MM-dd")
|
||||
private Date bookingDate;
|
||||
/**
|
||||
* 预约类型 lunch-午餐 dinner-晚餐
|
||||
*/
|
||||
private String bookingType;
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Integer dinerNum;
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
private String phoneNumber;
|
||||
/**
|
||||
* 订餐人
|
||||
*/
|
||||
private String bookingPerson;
|
||||
/**
|
||||
* 性别/称呼 1-先生 2-女士
|
||||
*/
|
||||
private Integer gender;
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private Date bookingTime;
|
||||
/**
|
||||
* 用餐类型 普通用餐/宴会套餐/自助餐/...,由前端定义或者输入文本
|
||||
*/
|
||||
private String diningType;
|
||||
/**
|
||||
* 重点关注 1-是 0-否
|
||||
*/
|
||||
private Integer focus;
|
||||
/**
|
||||
* 接收营销短信 1-是 0-否
|
||||
*/
|
||||
private Integer receiveMarketingSms;
|
||||
/**
|
||||
* 摆台桌数
|
||||
*/
|
||||
private Integer bookingTableNum;
|
||||
/**
|
||||
* 餐标(单价)
|
||||
*/
|
||||
private BigDecimal diningStandardPrice;
|
||||
/**
|
||||
* 餐标(单位) table-元/桌 person-元/人
|
||||
*/
|
||||
private String diningStandardUnit;
|
||||
/**
|
||||
* 预订状态 -1-已取消 10-已到店 20-待到店 999-已超时
|
||||
* 注:此处定义为数字是为了方便按状态排序
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 留座时间
|
||||
*/
|
||||
private Integer timeoutMinute;
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private String createUserName;
|
||||
/**
|
||||
* 到店时间
|
||||
*/
|
||||
@TableField(value = "arrived_time", updateStrategy = FieldStrategy.ALWAYS)
|
||||
private Date arrivedTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标志 1-是 0-否
|
||||
*/
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_third_party_coupon_record")
|
||||
public class TbThirdPartyCouponRecord {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "order_id")
|
||||
private Integer orderId;
|
||||
|
||||
@Column(name = "state")
|
||||
private Byte state;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "plat")
|
||||
private String plat;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "code", length = 50)
|
||||
private String code;
|
||||
|
||||
private Integer num;
|
||||
|
||||
@Column(name = "create_time")
|
||||
private Instant createTime;
|
||||
|
||||
@Column(name = "check_time")
|
||||
private Instant checkTime;
|
||||
|
||||
@Column(name = "shop_id")
|
||||
private Integer shopId;
|
||||
private String cartIdList;
|
||||
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface TbCashierCartMapper extends BaseMapper<TbCashierCart> {
|
||||
@@ -48,8 +47,5 @@ public interface TbCashierCartMapper extends BaseMapper<TbCashierCart> {
|
||||
*/
|
||||
@Update("update tb_cashier_cart set status=#{status}, total_amount=(number+#{changeNum})*sale_price,number=number+#{changeNum},total_number=total_number+#{changeNum} " +
|
||||
"where id=#{id}")
|
||||
int updateNumAmountStatus(Integer id, String status, BigDecimal changeNum);
|
||||
|
||||
@Select("select a.* from tb_cashier_cart as a left join tb_order_detail as b on a.id=b.cart_id where a.shop_id=#{shopId} and a.status=#{state} and a.created_at>#{time} and b.id is not null;")
|
||||
List<TbCashierCart> selectPlaceCart(Integer shopId, long time, String state);
|
||||
int updateNumAmountStatus(Integer id, String status, Integer changeNum);
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyer;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 挂账人
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbCreditBuyerMapper extends BaseMapper<TbCreditBuyer> {
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.dto.credit.CreditBuyerOrderDTO;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyerOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账账单
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbCreditBuyerOrderMapper extends BaseMapper<TbCreditBuyerOrder> {
|
||||
|
||||
List<CreditBuyerOrderDTO> getList(Map<String, Object> params);
|
||||
|
||||
long getCount(Map<String, Object> params);
|
||||
|
||||
BigDecimal getSumPayAmount(Map<String, Object> params);
|
||||
|
||||
BigDecimal getSumPaidAmount(Map<String, Object> params);
|
||||
|
||||
BigDecimal getSumUnpaidAmount(Map<String, Object> params);
|
||||
|
||||
CreditBuyerOrderDTO getOne(Map<String, Object> params);
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditPaymentRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 挂账账单付款记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbCreditPaymentRecordMapper extends BaseMapper<TbCreditPaymentRecord> {
|
||||
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface TbOrderDetailMapper extends BaseMapper<TbOrderDetail> {
|
||||
@@ -20,7 +19,7 @@ public interface TbOrderDetailMapper extends BaseMapper<TbOrderDetail> {
|
||||
*/
|
||||
@Update("update tb_order_detail set status=#{status}, price_amount=(num+#{changeNum})*price,num=num+#{changeNum} " +
|
||||
"where id=#{id}")
|
||||
int updateNumAmountStatus(Integer id, String status, BigDecimal changeNum);
|
||||
int updateNumAmountStatus(Integer id, String status, int changeNum);
|
||||
|
||||
/**
|
||||
* 查询包含打包费和是否赠送的订单详情信息
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface TbOrderInfoMapper extends BaseMapper<TbOrderInfo> {
|
||||
List<TbOrderSaleVO> selectAllSaleInfo(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime, @Param("productSkuIds") List<Integer> productSkuIds, @Param("shopId") Integer shopId);
|
||||
|
||||
@Update("update tb_order_info set settlement_amount=settlement_amount-#{priceAmount}, pack_fee=pack_fee-#{packAmount}," +
|
||||
"order_amount=order_amount-#{priceAmount}, amount=amount-#{priceAmount}, origin_amount=origin_amount-#{priceAmount}" +
|
||||
"order_amount=order_amount-#{priceAmount}, amount=amount-#{priceAmount}" +
|
||||
" where id=#{orderId} and origin_amount-#{priceAmount} >= 0 and order_amount-#{priceAmount} >= 0")
|
||||
int updateOrderAmount(Integer orderId, BigDecimal priceAmount, BigDecimal packAmount);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
public interface TbProducSkutMapper extends BaseMapper<TbProductSku> {
|
||||
|
||||
@@ -31,5 +29,5 @@ public interface TbProducSkutMapper extends BaseMapper<TbProductSku> {
|
||||
int decrStockUnCheck(String id, int num);
|
||||
|
||||
@Update("update tb_product_sku set real_sales_number=real_sales_number-#{num} WHERE id=#{skuId}")
|
||||
int decrRealSalesNumber(@Param("skuId") Integer skuId, @Param("num") BigDecimal num);
|
||||
int decrRealSalesNumber(@Param("skuId") Integer skuId, @Param("num") Integer num);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface TbProductMapper extends BaseMapper<TbProduct> {
|
||||
|
||||
@Select("select * from tb_product_sku as sku where sku.is_del=0 and sku.is_grounding=1 and sku.is_pause_sale=0 and sku.shop_id=#{shopId} and sku.id=#{skuId}")
|
||||
@@ -19,11 +17,11 @@ public interface TbProductMapper extends BaseMapper<TbProduct> {
|
||||
TbProduct selectByIdAndShopId(@Param("shopId") Integer shopId, @Param("id") Integer id);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number+#{addNum} WHERE id=#{id}")
|
||||
int incrStock(@Param("id") Integer id, @Param("addNum") BigDecimal addNum);
|
||||
int incrStock(@Param("id") Integer id, @Param("addNum") Integer addNum);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{decrNum} WHERE id=#{productId} and stock_number-#{decrNum} >= 0")
|
||||
int decrStock(@Param("productId") Integer productId, @Param("decrNum") BigDecimal decrNum);
|
||||
int decrStock(@Param("productId") Integer productId, @Param("decrNum") int decrNum);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id}")
|
||||
int decrStockUnCheck(Integer id, BigDecimal num);
|
||||
int decrStockUnCheck(Integer id, int num);
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSyncInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 店铺信息同步记录表(TbShopSyncInfo)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-25 16:46:12
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbShopSyncInfoMapper extends BaseMapper<TbShopSyncInfo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺台桌预订
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-21
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbShopTableBookingMapper extends BaseMapper<TbShopTableBooking> {
|
||||
|
||||
List<Map<String, Object>> summaryByPhoneNos(@Param("shopId") Integer shopId, @Param("phoneNoList") List<String> phoneNoList);
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbThirdPartyCouponRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_third_party_coupon_record】的数据库操作Mapper
|
||||
* @createDate 2024-11-25 17:57:03
|
||||
* @Entity cn.ysk.cashier.mybatis.entity.TbThirdPartyCouponRecord
|
||||
*/
|
||||
public interface TbThirdPartyCouponRecordMapper extends BaseMapper<TbThirdPartyCouponRecord> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,8 @@ import cn.ysk.cashier.cons.TableConstant;
|
||||
import cn.ysk.cashier.dto.shoptable.ShopEatTypeInfoDTO;
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -62,24 +60,9 @@ public interface MpCashierCartService extends IService<TbCashierCart> {
|
||||
/**
|
||||
* 根据店就餐模式查询购物车
|
||||
* @param shopEatTypeInfoDTO 就餐模式
|
||||
* @param masterId 取餐码
|
||||
* @param statuses 状态 为空默认查询 create return
|
||||
* @return 购物车信息
|
||||
*/
|
||||
List<TbCashierCart> selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, TableConstant.OrderInfo.Status... statuses);
|
||||
|
||||
|
||||
/**
|
||||
* 根据就餐模式查询购物车信息
|
||||
* @param shopEatTypeInfoDTO 就餐模式
|
||||
* @param masterId 取餐码
|
||||
* @param orderId 订单id
|
||||
* @param onlySearchPc 只查询pc
|
||||
* @param statuses 状态
|
||||
*/
|
||||
List<TbCashierCart> selectByShopEatTypeAndOrderId(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses);
|
||||
Long countByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses);
|
||||
List<TbCashierCart> getByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses);
|
||||
List<TbCashierCart> selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId);
|
||||
|
||||
/**
|
||||
* 根据订单id和状态获取购物车数据
|
||||
@@ -90,31 +73,5 @@ public interface MpCashierCartService extends IService<TbCashierCart> {
|
||||
|
||||
|
||||
boolean updateMemberAndAmountByOrderId(Integer orderId, boolean isMember);
|
||||
|
||||
/**
|
||||
* 根据就餐信息查询购物车信息
|
||||
* @param shopEatTypeInfoDTO 就餐信息
|
||||
* @return 购物车信息
|
||||
*/
|
||||
TbCashierCart selectOneCartByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer productId, Integer skuId, boolean isGift, boolean isTemp);
|
||||
|
||||
/**
|
||||
* 根据店铺id和购物车id查询信息
|
||||
* @param shopId 店铺id
|
||||
* @param cartId 购物车id
|
||||
* @param statuses 状态
|
||||
*/
|
||||
TbCashierCart selectByShopIdAndId(Integer shopId, Integer cartId, TableConstant.OrderInfo.Status... statuses);
|
||||
|
||||
/**
|
||||
* 根据id查询购物车数据
|
||||
* @param shopId 店铺id
|
||||
* @param orderId 订单id
|
||||
* @param ids 购物车id
|
||||
* @param statuses 状态
|
||||
*/
|
||||
List<TbCashierCart> selectByIds(Integer shopId, Integer orderId, List<Integer> ids, TableConstant.OrderInfo.Status... statuses);
|
||||
|
||||
boolean updateFieldValByIds(Integer shopId, ArrayList<Integer> cartIds, SFunction<TbCashierCart, ?> column, Object val);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,10 @@ import cn.ysk.cashier.dto.shoptable.ReturnOrderDTO;
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.pojo.order.TbFullOrderDetail;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* (TbShopPermission)表服务接口
|
||||
@@ -49,7 +46,7 @@ public interface MpOrderDetailService extends IService<TbOrderDetail> {
|
||||
/**
|
||||
* 根据订单id和状态获取订单详情
|
||||
*/
|
||||
List<TbOrderDetail> selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status... states);
|
||||
List<TbOrderDetail> selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status state);
|
||||
|
||||
/**
|
||||
* 根据购物车id和订单id查询订单详情
|
||||
@@ -66,33 +63,5 @@ public interface MpOrderDetailService extends IService<TbOrderDetail> {
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
boolean updateStatusByOrderId(TableConstant.OrderInfo.Status status, Integer orderId);
|
||||
|
||||
/**
|
||||
* 根据购物车id修改detail价格
|
||||
* @param cartId 购物车id
|
||||
* @param totalAmount 总价格
|
||||
*/
|
||||
boolean updatePriceByCartId(Integer cartId, BigDecimal saleAmount, BigDecimal totalAmount);
|
||||
|
||||
/**
|
||||
* 根据会员id修改detail信息
|
||||
* @param orderId 订单id
|
||||
* @param isMember 会员id
|
||||
*/
|
||||
boolean updateMemberByOrderId(Integer orderId, boolean isMember);
|
||||
|
||||
boolean updateFieldByCartId(SFunction<TbOrderDetail, ?> field, Object val, List<Integer> cartIds);
|
||||
|
||||
/**
|
||||
* 根据购物车更改订单台桌信息
|
||||
* @param shopId 店铺id
|
||||
* @param targetTableId 新的台桌id
|
||||
* @param masterId 取餐码
|
||||
* @param cartIds 购物车id
|
||||
* @return
|
||||
*/
|
||||
boolean updateTableInfoByCartIds(Integer shopId, String targetTableId, String masterId, List<Integer> cartIds);
|
||||
|
||||
boolean removeByCartIds(ArrayList<Integer> cartIds);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,8 @@ import cn.ysk.cashier.cons.TableConstant;
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -42,11 +40,5 @@ public interface MpOrderInfoService extends IService<TbOrderInfo> {
|
||||
*/
|
||||
TbOrderInfo selectOrderByIdAndState(Integer orderId, TableConstant.OrderInfo.Status status);
|
||||
|
||||
boolean incrAmount(Integer orderId, BigDecimal subtract);
|
||||
|
||||
|
||||
boolean updateFieldVal(Integer shopId, Integer orderId, SFunction<TbOrderInfo, ?> column, Object val);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyerOrder;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditPaymentRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账账单
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
public interface TbCreditBuyerOrderService extends IService<TbCreditBuyerOrder> {
|
||||
|
||||
Map<String, Object> page(Map<String, Object> params);
|
||||
Map<String, Object> summary(Map<String, Object> params);
|
||||
|
||||
void pay(TbCreditPaymentRecord record);
|
||||
|
||||
/**
|
||||
* 保存挂账账单
|
||||
* @param creditBuyerId 挂账人id
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
boolean save(String creditBuyerId, Long orderId);
|
||||
|
||||
/**
|
||||
* 挂账人退款(整单退款)
|
||||
* @param creditBuyerId 挂账人id
|
||||
* @param orderId 订单id
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
boolean refund(String creditBuyerId, Long orderId);
|
||||
|
||||
|
||||
/**
|
||||
* 挂账人退款(部分退款)
|
||||
* @param creditBuyerId 挂账人id
|
||||
* @param orderId 订单id
|
||||
* @param refundAmount 退款金额
|
||||
* @return
|
||||
*/
|
||||
boolean partRefund(String creditBuyerId, Long orderId, BigDecimal refundAmount);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyer;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账人
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
public interface TbCreditBuyerService extends IService<TbCreditBuyer> {
|
||||
|
||||
Map<String, Object> page(Map<String, Object> params);
|
||||
|
||||
boolean save(TbCreditBuyer entity);
|
||||
|
||||
boolean update(TbCreditBuyer dto);
|
||||
|
||||
void delete(String id);
|
||||
|
||||
TbCreditBuyer getById(String id);
|
||||
|
||||
Map<String,Object> repayment(Map<String, Object> params);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditPaymentRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账账单付款记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
public interface TbCreditPaymentRecordService extends IService<TbCreditPaymentRecord> {
|
||||
|
||||
Map<String, Object> page(Map<String, Object> params);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSyncInfo;
|
||||
import cn.ysk.cashier.dto.TbShopSyncInfoQueryCriteria;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺信息同步记录表(TbShopSyncInfo)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-25 16:46:12
|
||||
*/
|
||||
public interface TbShopSyncInfoService extends IService<TbShopSyncInfo> {
|
||||
|
||||
TbShopSyncInfo queryByShopId(TbShopSyncInfoQueryCriteria criteria);
|
||||
void sync(TbShopSyncInfo tbShopSyncInfo);
|
||||
void clear(TbShopSyncInfo tbShopSyncInfo);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.dto.booking.ShopTableBookingDTO;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopArea;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺台桌预订
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-21
|
||||
*/
|
||||
public interface TbShopTableBookingService extends IService<TbShopTableBooking> {
|
||||
|
||||
Map<String, Object> page(Map<String, Object> params);
|
||||
|
||||
String booking(TbShopTableBooking entity);
|
||||
|
||||
boolean update(TbShopTableBooking dto);
|
||||
|
||||
void markStatus(Long id, Integer status);
|
||||
|
||||
void delete(Long id);
|
||||
|
||||
/**
|
||||
* 获取待发送的短信内容
|
||||
* @param shopId 店铺id
|
||||
*/
|
||||
String getBookingSms(Integer shopId);
|
||||
|
||||
List<TbShopArea> findShopAreaList(Integer shopId);
|
||||
|
||||
List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> summary(Integer shopId,String[] phoneNos);
|
||||
|
||||
void markSubscribe(Integer shopTableId);
|
||||
void cancelSubscribe(Integer shopTableId);
|
||||
|
||||
void batchTimeout();
|
||||
|
||||
void autoCancel();
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbThirdPartyCouponRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_third_party_coupon_record】的数据库操作Service
|
||||
* @createDate 2024-11-25 17:57:03
|
||||
*/
|
||||
public interface TbThirdPartyCouponRecordService extends IService<TbThirdPartyCouponRecord> {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.cons.TableConstant;
|
||||
@@ -17,16 +16,13 @@ import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopTable;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* (TbShopPermission)表服务实现类
|
||||
@@ -57,7 +53,8 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
|
||||
@Override
|
||||
public List<TbCashierCart> selectUnTableCart(String masterId, Integer shopId) {
|
||||
TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>()
|
||||
.eq(TbShopInfo::getId, shopId));
|
||||
.eq(TbShopInfo::getId, shopId)
|
||||
.eq(TbShopInfo::getStatus, 1));
|
||||
if (shopInfo == null) {
|
||||
throw new BadRequestException("店铺信息不存在");
|
||||
}
|
||||
@@ -111,21 +108,14 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbCashierCart> selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, TableConstant.OrderInfo.Status... statuses) {
|
||||
public List<TbCashierCart> selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
|
||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
||||
.in(TbCashierCart::getStatus, "create", "return")
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
|
||||
|
||||
if (statuses.length == 0) {
|
||||
queryWrapper.in(TbCashierCart::getStatus, "create", "return");
|
||||
} else {
|
||||
queryWrapper.in(TbCashierCart::getStatus, Arrays.stream(statuses)
|
||||
.map(TableConstant.OrderInfo.Status::getValue)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// 非堂食校验台桌状态
|
||||
if (shopEatTypeInfoDTO.isTakeout()) {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
@@ -141,130 +131,6 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbCashierCart> selectByShopEatTypeAndOrderId(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId,
|
||||
Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
|
||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
|
||||
|
||||
if (statuses.length == 0) {
|
||||
queryWrapper.in(TbCashierCart::getStatus, "create", "return");
|
||||
} else {
|
||||
queryWrapper.in(TbCashierCart::getStatus, Arrays.stream(statuses)
|
||||
.map(TableConstant.OrderInfo.Status::getValue)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (orderId != null) {
|
||||
queryWrapper.and(q -> q.eq(TbCashierCart::getOrderId, orderId)
|
||||
.or().isNull(TbCashierCart::getOrderId));
|
||||
}
|
||||
|
||||
if (onlySearchPc) {
|
||||
queryWrapper.ne(TbCashierCart::getPlatformType, "mimiapp");
|
||||
}
|
||||
|
||||
// 非堂食校验台桌状态
|
||||
if (shopEatTypeInfoDTO.isTakeout()) {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
.in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue());
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())) {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, shopEatTypeInfoDTO.getTableId());
|
||||
} else {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""));
|
||||
}
|
||||
|
||||
}
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbCashierCart> getByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
|
||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
|
||||
|
||||
if (statuses.length == 0) {
|
||||
queryWrapper.in(TbCashierCart::getStatus, "create", "return");
|
||||
} else {
|
||||
queryWrapper.in(TbCashierCart::getStatus, Arrays.stream(statuses)
|
||||
.map(TableConstant.OrderInfo.Status::getValue)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (orderId != null) {
|
||||
queryWrapper.and(q -> q.eq(TbCashierCart::getOrderId, orderId)
|
||||
.or().isNull(TbCashierCart::getOrderId));
|
||||
}
|
||||
|
||||
if (onlySearchPc) {
|
||||
queryWrapper.ne(TbCashierCart::getPlatformType, "mimiapp");
|
||||
}
|
||||
|
||||
// 非堂食校验台桌状态
|
||||
if (shopEatTypeInfoDTO.isTakeout()) {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
.in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue());
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())) {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, shopEatTypeInfoDTO.getTableId());
|
||||
} else {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""));
|
||||
}
|
||||
|
||||
}
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId,
|
||||
Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
|
||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
|
||||
|
||||
if (statuses.length == 0) {
|
||||
queryWrapper.in(TbCashierCart::getStatus, "create", "return");
|
||||
} else {
|
||||
queryWrapper.in(TbCashierCart::getStatus, Arrays.stream(statuses)
|
||||
.map(TableConstant.OrderInfo.Status::getValue)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (orderId != null) {
|
||||
queryWrapper.and(q -> q.eq(TbCashierCart::getOrderId, orderId)
|
||||
.or().isNull(TbCashierCart::getOrderId));
|
||||
}
|
||||
|
||||
if (onlySearchPc) {
|
||||
queryWrapper.ne(TbCashierCart::getPlatformType, "mimiapp");
|
||||
}
|
||||
|
||||
// 非堂食校验台桌状态
|
||||
if (shopEatTypeInfoDTO.isTakeout()) {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
.in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue());
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())) {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, shopEatTypeInfoDTO.getTableId());
|
||||
} else {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""));
|
||||
}
|
||||
|
||||
}
|
||||
return count(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TbCashierCart> selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status... status) {
|
||||
LambdaQueryChainWrapper<TbCashierCart> queryChainWrapper = lambdaQuery().eq(TbCashierCart::getOrderId, orderId);
|
||||
@@ -273,71 +139,5 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
|
||||
}
|
||||
return queryChainWrapper.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbCashierCart selectOneCartByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer productId, Integer skuId, boolean isGift, boolean isTemp) {
|
||||
LambdaQueryWrapper<TbCashierCart> query = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.isNull(TbCashierCart::getPlaceNum)
|
||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
||||
.eq(TbCashierCart::getStatus, "create")
|
||||
.eq(TbCashierCart::getIsGift, isGift)
|
||||
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
|
||||
if (isTemp) {
|
||||
query.isNull(TbCashierCart::getProductId).isNull(TbCashierCart::getSkuId).eq(TbCashierCart::getIsTemporary, 1);
|
||||
} else {
|
||||
query.eq(TbCashierCart::getProductId, productId)
|
||||
.eq(TbCashierCart::getSkuId, skuId);
|
||||
}
|
||||
|
||||
// 外带只查询pc和收银机商品
|
||||
if (shopEatTypeInfoDTO.isTakeout()) {
|
||||
query.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
.in(TbCashierCart::getPlatformType, "pc", "cash");
|
||||
} else {
|
||||
query.eq(TbCashierCart::getTableId, shopEatTypeInfoDTO.getTableId());
|
||||
}
|
||||
|
||||
return getOne(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbCashierCart selectByShopIdAndId(Integer shopId, Integer cartId, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.eq(TbCashierCart::getId, cartId);
|
||||
if (statuses.length != 0) {
|
||||
queryWrapper.in(TbCashierCart::getStatus, Arrays.stream(statuses)
|
||||
.map(TableConstant.OrderInfo.Status::getValue)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbCashierCart> selectByIds(Integer shopId, Integer orderId, List<Integer> ids, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.in(TbCashierCart::getId, ids);
|
||||
if (orderId != null) {
|
||||
queryWrapper.eq(TbCashierCart::getOrderId, orderId);
|
||||
}
|
||||
if (statuses.length != 0) {
|
||||
|
||||
queryWrapper.in(TbCashierCart::getStatus, Arrays.stream(statuses)
|
||||
.map(TableConstant.OrderInfo.Status::getValue)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateFieldValByIds(Integer shopId, ArrayList<Integer> cartIds, SFunction<TbCashierCart, ?> column, Object val) {
|
||||
return update(new LambdaUpdateWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.in(TbCashierCart::getId, cartIds)
|
||||
.set(column, val));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.ysk.cashier.cons.TableConstant;
|
||||
import cn.ysk.cashier.dto.shoptable.ReturnOrderDTO;
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper;
|
||||
import cn.ysk.cashier.mybatis.service.MpOrderDetailService;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -50,13 +49,10 @@ public class MpOrderDetailServiceImpl extends ServiceImpl<TbOrderDetailMapper, T
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbOrderDetail> selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbOrderDetail> query = new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getOrderId, orderId);
|
||||
if (statuses.length != 0) {
|
||||
query.in(TbOrderDetail::getStatus, CollUtil.newArrayList(statuses));
|
||||
}
|
||||
return list(query);
|
||||
public List<TbOrderDetail> selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status state) {
|
||||
return list(new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getStatus, state.getValue())
|
||||
.eq(TbOrderDetail::getOrderId, orderId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,41 +68,5 @@ public class MpOrderDetailServiceImpl extends ServiceImpl<TbOrderDetailMapper, T
|
||||
.eq(TbOrderDetail::getOrderId, orderId)
|
||||
.set(TbOrderDetail::getStatus, status.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePriceByCartId(Integer cartId, BigDecimal saleAmount, BigDecimal totalAmount) {
|
||||
return update(new LambdaUpdateWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getCartId, cartId)
|
||||
.set(TbOrderDetail::getPrice, saleAmount)
|
||||
.set(TbOrderDetail::getPriceAmount, totalAmount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateMemberByOrderId(Integer orderId, boolean isMember) {
|
||||
return update(new LambdaUpdateWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getOrderId, orderId)
|
||||
.set(TbOrderDetail::getIsMember, isMember ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateFieldByCartId(SFunction<TbOrderDetail, ?> field, Object val, List<Integer> cartIds) {
|
||||
LambdaUpdateWrapper<TbOrderDetail> query = new LambdaUpdateWrapper<TbOrderDetail>()
|
||||
.set(field, val);
|
||||
if (!cartIds.isEmpty()) {
|
||||
query.in(TbOrderDetail::getCartId, cartIds);
|
||||
}
|
||||
return update(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTableInfoByCartIds(Integer shopId, String targetTableId, String masterId, List<Integer> cartIds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeByCartIds(ArrayList<Integer> cartIds) {
|
||||
return remove(new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.in(TbOrderDetail::getCartId, cartIds));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.cons.TableConstant;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbOrderInfoMapper;
|
||||
@@ -10,12 +9,9 @@ import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* (TbShopPermission)表服务实现类
|
||||
*
|
||||
@@ -44,26 +40,5 @@ public class MpOrderInfoServiceImpl extends ServiceImpl<TbOrderInfoMapper, TbOrd
|
||||
.eq(TbOrderInfo::getId, orderId)
|
||||
.eq(TbOrderInfo::getStatus, status.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean incrAmount(Integer orderId, BigDecimal subtract) {
|
||||
return update(new LambdaUpdateWrapper<TbOrderInfo>()
|
||||
.eq(TbOrderInfo::getId, orderId)
|
||||
.eq(TbOrderInfo::getStatus, TableConstant.OrderInfo.Status.UNPAID.getValue())
|
||||
.apply(StrUtil.format("settlement_amount + {} >= 0", subtract))
|
||||
.setSql(StrUtil.format("settlement_amount=settlement_amount+{}", subtract))
|
||||
.setSql(StrUtil.format("order_amount=order_amount+{}", subtract))
|
||||
.setSql(StrUtil.format("amount=amount+{}", subtract))
|
||||
.setSql(StrUtil.format("origin_amount=origin_amount+{}", subtract))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateFieldVal(Integer shopId, Integer orderId, SFunction<TbOrderInfo, ?> column, Object val) {
|
||||
return update(new LambdaUpdateWrapper<TbOrderInfo>()
|
||||
.eq(TbOrderInfo::getShopId, shopId)
|
||||
.eq(TbOrderInfo::getId, orderId)
|
||||
.set(column, val));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,349 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.dto.credit.CreditBuyerOrderDTO;
|
||||
import cn.ysk.cashier.dto.product.PadProductCategoryDTO;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyer;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyerOrder;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditPaymentRecord;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditBuyerMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditBuyerOrderMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditPaymentRecordMapper;
|
||||
import cn.ysk.cashier.mybatis.service.MpOrderInfoService;
|
||||
import cn.ysk.cashier.mybatis.service.TbCreditBuyerOrderService;
|
||||
import cn.ysk.cashier.mybatis.service.TbCreditBuyerService;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 挂账账单
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Service
|
||||
public class TbCreditBuyerOrderServiceImpl extends ServiceImpl<TbCreditBuyerOrderMapper, TbCreditBuyerOrder> implements TbCreditBuyerOrderService {
|
||||
|
||||
@Resource
|
||||
private TbCreditBuyerService tbCreditBuyerService;
|
||||
@Resource
|
||||
private TbCreditBuyerMapper tbCreditBuyerMapper;
|
||||
@Resource
|
||||
private TbCreditBuyerOrderMapper tbCreditBuyerOrderMapper;
|
||||
@Resource
|
||||
private TbCreditPaymentRecordMapper tbCreditPaymentRecordMapper;
|
||||
@Resource
|
||||
private MpOrderInfoService mpOrderInfoService;
|
||||
|
||||
private LambdaQueryWrapper<TbCreditBuyerOrder> getWrapper(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
String beginDate = mapProxy.getStr("beginDate");
|
||||
String endDate = mapProxy.getStr("endDate");
|
||||
TbCreditBuyerOrder param = BeanUtil.toBean(params, TbCreditBuyerOrder.class);
|
||||
LambdaQueryWrapper<TbCreditBuyerOrder> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.orderByDesc(TbCreditBuyerOrder::getOrderId);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> page(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
int pageNum = mapProxy.getInt("page", 1);
|
||||
int pageSize = mapProxy.getInt("size", 10);
|
||||
Page<PadProductCategoryDTO> page = new Page<>(pageNum, pageSize);
|
||||
page.addOrder(OrderItem.desc("order_id"));
|
||||
params.put("page", page);
|
||||
List<CreditBuyerOrderDTO> list = baseMapper.getList(params);
|
||||
return PageUtil.toPlusPage(list, Convert.toInt(page.getTotal()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> summary(Map<String, Object> params) {
|
||||
long count = baseMapper.getCount(params);
|
||||
Map<String, Object> data = new HashMap<>(5);
|
||||
// 总交易笔数
|
||||
data.put("count", count);
|
||||
// 总交易金额
|
||||
BigDecimal payAmount = baseMapper.getSumPayAmount(params);
|
||||
data.put("payAmountTotal", payAmount);
|
||||
|
||||
// 待支付笔数
|
||||
params.put("statusList", Arrays.asList("unpaid", "partial"));
|
||||
long unpaidCount = baseMapper.getCount(params);
|
||||
data.put("unpaidCount", unpaidCount);
|
||||
params.put("statusList", Arrays.asList("paid", "partial"));
|
||||
BigDecimal paidAmount = baseMapper.getSumPaidAmount(params);
|
||||
params.put("statusList", Arrays.asList("unpaid", "partial"));
|
||||
BigDecimal unpaidAmount = baseMapper.getSumUnpaidAmount(params);
|
||||
data.put("paidAmountTotal", paidAmount);
|
||||
data.put("unpaidAmountTotal", unpaidAmount);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void pay(TbCreditPaymentRecord record) {
|
||||
try {
|
||||
Assert.notNull(record.getCreditBuyerId(), "{}({})不能为空", "挂账人id", "creditBuyerId");
|
||||
Assert.notNull(record.getOrderId(), "{}({})不能为空", "订单id", "orderId");
|
||||
Assert.notNull(record.getRepaymentAmount(), "{}({})不能为空", "还款金额", "repaymentAmount");
|
||||
Assert.notEmpty(record.getPaymentMethod(), "{}({})不能为空", "支付方式", "paymentMethod");
|
||||
//Assert.notNull(record.getPaymentTime(), "{}({})不能为空", "还款时间", "paymentTime");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
TbCreditBuyer creditBuyer = tbCreditBuyerMapper.selectById(record.getCreditBuyerId());
|
||||
if (creditBuyer == null) {
|
||||
throw new BadRequestException("挂账人不存在");
|
||||
}
|
||||
String repaymentMethod = creditBuyer.getRepaymentMethod();
|
||||
if (!"order".equals(repaymentMethod)) {
|
||||
throw new BadRequestException("该挂账人不支持按订单付款");
|
||||
}
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("creditBuyerId", record.getCreditBuyerId());
|
||||
params.put("orderId", record.getOrderId());
|
||||
CreditBuyerOrderDTO dto = baseMapper.getOne(params);
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("挂账订单不存在");
|
||||
}
|
||||
if ("paid".equals(dto.getStatus())) {
|
||||
throw new BadRequestException("挂账订单已还清,无需还款");
|
||||
}
|
||||
if (NumberUtil.isLess(record.getRepaymentAmount(), BigDecimal.ZERO)) {
|
||||
throw new BadRequestException("还款金额不能小于0");
|
||||
}
|
||||
if (NumberUtil.isGreater(record.getRepaymentAmount(), dto.getUnpaidAmount())) {
|
||||
throw new BadRequestException("还款金额不能大于未支付金额");
|
||||
}
|
||||
TbCreditBuyerOrder entity = BeanUtil.copyProperties(dto, TbCreditBuyerOrder.class);
|
||||
if (NumberUtil.equals(record.getRepaymentAmount(), dto.getUnpaidAmount())) {
|
||||
entity.setStatus("paid");
|
||||
} else {
|
||||
entity.setStatus("partial");
|
||||
}
|
||||
entity.setPaidAmount(NumberUtil.add(entity.getPaidAmount(), record.getRepaymentAmount()));
|
||||
entity.setLastPaymentTime(new Date());
|
||||
entity.setLastPaymentMethod(record.getPaymentMethod());
|
||||
entity.setRemark(record.getRemark());
|
||||
super.updateById(entity);
|
||||
record.setCreateTime(new Date());
|
||||
record.setPaymentTime(new Date());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean save(String creditBuyerId, Long orderId) {
|
||||
if (StrUtil.isBlank(creditBuyerId)) {
|
||||
throw new BadRequestException("挂账人id不能为空");
|
||||
}
|
||||
TbCreditBuyer creditBuyer = tbCreditBuyerService.getById(creditBuyerId);
|
||||
if (creditBuyer == null) {
|
||||
throw new BadRequestException("挂账人不存在");
|
||||
}
|
||||
Integer delFlag = creditBuyer.getDelFlag();
|
||||
if (delFlag != null && delFlag == 1) {
|
||||
throw new BadRequestException("挂账人已删除");
|
||||
}
|
||||
Integer status = creditBuyer.getStatus();
|
||||
if (status != null && status == 0) {
|
||||
throw new BadRequestException("挂账人已被停用");
|
||||
}
|
||||
TbOrderInfo orderInfo = mpOrderInfoService.getById(orderId);
|
||||
if (orderInfo == null) {
|
||||
throw new BadRequestException("订单不存在");
|
||||
}
|
||||
// 账户余额
|
||||
BigDecimal accountBalance = creditBuyer.getAccountBalance();
|
||||
// 如果有余额的话,从余额里面扣除,没有余额的话,从信用额度里面扣除,余额和信用额度都为0,则不允许挂账,余额+信用额度刚好够支付这笔订单的话需要同时减余额减信用额度
|
||||
if (NumberUtil.isGreaterOrEqual(accountBalance, orderInfo.getOrderAmount())) {
|
||||
// 减余额
|
||||
creditBuyer.setAccountBalance(NumberUtil.sub(accountBalance, orderInfo.getOrderAmount()));
|
||||
tbCreditBuyerMapper.updateById(creditBuyer);
|
||||
// 记录还款记录
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
record.setCreditBuyerId(creditBuyerId);
|
||||
record.setOrderId(orderId);
|
||||
record.setRepaymentAmount(orderInfo.getOrderAmount());
|
||||
record.setPaymentMethod("余额支付");
|
||||
record.setPaymentTime(new Date());
|
||||
record.setRemark("挂账时余额充足,直接从余额扣除");
|
||||
record.setCreateTime(new Date());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
TbCreditBuyerOrder entity = new TbCreditBuyerOrder();
|
||||
entity.setCreditBuyerId(creditBuyerId);
|
||||
entity.setOrderId(orderId);
|
||||
entity.setPaidAmount(orderInfo.getOrderAmount());
|
||||
entity.setStatus("paid");
|
||||
entity.setLastPaymentTime(new Date());
|
||||
entity.setLastPaymentMethod(record.getPaymentMethod());
|
||||
entity.setRemark(record.getRemark());
|
||||
return super.save(entity);
|
||||
}
|
||||
TbCreditBuyerOrder entity = null;
|
||||
if (NumberUtil.isGreater(accountBalance, BigDecimal.ZERO)) {
|
||||
// 减余额
|
||||
creditBuyer.setAccountBalance(BigDecimal.ZERO);
|
||||
tbCreditBuyerMapper.updateById(creditBuyer);
|
||||
// 记录还款记录
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
record.setCreditBuyerId(creditBuyerId);
|
||||
record.setOrderId(orderId);
|
||||
record.setRepaymentAmount(accountBalance);
|
||||
record.setPaymentMethod("余额支付");
|
||||
record.setPaymentTime(new Date());
|
||||
record.setRemark("挂账时余额不足,先扣除现有余额,其他的从挂账额度中扣除");
|
||||
record.setCreateTime(new Date());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
entity = new TbCreditBuyerOrder();
|
||||
entity.setCreditBuyerId(creditBuyerId);
|
||||
entity.setOrderId(orderId);
|
||||
entity.setPaidAmount(accountBalance);
|
||||
entity.setStatus("partial");
|
||||
entity.setLastPaymentTime(new Date());
|
||||
entity.setLastPaymentMethod(record.getPaymentMethod());
|
||||
entity.setRemark(record.getRemark());
|
||||
//super.save(entity);
|
||||
orderInfo.setPayAmount(NumberUtil.sub(orderInfo.getOrderAmount(), accountBalance));
|
||||
}
|
||||
// 剩余挂账额度
|
||||
BigDecimal remainingAmount = creditBuyer.getRemainingAmount();
|
||||
// 验证挂账金额是否大于剩余额度
|
||||
boolean greater = NumberUtil.isGreater(orderInfo.getOrderAmount(), remainingAmount);
|
||||
if (greater) {
|
||||
throw new BadRequestException(StrUtil.format("{}:¥{}不能大于剩余挂账额度({})", "挂账金额", orderInfo.getOrderAmount(), remainingAmount));
|
||||
}
|
||||
if (entity == null) {
|
||||
entity = new TbCreditBuyerOrder();
|
||||
entity.setStatus("unpaid");
|
||||
entity.setPaidAmount(BigDecimal.ZERO);
|
||||
entity.setCreditBuyerId(creditBuyerId);
|
||||
entity.setOrderId(orderId);
|
||||
}
|
||||
return super.saveOrUpdate(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean refund(String creditBuyerId, Long orderId) {
|
||||
if (StrUtil.isBlank(creditBuyerId)) {
|
||||
throw new BadRequestException("挂账人id不能为空");
|
||||
}
|
||||
TbCreditBuyer creditBuyer = tbCreditBuyerService.getById(creditBuyerId);
|
||||
if (creditBuyer == null) {
|
||||
throw new BadRequestException("挂账人不存在");
|
||||
}
|
||||
TbOrderInfo orderInfo = mpOrderInfoService.getById(orderId);
|
||||
if (orderInfo == null) {
|
||||
throw new BadRequestException("订单不存在");
|
||||
}
|
||||
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("creditBuyerId", creditBuyerId);
|
||||
params.put("orderId", orderId);
|
||||
CreditBuyerOrderDTO dto = baseMapper.getOne(params);
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("挂账订单不存在");
|
||||
}
|
||||
// 1.只挂账未还款的情况,直接删除挂账订单
|
||||
if ("unpaid".equals(dto.getStatus())) {
|
||||
baseMapper.deleteById(dto.getId());
|
||||
return true;
|
||||
}
|
||||
// 2.部分还款/已还款,删除挂账订单+红冲还款记录,并把已还款金额退回余额或挂账额度
|
||||
if ("partial".equals(dto.getStatus()) || "paid".equals(dto.getStatus())) {
|
||||
// 已还款金额
|
||||
BigDecimal paidAmount = dto.getPaidAmount();
|
||||
// 已还款金额进行红冲
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
record.setCreditBuyerId(creditBuyerId);
|
||||
record.setOrderId(orderId);
|
||||
record.setRepaymentAmount(NumberUtil.sub(BigDecimal.ZERO, paidAmount));
|
||||
record.setPaymentMethod("挂账退款");
|
||||
record.setPaymentTime(new Date());
|
||||
record.setRemark(StrUtil.format("挂账订单:{}申请退款,已归还挂账额度或账户余额", orderInfo.getOrderNo()));
|
||||
record.setCreateTime(new Date());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
// 删除挂账订单,恢复挂账额度
|
||||
baseMapper.deleteById(dto.getId());
|
||||
// 退回余额
|
||||
creditBuyer.setAccountBalance(NumberUtil.add(creditBuyer.getAccountBalance(), paidAmount));
|
||||
tbCreditBuyerService.updateById(creditBuyer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean partRefund(String creditBuyerId, Long orderId, BigDecimal refundAmount) {
|
||||
if (StrUtil.isBlank(creditBuyerId)) {
|
||||
throw new BadRequestException("挂账人id不能为空");
|
||||
}
|
||||
TbCreditBuyer creditBuyer = tbCreditBuyerService.getById(creditBuyerId);
|
||||
if (creditBuyer == null) {
|
||||
throw new BadRequestException("挂账人不存在");
|
||||
}
|
||||
TbOrderInfo orderInfo = mpOrderInfoService.getById(orderId);
|
||||
if (orderInfo == null) {
|
||||
throw new BadRequestException("订单不存在");
|
||||
}
|
||||
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("creditBuyerId", creditBuyerId);
|
||||
params.put("orderId", orderId);
|
||||
CreditBuyerOrderDTO dto = baseMapper.getOne(params);
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("挂账订单不存在");
|
||||
}
|
||||
// 已还款金额进行红冲
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
record.setCreditBuyerId(creditBuyerId);
|
||||
record.setOrderId(orderId);
|
||||
record.setRepaymentAmount(NumberUtil.sub(BigDecimal.ZERO, refundAmount));
|
||||
record.setPaymentMethod("挂账退款");
|
||||
record.setPaymentTime(new Date());
|
||||
record.setRemark(StrUtil.format("挂账订单:{},申请退款¥{}元,已恢复挂账额度。", orderInfo.getOrderNo(), refundAmount));
|
||||
record.setCreateTime(new Date());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
dto = baseMapper.getOne(params);
|
||||
BigDecimal sub = NumberUtil.sub(refundAmount, dto.getUnpaidAmount());
|
||||
if (NumberUtil.isGreater(sub, BigDecimal.ZERO)) {
|
||||
TbCreditPaymentRecord flow = new TbCreditPaymentRecord();
|
||||
flow.setCreditBuyerId(creditBuyerId);
|
||||
flow.setOrderId(orderId);
|
||||
flow.setRepaymentAmount(sub);
|
||||
flow.setPaymentMethod("转储余额");
|
||||
flow.setPaymentTime(new Date());
|
||||
flow.setRemark(StrUtil.format("挂账订单:{},申请退款¥{}元,由于此挂账订单已提前还款,溢出部分¥{}元将转储至账户余额。", orderInfo.getOrderNo(), refundAmount, sub));
|
||||
flow.setCreateTime(new Date());
|
||||
tbCreditPaymentRecordMapper.insert(flow);
|
||||
tbCreditBuyerOrderMapper.update(Wrappers.<TbCreditBuyerOrder>lambdaUpdate()
|
||||
.eq(TbCreditBuyerOrder::getId, dto.getId())
|
||||
.set(TbCreditBuyerOrder::getPaidAmount, NumberUtil.sub(dto.getPaidAmount(), sub))
|
||||
);
|
||||
// 退回余额
|
||||
creditBuyer.setAccountBalance(NumberUtil.add(creditBuyer.getAccountBalance(), sub));
|
||||
tbCreditBuyerService.updateById(creditBuyer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,304 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.dto.credit.CreditBuyerOrderDTO;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyer;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditBuyerOrder;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditPaymentRecord;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditBuyerMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditBuyerOrderMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditPaymentRecordMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbCreditBuyerService;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 挂账人
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Service
|
||||
public class TbCreditBuyerServiceImpl extends ServiceImpl<TbCreditBuyerMapper, TbCreditBuyer> implements TbCreditBuyerService {
|
||||
|
||||
@Resource
|
||||
private TbCreditBuyerOrderMapper tbCreditBuyerOrderMapper;
|
||||
|
||||
@Resource
|
||||
private TbCreditPaymentRecordMapper tbCreditPaymentRecordMapper;
|
||||
|
||||
private LambdaQueryWrapper<TbCreditBuyer> getWrapper(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
String keywords = mapProxy.getStr("keywords");
|
||||
String repaymentStatus = mapProxy.getStr("repaymentStatus");
|
||||
TbCreditBuyer param = BeanUtil.toBean(params, TbCreditBuyer.class);
|
||||
|
||||
LambdaQueryWrapper<TbCreditBuyer> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TbCreditBuyer::getShopId, param.getShopId());
|
||||
wrapper.eq(StrUtil.isNotEmpty(param.getId()), TbCreditBuyer::getId, param.getId());
|
||||
wrapper.like(StrUtil.isNotEmpty(param.getResponsiblePerson()), TbCreditBuyer::getResponsiblePerson, param.getResponsiblePerson());
|
||||
wrapper.eq(param.getStatus() != null, TbCreditBuyer::getStatus, param.getStatus());
|
||||
if (StrUtil.isNotEmpty(keywords)) {
|
||||
wrapper.nested(i -> i.like(TbCreditBuyer::getDebtor, keywords).or().like(TbCreditBuyer::getMobile, keywords));
|
||||
}
|
||||
if (StrUtil.isNotEmpty(repaymentStatus)) {
|
||||
if ("unpaid".equals(repaymentStatus)) {
|
||||
wrapper.apply("0 < ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'unpaid'),0)");
|
||||
wrapper.apply("0 = ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'partial'),0)");
|
||||
} else if ("partial".equals(repaymentStatus)) {
|
||||
wrapper.apply("0 < ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'partial'),0)");
|
||||
} else if ("paid".equals(repaymentStatus)) {
|
||||
wrapper.apply("0 = ifnull((select sum(x.count) from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status in ('unpaid','partial')),0)");
|
||||
}
|
||||
}
|
||||
wrapper.eq(TbCreditBuyer::getDelFlag, 0);
|
||||
wrapper.select(TbCreditBuyer::getId, TbCreditBuyer::getShopId, TbCreditBuyer::getStatus, TbCreditBuyer::getDebtor, TbCreditBuyer::getMobile, TbCreditBuyer::getPosition, TbCreditBuyer::getCreditAmount, TbCreditBuyer::getRepaymentMethod, TbCreditBuyer::getPaymentMethod, TbCreditBuyer::getRemark, TbCreditBuyer::getDelFlag, TbCreditBuyer::getOwedAmount, TbCreditBuyer::getAccumulateAmount, TbCreditBuyer::getShopName, TbCreditBuyer::getResponsiblePerson, TbCreditBuyer::getAccountBalance);
|
||||
wrapper.orderByDesc(TbCreditBuyer::getStatus);
|
||||
wrapper.orderByDesc(TbCreditBuyer::getId);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> page(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
int pageNum = mapProxy.getInt("page", 1);
|
||||
int pageSize = mapProxy.getInt("size", 10);
|
||||
LambdaQueryWrapper<TbCreditBuyer> wrapper = getWrapper(params);
|
||||
Page<TbCreditBuyer> page = super.page(new Page<>(pageNum, pageSize), wrapper);
|
||||
return PageUtil.toPlusPage(page.getRecords(), Convert.toInt(page.getTotal()));
|
||||
}
|
||||
|
||||
private void commonVerify(TbCreditBuyer entity) {
|
||||
try {
|
||||
Assert.notNull(entity.getShopId(), "{}({})不能为空", "店铺id", "shopId");
|
||||
Assert.notNull(entity.getStatus(), "{}({})不能为空", "状态", "status");
|
||||
Assert.notEmpty(entity.getDebtor(), "{}({})不能为空", "挂账人", "debtor");
|
||||
Assert.notEmpty(entity.getMobile(), "{}({})不能为空", "手机号", "mobile");
|
||||
Assert.notNull(entity.getCreditAmount(), "{}({})不能为空", "挂账额度", "creditAmount");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
if (!Validator.isMobile(entity.getMobile())) {
|
||||
throw new BadRequestException(StrUtil.format("{}({})不合法", "手机号", "mobile"));
|
||||
}
|
||||
if (NumberUtil.isLessOrEqual(entity.getCreditAmount(), BigDecimal.ZERO)) {
|
||||
throw new BadRequestException(StrUtil.format("{}({})必须大于0", "挂账额度", "creditAmount"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(TbCreditBuyer entity) {
|
||||
commonVerify(entity);
|
||||
try {
|
||||
Assert.notEmpty(entity.getRepaymentMethod(), "{}({})不能为空", "还款方式", "repaymentMethod");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
if (!ArrayUtil.contains(new String[]{"total", "order"}, entity.getRepaymentMethod())) {
|
||||
throw new BadRequestException(StrUtil.format("{}({})不合法", "还款方式", "repaymentMethod"));
|
||||
}
|
||||
entity.setAccountBalance(BigDecimal.ZERO);
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(TbCreditBuyer dto) {
|
||||
try {
|
||||
Assert.notEmpty(dto.getId(), "{}不能为空", "id");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
commonVerify(dto);
|
||||
TbCreditBuyer entity = super.getById(dto.getId());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("挂账人不存在");
|
||||
}
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", dto.getId());
|
||||
params.put("shopId", dto.getShopId());
|
||||
LambdaQueryWrapper<TbCreditBuyer> wrapper = getWrapper(params);
|
||||
entity = baseMapper.selectOne(wrapper);
|
||||
|
||||
// 验证挂账额度是否小于已挂账金额
|
||||
boolean less = NumberUtil.isLess(dto.getCreditAmount(), NumberUtil.null2Zero(entity.getOwedAmount()));
|
||||
if (less) {
|
||||
throw new BadRequestException(StrUtil.format("{}({})不能小于已挂账金额({})", "挂账额度", "creditAmount", entity.getOwedAmount()));
|
||||
}
|
||||
BeanUtil.copyProperties(dto, entity, CopyOptions.create().setIgnoreNullValue(false).setIgnoreProperties("repaymentMethod", "accountBalance"));
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
try {
|
||||
Assert.notEmpty(id, "{}不能为空", "id");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
super.update(Wrappers.<TbCreditBuyer>lambdaUpdate().set(TbCreditBuyer::getDelFlag, 1).eq(TbCreditBuyer::getId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbCreditBuyer getById(String id) {
|
||||
LambdaQueryWrapper<TbCreditBuyer> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TbCreditBuyer::getId, id);
|
||||
wrapper.select(TbCreditBuyer::getId, TbCreditBuyer::getShopId, TbCreditBuyer::getStatus, TbCreditBuyer::getDebtor, TbCreditBuyer::getMobile, TbCreditBuyer::getPosition, TbCreditBuyer::getCreditAmount, TbCreditBuyer::getRepaymentMethod, TbCreditBuyer::getPaymentMethod, TbCreditBuyer::getRemark, TbCreditBuyer::getDelFlag, TbCreditBuyer::getOwedAmount, TbCreditBuyer::getAccumulateAmount, TbCreditBuyer::getShopName, TbCreditBuyer::getResponsiblePerson, TbCreditBuyer::getAccountBalance);
|
||||
return baseMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> repayment(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
// 还款金额
|
||||
BigDecimal repaymentAmount = mapProxy.getBigDecimal("repaymentAmount");
|
||||
TbCreditBuyer param = BeanUtil.toBean(params, TbCreditBuyer.class);
|
||||
try {
|
||||
Assert.notEmpty(param.getId(), "{}不能为空", "id");
|
||||
Assert.notNull(repaymentAmount, "{}({})不能为空", "还款金额", "repaymentAmount");
|
||||
Assert.notNull(param.getPaymentMethod(), "{}({})不能为空", "支付方式", "paymentMethod");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
TbCreditBuyer entity = getById(param.getId());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("挂账人不存在");
|
||||
}
|
||||
Integer delFlag = entity.getDelFlag();
|
||||
if (delFlag == 1) {
|
||||
throw new BadRequestException("挂账人已删除");
|
||||
}
|
||||
if (!"total".equals(entity.getRepaymentMethod())) {
|
||||
throw new BadRequestException("此挂账人不能以【按总账户还款】进行还款");
|
||||
}
|
||||
if (NumberUtil.isLess(repaymentAmount, BigDecimal.ZERO)) {
|
||||
throw new BadRequestException("还款金额不能小于0");
|
||||
}
|
||||
BigDecimal initRepaymentAmount = NumberUtil.add(repaymentAmount, BigDecimal.ZERO);
|
||||
// 已挂账金额
|
||||
BigDecimal owedAmount = entity.getOwedAmount();
|
||||
if (NumberUtil.equals(owedAmount, BigDecimal.ZERO)) {
|
||||
entity.setAccountBalance(NumberUtil.add(entity.getAccountBalance(), repaymentAmount));
|
||||
super.updateById(entity);
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
record.setCreditBuyerId(param.getId());
|
||||
record.setRepaymentAmount(repaymentAmount);
|
||||
record.setPaymentMethod(param.getPaymentMethod());
|
||||
record.setCreateTime(new Date());
|
||||
record.setPaymentTime(new Date());
|
||||
record.setRemark(param.getRemark());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("repaymentCount", 0);
|
||||
result.put("repaymentAmount", repaymentAmount);
|
||||
result.put("repaymentMsg", StrUtil.format("账单无需还款,{}元已转储至余额。", repaymentAmount));
|
||||
return result;
|
||||
}
|
||||
// 转存余额
|
||||
BigDecimal rechargeAmount = BigDecimal.ZERO;
|
||||
if (NumberUtil.isGreater(repaymentAmount, owedAmount)) {
|
||||
rechargeAmount = NumberUtil.sub(repaymentAmount, owedAmount);
|
||||
entity.setAccountBalance(NumberUtil.add(entity.getAccountBalance(), rechargeAmount));
|
||||
super.updateById(entity);
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
record.setCreditBuyerId(param.getId());
|
||||
record.setRepaymentAmount(rechargeAmount);
|
||||
record.setPaymentMethod(param.getPaymentMethod());
|
||||
record.setCreateTime(new Date());
|
||||
record.setPaymentTime(new Date());
|
||||
record.setRemark(param.getRemark());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
}
|
||||
|
||||
// 校验完毕,可以批量还款
|
||||
Map<String, Object> where = new HashMap<>();
|
||||
where.put("creditBuyerId", param.getId());
|
||||
where.put("statusList", Arrays.asList("unpaid", "partial"));
|
||||
List<CreditBuyerOrderDTO> list = tbCreditBuyerOrderMapper.getList(where);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("没有需要还款的订单");
|
||||
}
|
||||
int repaymentCount = 0;
|
||||
List<CreditBuyerOrderDTO> orderList = list.stream().sorted(Comparator.comparing(CreditBuyerOrderDTO::getOrderId)).collect(Collectors.toList());
|
||||
for (CreditBuyerOrderDTO dto : orderList) {
|
||||
// 未付款金额
|
||||
BigDecimal unpaidAmount = dto.getUnpaidAmount();
|
||||
// 记录还款记录
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
if (NumberUtil.isGreaterOrEqual(repaymentAmount, unpaidAmount)) {
|
||||
// 还全额
|
||||
tbCreditBuyerOrderMapper.update(Wrappers.<TbCreditBuyerOrder>lambdaUpdate()
|
||||
.eq(TbCreditBuyerOrder::getStatus, dto.getStatus())
|
||||
.eq(TbCreditBuyerOrder::getId, dto.getId())
|
||||
.eq(TbCreditBuyerOrder::getOrderId, dto.getOrderId())
|
||||
.eq(TbCreditBuyerOrder::getCreditBuyerId, dto.getCreditBuyerId())
|
||||
.eq(TbCreditBuyerOrder::getPaidAmount, dto.getPaidAmount())
|
||||
.set(TbCreditBuyerOrder::getStatus, "paid")
|
||||
.set(TbCreditBuyerOrder::getPaidAmount, NumberUtil.add(dto.getPaidAmount(), unpaidAmount))
|
||||
.set(TbCreditBuyerOrder::getRemark, param.getRemark())
|
||||
.set(TbCreditBuyerOrder::getLastPaymentMethod, param.getPaymentMethod())
|
||||
.set(TbCreditBuyerOrder::getLastPaymentTime, new Date())
|
||||
);
|
||||
record.setRepaymentAmount(unpaidAmount);
|
||||
repaymentAmount = NumberUtil.sub(repaymentAmount, unpaidAmount);
|
||||
} else if (NumberUtil.isLess(repaymentAmount, unpaidAmount)) {
|
||||
// 还部分
|
||||
tbCreditBuyerOrderMapper.update(Wrappers.<TbCreditBuyerOrder>lambdaUpdate()
|
||||
.eq(TbCreditBuyerOrder::getStatus, dto.getStatus())
|
||||
.eq(TbCreditBuyerOrder::getId, dto.getId())
|
||||
.eq(TbCreditBuyerOrder::getOrderId, dto.getOrderId())
|
||||
.eq(TbCreditBuyerOrder::getCreditBuyerId, dto.getCreditBuyerId())
|
||||
.eq(TbCreditBuyerOrder::getPaidAmount, dto.getPaidAmount())
|
||||
.set(TbCreditBuyerOrder::getStatus, "partial")
|
||||
.set(TbCreditBuyerOrder::getPaidAmount, NumberUtil.add(dto.getPaidAmount(), repaymentAmount))
|
||||
.set(TbCreditBuyerOrder::getRemark, param.getRemark())
|
||||
.set(TbCreditBuyerOrder::getLastPaymentMethod, param.getPaymentMethod())
|
||||
.set(TbCreditBuyerOrder::getLastPaymentTime, new Date())
|
||||
);
|
||||
record.setRepaymentAmount(repaymentAmount);
|
||||
repaymentAmount = BigDecimal.ZERO;
|
||||
}
|
||||
record.setCreditBuyerId(dto.getCreditBuyerId());
|
||||
record.setOrderId(dto.getOrderId());
|
||||
record.setPaymentMethod(param.getPaymentMethod());
|
||||
record.setCreateTime(new Date());
|
||||
record.setPaymentTime(new Date());
|
||||
record.setRemark(param.getRemark());
|
||||
tbCreditPaymentRecordMapper.insert(record);
|
||||
repaymentCount++;
|
||||
if (NumberUtil.equals(repaymentAmount, BigDecimal.ZERO)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>(5);
|
||||
BigDecimal payAmount = NumberUtil.sub(initRepaymentAmount, repaymentAmount);
|
||||
result.put("repaymentCount", repaymentCount);
|
||||
result.put("repaymentAmount", initRepaymentAmount);
|
||||
result.put("payAmount", payAmount);
|
||||
result.put("rechargeAmount", rechargeAmount);
|
||||
result.put("repaymentMsg", StrUtil.format("共计还款{}笔,还款金额:{}元,支付欠款:{}元,转存余额:{}元,当前余额:{}元。", repaymentCount, initRepaymentAmount, payAmount, rechargeAmount, entity.getAccountBalance()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCreditPaymentRecord;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditPaymentRecordMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbCreditPaymentRecordService;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账账单付款记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-20
|
||||
*/
|
||||
@Service
|
||||
public class TbCreditPaymentRecordServiceImpl extends ServiceImpl<TbCreditPaymentRecordMapper, TbCreditPaymentRecord> implements TbCreditPaymentRecordService {
|
||||
|
||||
private LambdaQueryWrapper<TbCreditPaymentRecord> getWrapper(Map<String, Object> params) {
|
||||
TbCreditPaymentRecord param = BeanUtil.toBean(params, TbCreditPaymentRecord.class);
|
||||
LambdaQueryWrapper<TbCreditPaymentRecord> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TbCreditPaymentRecord::getCreditBuyerId, param.getCreditBuyerId());
|
||||
wrapper.eq(param.getOrderId() != null, TbCreditPaymentRecord::getOrderId, param.getOrderId());
|
||||
wrapper.like(StrUtil.isNotEmpty(param.getPaymentMethod()), TbCreditPaymentRecord::getPaymentMethod, param.getPaymentMethod());
|
||||
wrapper.orderByDesc(TbCreditPaymentRecord::getId);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> page(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
int pageNum = mapProxy.getInt("page", 1);
|
||||
int pageSize = mapProxy.getInt("size", 10);
|
||||
LambdaQueryWrapper<TbCreditPaymentRecord> wrapper = getWrapper(params);
|
||||
wrapper.orderByDesc(TbCreditPaymentRecord::getId);
|
||||
Page<TbCreditPaymentRecord> page = super.page(new Page<>(pageNum, pageSize), wrapper);
|
||||
return PageUtil.toPlusPage(page.getRecords(), Convert.toInt(page.getTotal()));
|
||||
}
|
||||
}
|
||||
@@ -211,8 +211,7 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCat
|
||||
BeanUtil.copyProperties(dto, entity);
|
||||
entity.setCreateTime(new Date());
|
||||
super.save(entity);
|
||||
Set<Long> productIdSet = productIdList.stream().collect(Collectors.toSet());
|
||||
for (Long productId : productIdSet) {
|
||||
for (Long productId : productIdList) {
|
||||
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
|
||||
subEntity.setProductId(productId);
|
||||
subEntity.setPadProductCategoryId(entity.getId());
|
||||
@@ -270,9 +269,8 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCat
|
||||
BeanUtil.copyProperties(dto, entity, "createTime");
|
||||
entity.setUpdateTime(new Date());
|
||||
super.updateById(entity);
|
||||
tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId()));
|
||||
Set<Long> productIdSet = productIdList.stream().collect(Collectors.toSet());
|
||||
for (Long productId : productIdSet) {
|
||||
for (Long productId : productIdList) {
|
||||
tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId()));
|
||||
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
|
||||
subEntity.setProductId(productId);
|
||||
subEntity.setPadProductCategoryId(entity.getId());
|
||||
|
||||
@@ -196,7 +196,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
||||
setCouponInfo(coupons, tbUserCouponVo, orderAmount, week, now, formatter);
|
||||
}
|
||||
JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId());
|
||||
tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").getAsString());
|
||||
tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").toString());
|
||||
if (tbUserCouponVo.getType().equals(1)) {
|
||||
tbUserCouponVo.setUse(couponJson.get("isUse").getAsBoolean());
|
||||
} else if (tbUserCouponVo.getType().equals(2) && couponJson.get("isUse").getAsBoolean()) {
|
||||
|
||||
@@ -1,535 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||
import cn.ysk.cashier.cons.domain.TbConsType;
|
||||
import cn.ysk.cashier.cons.domain.TbProskuCon;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsTypeRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbProskuConRepository;
|
||||
import cn.ysk.cashier.dto.TbShopSyncInfoQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSyncInfo;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopSyncInfoMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopSyncInfoService;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import cn.ysk.cashier.pojo.product.*;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
||||
import cn.ysk.cashier.repository.product.*;
|
||||
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.ProductGroupVo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static cn.ysk.cashier.utils.StringCodeUtil.TYPE.LETTER_CAPITAL_NUMBER;
|
||||
|
||||
/**
|
||||
* 店铺信息同步记录表(TbShopSyncInfo)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-25 16:46:12
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class TbShopSyncInfoServiceImpl extends ServiceImpl<TbShopSyncInfoMapper, TbShopSyncInfo> implements TbShopSyncInfoService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private TbShopSyncInfoMapper tbShopSyncInfomapper;
|
||||
//单位
|
||||
@Autowired
|
||||
private TbShopUnitRepository unitRepository;
|
||||
//规格
|
||||
@Autowired
|
||||
private TbProductSpecRepository specRepository;
|
||||
//分组
|
||||
@Autowired
|
||||
private TbProductGroupRepository groupRepository;
|
||||
//分类
|
||||
@Autowired
|
||||
private TbShopCategoryRepository categoryRepository;
|
||||
//商品
|
||||
@Autowired
|
||||
private TbProductRepository productRepository;
|
||||
@Autowired
|
||||
private TbProductSkuRepository skuRepository;
|
||||
@Autowired
|
||||
private TbProductSkuResultRepository skuResultRepository;
|
||||
|
||||
//耗材
|
||||
@Autowired
|
||||
private TbConsInfoRepository consRepository;
|
||||
@Autowired
|
||||
private TbConsTypeRepository consTypeRepository;
|
||||
@Autowired
|
||||
private TbProskuConRepository proSkuConRepository;
|
||||
|
||||
|
||||
@Override
|
||||
public TbShopSyncInfo queryByShopId(TbShopSyncInfoQueryCriteria criteria) {
|
||||
QueryWrapper<TbShopSyncInfo> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("point_shop_id", criteria.getPointShopId());
|
||||
wrapper.orderByDesc("sync_time");
|
||||
TbShopSyncInfo tbShopSyncInfo = tbShopSyncInfomapper.selectOne(wrapper);
|
||||
return tbShopSyncInfo;
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void sync(TbShopSyncInfo tbShopSyncInfo) {
|
||||
Map<Integer, Integer> units;
|
||||
Map<Integer, Integer> specs;
|
||||
Map<Integer, Integer> cateGorys;
|
||||
Map<Integer, Integer> groups;
|
||||
Map<Integer, Integer> pros = new HashMap<>();
|
||||
Map<Integer, Integer> skus = new HashMap<>();
|
||||
Map<Integer, Integer> conTypes;
|
||||
Map<Integer, Integer> consInfos = new HashMap<>();
|
||||
Map<Integer, Integer> consPros = new HashMap<>();
|
||||
Integer skuResults = 0;
|
||||
TbShopSyncInfoServiceImpl self = applicationContext.getBean(TbShopSyncInfoServiceImpl.class);
|
||||
|
||||
try {
|
||||
List<CompletableFuture<?>> futures = new ArrayList<>();
|
||||
List<CompletableFuture<?>> futures2 = new ArrayList<>();
|
||||
if (tbShopSyncInfo.getProduct() != null && tbShopSyncInfo.getProduct() > 0) {
|
||||
CompletableFuture<Map<Integer, Integer>> futureUnit = self.syncUnit(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
CompletableFuture<Map<Integer, Integer>> futureSpec = self.syncSpec(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
CompletableFuture<Map<Integer, Integer>> futureCate = self.syncCategory(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
futures.add(futureUnit);
|
||||
futures.add(futureSpec);
|
||||
futures.add(futureCate);
|
||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||
|
||||
units = futureUnit.get();
|
||||
tbShopSyncInfo.setProUnit(units.size());
|
||||
|
||||
specs = futureSpec.get();
|
||||
tbShopSyncInfo.setProSpec(specs.size());
|
||||
|
||||
cateGorys = futureCate.get();
|
||||
tbShopSyncInfo.setProCategory(cateGorys.size());
|
||||
|
||||
CompletableFuture<Map<Integer, Integer>> futurePros = self.syncProduct(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId(), units, specs, cateGorys);
|
||||
pros = futurePros.get();
|
||||
tbShopSyncInfo.setProduct(pros.size());
|
||||
|
||||
self.syncGroupPackage(tbShopSyncInfo.getPointShopId(), pros, skus);
|
||||
CompletableFuture<Map<Integer, Integer>> futureGroup = self.syncGroup(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId(), pros);
|
||||
CompletableFuture<Map<Integer, Integer>> futureSkus = self.syncSku(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId(), pros);
|
||||
CompletableFuture<Integer> futureSkuResults = self.syncSkuResult(pros);
|
||||
futures2.add(futureGroup);
|
||||
futures2.add(futureSkus);
|
||||
futures2.add(futureSkuResults);
|
||||
|
||||
CompletableFuture.allOf(futures2.toArray(new CompletableFuture[0])).join();
|
||||
|
||||
groups = futureGroup.get();
|
||||
tbShopSyncInfo.setProGroup(groups.size());
|
||||
|
||||
skus = futureSkus.get();
|
||||
tbShopSyncInfo.setProSku(skus.size());
|
||||
|
||||
skuResults = futureSkuResults.get();
|
||||
tbShopSyncInfo.setProSkuResult(skuResults);
|
||||
} else {
|
||||
if (tbShopSyncInfo.getProUnit() != null && tbShopSyncInfo.getProUnit() > 0) {
|
||||
CompletableFuture<Map<Integer, Integer>> futureUnit = self.syncUnit(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
units = futureUnit.get();
|
||||
tbShopSyncInfo.setProUnit(units.size());
|
||||
}
|
||||
if (tbShopSyncInfo.getProCategory() != null && tbShopSyncInfo.getProCategory() > 0) {
|
||||
CompletableFuture<Map<Integer, Integer>> futureCate = self.syncCategory(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
cateGorys = futureCate.get();
|
||||
tbShopSyncInfo.setProCategory(cateGorys.size());
|
||||
}
|
||||
if (tbShopSyncInfo.getProSpec() != null && tbShopSyncInfo.getProSpec() > 0) {
|
||||
CompletableFuture<Map<Integer, Integer>> futureSpec = self.syncSpec(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
specs = futureSpec.get();
|
||||
tbShopSyncInfo.setProSpec(specs.size());
|
||||
}
|
||||
}
|
||||
|
||||
if (tbShopSyncInfo.getConsInfo() != null && tbShopSyncInfo.getConsInfo() > 0) {
|
||||
CompletableFuture<Map<Integer, Integer>> futureConTypes = self.syncConsType(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
conTypes = futureConTypes.get();
|
||||
tbShopSyncInfo.setConsType(conTypes.size());
|
||||
|
||||
CompletableFuture<Map<Integer, Integer>> futureConsInfos = self.syncCons(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId(), conTypes);
|
||||
consInfos = futureConsInfos.get();
|
||||
tbShopSyncInfo.setConsInfo(consInfos.size());
|
||||
} else if (tbShopSyncInfo.getConsType() != null && tbShopSyncInfo.getConsType() > 0) {
|
||||
CompletableFuture<Map<Integer, Integer>> futureConTypes = self.syncConsType(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId());
|
||||
conTypes = futureConTypes.get();
|
||||
tbShopSyncInfo.setConsType(conTypes.size());
|
||||
}
|
||||
|
||||
if (tbShopSyncInfo.getConsPro() != null && tbShopSyncInfo.getConsPro() > 0
|
||||
&& tbShopSyncInfo.getConsInfo() != null && tbShopSyncInfo.getConsInfo() > 0
|
||||
&& tbShopSyncInfo.getProduct() != null && tbShopSyncInfo.getProduct() > 0) {
|
||||
CompletableFuture<Map<Integer, Integer>> mapCompletableFuture = self.syncConsPro(tbShopSyncInfo.getSourceShopId(), tbShopSyncInfo.getPointShopId(), consInfos, pros, skus);
|
||||
consPros = mapCompletableFuture.get();
|
||||
tbShopSyncInfo.setConsPro(consPros.size());
|
||||
}
|
||||
tbShopSyncInfo.setSyncTime(new Date());
|
||||
tbShopSyncInfo.setStatus(2);
|
||||
tbShopSyncInfomapper.updateById(tbShopSyncInfo);
|
||||
} catch (Exception e) {
|
||||
tbShopSyncInfo.setProSpec(0);
|
||||
tbShopSyncInfo.setProGroup(0);
|
||||
tbShopSyncInfo.setProUnit(0);
|
||||
tbShopSyncInfo.setProCategory(0);
|
||||
tbShopSyncInfo.setProSkuResult(0);
|
||||
tbShopSyncInfo.setProSku(0);
|
||||
tbShopSyncInfo.setProduct(0);
|
||||
|
||||
tbShopSyncInfo.setConsType(0);
|
||||
tbShopSyncInfo.setConsInfo(0);
|
||||
tbShopSyncInfo.setConsPro(0);
|
||||
|
||||
tbShopSyncInfo.setSyncTime(new Date());
|
||||
tbShopSyncInfo.setStatus(0);
|
||||
tbShopSyncInfomapper.updateById(tbShopSyncInfo);
|
||||
log.error("数据同步失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(TbShopSyncInfo tbShopSyncInfo) {
|
||||
unitRepository.clearShopUnit(tbShopSyncInfo.getPointShopId().toString());
|
||||
specRepository.clearShopSpec(tbShopSyncInfo.getPointShopId().toString());
|
||||
groupRepository.clearShopGroup(tbShopSyncInfo.getPointShopId());
|
||||
categoryRepository.clearShopCategory(tbShopSyncInfo.getPointShopId().toString());
|
||||
List<TbProduct> products = productRepository.selectByShopId(tbShopSyncInfo.getPointShopId().toString());
|
||||
List<Integer> collect = products.stream().map(TbProduct::getId).collect(Collectors.toList());
|
||||
skuResultRepository.deleteAllByIdInBatch(collect);
|
||||
productRepository.clearShopPro(tbShopSyncInfo.getPointShopId().toString());
|
||||
skuRepository.clearShopSku(tbShopSyncInfo.getPointShopId().toString());
|
||||
consRepository.clearShopCons(tbShopSyncInfo.getPointShopId());
|
||||
consTypeRepository.clearShopConType(tbShopSyncInfo.getPointShopId());
|
||||
List<TbProskuCon> tbProskuCons = proSkuConRepository.searchConsProByShopId(tbShopSyncInfo.getPointShopId());
|
||||
List<Integer> proCons = tbProskuCons.stream().map(TbProskuCon::getId).collect(Collectors.toList());
|
||||
proSkuConRepository.deleteAllByIdInBatch(proCons);
|
||||
|
||||
proSkuConRepository.clearShopConPro(tbShopSyncInfo.getPointShopId());
|
||||
QueryWrapper<TbShopSyncInfo> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("point_shop_id", tbShopSyncInfo.getPointShopId());
|
||||
tbShopSyncInfomapper.delete(wrapper);
|
||||
}
|
||||
|
||||
//单位
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncUnit(Integer sourceShopId, Integer pointShopId) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> unitMap = new HashMap<>();
|
||||
unitRepository.searchUnitByShopId(sourceShopId.toString()).forEach(tbShopUnit -> {
|
||||
Integer sourceUnitId = tbShopUnit.getId();
|
||||
TbShopUnit unitNew = new TbShopUnit();
|
||||
unitNew.copy(tbShopUnit);
|
||||
unitNew.setId(null);
|
||||
unitNew.setShopId(pointShopId.toString());
|
||||
unitRepository.save(unitNew);
|
||||
unitMap.put(sourceUnitId, unitNew.getId());
|
||||
});
|
||||
future.complete(unitMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
//规格
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncSpec(Integer sourceShopId, Integer pointShopId) {
|
||||
log.info("规格同步 "+System.currentTimeMillis());
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> specMap = new HashMap<>();
|
||||
specRepository.searchSpecByShopId(sourceShopId.toString()).forEach(tbProductSpec -> {
|
||||
Integer sourceSpecId = tbProductSpec.getId();
|
||||
TbProductSpec tbProductSpecNew = new TbProductSpec();
|
||||
tbProductSpecNew.copy(tbProductSpec);
|
||||
tbProductSpecNew.setId(null);
|
||||
tbProductSpecNew.setShopId(pointShopId.toString());
|
||||
specRepository.save(tbProductSpecNew);
|
||||
specMap.put(sourceSpecId, tbProductSpec.getId());
|
||||
});
|
||||
future.complete(specMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
// 分类
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncCategory(Integer sourceShopId, Integer pointShopId) {
|
||||
log.info("分类同步 "+System.currentTimeMillis());
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> categoryMap = new HashMap<>();
|
||||
List<TbShopCategory> tbShopCategories = categoryRepository.searchCategoryByShopId(sourceShopId.toString());
|
||||
List<Integer> treeIds = new ArrayList<>();
|
||||
for (TbShopCategory tbShopCategory : tbShopCategories) {
|
||||
treeIds.add(tbShopCategory.getId());
|
||||
|
||||
Integer sourceCategoryId = tbShopCategory.getId();
|
||||
|
||||
TbShopCategory tbShopCategoryNew = new TbShopCategory();
|
||||
tbShopCategoryNew.copy(tbShopCategory);
|
||||
tbShopCategoryNew.setId(null);
|
||||
tbShopCategoryNew.setShopId(pointShopId.toString());
|
||||
tbShopCategoryNew.setTree(null);
|
||||
tbShopCategoryNew.setPid("");
|
||||
categoryRepository.save(tbShopCategoryNew);
|
||||
categoryMap.put(sourceCategoryId, tbShopCategoryNew.getId());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(treeIds)) {
|
||||
List<TbShopCategory> children = categoryRepository.findChildren(treeIds);
|
||||
for (TbShopCategory child : children) {
|
||||
Integer sourceCategoryId = child.getId();
|
||||
TbShopCategory tbShopCategoryNew = new TbShopCategory();
|
||||
tbShopCategoryNew.copy(child);
|
||||
tbShopCategoryNew.setId(null);
|
||||
tbShopCategoryNew.setShopId(pointShopId.toString());
|
||||
tbShopCategoryNew.setTree(categoryMap.get(child.getTree()));
|
||||
tbShopCategoryNew.setPid(StringUtils.isNotBlank(child.getPid()) ? categoryMap.get(Integer.valueOf(child.getPid())).toString() : "");
|
||||
categoryRepository.save(tbShopCategoryNew);
|
||||
categoryMap.put(sourceCategoryId, tbShopCategoryNew.getId());
|
||||
}
|
||||
}
|
||||
future.complete(categoryMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncProduct(Integer sourceShopId, Integer pointShopId, Map<Integer, Integer> units,
|
||||
Map<Integer, Integer> specs, Map<Integer, Integer> cateGorys) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
String cateGory = "";
|
||||
if(CollectionUtil.isNotEmpty(cateGorys)){
|
||||
cateGory = cateGorys.keySet().stream().findFirst().get().toString();
|
||||
}
|
||||
|
||||
Map<Integer, Integer> proMap = new HashMap<>();
|
||||
List<TbProduct> products = productRepository.findByShopId(sourceShopId.toString());
|
||||
if(CollectionUtil.isNotEmpty(products)){
|
||||
for (TbProduct tbProduct : products) {
|
||||
Integer sourceSpecId = tbProduct.getId();
|
||||
TbProduct tbProductNew = new TbProduct();
|
||||
tbProductNew.copy(tbProduct);
|
||||
|
||||
tbProductNew.setId(null);
|
||||
tbProductNew.setShopId(pointShopId.toString());
|
||||
if(StringUtils.isNotBlank(tbProduct.getCategoryId()) && cateGorys.containsKey(Integer.valueOf(tbProduct.getCategoryId()))){
|
||||
tbProductNew.setCategoryId(StringUtils.isNotBlank(tbProduct.getCategoryId()) ? cateGorys.get(Integer.valueOf(tbProduct.getCategoryId())).toString() : "");
|
||||
}else {
|
||||
tbProductNew.setCategoryId(cateGory);
|
||||
}
|
||||
|
||||
tbProductNew.setSpecId(tbProduct.getSpecId() != null ? specs.get(tbProduct.getSpecId()) : null);
|
||||
tbProductNew.setUnitId(tbProduct.getUnitId() != null ? units.get(tbProduct.getUnitId()) : null);
|
||||
tbProductNew.setStockNumber(0);
|
||||
|
||||
productRepository.save(tbProductNew);
|
||||
proMap.put(sourceSpecId, tbProductNew.getId());
|
||||
}
|
||||
}
|
||||
future.complete(proMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncGroup(Integer sourceShopId, Integer pointShopId, Map<Integer, Integer> pros) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> groupMap = new HashMap<>();
|
||||
groupRepository.searchGroupByShopId(sourceShopId).forEach(tbProductGroup -> {
|
||||
Integer groupId = tbProductGroup.getId();
|
||||
TbProductGroup tbProductGroupNew = new TbProductGroup();
|
||||
tbProductGroupNew.copy(tbProductGroup);
|
||||
tbProductGroupNew.setId(null);
|
||||
tbProductGroupNew.setShopId(pointShopId);
|
||||
tbProductGroupNew.setUseTime(0);
|
||||
tbProductGroupNew.setProductIds(replaceProIds(tbProductGroup.getProductIds(), pros));
|
||||
groupRepository.save(tbProductGroupNew);
|
||||
groupMap.put(groupId, tbProductGroupNew.getId());
|
||||
});
|
||||
future.complete(groupMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
//分组
|
||||
@Async
|
||||
public void syncGroupPackage(Integer shopId, Map<Integer, Integer> pros, Map<Integer, Integer> skus) {
|
||||
productRepository.findPackageByShopId(shopId.toString()).forEach(tbProduct -> {
|
||||
if(StringUtils.isNotBlank(tbProduct.getGroupSnap())){
|
||||
tbProduct.setProGroupVo(JSONUtil.parseJSONStrTList(tbProduct.getGroupSnap(), ProductGroupVo.class));
|
||||
if (tbProduct.getProGroupVo() != null) {
|
||||
tbProduct.getProGroupVo().forEach(proGroupVo -> {
|
||||
proGroupVo.getGoods().forEach(goods -> {
|
||||
if (pros.containsKey(goods.getProId())) {
|
||||
if (goods.getSkuId() != null && skus.containsKey(goods.getSkuId())) {
|
||||
goods.setProId(pros.get(goods.getProId()));
|
||||
goods.setSkuId(skus.get(goods.getSkuId()));
|
||||
} else {
|
||||
goods.setProId(pros.get(goods.getProId()));
|
||||
}
|
||||
}
|
||||
});
|
||||
proGroupVo.setCount(proGroupVo.getGoods().size());
|
||||
if (proGroupVo.getNumber() != null && proGroupVo.getNumber() > 0) {
|
||||
if (proGroupVo.getNumber() > proGroupVo.getCount()) {
|
||||
proGroupVo.setNumber(proGroupVo.getCount());
|
||||
}
|
||||
}
|
||||
});
|
||||
tbProduct.setGroupSnap(ListUtil.listToJsonString(tbProduct.getProGroupVo()));
|
||||
productRepository.save(tbProduct);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//分组
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncSku(Integer sourceShopId, Integer pointShopId, Map<Integer, Integer> pros) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> skuMap = new HashMap<>();
|
||||
skuRepository.searchSkuByShopId(sourceShopId.toString()).forEach(tbProductSku -> {
|
||||
Integer productId = Integer.valueOf(tbProductSku.getProductId());
|
||||
if (pros.containsKey(productId)) {
|
||||
Integer sourceSkuId = tbProductSku.getId();
|
||||
TbProductSku tbProductSkuNew = new TbProductSku();
|
||||
tbProductSkuNew.copy(tbProductSku);
|
||||
tbProductSkuNew.setId(null);
|
||||
tbProductSkuNew.setShopId(pointShopId.toString());
|
||||
tbProductSkuNew.setProductId(pros.get(productId).toString());
|
||||
skuRepository.save(tbProductSkuNew);
|
||||
skuMap.put(sourceSkuId, tbProductSkuNew.getId());
|
||||
}
|
||||
});
|
||||
future.complete(skuMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<Integer> syncSkuResult(Map<Integer, Integer> pros) {
|
||||
CompletableFuture<Integer> future = new CompletableFuture<>();
|
||||
List<TbProductSkuResult> skuResults = skuResultRepository.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
||||
Predicate predicate = root.get("id").in(pros.keySet());
|
||||
return predicate;
|
||||
});
|
||||
skuResults.forEach(tbProductSkuResult -> {
|
||||
TbProductSkuResult tbProductSkuResultNew = new TbProductSkuResult();
|
||||
tbProductSkuResultNew.copy(tbProductSkuResult);
|
||||
tbProductSkuResultNew.setId(pros.get(tbProductSkuResult.getId()));
|
||||
skuResultRepository.save(tbProductSkuResultNew);
|
||||
});
|
||||
future.complete(skuResults.size());
|
||||
return future;
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncConsType(Integer sourceShopId, Integer pointShopId) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> consTypeMap = new HashMap<>();
|
||||
|
||||
List<TbConsType> tbConsTypes = consTypeRepository.searchConsTypeByShopId(sourceShopId);
|
||||
for (TbConsType tbConsType : tbConsTypes) {
|
||||
Integer sourceConsTypeId = tbConsType.getId();
|
||||
TbConsType tbConsTypeNew = new TbConsType();
|
||||
tbConsTypeNew.copy(tbConsType);
|
||||
tbConsTypeNew.setId(null);
|
||||
tbConsTypeNew.setShopId(pointShopId);
|
||||
consTypeRepository.save(tbConsTypeNew);
|
||||
consTypeMap.put(sourceConsTypeId, tbConsTypeNew.getId());
|
||||
}
|
||||
|
||||
future.complete(consTypeMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
// 耗材
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncCons(Integer sourceShopId, Integer pointShopId, Map<Integer, Integer> conTypes) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> consMap = new HashMap<>();
|
||||
List<TbConsInfo> tbConsInfos = consRepository.searchConsInfoByShopId(sourceShopId);
|
||||
for (TbConsInfo tbConsInfo : tbConsInfos) {
|
||||
Integer sourceConsId = tbConsInfo.getId();
|
||||
TbConsInfo tbConsInfoNew = new TbConsInfo();
|
||||
tbConsInfoNew.copy(tbConsInfo);
|
||||
tbConsInfoNew.setId(null);
|
||||
tbConsInfoNew.setShopId(pointShopId);
|
||||
tbConsInfoNew.setConTypeId(conTypes.get(tbConsInfo.getConTypeId()));
|
||||
tbConsInfoNew.setConCode(StringCodeUtil.getRandom(8, LETTER_CAPITAL_NUMBER));
|
||||
tbConsInfoNew.setStockNumber(BigDecimal.ZERO);
|
||||
tbConsInfoNew.setStockConsume(BigDecimal.ZERO);
|
||||
consRepository.save(tbConsInfoNew);
|
||||
consMap.put(sourceConsId, tbConsInfoNew.getId());
|
||||
}
|
||||
future.complete(consMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncConsPro(Integer sourceShopId, Integer pointShopId, Map<Integer, Integer> consMap, Map<Integer, Integer> proMap, Map<Integer, Integer> skuMap) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> proSkuConMap = new HashMap<>();
|
||||
proSkuConRepository.searchConsProByShopId(sourceShopId).forEach(tbConsPro -> {
|
||||
if (consMap.containsKey(tbConsPro.getConInfoId()) && proMap.containsKey(tbConsPro.getProductId()) && skuMap.containsKey(tbConsPro.getProductSkuId())) {
|
||||
Integer sourceConsProId = tbConsPro.getId();
|
||||
TbProskuCon tbConsProNew = new TbProskuCon();
|
||||
tbConsProNew.copy(tbConsPro);
|
||||
tbConsProNew.setId(null);
|
||||
tbConsProNew.setShopId(pointShopId);
|
||||
tbConsProNew.setConInfoId(consMap.get(tbConsPro.getConInfoId()));
|
||||
tbConsProNew.setProductId(proMap.get(tbConsPro.getProductId()));
|
||||
if (tbConsPro.getProductSkuId() > 0) {
|
||||
tbConsProNew.setProductSkuId(skuMap.get(tbConsPro.getProductSkuId()));
|
||||
}
|
||||
proSkuConRepository.save(tbConsProNew);
|
||||
proSkuConMap.put(sourceConsProId, tbConsProNew.getId());
|
||||
}
|
||||
});
|
||||
future.complete(proSkuConMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组关联商品 重组 如果绑定的商品Id 不存在 则抛弃
|
||||
*/
|
||||
public static String replaceProIds(String proStr, Map<Integer, Integer> pros) {
|
||||
if (StringUtils.isNotBlank(proStr) && !"[]".equals(proStr)) {
|
||||
proStr = proStr.substring(1, proStr.length() - 1);
|
||||
String[] numbersStr = proStr.split(",");
|
||||
String result = Stream.of(numbersStr)
|
||||
.map(Integer::parseInt)
|
||||
.filter(number -> pros.containsKey(number))
|
||||
.map(pros::get)
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.joining(",", "[", "]"));
|
||||
return result;
|
||||
}
|
||||
return "[]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,354 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.dto.booking.ShopTableBookingDTO;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
|
||||
import cn.ysk.cashier.mybatis.mapper.MpShopAreaMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.MpShopTableMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopTableBookingMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopTableBookingService;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopArea;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopTable;
|
||||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import cn.ysk.cashier.utils.SecurityUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺台桌预订
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-11-21
|
||||
*/
|
||||
@Service
|
||||
public class TbShopTableBookingServiceImpl extends ServiceImpl<TbShopTableBookingMapper, TbShopTableBooking> implements TbShopTableBookingService {
|
||||
|
||||
private static final Map<String, String> BOOKING_TYPE = MapUtil.builder("lunch", "午餐")
|
||||
.put("dinner", "晚餐")
|
||||
.build();
|
||||
|
||||
@Resource
|
||||
private TbShopInfoRepository tbShopInfoRepository;
|
||||
|
||||
@Resource
|
||||
private MpShopTableMapper mpShopTableMapper;
|
||||
|
||||
@Resource
|
||||
private MpShopAreaMapper mpShopAreaMapper;
|
||||
|
||||
private LambdaQueryWrapper<TbShopTableBooking> getWrapper(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
String keywords = mapProxy.getStr("keywords");
|
||||
TbShopTableBooking param = BeanUtil.toBean(params, TbShopTableBooking.class);
|
||||
|
||||
LambdaQueryWrapper<TbShopTableBooking> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TbShopTableBooking::getShopId, param.getShopId());
|
||||
wrapper.eq(param.getId() != null, TbShopTableBooking::getId, param.getId());
|
||||
wrapper.like(StrUtil.isNotEmpty(param.getOrderNo()), TbShopTableBooking::getOrderNo, param.getOrderNo());
|
||||
wrapper.eq(param.getBookingDate() != null, TbShopTableBooking::getBookingDate, param.getBookingDate());
|
||||
wrapper.eq(StrUtil.isNotEmpty(param.getBookingType()), TbShopTableBooking::getBookingType, param.getBookingType());
|
||||
wrapper.like(StrUtil.isNotEmpty(param.getDiningType()), TbShopTableBooking::getDiningType, param.getDiningType());
|
||||
wrapper.eq(param.getFocus() != null, TbShopTableBooking::getFocus, param.getFocus());
|
||||
wrapper.eq(param.getReceiveMarketingSms() != null, TbShopTableBooking::getReceiveMarketingSms, param.getReceiveMarketingSms());
|
||||
wrapper.eq(param.getReceiveMarketingSms() != null, TbShopTableBooking::getReceiveMarketingSms, param.getReceiveMarketingSms());
|
||||
wrapper.eq(param.getStatus() != null, TbShopTableBooking::getStatus, param.getStatus());
|
||||
if (StrUtil.isNotEmpty(keywords)) {
|
||||
wrapper.nested(i -> i.like(TbShopTableBooking::getBookingPerson, keywords).or().like(TbShopTableBooking::getPhoneNumber, keywords));
|
||||
}
|
||||
wrapper.eq(TbShopTableBooking::getDelFlag, 0);
|
||||
wrapper.orderByDesc(TbShopTableBooking::getFocus);
|
||||
wrapper.orderByDesc(TbShopTableBooking::getStatus);
|
||||
wrapper.orderByAsc(TbShopTableBooking::getBookingTime);
|
||||
wrapper.orderByDesc(TbShopTableBooking::getId);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> page(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
int pageNum = mapProxy.getInt("page", 1);
|
||||
int pageSize = mapProxy.getInt("size", 10);
|
||||
LambdaQueryWrapper<TbShopTableBooking> wrapper = getWrapper(params);
|
||||
|
||||
Page<TbShopTableBooking> page = super.page(new Page<>(pageNum, pageSize), wrapper);
|
||||
return PageUtil.toPlusPage(page.getRecords(), Convert.toInt(page.getTotal()));
|
||||
}
|
||||
|
||||
private void commonVerify(TbShopTableBooking entity) {
|
||||
try {
|
||||
Assert.notNull(entity.getShopTableId(), "{}({})不能为空", "台桌id", "shopTableId");
|
||||
Assert.notNull(entity.getShopId(), "{}({})不能为空", "店铺id", "shopId");
|
||||
Assert.notNull(entity.getBookingDate(), "{}({})不能为空", "预约日期", "bookingDate");
|
||||
Assert.notEmpty(entity.getBookingType(), "{}({})不能为空", "预订类型(午餐/晚餐)", "bookingType");
|
||||
Assert.notNull(entity.getDinerNum(), "{}({})不能为空", "用餐人数", "dinerNum");
|
||||
Assert.notEmpty(entity.getPhoneNumber(), "{}({})不能为空", "电话号码", "phoneNumber");
|
||||
Assert.notEmpty(entity.getBookingPerson(), "{}({})不能为空", "订餐人", "bookingPerson");
|
||||
Assert.notNull(entity.getGender(), "{}({})不能为空", "性别/称呼", "gender");
|
||||
Assert.notNull(entity.getBookingTime(), "{}({})不能为空", "约定时间", "bookingTime");
|
||||
Assert.notEmpty(entity.getDiningType(), "{}({})不能为空", "用餐类型", "diningType");
|
||||
Assert.notNull(entity.getFocus(), "{}({})不能为空", "重点关注", "focus");
|
||||
Assert.notNull(entity.getReceiveMarketingSms(), "{}({})不能为空", "接收营销短信", "receiveMarketingSms");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String booking(TbShopTableBooking entity) {
|
||||
commonVerify(entity);
|
||||
if (DateUtil.compare(entity.getBookingTime(), new Date()) < 0) {
|
||||
throw new BadRequestException("预订日期(bookingDate)不能小于今天");
|
||||
}
|
||||
long existCount = baseMapper.selectCount(Wrappers.<TbShopTableBooking>lambdaQuery()
|
||||
.eq(TbShopTableBooking::getShopId, entity.getShopId())
|
||||
.eq(TbShopTableBooking::getShopTableId, entity.getShopTableId())
|
||||
.eq(TbShopTableBooking::getBookingDate, entity.getBookingDate())
|
||||
.eq(TbShopTableBooking::getBookingType, entity.getBookingType())
|
||||
.ne(TbShopTableBooking::getStatus, -1)
|
||||
.eq(TbShopTableBooking::getDelFlag, 0)
|
||||
);
|
||||
if (existCount > 0) {
|
||||
throw new BadRequestException(StrUtil.format("该台桌{}档在{}已被预订", BOOKING_TYPE.get(entity.getBookingType()), DateUtil.formatDate(entity.getBookingDate())));
|
||||
}
|
||||
String nextId = IdUtil.getSnowflakeNextIdStr();
|
||||
String seq = StrUtil.sub(nextId, -5, nextId.length());
|
||||
String orderNo = DateUtil.format(new Date(), "yyMMddHHmmss") + seq;
|
||||
entity.setOrderNo("BK" + orderNo);
|
||||
entity.setStatus(20);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreateUserName(SecurityUtils.getCurrentUserNickName());
|
||||
entity.setDelFlag(0);
|
||||
super.save(entity);
|
||||
return entity.getOrderNo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(TbShopTableBooking dto) {
|
||||
if (dto.getId() == null) {
|
||||
throw new BadRequestException("id不能为空");
|
||||
}
|
||||
commonVerify(dto);
|
||||
TbShopTableBooking entity = super.getById(dto.getId());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("预订信息不存在");
|
||||
}
|
||||
if (DateUtil.compare(dto.getBookingTime(), new Date()) < 0) {
|
||||
throw new BadRequestException("预订日期(bookingDate)不能小于今天");
|
||||
}
|
||||
long existCount = baseMapper.selectCount(Wrappers.<TbShopTableBooking>lambdaQuery()
|
||||
.ne(TbShopTableBooking::getId, entity.getId())
|
||||
.eq(TbShopTableBooking::getShopId, dto.getShopId())
|
||||
.eq(TbShopTableBooking::getShopTableId, dto.getShopTableId())
|
||||
.eq(TbShopTableBooking::getBookingDate, dto.getBookingDate())
|
||||
.eq(TbShopTableBooking::getBookingType, dto.getBookingType())
|
||||
.ne(TbShopTableBooking::getStatus, -1)
|
||||
.eq(TbShopTableBooking::getDelFlag, 0)
|
||||
);
|
||||
if (existCount > 0) {
|
||||
throw new BadRequestException(StrUtil.format("该台桌{}档在{}已被预订", BOOKING_TYPE.get(entity.getBookingType()), DateUtil.formatDate(entity.getBookingDate())));
|
||||
}
|
||||
BeanUtil.copyProperties(dto, entity, CopyOptions.create().setIgnoreNullValue(true).setIgnoreProperties("orderNo", "status", "createTime", "createUserName", "delFlag"));
|
||||
entity.setUpdateTime(new Date());
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void markStatus(Long id, Integer status) {
|
||||
if (id == null) {
|
||||
throw new BadRequestException("id不能为空");
|
||||
}
|
||||
if (status == null) {
|
||||
throw new BadRequestException("状态不能为空");
|
||||
}
|
||||
TbShopTableBooking entity = super.getById(id);
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("预订信息不存在");
|
||||
}
|
||||
entity.setStatus(status);
|
||||
entity.setUpdateTime(new Date());
|
||||
if (status == 10) {
|
||||
entity.setArrivedTime(new Date());
|
||||
} else {
|
||||
entity.setArrivedTime(null);
|
||||
}
|
||||
super.updateById(entity);
|
||||
mpShopTableMapper.update(Wrappers.<TbShopTable>lambdaUpdate()
|
||||
.set(TbShopTable::getStatus, "idle")
|
||||
.eq(TbShopTable::getStatus, "subscribe")
|
||||
.eq(TbShopTable::getId, entity.getShopTableId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
baseMapper.update(Wrappers.<TbShopTableBooking>lambdaUpdate()
|
||||
.set(TbShopTableBooking::getDelFlag, 1)
|
||||
.eq(TbShopTableBooking::getId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBookingSms(Integer shopId) {
|
||||
if (shopId == null) {
|
||||
throw new BadRequestException("shopId不能为空");
|
||||
}
|
||||
TbShopInfo shop = tbShopInfoRepository.getById(shopId);
|
||||
if (shop == null) {
|
||||
throw new BadRequestException("店铺信息不存在");
|
||||
}
|
||||
return shop.getBookingSms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbShopArea> findShopAreaList(Integer shopId) {
|
||||
List<TbShopTable> tableList = mpShopTableMapper.selectList(Wrappers.<TbShopTable>lambdaQuery().eq(TbShopTable::getShopId, shopId).eq(TbShopTable::getIsPredate, 1));
|
||||
if (CollUtil.isEmpty(tableList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<Integer> areaId = tableList.stream().map(TbShopTable::getAreaId).collect(Collectors.toSet());
|
||||
List<TbShopArea> areaList = mpShopAreaMapper.selectList(Wrappers.<TbShopArea>lambdaQuery().in(TbShopArea::getId, areaId));
|
||||
if (CollUtil.isEmpty(areaList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return areaList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
Integer areaId = mapProxy.getInt("areaId");
|
||||
TbShopTableBooking param = BeanUtil.toBean(params, TbShopTableBooking.class);
|
||||
List<TbShopTable> tableList = mpShopTableMapper.selectList(
|
||||
Wrappers.<TbShopTable>lambdaQuery()
|
||||
.eq(TbShopTable::getShopId, param.getShopId())
|
||||
.eq(TbShopTable::getIsPredate, 1)
|
||||
.eq(areaId != null, TbShopTable::getAreaId, areaId)
|
||||
.orderByAsc(TbShopTable::getName)
|
||||
);
|
||||
if (CollUtil.isEmpty(tableList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<ShopTableBookingDTO> result = BeanUtil.copyToList(tableList, ShopTableBookingDTO.class);
|
||||
Date bookingDate = param.getBookingDate();
|
||||
String bookingType = param.getBookingType();
|
||||
LambdaQueryWrapper<TbShopTableBooking> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(bookingDate != null, TbShopTableBooking::getBookingDate, bookingDate);
|
||||
wrapper.eq(StrUtil.isNotEmpty(bookingType), TbShopTableBooking::getBookingType, bookingType);
|
||||
wrapper.ne(TbShopTableBooking::getStatus, -1);
|
||||
wrapper.eq(TbShopTableBooking::getDelFlag, 0);
|
||||
List<TbShopTableBooking> list = super.list(wrapper);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return result;
|
||||
}
|
||||
for (ShopTableBookingDTO dto : result) {
|
||||
dto.setBookingInfo(list.stream().filter(item -> item.getShopTableId().equals(dto.getId()) && item.getStatus() != -1).findFirst().orElse(null));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> summary(Integer shopId, String[] phoneNos) {
|
||||
List<String> phoneNoList = Arrays.asList(phoneNos).stream().distinct().collect(Collectors.toList());
|
||||
List<List<String>> splits = CollUtil.split(phoneNoList, 10);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (List<String> split : splits) {
|
||||
List<Map<String, Object>> subList = baseMapper.summaryByPhoneNos(shopId, split);
|
||||
list.addAll(subList);
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>(phoneNoList.size());
|
||||
for (String phoneNo : phoneNos) {
|
||||
Map<String, Object> fillData = new HashMap<>(3);
|
||||
fillData.put("consumeOrders", 0);
|
||||
fillData.put("cancelOrders", 0);
|
||||
fillData.put("phoneNumber", phoneNo);
|
||||
Map<String, Object> data = list.stream().filter(item -> phoneNo.equals(item.get("phoneNumber"))).findFirst().orElse(fillData);
|
||||
result.put(phoneNo, data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markSubscribe(Integer shopTableId) {
|
||||
String today = DateUtil.today();
|
||||
LambdaQueryWrapper<TbShopTableBooking> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TbShopTableBooking::getBookingDate, today);
|
||||
wrapper.eq(shopTableId != null, TbShopTableBooking::getShopTableId, shopTableId);
|
||||
wrapper.ne(TbShopTableBooking::getStatus, -1);
|
||||
wrapper.eq(TbShopTableBooking::getDelFlag, 0);
|
||||
List<TbShopTableBooking> list = super.list(wrapper);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, List<TbShopTableBooking>> groupMap = list.stream().collect(Collectors.groupingBy(TbShopTableBooking::getShopTableId));
|
||||
groupMap.forEach((k, v) -> {
|
||||
mpShopTableMapper.update(Wrappers.<TbShopTable>lambdaUpdate()
|
||||
.set(TbShopTable::getStatus, "subscribe")
|
||||
.eq(TbShopTable::getStatus, "idle")
|
||||
.eq(TbShopTable::getId, k));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelSubscribe(Integer shopTableId) {
|
||||
String today = DateUtil.today();
|
||||
LambdaQueryWrapper<TbShopTableBooking> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TbShopTableBooking::getBookingDate, today);
|
||||
wrapper.eq(shopTableId != null, TbShopTableBooking::getShopTableId, shopTableId);
|
||||
//wrapper.ne(TbShopTableBooking::getStatus, -1);
|
||||
wrapper.eq(TbShopTableBooking::getDelFlag, 0);
|
||||
List<TbShopTableBooking> list = super.list(wrapper);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, List<TbShopTableBooking>> groupMap = list.stream().collect(Collectors.groupingBy(TbShopTableBooking::getShopTableId));
|
||||
groupMap.forEach((k, v) -> {
|
||||
long count = v.stream().filter(item -> item.getStatus() == -1).count();
|
||||
// 全部都取消了,则标记为空闲
|
||||
if (v.size() == count) {
|
||||
mpShopTableMapper.update(Wrappers.<TbShopTable>lambdaUpdate()
|
||||
.set(TbShopTable::getStatus, "idle")
|
||||
.eq(TbShopTable::getStatus, "subscribe")
|
||||
.eq(TbShopTable::getId, k)
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchTimeout() {
|
||||
baseMapper.update(Wrappers.<TbShopTableBooking>lambdaUpdate()
|
||||
.set(TbShopTableBooking::getStatus, 999)
|
||||
.set(TbShopTableBooking::getUpdateTime, new Date())
|
||||
.eq(TbShopTableBooking::getStatus, 20)
|
||||
.last("and TIMESTAMPDIFF(MINUTE, booking_time, NOW()) >= timeout_minute"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoCancel() {
|
||||
// 15分钟后自动取消
|
||||
baseMapper.update(Wrappers.<TbShopTableBooking>lambdaUpdate()
|
||||
.set(TbShopTableBooking::getStatus, -1)
|
||||
.set(TbShopTableBooking::getUpdateTime, new Date())
|
||||
.eq(TbShopTableBooking::getStatus, 999)
|
||||
.last("and TIMESTAMPDIFF(MINUTE, booking_time, NOW()) >= timeout_minute+15"));
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.ysk.cashier.mybatis.entity.TbThirdPartyCouponRecord;
|
||||
import cn.ysk.cashier.mybatis.service.TbThirdPartyCouponRecordService;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbThirdPartyCouponRecordMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_third_party_coupon_record】的数据库操作Service实现
|
||||
* @createDate 2024-11-25 17:57:03
|
||||
*/
|
||||
@Service
|
||||
public class TbThirdPartyCouponRecordServiceImpl extends ServiceImpl<TbThirdPartyCouponRecordMapper, TbThirdPartyCouponRecord>
|
||||
implements TbThirdPartyCouponRecordService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,17 +15,15 @@
|
||||
*/
|
||||
package cn.ysk.cashier.pojo.order;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
@@ -87,15 +85,15 @@ public class TbCashierCart implements Serializable {
|
||||
@Column(name = "`number`", nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "结余数量")
|
||||
private BigDecimal number;
|
||||
private Integer number;
|
||||
|
||||
@Column(name = "`total_number`")
|
||||
@ApiModelProperty(value = "总下单数量")
|
||||
private BigDecimal totalNumber;
|
||||
private Integer totalNumber;
|
||||
|
||||
@Column(name = "`refund_number`")
|
||||
@ApiModelProperty(value = "退单数量")
|
||||
private BigDecimal refundNumber;
|
||||
private Integer refundNumber;
|
||||
|
||||
@Column(name = "`category_id`")
|
||||
@ApiModelProperty(value = "分类Id")
|
||||
@@ -170,24 +168,6 @@ public class TbCashierCart implements Serializable {
|
||||
private Integer userCouponId;
|
||||
private BigDecimal memberPrice = BigDecimal.ZERO;
|
||||
private Integer isMember;
|
||||
// 是否临时菜品
|
||||
private Integer isTemporary;
|
||||
private String unit;
|
||||
private BigDecimal discountSaleAmount;
|
||||
private String discountSaleNote;
|
||||
private Boolean isPrint;
|
||||
private String useCouponInfo;
|
||||
// 是否团购券商品
|
||||
private Integer isThirdCoupon;
|
||||
// 是否等叫
|
||||
private Integer isWaitCall;
|
||||
// 套餐商品,选择的商品信息
|
||||
private String proGroupInfo;
|
||||
// 商品类型
|
||||
private String typeEnum;
|
||||
// 是否称重商品
|
||||
private Integer isWeight;
|
||||
|
||||
|
||||
public void copy(TbCashierCart source) {
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
@@ -197,53 +177,16 @@ public class TbCashierCart implements Serializable {
|
||||
* 根据是否会员充值价格
|
||||
*/
|
||||
public void resetTotalAmount() {
|
||||
if (isThirdCoupon != null && isThirdCoupon == 1) {
|
||||
totalAmount = BigDecimal.ZERO;
|
||||
return;
|
||||
}
|
||||
if ("false".equals(isPack)) {
|
||||
packFee = BigDecimal.ZERO;
|
||||
}
|
||||
if ("true".equals(isGift)) {
|
||||
totalAmount = packFee;
|
||||
} else {
|
||||
discountSaleAmount = discountSaleAmount == null ? BigDecimal.ZERO : discountSaleAmount;
|
||||
BigDecimal subtract;
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
subtract = memberPrice.subtract(discountSaleAmount);
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(memberPrice).add(packFee);
|
||||
} else {
|
||||
subtract = salePrice.subtract(discountSaleAmount);
|
||||
}
|
||||
totalAmount = totalNumber.multiply(subtract.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : subtract).add(packFee);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否会员充值价格
|
||||
*/
|
||||
public void resetTotalAmount(BigDecimal discountRadio) {
|
||||
if (isThirdCoupon != null && isThirdCoupon == 1) {
|
||||
totalAmount = BigDecimal.ZERO;
|
||||
return;
|
||||
}
|
||||
if (discountRadio == null) {
|
||||
discountRadio = BigDecimal.ONE;
|
||||
}
|
||||
if ("false".equals(isPack)) {
|
||||
packFee = BigDecimal.ZERO;
|
||||
}
|
||||
if ("true".equals(isGift)) {
|
||||
totalAmount = packFee;
|
||||
} else {
|
||||
discountSaleAmount = discountSaleAmount == null ? BigDecimal.ZERO : discountSaleAmount;
|
||||
BigDecimal subtract;
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
subtract = memberPrice.subtract(discountSaleAmount);
|
||||
totalAmount = totalNumber.multiply(subtract).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
} else {
|
||||
subtract = salePrice.subtract(discountSaleAmount);
|
||||
totalAmount = totalNumber.multiply(subtract)
|
||||
.add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(salePrice).add(packFee);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,29 +195,14 @@ public class TbCashierCart implements Serializable {
|
||||
* 获取总价不包含打包费
|
||||
*
|
||||
*/
|
||||
public BigDecimal getTotalAmountByNum(BigDecimal num, BigDecimal discountRadio) {
|
||||
if (isThirdCoupon != null && isThirdCoupon == 1) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (discountRadio == null) {
|
||||
discountRadio = new BigDecimal("1");
|
||||
}
|
||||
public BigDecimal getTotalAmountByNum(Integer num) {
|
||||
if (num == null) {
|
||||
num = totalNumber;
|
||||
}
|
||||
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
return num.multiply(memberPrice.subtract(NumberUtil.null2Zero(discountSaleAmount))).multiply(discountRadio).add(packFee).setScale(2, RoundingMode.HALF_UP);
|
||||
}else {
|
||||
return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
return BigDecimal.valueOf(num).multiply(memberPrice);
|
||||
} else {
|
||||
return BigDecimal.valueOf(num).multiply(salePrice);
|
||||
}
|
||||
// if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// return num.multiply(memberPrice);
|
||||
// } else {
|
||||
// return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package cn.ysk.cashier.pojo.order;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@@ -62,7 +61,7 @@ public class TbOrderDetail implements Serializable {
|
||||
|
||||
@Column(name = "`num`")
|
||||
@ApiModelProperty(value = "num")
|
||||
private BigDecimal num;
|
||||
private Integer num;
|
||||
|
||||
@Column(name = "`product_name`")
|
||||
@ApiModelProperty(value = "productName")
|
||||
@@ -104,7 +103,7 @@ public class TbOrderDetail implements Serializable {
|
||||
@Transient
|
||||
@ApiModelProperty(value = "退单数量")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal refundNumber;
|
||||
private Integer refundNumber;
|
||||
|
||||
@Column(name = "`is_vip`")
|
||||
@ApiModelProperty(value = "isVip")
|
||||
@@ -132,20 +131,8 @@ public class TbOrderDetail implements Serializable {
|
||||
private BigDecimal memberPrice;
|
||||
private Integer userCouponId;
|
||||
private Integer isMember;
|
||||
private Integer isTemporary;
|
||||
private String discountSaleNote;
|
||||
private BigDecimal discountSaleAmount;
|
||||
private Boolean isPrint;
|
||||
private String useCouponInfo;
|
||||
private BigDecimal returnAmount;
|
||||
private BigDecimal canReturnAmount;
|
||||
private Integer isThirdCoupon;
|
||||
private Integer isWaitCall;
|
||||
private String proGroupInfo;
|
||||
private Integer isWeight;
|
||||
|
||||
public void copy(TbOrderDetail source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -252,11 +252,8 @@ public class TbOrderInfo implements Serializable {
|
||||
// 满减抵扣金额
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
private Integer isPostpaid;
|
||||
private Integer isWaitCall;
|
||||
private String creditBuyerId;
|
||||
|
||||
public void copy(TbOrderInfo source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package cn.ysk.cashier.pojo.product;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.ysk.cashier.vo.ProductGroupVo;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -51,6 +50,14 @@ public class TbProduct implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`source_path`")
|
||||
@ApiModelProperty(value = "商品来源 NORMAL普通商品 --,SCORE积分商品")
|
||||
private String sourcePath="NORMAL";
|
||||
|
||||
@Column(name = "`merchant_id`")
|
||||
@ApiModelProperty(value = "商户Id")
|
||||
private String merchantId = "PLANT_ID";
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "店铺id")
|
||||
private String shopId;
|
||||
@@ -59,6 +66,10 @@ public class TbProduct implements Serializable {
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "商品类型(属性):REAL- 实物商品 VIR---虚拟商品")
|
||||
private String type = "REAL";
|
||||
|
||||
@Column(name = "`pack_fee`")
|
||||
@ApiModelProperty(value = "包装费")
|
||||
private BigDecimal packFee;
|
||||
@@ -72,10 +83,6 @@ public class TbProduct implements Serializable {
|
||||
@ApiModelProperty(value = "单位Id")
|
||||
private Integer unitId;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String unitName;
|
||||
|
||||
@Column(name = "`cover_img`")
|
||||
@ApiModelProperty(value = "商品封面图")
|
||||
private String coverImg;
|
||||
@@ -88,35 +95,84 @@ public class TbProduct implements Serializable {
|
||||
@ApiModelProperty(value = "商品规格")
|
||||
private Integer specId;
|
||||
|
||||
@Column(name = "`brand_id`")
|
||||
@ApiModelProperty(value = "品牌Id")
|
||||
private Integer brandId;
|
||||
|
||||
@Column(name = "`short_title`")
|
||||
@ApiModelProperty(value = "短标题--促销语")
|
||||
private String shortTitle;
|
||||
|
||||
@Column(name = "`low_member_price`")
|
||||
@ApiModelProperty(value = "lowMemberPrice")
|
||||
private BigDecimal lowMemberPrice;
|
||||
|
||||
@Column(name = "`unit_snap`")
|
||||
@ApiModelProperty(value = "单位镜像")
|
||||
private String unitSnap;
|
||||
|
||||
@Column(name = "`share_img`")
|
||||
@ApiModelProperty(value = "商品分享图")
|
||||
private String shareImg;
|
||||
|
||||
@Column(name = "`images`")
|
||||
@ApiModelProperty(value = "商品图片(第一张为缩略图,其他为详情)")
|
||||
private String images;
|
||||
|
||||
@Column(name = "`video`")
|
||||
@ApiModelProperty(value = "商品视频URL地址")
|
||||
private String video;
|
||||
|
||||
@Column(name = "`video_cover_img`")
|
||||
@ApiModelProperty(value = "视频封面图")
|
||||
private String videoCoverImg;
|
||||
|
||||
@Column(name = "`sort`")
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort = 0;
|
||||
|
||||
@Column(name = "`limit_number`")
|
||||
@ApiModelProperty(value = "0-不限购")
|
||||
private Integer limitNumber = 0;
|
||||
|
||||
@Column(name = "`product_score`")
|
||||
@ApiModelProperty(value = "商品赚送积分")
|
||||
private Integer productScore;
|
||||
|
||||
@Column(name = "`status`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "0--待审核 1审核通过 -1审核失败 -2违规下架")
|
||||
private Integer status = 0;
|
||||
|
||||
@Column(name = "`fail_msg`")
|
||||
@ApiModelProperty(value = "审核失败原因")
|
||||
private String failMsg;
|
||||
|
||||
@Column(name = "`is_recommend`")
|
||||
@ApiModelProperty(value = "是否推荐,店铺推荐展示")
|
||||
private Integer isRecommend = 0;
|
||||
|
||||
@Column(name = "`is_hot`")
|
||||
@ApiModelProperty(value = "是否热销")
|
||||
private Integer isHot = 0;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "商品类型(属性):普通商品 normal 套餐商品 package 称重商品 weigh 团购券 coupon")
|
||||
private String type;
|
||||
@Column(name = "`is_new`")
|
||||
@ApiModelProperty(value = "是否新品")
|
||||
private Integer isNew;
|
||||
|
||||
@Column(name = "`is_on_sale`")
|
||||
@ApiModelProperty(value = "是否促销1-是0-否")
|
||||
private Integer isOnSale = 0;
|
||||
|
||||
@Column(name = "`is_show`")
|
||||
@ApiModelProperty(value = "是否展示0-下架 1上架---废弃")
|
||||
private Integer isShow = 0;
|
||||
|
||||
@Column(name = "`type_enum`")
|
||||
@ApiModelProperty(value = "商品规格:normal-单规格 sku-多规格")
|
||||
@ApiModelProperty(value = "商品规格:0-单规格 1多规格")
|
||||
private String typeEnum;
|
||||
|
||||
|
||||
@Column(name = "`is_del`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否回收站 0-否,1回收站")
|
||||
@@ -130,22 +186,120 @@ public class TbProduct implements Serializable {
|
||||
@ApiModelProperty(value = "是否暂停销售")
|
||||
private Integer isPauseSale = 0;
|
||||
|
||||
@Column(name = "`is_free_freight`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否免邮1-是 0-否")
|
||||
private Integer isFreeFreight=1;
|
||||
|
||||
@Column(name = "`freight_id`")
|
||||
@ApiModelProperty(value = "邮费模版")
|
||||
private Long freightId;
|
||||
|
||||
@Column(name = "`strategy_type`")
|
||||
@ApiModelProperty(value = "商品当前生效策略")
|
||||
private String strategyType;
|
||||
|
||||
@Column(name = "`strategy_id`")
|
||||
@ApiModelProperty(value = "策略Id")
|
||||
private Integer strategyId = 1;
|
||||
|
||||
@Column(name = "`is_vip`")
|
||||
@ApiModelProperty(value = "vip专属")
|
||||
private Integer isVip = 0;
|
||||
|
||||
@Column(name = "`is_delete`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer isDelete = 0;
|
||||
|
||||
@Column(name = "`notice`")
|
||||
@ApiModelProperty(value = "购买须知")
|
||||
private String notice;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Long createdAt;
|
||||
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
@Column(name = "`group_type`")
|
||||
@ApiModelProperty(value = "套餐类型 0固定套餐 1可选套餐")
|
||||
private Integer groupType;
|
||||
@Column(name = "`base_sales_number`")
|
||||
@ApiModelProperty(value = "基础出售数量")
|
||||
private Double baseSalesNumber =0.00;
|
||||
|
||||
@Column(name = "`real_sales_number`")
|
||||
@ApiModelProperty(value = "实际销量")
|
||||
private Integer realSalesNumber = 0;
|
||||
|
||||
@Column(name = "`sales_number`")
|
||||
@ApiModelProperty(value = "合计销量")
|
||||
private Integer salesNumber = 0;
|
||||
|
||||
@Column(name = "`thumb_count`")
|
||||
@ApiModelProperty(value = "点赞次数")
|
||||
private Integer thumbCount = 0;
|
||||
|
||||
@Column(name = "`store_count`")
|
||||
@ApiModelProperty(value = "收藏次数")
|
||||
private Integer storeCount = 0;
|
||||
|
||||
@Column(name = "`furnish_meal`")
|
||||
@ApiModelProperty(value = "支持堂食")
|
||||
private Integer furnishMeal = 0;
|
||||
|
||||
@Column(name = "`furnish_express`")
|
||||
@ApiModelProperty(value = "支持配送")
|
||||
private Integer furnishExpress = 0;
|
||||
|
||||
@Column(name = "`furnish_draw`")
|
||||
@ApiModelProperty(value = "支持自提")
|
||||
private Integer furnishDraw = 0;
|
||||
|
||||
@Column(name = "`furnish_vir`")
|
||||
@ApiModelProperty(value = "支持虚拟")
|
||||
private Integer furnishVir = 0;
|
||||
|
||||
@Column(name = "`is_combo`")
|
||||
@ApiModelProperty(value = "是否套餐")
|
||||
private Integer isCombo =0;
|
||||
|
||||
@Column(name = "`group_snap`")
|
||||
@ApiModelProperty(value = "套餐内容")
|
||||
private String groupSnap;
|
||||
|
||||
@Column(name = "`is_show_cash`")
|
||||
@ApiModelProperty(value = "isShowCash")
|
||||
private Integer isShowCash =0;
|
||||
|
||||
@Column(name = "`is_show_mall`")
|
||||
@ApiModelProperty(value = "isShowMall")
|
||||
private Integer isShowMall = 0;
|
||||
|
||||
@Column(name = "`is_need_examine`")
|
||||
@ApiModelProperty(value = "是否需要审核")
|
||||
private Integer isNeedExamine = 0;
|
||||
|
||||
@Column(name = "`show_on_mall_status`")
|
||||
@ApiModelProperty(value = "线上商城展示状态0待审核 -1 异常 1正常")
|
||||
private Integer showOnMallStatus = 1;
|
||||
|
||||
@Column(name = "`show_on_mall_time`")
|
||||
@ApiModelProperty(value = "提交审核时间")
|
||||
private Long showOnMallTime;
|
||||
|
||||
@Column(name = "`show_on_mall_error_msg`")
|
||||
@ApiModelProperty(value = "线上商城展示失败原因")
|
||||
private String showOnMallErrorMsg;
|
||||
|
||||
@Column(name = "`enable_label`")
|
||||
@ApiModelProperty(value = "使用标签打印 选择 是 并在 前台>本机设置 勾选打印标签后,收银完成后会自动打印对应数量的标签数")
|
||||
private Integer enableLabel = 0;
|
||||
|
||||
@Column(name = "`tax_config_id`")
|
||||
@ApiModelProperty(value = "税率")
|
||||
private String taxConfigId;
|
||||
|
||||
@Column(name = "spec_info")
|
||||
@ApiModelProperty(value = "specInfo")
|
||||
private String specInfo;
|
||||
@@ -178,42 +332,6 @@ public class TbProduct implements Serializable {
|
||||
@ApiModelProperty("库存警戒线")
|
||||
private Integer warnLine = 0;
|
||||
|
||||
@Column(name = "show_type")
|
||||
@ApiModelProperty("堂食 table 自取 dine 配送 delivery 快递 express")
|
||||
private String showType;
|
||||
|
||||
@Column(name = "weight")
|
||||
@ApiModelProperty("称重 价格/千克")
|
||||
private BigDecimal weight;
|
||||
|
||||
@Column(name = "is_temp_price")
|
||||
@ApiModelProperty("是否允许临时改价")
|
||||
private Integer isTempPrice = 0;
|
||||
|
||||
@Column(name = "day_limit")
|
||||
@ApiModelProperty("日销售上限")
|
||||
private Integer dayLimit = 0;
|
||||
|
||||
@Column(name = "single_order_limit")
|
||||
@ApiModelProperty("每单销售上限")
|
||||
private Integer singleOrderLimit = 0;
|
||||
|
||||
@Column(name = "single_people_limit")
|
||||
@ApiModelProperty("每人销售上限")
|
||||
private Integer singlePeopleLimit = 0;
|
||||
|
||||
@Column(name = "days")
|
||||
@ApiModelProperty("周数组 周一,周二,周日")
|
||||
private String days;
|
||||
|
||||
@Column(name = "start_time")
|
||||
@ApiModelProperty("可用开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Column(name = "end_time")
|
||||
@ApiModelProperty("可用结束时间")
|
||||
private String endTime;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private TbProductSkuResult skuResult;
|
||||
@@ -221,9 +339,7 @@ public class TbProduct implements Serializable {
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<Map<String, Object>> specList;
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<ProductGroupVo> proGroupVo;
|
||||
|
||||
|
||||
public void copy(TbProduct source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
|
||||
@@ -131,22 +131,6 @@ public class TbMerchantAccount implements Serializable {
|
||||
@ApiModelProperty(value = "操作密码")
|
||||
private String pwd;
|
||||
|
||||
@Column(name = "`bind_account`")
|
||||
@ApiModelProperty(value = "开票系统账号")
|
||||
private String bindAccount;
|
||||
|
||||
@Column(name = "`article`")
|
||||
@ApiModelProperty(value = "项目分类")
|
||||
private String article;
|
||||
|
||||
@Column(name = "`sd_type`")
|
||||
@ApiModelProperty(value = "数电发票类型")
|
||||
private String sdType;
|
||||
|
||||
@Column(name = "`tax_amount`")
|
||||
@ApiModelProperty(value = "税率")
|
||||
private String taxAmount;
|
||||
|
||||
public void copy(TbMerchantAccount source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -15,15 +15,14 @@
|
||||
*/
|
||||
package cn.ysk.cashier.pojo.shop;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -42,10 +41,6 @@ public class TbShopInfo implements Serializable {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`main_id`")
|
||||
@ApiModelProperty(value = "总店铺帐号")
|
||||
private String mainId;
|
||||
|
||||
@Column(name = "`account`")
|
||||
@ApiModelProperty(value = "店铺帐号")
|
||||
private String account;
|
||||
@@ -143,13 +138,9 @@ public class TbShopInfo implements Serializable {
|
||||
private String city;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "店铺类型 单店--only 连锁店--chain--加盟店join")
|
||||
@ApiModelProperty(value = "店铺类型 超市--MARKET---其它店SHOP")
|
||||
private String type;
|
||||
|
||||
@Column(name = "`tube_type`")
|
||||
@ApiModelProperty(value = "管理 0否 1是")
|
||||
private Integer tubeType;
|
||||
|
||||
@Column(name = "`industry`")
|
||||
@ApiModelProperty(value = "行业")
|
||||
private String industry;
|
||||
@@ -180,7 +171,7 @@ public class TbShopInfo implements Serializable {
|
||||
|
||||
@Column(name = "`on_sale`")
|
||||
@ApiModelProperty(value = "0停业1,正常营业,网上售卖")
|
||||
private Integer onSale = 1;
|
||||
private Integer onSale;
|
||||
|
||||
@Column(name = "`settle_type`")
|
||||
@ApiModelProperty(value = "0今日,1次日")
|
||||
@@ -253,33 +244,33 @@ public class TbShopInfo implements Serializable {
|
||||
|
||||
@Column(name = "is_custom")
|
||||
@ApiModelProperty(value = "是否允许用户自定义金额")
|
||||
private String isCustom = "0";
|
||||
private String isCustom;
|
||||
|
||||
|
||||
@Column(name = "is_return")
|
||||
@ApiModelProperty(value = "是否开启退款密码 ")
|
||||
private String isReturn = "0";
|
||||
@ApiModelProperty(value = "是否允许用户自定义金额")
|
||||
private String isReturn;
|
||||
|
||||
|
||||
@Column(name = "is_member_in")
|
||||
@ApiModelProperty(value = "是否开启会员充值密码 ")
|
||||
private String isMemberIn = "0";
|
||||
@ApiModelProperty(value = "是否允许用户自定义金额")
|
||||
private String isMemberIn;
|
||||
|
||||
@Column(name = "is_member_return")
|
||||
@ApiModelProperty(value = "是否开启会员退款密码 ")
|
||||
private String isMemberReturn = "0";
|
||||
@ApiModelProperty(value = "是否允许用户自定义金额")
|
||||
private String isMemberReturn;
|
||||
|
||||
@Column(name = "is_member_price")
|
||||
@ApiModelProperty(value = "是否启用会员价 0否1是")
|
||||
private Integer isMemberPrice = 0;
|
||||
private Integer isMemberPrice;
|
||||
|
||||
@Column(name = "consume_colony")
|
||||
@ApiModelProperty(value = "积分群体 all-所有 vip-仅针对会员")
|
||||
private String consumeColony = "all";
|
||||
private String consumeColony;
|
||||
|
||||
@Column(name = "is_table_fee")
|
||||
@ApiModelProperty(value = "是否免除桌位费 0否1是")
|
||||
private Integer isTableFee = 1;
|
||||
private Integer isTableFee;
|
||||
|
||||
@Column(name = "table_fee")
|
||||
@ApiModelProperty(value = "桌位费")
|
||||
@@ -296,14 +287,6 @@ public class TbShopInfo implements Serializable {
|
||||
@ApiModelProperty(value = "店铺收款码")
|
||||
private String paymentQrcode;
|
||||
|
||||
@Column(name = "booking_sms")
|
||||
@ApiModelProperty(value = "台桌预订短信")
|
||||
private String bookingSms;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String registerCode;
|
||||
|
||||
public void copy(TbShopInfo source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.ysk.cashier.pojo.shop;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.SuppFlow;
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -10,7 +23,6 @@ import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -82,14 +94,7 @@ public class TbShopPurveyorTransact implements Serializable {
|
||||
@ApiModelProperty(value = "type")
|
||||
private String type;
|
||||
|
||||
@Column(name = "`con_infos`")
|
||||
private String conInfos;
|
||||
|
||||
@Transient
|
||||
private List<SuppFlow.ConInfos> conFlows;
|
||||
|
||||
@Transient
|
||||
private List<TbConsInfo> cons;
|
||||
|
||||
|
||||
public void copy(TbShopPurveyorTransact source){
|
||||
|
||||
@@ -2,7 +2,6 @@ package cn.ysk.cashier.quartz.task;
|
||||
|
||||
import cn.ysk.cashier.dto.product.StockCountDTO;
|
||||
import cn.ysk.cashier.mybatis.service.TbPointsExchangeRecordService;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopTableBookingService;
|
||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||
import cn.ysk.cashier.repository.order.StockCountRepository;
|
||||
@@ -47,8 +46,6 @@ public class TestTask {
|
||||
private EntityManager entityManager;
|
||||
@Autowired
|
||||
private TbPointsExchangeRecordService tbPointsExchangeRecordService;
|
||||
@Autowired
|
||||
private TbShopTableBookingService tbShopTableBookingService;
|
||||
private final TbCashierCartService tbCashierCartService;
|
||||
private final TbOrderInfoService orderInfoService;
|
||||
|
||||
@@ -106,13 +103,6 @@ public class TestTask {
|
||||
public void cancelPointsExchangeOrder(){
|
||||
log.info("积分商品订单取消定时任务执行");
|
||||
tbPointsExchangeRecordService.authCancel();
|
||||
log.info("当日预订台桌打标记-预订状态");
|
||||
tbShopTableBookingService.markSubscribe(null);
|
||||
tbShopTableBookingService.cancelSubscribe(null);
|
||||
log.info("预定订单超时定时任务执行");
|
||||
tbShopTableBookingService.batchTimeout();
|
||||
log.info("预定订单取消定时任务执行");
|
||||
tbShopTableBookingService.autoCancel();
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -171,8 +171,8 @@ public interface TbOrderDetailRepository extends JpaRepository<TbOrderDetail, In
|
||||
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderSalesCountByDayVo(" +
|
||||
"COALESCE(SUM(CASE WHEN orders.orderType!='return' THEN info.num ELSE 0 END),0), " +
|
||||
"COALESCE(SUM(CASE WHEN orders.orderType='return' THEN info.num ELSE 0 END),0))" +
|
||||
"COALESCE(CAST(SUM(CASE WHEN orders.orderType!='return' THEN info.num ELSE 0 END) as long),0), " +
|
||||
"COALESCE(CAST(SUM(CASE WHEN orders.orderType='return' THEN info.num ELSE 0 END) as long),0))" +
|
||||
"FROM TbOrderInfo orders " +
|
||||
"LEFT JOIN TbOrderDetail info on orders.id=info.orderId " +
|
||||
"WHERE info.shopId = :shopId " +
|
||||
|
||||
@@ -2,7 +2,6 @@ package cn.ysk.cashier.repository.product;
|
||||
import cn.ysk.cashier.pojo.product.TbProductGroup;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
@@ -24,13 +23,4 @@ public interface TbProductGroupRepository extends JpaRepository<TbProductGroup,
|
||||
|
||||
@Query("SELECT groups from TbProductGroup groups where groups.id in :productIds order by groups.sort")
|
||||
List<TbProductGroup> findByIds(List<Integer> productIds);
|
||||
|
||||
@Query("SELECT groups from TbProductGroup groups where groups.shopId = :shopId")
|
||||
List<TbProductGroup> searchGroupByShopId(@Param("shopId") Integer shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("delete from TbProductGroup groups where groups.shopId = :shopId")
|
||||
void clearShopGroup(@Param("shopId") Integer shopId);
|
||||
|
||||
|
||||
}
|
||||
@@ -14,48 +14,37 @@ import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
public interface TbProductRepository extends JpaRepository<TbProduct, Integer>, JpaSpecificationExecutor<TbProduct> {
|
||||
|
||||
|
||||
@Query("SELECT product from TbProduct product where product.id in :productIds order by product.sort")
|
||||
List<TbProduct> findByIds(List<Integer> productIds);
|
||||
|
||||
@Query("SELECT product from TbProduct product where product.shopId = :shopId and product.status=1 and product.isDel=0 and product.type in ('coupon','package') ")
|
||||
List<TbProduct> findPackageByShopId(@Param("shopId") String shopId);
|
||||
|
||||
|
||||
@Query("SELECT product from TbProduct product where product.shopId = :shopId and product.status=1 and product.isDel=0")
|
||||
List<TbProduct> findByShopId(@Param("shopId") String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("delete FROM TbProduct product where product.shopId = :shopId")
|
||||
void clearShopPro(@Param("shopId") String shopId);
|
||||
|
||||
@Query(value = "update tb_product set status = -1 and is_del = 1 where id in :productIds", nativeQuery = true)
|
||||
@Query(value = "update tb_product set status = -1 where id in :productIds",nativeQuery = true)
|
||||
@Modifying
|
||||
void updateByStatus(List<Integer> productIds);
|
||||
|
||||
@Modifying
|
||||
@Query("update FROM TbProduct pro set pro.stockNumber=:stockNumber WHERE pro.id =:productId")
|
||||
void updateProductStockNumber(@Param("productId") Integer productId, @Param("stockNumber") Integer stockNumber);
|
||||
void updateProductStockNumber(@Param("productId") Integer productId,@Param("stockNumber") Integer stockNumber);
|
||||
|
||||
@Modifying
|
||||
@Query("update FROM TbProduct pro set pro.stockNumber=pro.stockNumber+:number WHERE pro.id =:productId")
|
||||
void incrProductStockNumber(Integer productId, BigDecimal number);
|
||||
void incrProductStockNumber(Integer productId, Integer number);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update FROM TbProduct pro set pro.stockNumber=:stocktakinNum where pro.id=:id and pro.stockNumber=:stockNumber")
|
||||
Integer updateStock(@Param("id") Integer id, @Param("stockNumber") Integer stockNumber,
|
||||
@Param("stocktakinNum") Integer stocktakinNum);
|
||||
Integer updateStock(@Param("id") Integer id,@Param("stockNumber") Integer stockNumber,
|
||||
@Param("stocktakinNum") Integer stocktakinNum);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbProduct set stockNumber=stockNumber+:num where id=:id")
|
||||
void incrStock(@Param("id") Integer id, @Param("num") BigDecimal num);
|
||||
void incrStock(@Param("id") Integer id, @Param("num") Integer num);
|
||||
|
||||
|
||||
@Query("select product from TbProduct product where product.shopId=:shopId")
|
||||
@@ -75,6 +64,6 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("UPDATE TbProduct p SET p.warnLine = :warnLine WHERE p.shopId = :shopId")
|
||||
Integer updateWarnLineByShopId(@Param("warnLine") Integer warnLine, @Param("shopId") String shopId);
|
||||
Integer updateWarnLineByShopId(@Param("warnLine")Integer warnLine, @Param("shopId")String shopId);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,12 +22,6 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId = :productId and sku.isDel=0")
|
||||
List<TbProductSku> searchSku(@Param("productId")String productId);
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.shopId = :shopId and sku.isDel=0")
|
||||
List<TbProductSku> searchSkuByShopId(@Param("shopId")String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("delete FROM TbProductSku sku WHERE sku.shopId = :shopId ")
|
||||
void clearShopSku(@Param("shopId")String shopId);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@@ -56,16 +50,4 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
@Modifying
|
||||
@Query("update TbProductSku set salePrice = :salePrice where productId= :productId")
|
||||
void upSalePrice(@Param("productId") String productId, @Param("lowPrice") BigDecimal salePrice);
|
||||
|
||||
@Query(value =
|
||||
"SELECT " +
|
||||
" sum( real_sales_number )," +
|
||||
" product_id " +
|
||||
" FROM" +
|
||||
" tb_product_sku " +
|
||||
" WHERE" +
|
||||
" product_id IN :ids" +
|
||||
" GROUP BY" +
|
||||
" product_id", nativeQuery = true)
|
||||
List<Object[]> searchProRealSalesNumber(@Param("ids") List<Integer> ids);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.ysk.cashier.repository.product;
|
||||
|
||||
import cn.ysk.cashier.pojo.product.TbProductSkuResult;
|
||||
|
||||
@@ -1,50 +1,41 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.ysk.cashier.repository.product;
|
||||
|
||||
import cn.ysk.cashier.pojo.product.TbProductSpec;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
* @website https://eladmin.vip
|
||||
* @date 2024-01-03
|
||||
**/
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-03
|
||||
**/
|
||||
public interface TbProductSpecRepository extends JpaRepository<TbProductSpec, Integer>, JpaSpecificationExecutor<TbProductSpec> {
|
||||
|
||||
@Query("SELECT spec FROM TbProductSpec spec WHERE spec.id IN :ids")
|
||||
List<TbProductSpec> searchSpec(@Param("ids") List<Integer> ids);
|
||||
List<TbProductSpec> searchSpec(@Param("ids")List<Integer> ids);
|
||||
|
||||
@Query("SELECT spec FROM TbProductSpec spec WHERE spec.id = :ids")
|
||||
TbProductSpec searchSpec(@Param("ids") Integer ids);
|
||||
TbProductSpec searchSpec(@Param("ids")Integer ids);
|
||||
|
||||
@Query("SELECT spec FROM TbProductSpec spec WHERE spec.shopId = :shopId and spec.name = :name")
|
||||
TbProductSpec findAllByName(@Param("shopId") String shopId, @Param("name") String name);
|
||||
|
||||
|
||||
@Query("SELECT spec FROM TbProductSpec spec WHERE spec.shopId = :shopId")
|
||||
List<TbProductSpec> searchSpecByShopId(@Param("shopId") String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("delete FROM TbProductSpec spec WHERE spec.shopId = :shopId")
|
||||
void clearShopSpec(@Param("shopId") String shopId);
|
||||
TbProductSpec findAllByName(@Param("shopId")String shopId, @Param("name")String name);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user