Compare commits
2 Commits
ww-多门店-数据同
...
gyj
| 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) {
|
||||
|
||||
@@ -137,7 +137,6 @@ public class AuthorizationController {
|
||||
put("user", jwtUserDto);
|
||||
if (byAccount != null) {
|
||||
put("shopId", byAccount.getId());
|
||||
put("mainId", byAccount.getId());
|
||||
put("loginType", org.apache.commons.lang3.StringUtils.isNotBlank(authUser.getLoginType())?authUser.getLoginType():"merchant");
|
||||
put("shopName", byAccount.getShopName());
|
||||
put("logo", byAccount.getLogo());
|
||||
|
||||
@@ -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 /
|
||||
|
||||
@@ -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_prosku_con 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 TbProskuCon 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=?1 ",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));
|
||||
|
||||
@@ -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,68 +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){
|
||||
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);
|
||||
long between = DateUtil.between(new Date(), tbShopSyncInfo1.getSyncTime(), DateUnit.HOUR);
|
||||
if(between > 24){
|
||||
throw new RuntimeException("数据同步已超过一天 无法清除");
|
||||
}
|
||||
tbShopSyncInfoService.clear(tbShopSyncInfo);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package cn.ysk.cashier.controller;
|
||||
|
||||
import cn.ysk.cashier.service.ThirdPartyCouponService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 三方团购券
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/thirdPartyCoupon")
|
||||
public class ThirdPartyCouponController {
|
||||
|
||||
private final ThirdPartyCouponService thirdPartyCouponService;
|
||||
|
||||
public ThirdPartyCouponController(ThirdPartyCouponService thirdPartyCouponService) {
|
||||
this.thirdPartyCouponService = thirdPartyCouponService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取美团绑定链接
|
||||
* @return 美团绑定链接
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseEntity<String> getBindUrl(@RequestParam Integer shopId) {
|
||||
return ResponseEntity.ok(thirdPartyCouponService.getBindUrl(shopId));
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package cn.ysk.cashier.controller.booking;
|
||||
|
||||
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);
|
||||
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);
|
||||
return ResponseEntity.ok().body(ret);
|
||||
}
|
||||
|
||||
@PostMapping("mark-status")
|
||||
@ApiOperation("修改预订状态")
|
||||
public ResponseEntity markStatus(@RequestBody TbShopTableBooking dto) {
|
||||
tbShopTableBookingService.markStatus(dto.getId(), dto.getStatus());
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@ApiOperation("删除")
|
||||
public ResponseEntity delete(@PathVariable("id") Long id) {
|
||||
tbShopTableBookingService.delete(id);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@GetMapping("sms/{id}")
|
||||
@ApiOperation("获取待发送的短信内容")
|
||||
public ResponseEntity sms(@PathVariable("id") Long id) {
|
||||
String smsContent = tbShopTableBookingService.getBookingSms(id);
|
||||
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);
|
||||
}
|
||||
|
||||
@GetMapping("summary")
|
||||
@ApiOperation("根据电话号码统计历史预订信息")
|
||||
public ResponseEntity summary(@RequestBody String[] phoneNos) {
|
||||
Map<String, Object> data = tbShopTableBookingService.summary(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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -76,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) {
|
||||
|
||||
@@ -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,22 +43,8 @@ public class TbShopTableQueryCriteria{
|
||||
|
||||
@Query
|
||||
private Long qrcode;
|
||||
|
||||
/**
|
||||
* 是否接受网络预订
|
||||
*/
|
||||
@Query
|
||||
private Integer isPredate;
|
||||
private String state;
|
||||
|
||||
private Integer page = 1;
|
||||
private Integer size = 99999;
|
||||
|
||||
public Integer getIsPredate() {
|
||||
return isPredate;
|
||||
}
|
||||
|
||||
public void setIsPredate(Integer isPredate) {
|
||||
this.isPredate = isPredate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class AddCartDTO {
|
||||
@@ -17,8 +19,8 @@ public class AddCartDTO {
|
||||
private Integer shopId;
|
||||
private String tableId;
|
||||
@NotNull
|
||||
@DecimalMin("0.01")
|
||||
private BigDecimal num;
|
||||
@Min(1)
|
||||
private Integer num;
|
||||
private boolean isPack;
|
||||
private boolean isGift;
|
||||
private Integer cartId;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,9 +19,9 @@ 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 String token;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,27 +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;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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("0.01")
|
||||
@NotNull
|
||||
private BigDecimal saleAmount;
|
||||
@NotBlank(message = "折扣原因不能为空")
|
||||
private String note;
|
||||
}
|
||||
@@ -1,104 +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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 查询包含打包费和是否赠送的订单详情信息
|
||||
|
||||
@@ -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("phoneNoList") List<String> phoneNoList);
|
||||
|
||||
}
|
||||
@@ -60,11 +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);
|
||||
List<TbCashierCart> selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId);
|
||||
|
||||
/**
|
||||
* 根据订单id和状态获取购物车数据
|
||||
@@ -75,20 +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);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import cn.ysk.cashier.pojo.order.TbFullOrderDetail;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -47,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查询订单详情
|
||||
@@ -64,19 +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);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -41,6 +40,5 @@ public interface MpOrderInfoService extends IService<TbOrderInfo> {
|
||||
*/
|
||||
TbOrderInfo selectOrderByIdAndState(Integer orderId, TableConstant.OrderInfo.Status status);
|
||||
|
||||
boolean incrAmount(Integer orderId, BigDecimal subtract);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +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.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);
|
||||
|
||||
}
|
||||
@@ -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,41 +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 id 预订id
|
||||
*/
|
||||
String getBookingSms(Long id);
|
||||
|
||||
List<TbShopArea> findShopAreaList(Integer shopId);
|
||||
|
||||
List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> summary(String[] phoneNos);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -109,19 +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, CollUtil.newArrayList(statuses));
|
||||
}
|
||||
|
||||
// 非堂食校验台桌状态
|
||||
if (shopEatTypeInfoDTO.isTakeout()) {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
@@ -145,44 +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, CollUtil.newArrayList(statuses));
|
||||
}
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -12,7 +11,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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;
|
||||
@@ -51,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
|
||||
@@ -73,20 +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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -13,8 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* (TbShopPermission)表服务实现类
|
||||
*
|
||||
@@ -43,18 +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))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,247 +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.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账账单
|
||||
*
|
||||
* @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 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<>(4);
|
||||
// 总交易笔数
|
||||
data.put("count", count);
|
||||
|
||||
// 总交易金额
|
||||
BigDecimal payAmount = baseMapper.getSumPayAmount(params);
|
||||
data.put("payAmountTotal", payAmount);
|
||||
|
||||
// 未支付
|
||||
params.put("status", "unpaid");
|
||||
long unpaidCount = baseMapper.getCount(params);
|
||||
// 部分支付
|
||||
params.put("status", "partial");
|
||||
long partialCount = baseMapper.getCount(params);
|
||||
// 待支付笔数 = 未支付笔数 + 部分支付笔数
|
||||
data.put("unpaidCount", unpaidCount + partialCount);
|
||||
|
||||
BigDecimal paidAmount = baseMapper.getSumPaidAmount(params);
|
||||
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
|
||||
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.getPayAmount())) {
|
||||
// 减余额
|
||||
creditBuyer.setAccountBalance(NumberUtil.sub(accountBalance, orderInfo.getPayAmount()));
|
||||
tbCreditBuyerMapper.updateById(creditBuyer);
|
||||
// 记录还款记录
|
||||
TbCreditPaymentRecord record = new TbCreditPaymentRecord();
|
||||
record.setCreditBuyerId(creditBuyerId);
|
||||
record.setOrderId(orderId);
|
||||
record.setRepaymentAmount(orderInfo.getPayAmount());
|
||||
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.getPayAmount());
|
||||
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.getPayAmount(), accountBalance));
|
||||
}
|
||||
// 剩余挂账额度
|
||||
BigDecimal remainingAmount = creditBuyer.getRemainingAmount();
|
||||
// 验证挂账金额是否大于剩余额度
|
||||
boolean greater = NumberUtil.isGreater(orderInfo.getPayAmount(), remainingAmount);
|
||||
if (greater) {
|
||||
throw new BadRequestException(StrUtil.format("{}:¥{}不能大于剩余挂账额度({})", "挂账金额", orderInfo.getPayAmount(), remainingAmount));
|
||||
}
|
||||
if (entity == null) {
|
||||
entity = new TbCreditBuyerOrder();
|
||||
entity.setStatus("unpaid");
|
||||
entity.setPaidAmount(BigDecimal.ZERO);
|
||||
entity.setCreditBuyerId(creditBuyerId);
|
||||
entity.setOrderId(orderId);
|
||||
}
|
||||
return super.saveOrUpdate(entity);
|
||||
}
|
||||
}
|
||||
@@ -1,271 +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.mapper.TbCreditBuyerMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCreditBuyerOrderMapper;
|
||||
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;
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
// 校验完毕,可以批量还款
|
||||
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();
|
||||
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())
|
||||
);
|
||||
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())
|
||||
);
|
||||
repaymentAmount = BigDecimal.ZERO;
|
||||
}
|
||||
repaymentCount++;
|
||||
if (NumberUtil.equals(repaymentAmount, BigDecimal.ZERO)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
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, 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,474 +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.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.JSONUtil;
|
||||
import cn.ysk.cashier.utils.ListUtil;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import cn.ysk.cashier.utils.QueryHelp;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* 店铺信息同步记录表(TbShopSyncInfo)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-25 16:46:12
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
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.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());
|
||||
products.stream().map(TbProduct::getId).collect(Collectors.toList()).forEach(id -> skuResultRepository.deleteById(id));
|
||||
productRepository.clearShopPro(tbShopSyncInfo.getPointShopId().toString());
|
||||
skuRepository.clearShopSku(tbShopSyncInfo.getPointShopId().toString());
|
||||
consRepository.clearShopCons(tbShopSyncInfo.getPointShopId());
|
||||
consTypeRepository.clearShopConType(tbShopSyncInfo.getPointShopId());
|
||||
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.setId(null);
|
||||
tbShopUnit.setShopId(pointShopId.toString());
|
||||
unitRepository.save(tbShopUnit);
|
||||
unitMap.put(sourceUnitId, tbShopUnit.getId());
|
||||
});
|
||||
future.complete(unitMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
//规格
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncSpec(Integer sourceShopId, Integer pointShopId) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> specMap = new HashMap<>();
|
||||
specRepository.searchSpecByShopId(sourceShopId.toString()).forEach(tbProductSpec -> {
|
||||
Integer sourceSpecId = tbProductSpec.getId();
|
||||
tbProductSpec.setId(null);
|
||||
tbProductSpec.setShopId(pointShopId.toString());
|
||||
specRepository.save(tbProductSpec);
|
||||
specMap.put(sourceSpecId, tbProductSpec.getId());
|
||||
});
|
||||
future.complete(specMap);
|
||||
return future;
|
||||
}
|
||||
|
||||
// 分类
|
||||
@Async
|
||||
public CompletableFuture<Map<Integer, Integer>> syncCategory(Integer sourceShopId, Integer pointShopId) {
|
||||
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.setId(null);
|
||||
tbShopCategory.setShopId(pointShopId.toString());
|
||||
tbShopCategory.setTree(null);
|
||||
tbShopCategory.setPid("");
|
||||
categoryRepository.save(tbShopCategory);
|
||||
categoryMap.put(sourceCategoryId, tbShopCategory.getId());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(treeIds)) {
|
||||
List<TbShopCategory> children = categoryRepository.findChildren(treeIds);
|
||||
for (TbShopCategory child : children) {
|
||||
Integer sourceCategoryId = child.getId();
|
||||
child.setId(null);
|
||||
child.setShopId(pointShopId.toString());
|
||||
child.setTree(categoryMap.get(child.getTree()));
|
||||
child.setPid(StringUtils.isNotBlank(child.getPid()) ? categoryMap.get(Integer.valueOf(child.getPid())).toString() : "");
|
||||
categoryRepository.save(child);
|
||||
categoryMap.put(sourceCategoryId, child.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<>();
|
||||
Map<Integer, Integer> proMap = new HashMap<>();
|
||||
productRepository.findByShopId(sourceShopId.toString()).forEach(tbProduct -> {
|
||||
Integer sourceSpecId = tbProduct.getId();
|
||||
tbProduct.setId(null);
|
||||
tbProduct.setShopId(pointShopId.toString());
|
||||
tbProduct.setCategoryId(StringUtils.isNotBlank(tbProduct.getCategoryId()) ? cateGorys.get(Integer.valueOf(tbProduct.getCategoryId())).toString() : "");
|
||||
tbProduct.setSpecId(tbProduct.getSpecId() != null ? specs.get(tbProduct.getSpecId()) : null);
|
||||
tbProduct.setUnitId(tbProduct.getUnitId() != null ? units.get(tbProduct.getUnitId()) : null);
|
||||
tbProduct.setStockNumber(0);
|
||||
|
||||
productRepository.save(tbProduct);
|
||||
proMap.put(sourceSpecId, tbProduct.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.setId(null);
|
||||
tbProductGroup.setShopId(pointShopId);
|
||||
tbProductGroup.setUseTime(0);
|
||||
tbProductGroup.setProductIds(replaceProIds(tbProductGroup.getProductIds(), pros));
|
||||
groupRepository.save(tbProductGroup);
|
||||
groupMap.put(groupId, tbProductGroup.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 -> {
|
||||
tbProduct.setProGroupVo(JSONUtil.parseJSONStrTList(tbProduct.getGroupSnap(), ProductGroupVo.class));
|
||||
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.setId(null);
|
||||
tbProductSku.setShopId(pointShopId.toString());
|
||||
tbProductSku.setProductId(pros.get(productId).toString());
|
||||
skuRepository.save(tbProductSku);
|
||||
skuMap.put(sourceSkuId, tbProductSku.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.setId(pros.get(tbProductSkuResult.getId()));
|
||||
skuResultRepository.save(tbProductSkuResult);
|
||||
});
|
||||
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.setId(null);
|
||||
tbConsType.setShopId(pointShopId);
|
||||
consTypeRepository.save(tbConsType);
|
||||
consTypeMap.put(sourceConsTypeId, tbConsType.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.setId(null);
|
||||
tbConsInfo.setShopId(pointShopId);
|
||||
tbConsInfo.setConTypeId(conTypes.get(tbConsInfo.getConTypeId()));
|
||||
tbConsInfo.setStockNumber(BigDecimal.ZERO);
|
||||
tbConsInfo.setStockConsume(BigDecimal.ZERO);
|
||||
consRepository.save(tbConsInfo);
|
||||
consMap.put(sourceConsId, tbConsInfo.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();
|
||||
tbConsPro.setId(null);
|
||||
tbConsPro.setShopId(pointShopId);
|
||||
tbConsPro.setConInfoId(consMap.get(tbConsPro.getConInfoId()));
|
||||
tbConsPro.setProductId(proMap.get(tbConsPro.getProductId()));
|
||||
if (tbConsPro.getProductSkuId() > 0) {
|
||||
tbConsPro.setProductSkuId(skuMap.get(tbConsPro.getProductSkuId()));
|
||||
}
|
||||
proSkuConRepository.save(tbConsPro);
|
||||
proSkuConMap.put(sourceConsProId, tbConsPro.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,280 +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.RandomUtil;
|
||||
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 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 randomStr = RandomUtil.randomString(RandomUtil.BASE_CHAR_NUMBER, 4);
|
||||
String orderNo = DateUtil.format(new Date(), "yyMMddHHmmss") + "-" + randomStr.toUpperCase();
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
baseMapper.update(Wrappers.<TbShopTableBooking>lambdaUpdate()
|
||||
.set(TbShopTableBooking::getDelFlag, 1)
|
||||
.eq(TbShopTableBooking::getId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBookingSms(Long id) {
|
||||
if (id == null) {
|
||||
throw new BadRequestException("id不能为空");
|
||||
}
|
||||
TbShopTableBooking entity = super.getById(id);
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("预订信息不存在");
|
||||
}
|
||||
Integer shopId = entity.getShopId();
|
||||
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())).findFirst().orElse(null));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> summary(String[] phoneNos) {
|
||||
List<Map<String, Object>> list = baseMapper.summaryByPhoneNos(Arrays.asList(phoneNos));
|
||||
Map<String, Object> result = new HashMap<>(phoneNos.length);
|
||||
Map<String, Object> fillData = new HashMap<>(2);
|
||||
fillData.put("consumeOrders", 0);
|
||||
fillData.put("cancelOrders", 0);
|
||||
for (String phoneNo : phoneNos) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package cn.ysk.cashier.pojo.order;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord;
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -25,7 +24,6 @@ import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* @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,13 +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;
|
||||
|
||||
public void copy(TbCashierCart source) {
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
@@ -192,35 +183,10 @@ public class TbCashierCart implements Serializable {
|
||||
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 (discountRadio == null) {
|
||||
discountRadio = BigDecimal.ONE;
|
||||
}
|
||||
if ("false".equals(isPack)) {
|
||||
packFee = BigDecimal.ZERO;
|
||||
}
|
||||
if ("true".equals(isGift)) {
|
||||
totalAmount = packFee;
|
||||
} else {
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
totalAmount = totalNumber.multiply(memberPrice).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
} else {
|
||||
totalAmount = totalNumber.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice)
|
||||
.add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(salePrice).add(packFee);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,31 +195,14 @@ public class TbCashierCart implements Serializable {
|
||||
* 获取总价不包含打包费
|
||||
*
|
||||
*/
|
||||
public BigDecimal getTotalAmountByNum(BigDecimal num, BigDecimal discountRadio) {
|
||||
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).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);
|
||||
}
|
||||
// if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// return num.multiply(memberPrice);
|
||||
// } else {
|
||||
// return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public void resetDiscountSaleAmount() {
|
||||
BigDecimal finalAmount = BigDecimal.ZERO;
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
|
||||
return BigDecimal.valueOf(num).multiply(memberPrice);
|
||||
} else {
|
||||
return BigDecimal.valueOf(num).multiply(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,15 +131,8 @@ public class TbOrderDetail implements Serializable {
|
||||
private BigDecimal memberPrice;
|
||||
private Integer userCouponId;
|
||||
private Integer isMember;
|
||||
private Integer isTemporary;
|
||||
private String discountSaleNote;
|
||||
private Boolean isPrint;
|
||||
private String useCouponInfo;
|
||||
private BigDecimal returnAmount;
|
||||
private BigDecimal canReturnAmount;
|
||||
|
||||
public void copy(TbOrderDetail 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;
|
||||
@@ -84,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回收站")
|
||||
@@ -126,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;
|
||||
@@ -174,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;
|
||||
@@ -217,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,14 +15,14 @@
|
||||
*/
|
||||
package cn.ysk.cashier.pojo.shop;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
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
|
||||
@@ -41,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;
|
||||
@@ -142,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;
|
||||
@@ -179,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次日")
|
||||
@@ -252,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 = "桌位费")
|
||||
@@ -295,10 +287,6 @@ public class TbShopInfo implements Serializable {
|
||||
@ApiModelProperty(value = "店铺收款码")
|
||||
private String paymentQrcode;
|
||||
|
||||
@Column(name = "booking_sms")
|
||||
@ApiModelProperty(value = "台桌预订短信")
|
||||
private String bookingSms;
|
||||
|
||||
public void copy(TbShopInfo source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Page;
|
||||
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.domain.Pageable;
|
||||
|
||||
@@ -45,10 +44,4 @@ public interface TbShopCategoryRepository extends JpaRepository<TbShopCategory,
|
||||
|
||||
@Query("SELECT category FROM TbShopCategory category where category.id IN :ids ")
|
||||
List<TbShopCategory> searchCategory(@Param("ids")List<Integer> ids);
|
||||
@Query("SELECT category FROM TbShopCategory category where category.shopId = :shopId and (category.pid is null or category.pid = '')")
|
||||
List<TbShopCategory> searchCategoryByShopId(@Param("shopId") String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("delete FROM TbShopCategory category where category.shopId = :shopId")
|
||||
void clearShopCategory(@Param("shopId") String shopId);
|
||||
}
|
||||
@@ -1,9 +1,23 @@
|
||||
/*
|
||||
* 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.shop;
|
||||
|
||||
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
||||
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;
|
||||
|
||||
@@ -23,11 +37,4 @@ public interface TbShopUnitRepository extends JpaRepository<TbShopUnit, Integer>
|
||||
|
||||
@Query("SELECT unit from TbShopUnit unit where unit.name = :name and unit.shopId = :shopId")
|
||||
TbShopUnit findName(@Param("name")String name,@Param("shopId")String shopId);
|
||||
|
||||
@Query("SELECT unit FROM TbShopUnit unit WHERE unit.shopId = :shopId")
|
||||
List<TbShopUnit> searchUnitByShopId(@Param("shopId")String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("delete FROM TbShopUnit unit WHERE unit.shopId = :shopId")
|
||||
void clearShopUnit(@Param("shopId")String shopId);
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package cn.ysk.cashier.repository.shop;
|
||||
|
||||
import javax.persistence.Tuple;
|
||||
import cn.ysk.cashier.pojo.TbShopUserDutyDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
@@ -9,4 +14,14 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
public interface TbShopUserDutyDetailRepository extends JpaRepository<TbShopUserDutyDetail,Integer> {
|
||||
|
||||
|
||||
@Query(value = "SELECT " +
|
||||
"sum( num ), " +
|
||||
"product_id " +
|
||||
"FROM " +
|
||||
"tb_shop_user_duty_detail " +
|
||||
"WHERE " +
|
||||
"product_id IN :ids " +
|
||||
"GROUP BY " +
|
||||
"product_id",nativeQuery = true)
|
||||
List<Object[]> searchUUserDutyDetail(@Param("ids") List<Integer> ids);
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package cn.ysk.cashier.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PhpCommonResp<T> {
|
||||
private String code;
|
||||
private String msg;
|
||||
private long time;
|
||||
private T data;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package cn.ysk.cashier.service;
|
||||
|
||||
import cn.ysk.cashier.dto.BindingDto;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 开票服务员
|
||||
*/
|
||||
public interface BindService {
|
||||
|
||||
/**
|
||||
* 绑定
|
||||
*/
|
||||
JSONObject binding(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 商家提交开票信息
|
||||
*/
|
||||
JSONObject subInvoicing(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 项目分类
|
||||
*/
|
||||
JSONObject industry(BindingDto bindingDto);
|
||||
|
||||
|
||||
/**
|
||||
* 计算税额
|
||||
*/
|
||||
JSONObject storeSe(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 数电发票类型
|
||||
*/
|
||||
JSONArray digitalInvoice();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package cn.ysk.cashier.service;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
public interface ThirdPartyCouponService {
|
||||
|
||||
String getBindUrl(Integer shopId);
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
package cn.ysk.cashier.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.ysk.cashier.dto.BindingDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import cn.ysk.cashier.service.BindService;
|
||||
import cn.ysk.cashier.utils.CacheKey;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class BindServiceImpl implements BindService {
|
||||
|
||||
@Autowired
|
||||
private TbMerchantAccountRepository accountRepository;
|
||||
@Autowired
|
||||
private TbShopInfoRepository tbShopInfoRepository;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
private final String url = "http://test.invoice.sxczgkj.cn/api/";
|
||||
|
||||
@Override
|
||||
public JSONObject binding(Map<String, Object> params) {
|
||||
String result = HttpUtil.post(url + "cash/binding", params, 5000);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if (jsonObject.getInteger("code").equals(1)) {
|
||||
return jsonObject.getJSONObject("data");
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject subInvoicing(Map<String, Object> params) {
|
||||
String shopId = params.get("shopId").toString();
|
||||
params.remove("shopId");
|
||||
String result = HttpUtil.post(url + "cash/subinvoicing", params, 5000);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if (jsonObject.getInteger("code").equals(1)) {
|
||||
// if (StringUtils.isNotBlank(shopId)) {
|
||||
// if (redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + shopId)) {
|
||||
// Set<Object> articles = redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + shopId);
|
||||
// if (!articles.contains(params.get("article"))) {
|
||||
// articles.add(params.get("article"));
|
||||
// redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + shopId, articles);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return jsonObject.getJSONObject("data");
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject industry(BindingDto bindingDto) {
|
||||
// if (StringUtils.isNotBlank(bindingDto.getArticle())) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("name", bindingDto.getArticle());
|
||||
params.put("page", bindingDto.getPage() == null ? 1 : bindingDto.getPage());
|
||||
String result = HttpUtil.post(url + "store/industrylistsj", params, 5000);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if (jsonObject.getInteger("code").equals(1)) {
|
||||
return jsonObject.getJSONObject("data");
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("msg"));
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
// Set<String> set = new HashSet<>();
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// if (!redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())) {
|
||||
// TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null);
|
||||
// TbMerchantAccount account = accountRepository.findByAccount(tbShopInfo.getAccount());
|
||||
// set.add(account.getArticle());
|
||||
// redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId(), set);
|
||||
// jsonObject.put("articles", set);
|
||||
// } else {
|
||||
// jsonObject.put("list", redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId()));
|
||||
// }
|
||||
// return jsonObject;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject storeSe(Map<String, Object> params) {
|
||||
String result = HttpUtil.post(url + "store/se", params, 5000);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if (jsonObject.getInteger("code").equals(1)) {
|
||||
return jsonObject.getJSONObject("data");
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray digitalInvoice() {
|
||||
String result = HttpUtil.post(url + "store/digitalinvoice", "", 5000);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if (jsonObject.getInteger("code").equals(1)) {
|
||||
return jsonObject.getJSONArray("data");
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("msg"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,13 +176,13 @@ public class PayServiceImpl implements PayService {
|
||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
||||
.eq(TbOrderDetail::getUseType, orderInfo.getUseType())
|
||||
.in(TbOrderDetail::getStatus, "unpaid")
|
||||
// .setSql(StrUtil.format("price_amount=price*num*{}", orderInfo.getDiscountRatio() == null ? 1 : orderInfo.getDiscountRatio()))
|
||||
.setSql(StrUtil.format("price_amount=price*num*{}", orderInfo.getDiscountRatio() == null ? 1 : orderInfo.getDiscountRatio()))
|
||||
.set(TbOrderDetail::getStatus, "closed"));
|
||||
|
||||
//修改主单状态
|
||||
orderInfo.setStatus("closed");
|
||||
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||
// orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderInfo.setPaidTime(System.currentTimeMillis());
|
||||
tbOrderInfoMapper.updateById(orderInfo);
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
}
|
||||
|
||||
TbOrderSalesCountByDayVo tbOrderSalesCountByDayVo = detailRepository.queryTbOrderSalesCountByDaysummaryCount(Integer.valueOf(summaryDto.getShopId()), summaryDto.getCateId(), summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
|
||||
TbOrderPayCountVo zongShuLiang = new TbOrderPayCountVo("el-icon-goods", "总数量", "0", tbOrderSalesCountByDayVo.getSalesNum().add(tbOrderSalesCountByDayVo.getRefNum()));
|
||||
TbOrderPayCountVo zongShuLiang = new TbOrderPayCountVo("el-icon-goods", "总数量", "0", tbOrderSalesCountByDayVo.getSalesNum() + tbOrderSalesCountByDayVo.getRefNum());
|
||||
TbOrderPayCountVo zong = new TbOrderPayCountVo("el-icon-coin", "总金额", "1", tbOrderSalesCountByDayVo.getSalesAmount());
|
||||
TbOrderPayCountVo tuidan = new TbOrderPayCountVo("el-icon-goods", "退单量", "0", tbOrderSalesCountByDayVo.getRefNum());
|
||||
TbOrderPayCountVo tuikuan = new TbOrderPayCountVo("el-icon-money", "退款金额", "1", tbOrderSalesCountByDayVo.getRefAmount());
|
||||
|
||||
@@ -365,12 +365,12 @@ public class TbPayServiceImpl implements TbPayService {
|
||||
// return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
||||
// }
|
||||
|
||||
BigDecimal payMount = orderInfo.getOrderAmount().multiply(payDTO.getDiscount()).setScale(2, RoundingMode.HALF_UP);
|
||||
BigDecimal payMount = orderInfo.getOrderAmount().multiply(BigDecimal.valueOf(payDTO.getDiscount())).setScale(2, RoundingMode.HALF_UP);
|
||||
orderInfo.setPayAmount(payMount);
|
||||
orderInfo.setPayType("cash");
|
||||
orderInfo.setStatus("closed");
|
||||
orderInfo.setPayOrderNo("cash".concat(SnowFlakeUtil.generateOrderNo()));
|
||||
orderInfo.setDiscountRatio(payDTO.getDiscount());
|
||||
orderInfo.setDiscountRatio(BigDecimal.valueOf(payDTO.getDiscount()));
|
||||
orderInfo.setDiscountAmount(orderInfo.getAmount().subtract(payMount));
|
||||
orderInfoMapper.updateById(orderInfo);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import cn.ysk.cashier.utils.ValidationUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import cn.ysk.cashier.repository.TbPlatformDictTypeRepository;
|
||||
import cn.ysk.cashier.service.TbPlatformDictTypeService;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -32,7 +31,6 @@ public class TbPlatformDictTypeServiceImpl implements TbPlatformDictTypeService
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbPlatformDictTypeQueryCriteria criteria, Pageable pageable){
|
||||
pageable = PageRequest.of(0,50);
|
||||
Page<TbPlatformDictType> page = tbPlatformDictTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbPlatformDictTypeMapper::toDto));
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
package cn.ysk.cashier.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.mapper.MpShopInfoMapper;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.resp.PhpCommonResp;
|
||||
import cn.ysk.cashier.service.ThirdPartyCouponService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ThirdPartyCouponServiceImpl implements ThirdPartyCouponService {
|
||||
|
||||
private final MpShopInfoMapper mpShopInfoMapper;
|
||||
@Value("${phpServer}")
|
||||
private String phpServerUrl;
|
||||
|
||||
public ThirdPartyCouponServiceImpl(RestTemplate restTemplate, MpShopInfoMapper mpShopInfoMapper) {
|
||||
this.restTemplate = restTemplate;
|
||||
this.mpShopInfoMapper = mpShopInfoMapper;
|
||||
}
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
private <T> T getData(String url, Integer shopId, Object data) {
|
||||
// 获取店铺信息
|
||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
|
||||
if (shopInfo == null) {
|
||||
throw new BadRequestException("店铺信息不存在");
|
||||
}
|
||||
|
||||
// 设置请求头
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("account", shopId.toString());
|
||||
|
||||
// 构造请求实体,根据 data 是否为空设置请求体
|
||||
HttpEntity<Object> entity;
|
||||
if (data != null) {
|
||||
Map<String, Object> map = BeanUtil.beanToMap(data);
|
||||
map.put("title", shopInfo.getShopName());
|
||||
entity = new HttpEntity<>(map, headers);
|
||||
} else {
|
||||
entity = new HttpEntity<>(new HashMap<String, Object>(){{
|
||||
put("title", shopInfo.getShopName());
|
||||
}},headers);
|
||||
}
|
||||
|
||||
// 发起请求
|
||||
ResponseEntity<PhpCommonResp> response = restTemplate.exchange(
|
||||
phpServerUrl + url,
|
||||
HttpMethod.POST, // 使用 POST 请求发送 body 数据
|
||||
entity,
|
||||
PhpCommonResp.class
|
||||
);
|
||||
|
||||
// 处理响应
|
||||
PhpCommonResp<?> resp = response.getBody();
|
||||
if (resp == null) {
|
||||
throw new BadRequestException("请求php服务器失败");
|
||||
}
|
||||
if (!"1".equals(resp.getCode())) {
|
||||
throw new BadRequestException(resp.getMsg());
|
||||
}
|
||||
|
||||
// 返回数据
|
||||
return (T) resp.getData();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getBindUrl(Integer shopId) {
|
||||
return getData("/meituan/getuisdkurl", shopId, null);
|
||||
}
|
||||
}
|
||||
@@ -178,26 +178,17 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
List<TbFullOrderDetail> details = tbOrderDetailMapper.selectFullInfoByOrderId(tbOrderInfo.getId());
|
||||
if (!tbOrderInfo.getOrderType().equals("return")) {
|
||||
List<TbOrderInfo> tbOrderInfos = tbOrderInfoRepository.selTbOrdersBysource(tbOrderInfo.getId(), tbOrderInfo.getShopId());
|
||||
Map<Integer, BigDecimal> map;
|
||||
Map<Integer, Integer> map;
|
||||
if (!CollectionUtils.isEmpty(tbOrderInfos)) {
|
||||
List<Integer> ids = tbOrderInfos.stream().map(TbOrderInfo::getId).collect(Collectors.toList());
|
||||
List<TbOrderDetail> refundOrderDetail = tbOrderDetailRepository.searchDetailByOrderIds(ids);
|
||||
map = refundOrderDetail.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
TbOrderDetail::getProductSkuId,
|
||||
Collectors.reducing(
|
||||
BigDecimal.ZERO,
|
||||
TbOrderDetail::getNum,
|
||||
BigDecimal::add
|
||||
)
|
||||
));
|
||||
|
||||
map = refundOrderDetail.stream().collect(Collectors.groupingBy(TbOrderDetail::getProductSkuId, Collectors.summingInt(TbOrderDetail::getNum)));
|
||||
refundAmount = tbOrderInfos.stream().map(TbOrderInfo::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
} else {
|
||||
map = new HashMap<>();
|
||||
}
|
||||
details.parallelStream().forEach(detail -> {
|
||||
BigDecimal refundNumber = map.get(detail.getProductSkuId());
|
||||
Integer refundNumber = map.get(detail.getProductSkuId());
|
||||
if (refundNumber != null) {
|
||||
detail.setRefundNumber(refundNumber);
|
||||
}
|
||||
@@ -211,7 +202,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
TbOrderDetail seatInfo = null;
|
||||
ArrayList<TbFullOrderDetail> detailList = new ArrayList<>();
|
||||
for (TbFullOrderDetail detail : details) {
|
||||
if (detail.getProductId() != null && TableConstant.CART_SEAT_ID.equals(detail.getProductId().toString())) {
|
||||
if (TableConstant.CART_SEAT_ID.equals(detail.getProductId().toString())) {
|
||||
seatInfo = detail;
|
||||
} else {
|
||||
detailList.add(detail);
|
||||
@@ -637,7 +628,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
flow.setBizName("会员储值卡退款");
|
||||
flow.setType("+");
|
||||
flow.setAmount(returnAmount);
|
||||
flow.setBalance(user.getAmount().add(returnAmount));
|
||||
flow.setBalance(user.getAmount());
|
||||
flow.setCreateTime(cn.hutool.core.date.DateUtil.date().toTimestamp());
|
||||
flow.setIsReturn("0");
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
@@ -723,10 +714,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(), "订单取消返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId()));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("返还订单积分优惠券失败: 订单信息: {}", orderInfo);
|
||||
log.error("异常信息: ", e);
|
||||
}finally {
|
||||
mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, orderInfo.getId());
|
||||
mpOrderDetailService.updateStatusByOrderId(TableConstant.OrderInfo.Status.CLOSED, orderInfo.getId());
|
||||
|
||||
@@ -738,6 +725,9 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
.set(TbOrderInfo::getPointsNum, 0)
|
||||
.set(TbOrderInfo::getUpdatedAt, cn.hutool.core.date.DateUtil.current())
|
||||
.set(TbOrderInfo::getStatus, "cancelled"));
|
||||
} catch (Exception e) {
|
||||
log.error("取消订单失败: 订单信息: {}", orderInfo);
|
||||
log.error("异常信息: ", e);
|
||||
}
|
||||
});
|
||||
// List<Integer> ids = tbOrderInfos.stream().map(TbOrderInfo::getId).collect(Collectors.toList());
|
||||
|
||||
@@ -2,8 +2,6 @@ package cn.ysk.cashier.service.impl.productimpl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.cons.domain.ViewConSku;
|
||||
import cn.ysk.cashier.cons.repository.ViewConSkuRepository;
|
||||
@@ -15,6 +13,7 @@ import cn.ysk.cashier.dto.product.TbProductSortCriteria;
|
||||
import cn.ysk.cashier.dto.shop.TbCouponCategoryDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mapper.product.TbProductMapper;
|
||||
import cn.ysk.cashier.mapper.product.TbProductSkuMapper;
|
||||
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TagProductDeptsService;
|
||||
@@ -30,7 +29,6 @@ import cn.ysk.cashier.service.TbPlatformDictService;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.service.shop.TbCouponCategoryService;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.ProductGroupVo;
|
||||
import cn.ysk.cashier.vo.TbProductNewVo;
|
||||
import cn.ysk.cashier.vo.TbProductVo;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -40,7 +38,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.LocalTime;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.domain.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -71,6 +68,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
private final TbProductSkuRepository tbProductSkuRepository;
|
||||
private final TbShopUnitRepository tbShopUnitRepository;
|
||||
private final TbProductSpecRepository tbProductSpecRepository;
|
||||
private final TbProductSkuMapper TbProductSkuMapper;
|
||||
private final TbProductSkuResultRepository tbProductSkuResultRepository;
|
||||
private final TbShopCategoryRepository tbShopCategoryRepository;
|
||||
private final TbShopUserDutyDetailRepository tbShopUserDutyDetailRe;
|
||||
@@ -151,7 +149,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
//销量
|
||||
List<Object[]> objects = new ArrayList<>();
|
||||
if (!productIdInt.isEmpty()) {
|
||||
objects = tbProductSkuRepository.searchProRealSalesNumber(productIdInt);
|
||||
objects = tbShopUserDutyDetailRe.searchUUserDutyDetail(productIdInt);
|
||||
}
|
||||
//组装
|
||||
List<TbProductVo> tbProductVoList = new ArrayList<>();
|
||||
@@ -219,11 +217,9 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
tbProductVo.setRealSalesNumber(0.00);
|
||||
} else {
|
||||
for (Object[] o : objects) {
|
||||
if (o[1] != null && (o[1]).equals(product.getId())) {
|
||||
if (o[0] != null) {
|
||||
BigDecimal bigDecimal = (BigDecimal) o[0];
|
||||
tbProductVo.setRealSalesNumber(bigDecimal.doubleValue());
|
||||
}
|
||||
if (((Integer) o[1]).equals(product.getId())) {
|
||||
BigDecimal bigDecimal = (BigDecimal) o[0];
|
||||
tbProductVo.setRealSalesNumber(bigDecimal.doubleValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,16 +248,16 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
productNewVo.setLowPrice(product.getLowPrice().toString());
|
||||
productNewVo.setStockNumber(Double.valueOf(product.getStockNumber()));
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(product.getId().toString());
|
||||
if ("sku".equals(product.getTypeEnum())) {
|
||||
if (tbProductSkus.size() > 1) {
|
||||
if ("sku".equals(product.getTypeEnum())){
|
||||
if(tbProductSkus.size() > 1){
|
||||
BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get();
|
||||
if (maxPrice.compareTo(new BigDecimal(productNewVo.getLowPrice())) == 0) {
|
||||
productNewVo.setLowPrice("¥" + productNewVo.getLowPrice());
|
||||
} else {
|
||||
productNewVo.setLowPrice("¥" + productNewVo.getLowPrice() + "~¥" + maxPrice);
|
||||
productNewVo.setLowPrice("¥" +productNewVo.getLowPrice());
|
||||
}else {
|
||||
productNewVo.setLowPrice("¥" +productNewVo.getLowPrice() + "~¥" + maxPrice);
|
||||
}
|
||||
} else {
|
||||
productNewVo.setLowPrice("¥" + productNewVo.getLowPrice());
|
||||
}else {
|
||||
productNewVo.setLowPrice("¥" +productNewVo.getLowPrice());
|
||||
}
|
||||
}
|
||||
ViewConSku viewConSku = new ViewConSku();
|
||||
@@ -269,7 +265,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
viewConSku.setProductId(product.getId());
|
||||
Example<ViewConSku> query = Example.of(viewConSku);
|
||||
List<ViewConSku> skuCons = viewConSkuRepository.findAll(query);
|
||||
if (product.getTypeEnum().equals("sku")) {
|
||||
if(product.getTypeEnum().equals("sku")){
|
||||
//规格填充
|
||||
productNewVo.setSkuList(convert(tbProductSkus));
|
||||
//耗材弹窗选项
|
||||
@@ -280,11 +276,11 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
}
|
||||
}
|
||||
}
|
||||
productNewVo.setConInfos(CollectionUtils.isEmpty(skuCons) ? Collections.emptyList() : skuCons);
|
||||
productNewVo.setConInfos(CollectionUtils.isEmpty(skuCons)? Collections.emptyList() :skuCons);
|
||||
products.add(productNewVo);
|
||||
}
|
||||
Map<String, Object> result = PageUtil.toPage(products, page.getTotalElements());
|
||||
result.put("warnLine", warnLine);
|
||||
result.put("warnLine",warnLine);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -307,6 +303,9 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
public TbProductVo findByProductId(Integer id) throws Exception {
|
||||
TbProduct tbProduct = tbProductRepository.findById(id).orElseGet(TbProduct::new);
|
||||
|
||||
//单位
|
||||
// CompletableFuture<TbShopUnit> tbShopUnits = CompletableFuture.supplyAsync(() ->
|
||||
// tbShopUnitRepository.searchUnit(Integer.valueOf(StringUtils.isEmpty(tbProduct.getUnitId()) ? null : tbProduct.getUnitId())));
|
||||
//sku
|
||||
CompletableFuture<List<TbProductSku>> tbProductSkus = CompletableFuture.supplyAsync(() ->
|
||||
tbProductSkuRepository.searchSku(tbProduct.getId().toString()));
|
||||
@@ -314,20 +313,24 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
CompletableFuture<TbProductSpec> tbProductSpec = CompletableFuture.supplyAsync(() ->
|
||||
tbProductSpecRepository.searchSpec(tbProduct.getSpecId()));
|
||||
|
||||
// Threads.call(tbShopUnits, tbProductSkus, tbProductSpec);
|
||||
Threads.call(tbProductSkus, tbProductSpec);
|
||||
//组装
|
||||
TbProductVo tbProductVo = new TbProductVo();
|
||||
// tbProductVo.setStockNumber(tbProduct.getStockNumber() == null ? 0.00 : tbProduct.getStockNumber());
|
||||
tbProductVo.setCategoryId(StringUtils.isNotBlank(tbProduct.getCategoryId()) ? Integer.valueOf(tbProduct.getCategoryId()) : null);
|
||||
|
||||
BeanUtils.copyProperties(tbProduct, tbProductVo);
|
||||
//单位
|
||||
// if (tbProduct.getUnitId() == null) {
|
||||
// tbProductVo.setUnitId(null);
|
||||
// tbProductVo.setUnitName(null);
|
||||
// }
|
||||
//套餐
|
||||
if(tbProduct.getType().equals("package")){
|
||||
if (tbProduct.getGroupSnap() == null) {
|
||||
tbProductVo.setProGroupVo(null);
|
||||
} else {
|
||||
tbProductVo.setProGroupVo(JSONUtil.parseJSONStrTList(tbProduct.getGroupSnap(), ProductGroupVo.class));
|
||||
}
|
||||
if (tbProduct.getGroupSnap() == null) {
|
||||
tbProductVo.setGroupSnap(new JSONArray());
|
||||
} else {
|
||||
tbProductVo.setGroupSnap(ListUtil.stringChangeList(tbProduct.getGroupSnap()));
|
||||
}
|
||||
BeanUtils.copyProperties(tbProduct, tbProductVo);
|
||||
tbProductVo.setStockNumber(Double.valueOf(tbProduct.getStockNumber()));
|
||||
if (!org.apache.commons.lang3.StringUtils.isBlank(tbProduct.getImages())) {
|
||||
tbProductVo.setImages(ListUtil.stringChangeList(tbProduct.getImages()));
|
||||
@@ -360,7 +363,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
Optional<TbProductSkuResult> skuResult = tbProductSkuResultRepository.findById(tbProductVo.getId());
|
||||
tbProductVo.setSkuSnap(skuResult.get().getTagSnap());
|
||||
}
|
||||
if ("coupon".equals(tbProductVo.getType())) {
|
||||
if ("group".equals(tbProductVo.getTypeEnum())) {
|
||||
if (StringUtils.isNotBlank(tbProduct.getGroupCategoryId())) {
|
||||
JSONArray objects = ListUtil.stringChangeList(tbProduct.getGroupCategoryId());
|
||||
for (Object groupCategoryId : objects) {
|
||||
@@ -415,7 +418,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
if (CollectionUtils.isEmpty(resources.getSkuList())) {
|
||||
throw new BadRequestException("商品规格不可为空");
|
||||
}
|
||||
if (!"coupon".equals(resources.getType())) {
|
||||
if (!"group".equals(resources.getTypeEnum())) {
|
||||
if (resources.getCategoryId() == null) {
|
||||
throw new BadRequestException("必填内容未填写");
|
||||
}
|
||||
@@ -428,16 +431,19 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
product.setImages(resources.getImages().toString());
|
||||
}
|
||||
product.setIsDel(0);
|
||||
product.setIsDelete(0);
|
||||
product.setIsFreeFreight(1);
|
||||
product.setStatus(1);
|
||||
product.setCreatedAt(Instant.now().toEpochMilli());
|
||||
product.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
List<BigDecimal> lowPrice = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
|
||||
product.setLowPrice(lowPrice.get(0));
|
||||
if ("coupon".equals(resources.getType())) {
|
||||
// //套餐内容
|
||||
// if (!resources.getGroupSnap().isEmpty()) {
|
||||
// product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
|
||||
// }
|
||||
if ("group".equals(resources.getTypeEnum())) {
|
||||
//套餐内容
|
||||
if (!resources.getGroupSnap().isEmpty()) {
|
||||
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
|
||||
product.setIsCombo(1);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) {
|
||||
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
|
||||
product.setGroupCategoryId(collect.toString());
|
||||
@@ -448,12 +454,6 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
}
|
||||
}
|
||||
}
|
||||
if("package".equals(resources.getType())){
|
||||
//套餐内容
|
||||
if (!resources.getProGroupVo().isEmpty()) {
|
||||
product.setGroupSnap(ListUtil.listToJsonString(resources.getProGroupVo()));
|
||||
}
|
||||
}
|
||||
|
||||
TbProduct save = tbProductRepository.save(product);
|
||||
if (save.getId() == null) {
|
||||
@@ -483,7 +483,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
productSkuResult.setTagSnap(resources.getSkuSnap());
|
||||
productSkuResult.setId(save.getId());
|
||||
tbProductSkuResultRepository.save(productSkuResult);
|
||||
} else if ("coupon".equals(resources.getType())) {
|
||||
} else if ("group".equals(resources.getTypeEnum())) {
|
||||
TbPurchaseNotice notices = resources.getNotices();
|
||||
if (StringUtils.isBlank(notices.getDateUsed())
|
||||
&& StringUtils.isBlank(notices.getAvailableTime())
|
||||
@@ -528,27 +528,29 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
throw new BadRequestException("规格数据异常");
|
||||
}
|
||||
}
|
||||
if (!"coupon".equals(product.getType())) {
|
||||
if (!"group".equals(product.getTypeEnum())) {
|
||||
if (resources.getCategoryId() == null) throw new BadRequestException("商品分类不可为空");
|
||||
product.setIsCombo(0);
|
||||
product.setGroupSnap(null);
|
||||
if (resources.getNotices() != null && resources.getNotices().getId() != null && resources.getNotices().getId() > 0) {
|
||||
noticeRepository.deleteById(resources.getNotices().getId());
|
||||
}
|
||||
}
|
||||
product.setIsDel(0);
|
||||
product.setIsDelete(0);
|
||||
product.setIsFreeFreight(1);
|
||||
product.setStatus(1);
|
||||
product.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
product.setImages(resources.getImages().toString());
|
||||
product.setStockNumber(resources.getStockNumber().intValue());
|
||||
List<BigDecimal> lowPrices = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
|
||||
product.setLowPrice(lowPrices.get(0));
|
||||
if ("coupon".equals(resources.getType())) {
|
||||
// //套餐内容
|
||||
// if (!resources.getGroupSnap().isEmpty()) {
|
||||
// product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
|
||||
// } else {
|
||||
// throw new BadRequestException("套餐内容不可为空");
|
||||
// }
|
||||
if ("group".equals(resources.getTypeEnum())) {
|
||||
//套餐内容
|
||||
if (!resources.getGroupSnap().isEmpty()) {
|
||||
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
|
||||
product.setIsCombo(1);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) {
|
||||
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
|
||||
product.setGroupCategoryId(collect.toString());
|
||||
@@ -563,12 +565,6 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
} else {
|
||||
product.setCategoryId(resources.getCategoryId().toString());
|
||||
}
|
||||
if("package".equals(resources.getType())){
|
||||
//套餐内容
|
||||
if (CollectionUtil.isNotEmpty(resources.getProGroupVo())) {
|
||||
product.setGroupSnap(ListUtil.listToJsonString(resources.getProGroupVo()));
|
||||
}
|
||||
}
|
||||
TbProduct save = tbProductRepository.save(product);
|
||||
|
||||
//sku
|
||||
@@ -595,7 +591,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
tbProductSkuResultRepository.save(productSkuResult);
|
||||
} else {
|
||||
tbProductSkuResultRepository.deleteByIdN(save.getId());
|
||||
if ("coupon".equals(resources.getType())) {
|
||||
if ("group".equals(resources.getTypeEnum())) {
|
||||
TbPurchaseNotice notices = resources.getNotices();
|
||||
if (StringUtils.isBlank(notices.getDateUsed())
|
||||
&& StringUtils.isBlank(notices.getAvailableTime())
|
||||
@@ -617,6 +613,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void upProSort(TbProductSortCriteria param) {
|
||||
@@ -749,12 +746,12 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrStockNumber(String productId, BigDecimal number) {
|
||||
public void incrStockNumber(String productId, Integer number) {
|
||||
tbProductRepository.incrProductStockNumber(Integer.valueOf(productId), number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void returnStockByPro(Integer productId, Integer productSkuId, BigDecimal num) {
|
||||
public void returnStockByPro(Integer productId, Integer productSkuId, Integer num) {
|
||||
if (productId > 0) {
|
||||
log.info("开始返还库存,订单超时取消,商品id:{}", productId);
|
||||
TbProduct product = tbProductRepository.findById(productId).orElse(null);
|
||||
@@ -771,13 +768,10 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> page1 = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page, size);
|
||||
QueryWrapper<TbProduct> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_del", 0)
|
||||
.eq(false,"type", "coupon")
|
||||
.in("type_enum", "sku", "normal")
|
||||
.eq("shop_id", shopId)
|
||||
.eq("is_delete", 0)
|
||||
.eq("status", 1)
|
||||
.eq("is_del", 0)
|
||||
.like("days", DateUtil.dayOfWeekEnum(new Date()).name())
|
||||
.gt("end_time", DateUtil.formatTime(new Date()))
|
||||
.lt("start_time", DateUtil.formatTime(new Date()))
|
||||
.eq("is_pause_sale", 0);
|
||||
|
||||
// 查询skuResult
|
||||
@@ -793,9 +787,6 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> tbProductPage = productMapper.selectPage(page1, queryWrapper);
|
||||
tbProductPage.getRecords().forEach(item -> {
|
||||
if("package".equals(item.getType())){
|
||||
item.setProGroupVo(JSONUtil.parseJSONStrTList(item.getGroupSnap(), ProductGroupVo.class));
|
||||
}
|
||||
TbProductSkuResult skuResult = productSkuResultRepository.findById(item.getId()).orElse(null);
|
||||
List<TbProductSku> tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper<TbProductSku>().eq(TbProductSku::getIsDel, 0)
|
||||
.eq(TbProductSku::getIsPauseSale, 0)
|
||||
@@ -876,4 +867,10 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
current.remove(current.size() - 1); // 回溯
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String str="[{\"label\":\"温度\",\"value\":\"热,冰,少冰\"}]";
|
||||
str=str.replace("label", "name");
|
||||
System.out.println(str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
package cn.ysk.cashier.service.impl.shopimpl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.ysk.cashier.dto.BindingDto;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.config.security.service.UserCacheManager;
|
||||
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.exception.EntityNotFoundException;
|
||||
import cn.ysk.cashier.mapper.shop.TbShopInfoMapper;
|
||||
import cn.ysk.cashier.pojo.product.TbProductGroup;
|
||||
import cn.ysk.cashier.mybatis.mapper.MpShopInfoMapper;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.repository.TbShopPayTypeRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantRegisterRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import cn.ysk.cashier.service.BindService;
|
||||
import cn.ysk.cashier.repository.shop.*;
|
||||
import cn.ysk.cashier.service.WxService;
|
||||
import cn.ysk.cashier.service.product.TbProductGroupService;
|
||||
import cn.ysk.cashier.service.shop.TbShopInfoService;
|
||||
import cn.ysk.cashier.system.domain.Dept;
|
||||
import cn.ysk.cashier.system.domain.Job;
|
||||
@@ -31,8 +28,11 @@ import cn.ysk.cashier.system.repository.UserRepository;
|
||||
import cn.ysk.cashier.system.service.ParamsService;
|
||||
import cn.ysk.cashier.system.service.UserService;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -42,18 +42,21 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @date 2023-11-07
|
||||
**/
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2023-11-07
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
@@ -63,11 +66,13 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
private TbShopInfoMapper tbShopInfoMapper;
|
||||
|
||||
private final TbMerchantAccountRepository merchantAccountRepository;
|
||||
private final TbProductGroupService tbProductGroupService;
|
||||
|
||||
private final UserRepository userRepository;
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
private final UserCacheManager userCacheManager;
|
||||
private final TokenProvider tokenProvider;
|
||||
private final ParamsService paramsService;
|
||||
|
||||
private final TbMerchantRegisterRepository merchantRegisterRepository;
|
||||
@@ -79,68 +84,16 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
private final TbShopPayTypeRepository tbShopPayTypeRepository;
|
||||
private final BindService bindService;
|
||||
private final WxService wxService;
|
||||
|
||||
@Override
|
||||
public JSONObject binding(BindingDto bindingDto) {
|
||||
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null);
|
||||
TbMerchantAccount account = merchantAccountRepository.findByAccount(tbShopInfo.getAccount());
|
||||
boolean isNew = true;
|
||||
if (org.apache.commons.lang3.StringUtils.isBlank(bindingDto.getAccount())) {
|
||||
if (tbShopInfo != null) {
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(account.getBindAccount())) {
|
||||
isNew = false;
|
||||
bindingDto.setAccount(account.getBindAccount());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("account", bindingDto.getAccount());
|
||||
JSONObject data = bindService.binding(param);
|
||||
if (isNew) {
|
||||
account.setBindAccount(bindingDto.getAccount());
|
||||
account.setArticle(bindingDto.getArticle());
|
||||
account.setTaxAmount(bindingDto.getTaxAmount());
|
||||
account.setSdType(bindingDto.getSdType());
|
||||
merchantAccountRepository.save(account);
|
||||
}
|
||||
data.put("bindAccount", account.getBindAccount());
|
||||
data.put("article", account.getArticle());
|
||||
data.put("taxAmount", account.getTaxAmount());
|
||||
data.put("sdType", account.getSdType());
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TbShopInfoQueryCriteria criteria) {
|
||||
public Map<String,Object> queryAll(TbShopInfoQueryCriteria criteria){
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
||||
Pageable pageables = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
||||
Page<TbShopInfo> page = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageables);
|
||||
Page<TbShopInfo> page = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageables);
|
||||
return PageUtil.toPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbShopInfo> queryChildShop(TbShopInfoQueryCriteria criteria) {
|
||||
List<TbShopInfo> list = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
||||
Predicate query1 = criteriaBuilder.equal(root.get("id"), criteria.getId());
|
||||
Predicate query2 = criteriaBuilder.and(
|
||||
criteriaBuilder.equal(root.get("mainId"), criteria.getId()),
|
||||
criteriaBuilder.notEqual(root.get("type"), "only")
|
||||
);
|
||||
|
||||
Predicate predicate = criteriaBuilder.or(
|
||||
query1,
|
||||
query2
|
||||
);
|
||||
criteriaBuilder.desc(root.get("tubeType"));
|
||||
return predicate;
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<TbShopInfoDto> queryAll(TbShopInfoQueryCriteria criteria){
|
||||
// return tbShopInfoMapper.toDto(tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
@@ -150,14 +103,14 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
@Transactional
|
||||
public TbShopInfoDto findById(Integer id) {
|
||||
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(id).orElseGet(TbShopInfo::new);
|
||||
if (StringUtils.isBlank(tbShopInfo.getSmallQrcode())) {
|
||||
if(StringUtils.isBlank(tbShopInfo.getSmallQrcode())){
|
||||
String smallQrcode = wxService.getSmallQrcode(id.toString());
|
||||
tbShopInfo.setSmallQrcode(smallQrcode);
|
||||
tbShopInfoRepository.save(tbShopInfo);
|
||||
}
|
||||
String baseUrl = paramsService.getValue(ParamsEnum.SHOP_ORDER_PAY_BASE_URL.name());
|
||||
tbShopInfo.setPaymentQrcode(baseUrl + "?shopId=" + id);
|
||||
ValidationUtil.isNull(tbShopInfo.getId(), "TbShopInfo", "id", id);
|
||||
tbShopInfo.setPaymentQrcode(baseUrl+"?shopId="+id);
|
||||
ValidationUtil.isNull(tbShopInfo.getId(),"TbShopInfo","id",id);
|
||||
return tbShopInfoMapper.toDto(tbShopInfo);
|
||||
}
|
||||
|
||||
@@ -167,53 +120,49 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
return tbShopInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbShopInfoDto finByAccount(String account) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbShopInfoDto create(TbShopInfoDto resources) {
|
||||
if (StringUtils.isBlank(resources.getShopName())) {
|
||||
if(StringUtils.isBlank(resources.getShopName())){
|
||||
throw new BadRequestException("店铺名称不可为空");
|
||||
}
|
||||
resources.setShopName(resources.getShopName().trim());
|
||||
if ("release".equals(resources.getProfiles())) {
|
||||
if (resources.getRegisterCode() == null) {
|
||||
if ("release".equals(resources.getProfiles())){
|
||||
if (resources.getRegisterCode() == null){
|
||||
throw new BadRequestException("未绑定激活码");
|
||||
}
|
||||
}
|
||||
TbShopInfo byAccount = tbShopInfoRepository.findByAccount(resources.getAccount());
|
||||
User byUsername = userRepository.findByUsername(resources.getAccount());
|
||||
if (byAccount != null || byUsername != null) {
|
||||
if (byAccount != null || byUsername != null){
|
||||
throw new BadRequestException("登录名已注册");
|
||||
}
|
||||
|
||||
TbShopInfo tbShopInfo = new TbShopInfo();
|
||||
BeanUtil.copyProperties(resources, tbShopInfo, CopyOptions.create().setIgnoreNullValue(true));
|
||||
BeanUtils.copyProperties(resources,tbShopInfo);
|
||||
tbShopInfo.setCreatedAt(Instant.now().toEpochMilli());
|
||||
tbShopInfo.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
tbShopInfo.setOnSale(1);
|
||||
tbShopInfo.setIsOpenYhq(resources.getIsOpenYhq());
|
||||
//激活码
|
||||
TbMerchantRegister tbMerchantRegister = new TbMerchantRegister();
|
||||
if (resources.getRegisterCode() != null) {
|
||||
if (resources.getRegisterCode() != null){
|
||||
tbMerchantRegister = merchantRegisterRepository.findByRegisterCode(resources.getRegisterCode());
|
||||
if (tbMerchantRegister == null) {
|
||||
if(tbMerchantRegister == null){
|
||||
throw new BadRequestException("激活码有误");
|
||||
}
|
||||
if (tbMerchantRegister.getStatus() == 1) {
|
||||
if (tbMerchantRegister.getStatus() == 1){
|
||||
throw new BadRequestException("激活码已激活,不能重复绑定");
|
||||
}
|
||||
tbShopInfo.setExpireAt(DateUtil.addMonthsAndGetTimestamp(tbMerchantRegister.getPeriodYear()));
|
||||
//向redis中存入key
|
||||
redisUtils.set(CacheKey.ACT_CODE + resources.getAccount(), "1", tbShopInfo.getExpireAt() - Instant.now().toEpochMilli());
|
||||
redisUtils.set(CacheKey.ACT_CODE+resources.getAccount(),"1",tbShopInfo.getExpireAt()-Instant.now().toEpochMilli());
|
||||
}
|
||||
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(resources.getType()) && !"only".equals(resources.getType())) {
|
||||
if (resources.getMainId() == null) {
|
||||
throw new BadRequestException("连锁店或者扩展店 主店铺不能为空");
|
||||
}
|
||||
} else {
|
||||
tbShopInfo.setMainId(null);
|
||||
tbShopInfo.setTubeType(1);
|
||||
}
|
||||
|
||||
//增加商户详情
|
||||
TbShopInfo save = tbShopInfoRepository.save(tbShopInfo);
|
||||
if (resources.getRegisterCode() != null) {
|
||||
@@ -277,50 +226,36 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
shopStaffRepository.save(tbPlussShopStaff);
|
||||
//增加默认支付方式
|
||||
Integer integer = tbShopPayTypeRepository.creatPayType(save.getId().toString());
|
||||
if (integer < 4) {
|
||||
if (integer<4){
|
||||
throw new BadRequestException("请重试");
|
||||
}
|
||||
TbProductGroup tbProductGroup = new TbProductGroup();
|
||||
tbProductGroup.setName("热销");
|
||||
tbProductGroup.setShopId(save.getId());
|
||||
tbProductGroup.setProductIds("[]");
|
||||
tbProductGroup.setSortMode("0");
|
||||
tbProductGroup.setUseTime(0);
|
||||
tbProductGroupService.create(tbProductGroup);
|
||||
return tbShopInfoMapper.toDto(save);
|
||||
|
||||
return tbShopInfoMapper.toDto(new TbShopInfo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void upShopPass(String username, String password) {
|
||||
public void upShopPass(String username,String password){
|
||||
User user = userRepository.findByUsername(username);
|
||||
if (user == null) {
|
||||
throw new EntityNotFoundException(User.class, "username", username);
|
||||
}
|
||||
String encPass = MD5Utils.encrypt(password);
|
||||
shopStaffRepository.updatePass(username, encPass, System.currentTimeMillis());
|
||||
merchantAccountRepository.updatePass(username, encPass, System.currentTimeMillis());
|
||||
shopStaffRepository.updatePass(username,encPass,System.currentTimeMillis());
|
||||
merchantAccountRepository.updatePass(username,encPass,System.currentTimeMillis());
|
||||
// passwordEncoder.encode(passwordEncoder.encode(password))
|
||||
userService.updatePass(username, passwordEncoder.encode(password));
|
||||
userService.updatePass(username,passwordEncoder.encode(password));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbShopInfo resources) {
|
||||
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new);
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(resources.getType()) && !"only".equals(resources.getType())) {
|
||||
if (resources.getMainId() == null) {
|
||||
throw new BadRequestException("连锁店或者扩展店 主店铺不能为空");
|
||||
}
|
||||
} else {
|
||||
tbShopInfo.setMainId(null);
|
||||
tbShopInfo.setTubeType(1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(resources.getShopName()) && !resources.getShopName().equals(tbShopInfo.getShopName())) {
|
||||
shopStaffRepository.updateNameById(resources.getShopName(), resources.getId().toString());
|
||||
userRepository.updateNickName(resources.getAccount(), resources.getShopName());
|
||||
shopStaffRepository.updateNameById(resources.getShopName(),resources.getId().toString());
|
||||
userRepository.updateNickName(resources.getAccount(),resources.getShopName());
|
||||
}
|
||||
ValidationUtil.isNull(tbShopInfo.getId(), "TbShopInfo", "id", resources.getId());
|
||||
ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId());
|
||||
tbShopInfo.copy(resources);
|
||||
tbShopInfo.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
tbShopInfoRepository.save(tbShopInfo);
|
||||
@@ -329,7 +264,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
@Override
|
||||
public void updateShopId(TbShopInfo resources) {
|
||||
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new);
|
||||
ValidationUtil.isNull(tbShopInfo.getId(), "TbShopInfo", "id", resources.getId());
|
||||
ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId());
|
||||
tbShopInfo.copy(resources);
|
||||
}
|
||||
|
||||
@@ -350,7 +285,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
public void download(List<TbShopInfoDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbShopInfoDto tbShopInfo : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("店铺帐号", tbShopInfo.getAccount());
|
||||
map.put("店铺代号,策略方式为city +店铺号(8位)", tbShopInfo.getShopCode());
|
||||
map.put("店铺口号", tbShopInfo.getSubTitle());
|
||||
@@ -371,7 +306,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
map.put("经纬度", tbShopInfo.getLat());
|
||||
map.put("经纬度", tbShopInfo.getLng());
|
||||
map.put("未用", tbShopInfo.getMchId());
|
||||
map.put(" registerType", tbShopInfo.getRegisterType());
|
||||
map.put(" registerType", tbShopInfo.getRegisterType());
|
||||
map.put("是否独立的微信小程序", tbShopInfo.getIsWxMaIndependent());
|
||||
map.put("详细地址", tbShopInfo.getAddress());
|
||||
map.put("类似于这种规则51.51.570", tbShopInfo.getCity());
|
||||
@@ -380,7 +315,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
map.put("行业名称", tbShopInfo.getIndustryName());
|
||||
map.put("营业时间", tbShopInfo.getBusinessTime());
|
||||
map.put("配送时间", tbShopInfo.getPostTime());
|
||||
map.put(" postAmountLine", tbShopInfo.getPostAmountLine());
|
||||
map.put(" postAmountLine", tbShopInfo.getPostAmountLine());
|
||||
map.put("0停业1,正常营业,网上售卖", tbShopInfo.getOnSale());
|
||||
map.put("0今日,1次日", tbShopInfo.getSettleType());
|
||||
map.put("时间", tbShopInfo.getSettleTime());
|
||||
@@ -391,9 +326,9 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
map.put("订单等待时间", tbShopInfo.getOrderWaitPayMinute());
|
||||
map.put("支持登陆设备个数", tbShopInfo.getSupportDeviceNumber());
|
||||
map.put("分销层级(1-下级分销 2-两下级分销)", tbShopInfo.getDistributeLevel());
|
||||
map.put(" createdAt", tbShopInfo.getCreatedAt());
|
||||
map.put(" updatedAt", tbShopInfo.getUpdatedAt());
|
||||
map.put(" proxyId", tbShopInfo.getProxyId());
|
||||
map.put(" createdAt", tbShopInfo.getCreatedAt());
|
||||
map.put(" updatedAt", tbShopInfo.getUpdatedAt());
|
||||
map.put(" proxyId", tbShopInfo.getProxyId());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,6 @@ import cn.ysk.cashier.dto.product.TbProductDto;
|
||||
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
@@ -97,7 +96,7 @@ public interface TbProductService {
|
||||
* @param productId 商品id
|
||||
* @param number 增加数量
|
||||
*/
|
||||
void incrStockNumber(String productId, BigDecimal number);
|
||||
void incrStockNumber(String productId, Integer number);
|
||||
|
||||
/**
|
||||
* 返还库存
|
||||
@@ -105,7 +104,7 @@ public interface TbProductService {
|
||||
* @param productSkuId sku
|
||||
* @param num 数量
|
||||
*/
|
||||
void returnStockByPro(Integer productId, Integer productSkuId, BigDecimal num);
|
||||
void returnStockByPro(Integer productId, Integer productSkuId, Integer num);
|
||||
|
||||
Object activateProduct(Integer page, Integer size, Integer categoryId, Integer shopId, Integer productId);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
*/
|
||||
package cn.ysk.cashier.service.shop;
|
||||
|
||||
import cn.ysk.cashier.dto.BindingDto;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
@@ -34,13 +32,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
**/
|
||||
public interface TbShopInfoService {
|
||||
|
||||
/**
|
||||
* 绑定开票信息
|
||||
* @param bindingDto
|
||||
* @return
|
||||
*/
|
||||
JSONObject binding(BindingDto bindingDto);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
@@ -48,8 +39,6 @@ public interface TbShopInfoService {
|
||||
*/
|
||||
Map<String,Object> queryAll(TbShopInfoQueryCriteria criteria);
|
||||
|
||||
List<TbShopInfo> queryChildShop(TbShopInfoQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
@@ -65,6 +54,7 @@ public interface TbShopInfoService {
|
||||
TbShopInfoDto findById(Integer id);
|
||||
TbShopInfo findByIdInfo(Integer id);
|
||||
|
||||
TbShopInfoDto finByAccount(String account);
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
|
||||
@@ -98,13 +98,6 @@ public interface TbShopTableService {
|
||||
|
||||
TbCashierCart addCartForUser(AddCartDTO addCartDTO);
|
||||
|
||||
/**
|
||||
* 添加临时菜
|
||||
* @param temporaryDishesDTO 临时菜信息
|
||||
*/
|
||||
TbCashierCart addTemporaryDishes(AddTemporaryDishesDTO temporaryDishesDTO);
|
||||
|
||||
|
||||
void removeCart(RemoveCartDTO removeCartDTO);
|
||||
|
||||
void returnCart(ReturnCartDTO returnCartDTO);
|
||||
@@ -156,11 +149,4 @@ public interface TbShopTableService {
|
||||
Object getShopState(Integer shopId, String tableId);
|
||||
|
||||
Object bindQrcode(BindTableQrCodeDTO bindTableQrCodeDTO);
|
||||
|
||||
/**
|
||||
* 修改购物车价格
|
||||
* @param updatePriceDTO 价格信息
|
||||
*/
|
||||
TbCashierCart updatePrice(UpdatePriceDTO updatePriceDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -133,10 +133,10 @@ public class WxAccountUtil {
|
||||
}
|
||||
|
||||
|
||||
public void sendStockMsg(String shopName, String productName, double stock, String openId, ShopWxMsgTypeEnum shopWxMsgTypeEnum, Integer shopId) {
|
||||
public void sendStockMsg(String shopName, String productName, int stock, String openId, ShopWxMsgTypeEnum shopWxMsgTypeEnum, Integer shopId) {
|
||||
|
||||
stock = Math.max(stock, 0);
|
||||
double finalStock = stock;
|
||||
Integer finalStock = stock;
|
||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||
put("thing22", new HashMap<String, Object>() {{
|
||||
put("value", shopName);
|
||||
|
||||
@@ -95,11 +95,11 @@ public class WxMsgUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void aboardStockMsg(String shopName, Integer shopId, String proName, double stock) {
|
||||
public void aboardStockMsg(String shopName, Integer shopId, String proName, Integer stock) {
|
||||
if (!checkIsOpen(shopId, ShopWxMsgTypeEnum.OPERATION_MSG)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<TbShopOpenId> openIds = tbShopOpenIdService.lambdaQuery()
|
||||
.eq(TbShopOpenId::getShopId, shopId)
|
||||
.eq(TbShopOpenId::getStatus, 1)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user