Compare commits
No commits in common. "master" and "1.0.2" have entirely different histories.
|
|
@ -1,12 +1 @@
|
|||
### IDEA ###
|
||||
/target/**/*
|
||||
/log/*
|
||||
.idea/*
|
||||
*.iml
|
||||
*/target/*
|
||||
*/*.iml
|
||||
/.gradle/
|
||||
/application.pid
|
||||
/target/*
|
||||
**.jar
|
||||
/*.log
|
||||
/target/
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public @interface LimitSubmit {
|
|||
/**
|
||||
* 默认 10s
|
||||
*/
|
||||
int limit() default 10;
|
||||
int limit() default 7200;
|
||||
|
||||
/**
|
||||
* 请求完成后 是否一直等待
|
||||
|
|
@ -19,4 +19,4 @@ public @interface LimitSubmit {
|
|||
* @return
|
||||
*/
|
||||
boolean needAllWait() default true;
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ public class DataCache {
|
|||
|
||||
|
||||
|
||||
@Bean
|
||||
public void init(){
|
||||
// log.info("加载店铺信息");
|
||||
shopInfo();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class CloudPrinterController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("print")
|
||||
public Result print(@RequestHeader("token") String token,
|
||||
public Result print( @RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("type") String type,
|
||||
|
|
@ -51,22 +51,8 @@ public class CloudPrinterController {
|
|||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("tradeDay") String tradeDay,
|
||||
@RequestParam("id") Integer id
|
||||
|
||||
Integer id
|
||||
){
|
||||
return cloudPrinterService.handoverprintData(token,id,loginName,false);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("printInvoice")
|
||||
public Result printInvoice(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("content") String content,
|
||||
@RequestParam("remark") String remark,
|
||||
@RequestParam("amount") String amount,
|
||||
@RequestParam("shopId") String shopId
|
||||
){
|
||||
return cloudPrinterService.printInvoice(shopId, content, remark, amount);
|
||||
return cloudPrinterService.handoverprintData(token,id,loginName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,16 +25,4 @@ public class DataController {
|
|||
return dataService.handoverprintData(token,id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "handoverprint")
|
||||
public Result handoverprint(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
Integer id,
|
||||
boolean isprintProduct){
|
||||
return dataService.handoverprint(token,id,isprintProduct);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,9 @@ import com.chaozhanggui.system.cashierservice.sign.Result;
|
|||
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
|
|
@ -51,4 +49,5 @@ public class LoginContoller {
|
|||
@RequestHeader("clientType") String clientType){
|
||||
return loginService.getShopInfo(token);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
|
|
@ -11,9 +10,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@Slf4j
|
||||
|
|
@ -117,13 +113,9 @@ public class OrderController {
|
|||
@GetMapping("/findOrder")
|
||||
public Result findOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType, @RequestParam("shopId") Integer shopId,
|
||||
@RequestParam("status") String status,
|
||||
@RequestParam(value = "orderNo", required = false) String orderNo,
|
||||
@RequestParam(value = "startTime", required = false) String startTime,
|
||||
@RequestParam(value = "endTime", required = false) String endTime,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam("status") String status,@RequestParam("orderNo") String orderNo,@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "1") Integer size){
|
||||
return orderService.findOrder(shopId,status,page,size,orderNo, DateUtil.parse(startTime), DateUtil.parse(endTime));
|
||||
return orderService.findOrder(shopId,status,page,size,orderNo);
|
||||
}
|
||||
|
||||
@GetMapping("/orderDetail")
|
||||
|
|
@ -154,11 +146,4 @@ public class OrderController {
|
|||
@RequestParam("pageSize") int pageSize){
|
||||
return orderService.getOutNumber(shopId,page,pageSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("getOrderById")
|
||||
public Result getOrderById(@RequestParam("orderId") Integer orderId){
|
||||
return orderService.getOrder(orderId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,17 +211,13 @@ public class PayController {
|
|||
|
||||
|
||||
@RequestMapping("returnOrder")
|
||||
@LimitSubmit(key = "returnOrder:%s", limit = 10)
|
||||
@LimitSubmit(key = "returnOrder:%s")
|
||||
public Result returnOrder(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestBody List<TbOrderDetail> list,
|
||||
@RequestParam("pwd") String pwd,
|
||||
@RequestParam(defaultValue = "true") boolean isOnline
|
||||
@RequestBody List<TbOrderDetail> list
|
||||
){
|
||||
|
||||
|
||||
return payService.returnOrder(list,token,null, isOnline);
|
||||
return payService.returnOrder(list,token);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbUserShopMsgMapper;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpQrcodeService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||
|
|
@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.ShopUserDuty;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -44,7 +43,4 @@ public interface ShopUserDutyMapper {
|
|||
void updateStatusById(@Param("id") Integer id, @Param("staffId") Integer staffId);
|
||||
|
||||
// List<String> selectByShopIdAndTradeAll(@Param("shopId") Integer shopId,@Param("day") String day,@Param("tokenId") Integer tokenId);
|
||||
|
||||
|
||||
List<ProductInfo> selectByDutyId(Integer dutyId);
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.ShopUserDutyPay;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -32,6 +31,4 @@ public interface ShopUserDutyPayMapper {
|
|||
|
||||
|
||||
List<Map<String,Object>> selectCetoryBydutyId(Integer dutyId);
|
||||
|
||||
List<ProductInfoPO> selectProductByDutyId(Integer dutyId);
|
||||
}
|
||||
|
|
@ -7,8 +7,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -33,7 +31,7 @@ public interface TbOrderInfoMapper {
|
|||
List<TbOrderInfo> selectAllByStatus(String status);
|
||||
|
||||
List<OrderPo> selectAllByShop(@Param("shopId") Integer shopId, @Param("orderType") String orderType,
|
||||
@Param("day") String day, @Param("orderNo") String orderNo, Long startTime, Long endTime);
|
||||
@Param("day") String day, @Param("orderNo") String orderNo);
|
||||
|
||||
TbOrderInfo selectByTradeAndMasterId(@Param("day")String day, @Param("masterId")String masterId, @Param("shopId")Integer shopId);
|
||||
|
||||
|
|
@ -47,9 +45,4 @@ public interface TbOrderInfoMapper {
|
|||
Map<String,String> selectByOrderId(String orderId);
|
||||
|
||||
List<SkuInfoPo> selectSkuByOrderId(String orderId);
|
||||
|
||||
List<SkuInfoPo> selectSkuByOrderIdAndType(String orderId);
|
||||
|
||||
|
||||
TbOrderInfo selectById(Integer id);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,5 +20,4 @@ public interface TbPlussShopStaffMapper {
|
|||
int updateByPrimaryKey(TbPlussShopStaff record);
|
||||
|
||||
TbPlussShopStaff selectByAccount(String account);
|
||||
TbPlussShopStaff selectByAccountAndShopId(String account,String shopId);
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
|||
import com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -29,12 +28,10 @@ public interface TbProductMapper {
|
|||
|
||||
|
||||
List<TbProductWithBLOBs> selectByShopId(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndCheckGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
|
||||
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopType(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopTypeCheckGrounding(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
|
||||
|
||||
|
||||
|
|
@ -44,13 +41,4 @@ public interface TbProductMapper {
|
|||
|
||||
|
||||
List<ProConsSkuInfo> selectBySkuId(Integer skuId);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number+#{num} WHERE id=#{id}")
|
||||
int incrStock(String id, int num);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
|
||||
int decrStock(String id, int num);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id}")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs;
|
|||
import com.chaozhanggui.system.cashierservice.entity.po.ProductSkuPo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -41,19 +39,4 @@ public interface TbProductSkuMapper {
|
|||
|
||||
|
||||
void batchStockNum(@Param("list")List<ProductSkuPo> list);
|
||||
|
||||
@Update("update tb_product_sku set stock_number=stock_number+#{num} WHERE id=#{skuId}")
|
||||
int incrStock(String skuId, int num);
|
||||
|
||||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
|
||||
int decrStock(String id, int num);
|
||||
|
||||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id}")
|
||||
List<TbProductSku> selectByProductCheckGrounding(@Param("id") Integer id);
|
||||
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and is_del=0 and product_id=#{id}")
|
||||
List<TbProductSku> selectGroundingByProId(Integer id);
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,6 @@ public interface TbProskuConMapper {
|
|||
|
||||
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopOpenId;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_open_id(商家openid信息表)】的数据库操作Mapper
|
||||
* @createDate 2024-07-02 14:37:08
|
||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbShopOpenId
|
||||
*/
|
||||
public interface TbShopOpenIdMapper {
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(TbShopOpenId record);
|
||||
|
||||
int insertSelective(TbShopOpenId record);
|
||||
|
||||
TbShopOpenId selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbShopOpenId record);
|
||||
|
||||
int updateByPrimaryKey(TbShopOpenId record);
|
||||
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1")
|
||||
List<TbShopOpenId> selectByShopId(Integer integer);
|
||||
}
|
||||
|
|
@ -2,30 +2,20 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbUserShopMsgMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
int deleteByPrimaryKey(Integer shopId);
|
||||
|
||||
int insert(TbUserShopMsg record);
|
||||
|
||||
int insertSelective(TbUserShopMsg record);
|
||||
|
||||
TbUserShopMsg selectByPrimaryKey(Integer id);
|
||||
TbUserShopMsg selectByPrimaryKey(Integer shopId);
|
||||
|
||||
int updateByPrimaryKeySelective(TbUserShopMsg record);
|
||||
|
||||
int updateByPrimaryKey(TbUserShopMsg record);
|
||||
|
||||
@Select("select * from tb_user_shop_msg where shop_id=#{shopId}")
|
||||
TbUserShopMsg selectByShopId(@Param("shopId") String shopId);
|
||||
|
||||
|
||||
List<TbUserShopMsg> selectAllByShopId(@Param("shopId") Integer shopId);
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.tbHandover;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface tbHandoverMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(tbHandover record);
|
||||
|
||||
int insertSelective(tbHandover record);
|
||||
|
||||
tbHandover selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(tbHandover record);
|
||||
|
||||
int updateByPrimaryKey(tbHandover record);
|
||||
}
|
||||
|
|
@ -25,12 +25,6 @@ public class TbConsInfo implements Serializable {
|
|||
|
||||
private BigDecimal conWarning;
|
||||
|
||||
private BigDecimal stockConsume;
|
||||
|
||||
private String status;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
|
@ -132,28 +126,4 @@ public class TbConsInfo implements Serializable {
|
|||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public BigDecimal getStockConsume() {
|
||||
return stockConsume;
|
||||
}
|
||||
|
||||
public void setStockConsume(BigDecimal stockConsume) {
|
||||
this.stockConsume = stockConsume;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,8 +11,6 @@ public class TbConsInfoFlow implements Serializable {
|
|||
|
||||
private Integer consId;
|
||||
|
||||
private Integer proSkuId;
|
||||
|
||||
private String conName;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
|
@ -25,12 +23,6 @@ public class TbConsInfoFlow implements Serializable {
|
|||
|
||||
private String bizType;
|
||||
|
||||
|
||||
|
||||
private Integer orderId;
|
||||
|
||||
private String orderNo;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
|
@ -61,14 +53,6 @@ public class TbConsInfoFlow implements Serializable {
|
|||
this.consId = consId;
|
||||
}
|
||||
|
||||
public Integer getProSkuId() {
|
||||
return proSkuId;
|
||||
}
|
||||
|
||||
public void setProSkuId(Integer proSkuId) {
|
||||
this.proSkuId = proSkuId;
|
||||
}
|
||||
|
||||
public String getConName() {
|
||||
return conName;
|
||||
}
|
||||
|
|
@ -132,20 +116,4 @@ public class TbConsInfoFlow implements Serializable {
|
|||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Integer getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Integer orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
}
|
||||
|
|
@ -64,9 +64,6 @@ public class TbProduct implements Serializable {
|
|||
|
||||
private String typeEnum;
|
||||
|
||||
/**
|
||||
* 是否共享库存
|
||||
*/
|
||||
private Byte isDistribute;
|
||||
|
||||
private Byte isDel;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ public class TbProductSku implements Serializable {
|
|||
|
||||
private BigDecimal strategyPrice;
|
||||
|
||||
private Integer suit;
|
||||
|
||||
private Double stockNumber;
|
||||
|
||||
private String coverImg;
|
||||
|
|
@ -52,9 +50,6 @@ public class TbProductSku implements Serializable {
|
|||
private Long updatedAt;
|
||||
|
||||
private Integer isPauseSale = 0;
|
||||
private Integer isDel;
|
||||
private String specSnap;
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||
private String images;
|
||||
|
|
@ -16,18 +15,8 @@ public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
|||
|
||||
private String selectSpec;
|
||||
|
||||
private List<?> skuList;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public List<?> getSkuList() {
|
||||
return skuList;
|
||||
}
|
||||
|
||||
public void setSkuList(List<?> skuList) {
|
||||
this.skuList = skuList;
|
||||
}
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
}
|
||||
|
|
@ -75,4 +64,4 @@ public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
|||
public void setSelectSpec(String selectSpec) {
|
||||
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,8 +9,6 @@ public class TbProskuCon implements Serializable {
|
|||
|
||||
private Integer shopId;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer productSkuId;
|
||||
|
||||
private Integer conInfoId;
|
||||
|
|
@ -39,14 +37,6 @@ public class TbProskuCon implements Serializable {
|
|||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getProductSkuId() {
|
||||
return productSkuId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,176 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商家openid信息表
|
||||
* @TableName tb_shop_open_id
|
||||
*/
|
||||
public class TbShopOpenId implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 已经订阅消息的商家微信号
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已经订阅消息的商家微信号
|
||||
*/
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已经订阅消息的商家微信号
|
||||
*/
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TbShopOpenId other = (TbShopOpenId) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
||||
&& (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId()))
|
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
|
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
||||
result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode());
|
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
|
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", shopId=").append(shopId);
|
||||
sb.append(", openId=").append(openId);
|
||||
sb.append(", status=").append(status);
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,6 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
|
||||
public class TbUserShopMsg implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private String openId;
|
||||
|
|
@ -20,14 +18,6 @@ public class TbUserShopMsg implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ public class TbmerchantAccount implements Serializable {
|
|||
|
||||
private String headImg;
|
||||
|
||||
private String pwd;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
|
|
@ -216,12 +214,4 @@ public class TbmerchantAccount implements Serializable {
|
|||
public void setHeadImg(String headImg) {
|
||||
this.headImg = headImg == null ? null : headImg.trim();
|
||||
}
|
||||
|
||||
public String getPwd() {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
public void setPwd(String pwd) {
|
||||
this.pwd = pwd;
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,6 @@ public class OrderPo {
|
|||
private String outNumber;
|
||||
private String tableName;
|
||||
private List<SkuInfoPo> skuInfos;
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ProductInfo implements Serializable {
|
||||
|
||||
private String productName;
|
||||
private Integer num;
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
public ProductInfo(String productName, Integer num, BigDecimal amount) {
|
||||
this.productName = productName;
|
||||
this.num = num;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public ProductInfo() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ProductInfoPO implements Serializable {
|
||||
|
||||
private Integer productId;
|
||||
private String productName;
|
||||
private String skuName;
|
||||
private Integer num;
|
||||
private BigDecimal amount;
|
||||
}
|
||||
|
|
@ -2,15 +2,11 @@ package com.chaozhanggui.system.cashierservice.entity.po;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SkuInfoPo {
|
||||
|
||||
private String productName;
|
||||
private String productSkuName;
|
||||
private Integer num;
|
||||
private BigDecimal priceAmount;
|
||||
private BigDecimal packAmount;
|
||||
private String categoryId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,238 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class tbHandover implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private String tradeDay;
|
||||
|
||||
private String printNo;
|
||||
|
||||
private Integer dutyId;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private String merchantName;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private Integer staffId;
|
||||
|
||||
private String staffName;
|
||||
|
||||
private String payInfos;
|
||||
|
||||
private String memberData;
|
||||
|
||||
private String productCategories;
|
||||
|
||||
private String totalAmount;
|
||||
|
||||
private String imprest;
|
||||
|
||||
private String payable;
|
||||
|
||||
private String handIn;
|
||||
|
||||
private String returnAmount;
|
||||
|
||||
private String orderNum;
|
||||
|
||||
private String quickAmount;
|
||||
|
||||
private String productInfoPos;
|
||||
|
||||
private String productInfos;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTradeDay() {
|
||||
return tradeDay;
|
||||
}
|
||||
|
||||
public void setTradeDay(String tradeDay) {
|
||||
this.tradeDay = tradeDay == null ? null : tradeDay.trim();
|
||||
}
|
||||
|
||||
public String getPrintNo() {
|
||||
return printNo;
|
||||
}
|
||||
|
||||
public void setPrintNo(String printNo) {
|
||||
this.printNo = printNo == null ? null : printNo.trim();
|
||||
}
|
||||
|
||||
public Integer getDutyId() {
|
||||
return dutyId;
|
||||
}
|
||||
|
||||
public void setDutyId(Integer dutyId) {
|
||||
this.dutyId = dutyId;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public String getMerchantName() {
|
||||
return merchantName;
|
||||
}
|
||||
|
||||
public void setMerchantName(String merchantName) {
|
||||
this.merchantName = merchantName == null ? null : merchantName.trim();
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime == null ? null : startTime.trim();
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime == null ? null : endTime.trim();
|
||||
}
|
||||
|
||||
public Integer getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
public void setStaffId(Integer staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public String getStaffName() {
|
||||
return staffName;
|
||||
}
|
||||
|
||||
public void setStaffName(String staffName) {
|
||||
this.staffName = staffName == null ? null : staffName.trim();
|
||||
}
|
||||
|
||||
public String getPayInfos() {
|
||||
return payInfos;
|
||||
}
|
||||
|
||||
public void setPayInfos(String payInfos) {
|
||||
this.payInfos = payInfos == null ? null : payInfos.trim();
|
||||
}
|
||||
|
||||
public String getMemberData() {
|
||||
return memberData;
|
||||
}
|
||||
|
||||
public void setMemberData(String memberData) {
|
||||
this.memberData = memberData == null ? null : memberData.trim();
|
||||
}
|
||||
|
||||
public String getProductCategories() {
|
||||
return productCategories;
|
||||
}
|
||||
|
||||
public void setProductCategories(String productCategories) {
|
||||
this.productCategories = productCategories == null ? null : productCategories.trim();
|
||||
}
|
||||
|
||||
public String getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
public void setTotalAmount(String totalAmount) {
|
||||
this.totalAmount = totalAmount == null ? null : totalAmount.trim();
|
||||
}
|
||||
|
||||
public String getImprest() {
|
||||
return imprest;
|
||||
}
|
||||
|
||||
public void setImprest(String imprest) {
|
||||
this.imprest = imprest == null ? null : imprest.trim();
|
||||
}
|
||||
|
||||
public String getPayable() {
|
||||
return payable;
|
||||
}
|
||||
|
||||
public void setPayable(String payable) {
|
||||
this.payable = payable == null ? null : payable.trim();
|
||||
}
|
||||
|
||||
public String getHandIn() {
|
||||
return handIn;
|
||||
}
|
||||
|
||||
public void setHandIn(String handIn) {
|
||||
this.handIn = handIn == null ? null : handIn.trim();
|
||||
}
|
||||
|
||||
public String getReturnAmount() {
|
||||
return returnAmount;
|
||||
}
|
||||
|
||||
public void setReturnAmount(String returnAmount) {
|
||||
this.returnAmount = returnAmount == null ? null : returnAmount.trim();
|
||||
}
|
||||
|
||||
public String getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(String orderNum) {
|
||||
this.orderNum = orderNum == null ? null : orderNum.trim();
|
||||
}
|
||||
|
||||
public String getQuickAmount() {
|
||||
return quickAmount;
|
||||
}
|
||||
|
||||
public void setQuickAmount(String quickAmount) {
|
||||
this.quickAmount = quickAmount == null ? null : quickAmount.trim();
|
||||
}
|
||||
|
||||
public String getProductInfoPos() {
|
||||
return productInfoPos;
|
||||
}
|
||||
|
||||
public void setProductInfoPos(String productInfoPos) {
|
||||
this.productInfoPos = productInfoPos == null ? null : productInfoPos.trim();
|
||||
}
|
||||
|
||||
public String getProductInfos() {
|
||||
return productInfos;
|
||||
}
|
||||
|
||||
public void setProductInfos(String productInfos) {
|
||||
this.productInfos = productInfos == null ? null : productInfos.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -30,13 +30,15 @@ public class SignInterceptor implements HandlerInterceptor {
|
|||
|
||||
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
RedisUtils redisUtil;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
|
||||
|
||||
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
if (HttpMethod.OPTIONS.toString().equals(request.getMethod())) {
|
||||
|
|
@ -57,7 +59,7 @@ public class SignInterceptor implements HandlerInterceptor {
|
|||
|
||||
String key=RedisCst.ONLINE_USER.concat(":").concat(clientType).concat(":").concat(loginName);
|
||||
|
||||
String cacheToken= redisUtil.getMessage(key);
|
||||
String cacheToken= redisUtil.get(key)+"";
|
||||
if(ObjectUtil.isEmpty(cacheToken)||!cacheToken.equals(token)){
|
||||
response.setContentType(CONTENT_TYPE);
|
||||
response.getWriter().print(JSONUtil.toJsonStr(new Result(CodeEnum.TOENNOEXIST)));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.chaozhanggui.system.cashierservice.interceptor;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
|
@ -17,15 +18,12 @@ public class WebAppConfigurer implements WebMvcConfigurer {
|
|||
registry.addInterceptor(signInterceptor)
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns("/login/login")
|
||||
.excludePathPatterns("/login/getPhone")
|
||||
.excludePathPatterns("/cloudPrinter/print")
|
||||
.excludePathPatterns("/cloudPrinter/handoverPrint")
|
||||
.excludePathPatterns("/data/handoverData")
|
||||
.excludePathPatterns("/order/scanSendMessage")
|
||||
.excludePathPatterns("/order/getsendMessage")
|
||||
.excludePathPatterns("/qrcode/getscanCode")
|
||||
.excludePathPatterns("/order/sendMessage")
|
||||
.excludePathPatterns("/order/getOrderById")
|
||||
.excludePathPatterns("/data/handoverprint");
|
||||
.excludePathPatterns("/order/sendMessage");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package com.chaozhanggui.system.cashierservice.model;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
|
@ -41,13 +38,8 @@ public class HandoverInfo implements Serializable {
|
|||
|
||||
private String quickAmount;
|
||||
|
||||
private List<ProductInfoPO> productInfoPOS;
|
||||
|
||||
private List<ProductInfo> productInfos;
|
||||
|
||||
|
||||
public HandoverInfo(String merchantName, String startTime, String endTime, String staff, List<PayInfo> payInfos, List<HandoverInfo.MemberData> memberData, String totalAmount, String imprest, String payable, String handIn, String returnAmount, String orderNum
|
||||
, List<ProductCategory> productCategories, String quickAmount, List<ProductInfoPO> productInfoPOS, List<ProductInfo> productInfos
|
||||
public HandoverInfo(String merchantName, String startTime, String endTime, String staff, List<PayInfo> payInfos, List<HandoverInfo.MemberData> memberData, String totalAmount, String imprest, String payable, String handIn, String returnAmount,String orderNum
|
||||
,List<ProductCategory> productCategories,String quickAmount
|
||||
|
||||
) {
|
||||
this.merchantName = merchantName;
|
||||
|
|
@ -64,8 +56,6 @@ public class HandoverInfo implements Serializable {
|
|||
this.orderNum = orderNum;
|
||||
this.productCategories=productCategories;
|
||||
this.quickAmount=quickAmount;
|
||||
this.productInfoPOS=productInfoPOS;
|
||||
this.productInfos=productInfos;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
|
@ -106,6 +96,4 @@ public class HandoverInfo implements Serializable {
|
|||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import lombok.Data;
|
||||
import com.chaozhanggui.system.cashierservice.util.HttpClientUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.N;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
|
|
@ -17,8 +19,10 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
|
@ -47,10 +51,6 @@ public class ConsMsgConsumer {
|
|||
@Autowired
|
||||
TbProductMapper tbProductMapper;
|
||||
|
||||
private final WxAccountUtil wxAccountUtil;
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
|
|
@ -66,17 +66,10 @@ public class ConsMsgConsumer {
|
|||
@Value("${subscribe.message.miniprogramState}")
|
||||
private String miniprogramState;
|
||||
|
||||
public ConsMsgConsumer(WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper) {
|
||||
this.wxAccountUtil = wxAccountUtil;
|
||||
this.shopOpenIdMapper = shopOpenIdMapper;
|
||||
}
|
||||
|
||||
|
||||
@RabbitHandler
|
||||
public void listener(String message) {
|
||||
|
||||
log.info("耗材即将售罄提醒:{}",message);
|
||||
|
||||
JSONObject object = JSONObject.parseObject(message);
|
||||
if (Objects.isNull(object) || !object.containsKey("skuId") || !object.containsKey("shopId") || Objects.isNull(object.getInteger("skuId")) || Objects.isNull(object.getInteger("shopId"))) {
|
||||
log.info("接收的信息为空");
|
||||
|
|
@ -115,33 +108,65 @@ public class ConsMsgConsumer {
|
|||
tbProskuCons.parallelStream().forEach(it -> {
|
||||
TbConsInfo tbConsInfo = tbConsInfoMapper.selectByPrimaryKey(it.getConInfoId());
|
||||
if (Objects.isNull(tbConsInfo)) {
|
||||
log.info("耗材信息不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("耗材名称: {}, conwarning:{},stockNumber:{}",tbConsInfo.getConName(),
|
||||
tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||
if (N.egt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()))) {
|
||||
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
||||
log.info("待推送openId列表: {}", tbUserShopMsgs);
|
||||
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
||||
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
||||
String key=RedisCst.ORDER_MESSAGE.concat(tbConsInfo.getShopId().toString()).concat("#").concat(tbConsInfo.getId().toString()).concat("#").concat(tbUserShopMsg.getOpenId());
|
||||
String value = redisUtil.getMessage(key);
|
||||
log.info("redis_key:{}",value);
|
||||
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
||||
if (Objects.isNull(value)) {
|
||||
JSONObject jsonObject = wxAccountUtil.sendStockWarnMsg("耗材库存不足", tbConsInfo.getConName(),
|
||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toBigInteger().intValue(), tbUserShopMsg.getOpenId());
|
||||
if (jsonObject != null) {
|
||||
log.info("写入redis:{}",key);
|
||||
redisUtil.saveMessage(key, "1", 30 * 60);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (Objects.nonNull(tbConsInfo)) {
|
||||
|
||||
if (N.gt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber())) {
|
||||
String key = redisUtil.getMessage(RedisCst.ORDER_MESSAGE.concat(tbConsInfo.getShopId().toString()).concat("#").concat(tbConsInfo.getId().toString()));
|
||||
|
||||
if (Objects.isNull(key)) {
|
||||
TbUserShopMsg tbUserShopMsg = tbUserShopMsgMapper.selectByPrimaryKey(tbConsInfo.getShopId());
|
||||
if (Objects.nonNull(tbUserShopMsg) && Objects.nonNull(tbUserShopMsg.getOpenId())) {
|
||||
JSONObject access_token = getAccessToken();
|
||||
String accessToken = String.valueOf(access_token.get("access_token"));
|
||||
|
||||
JSONObject object1 = new JSONObject();
|
||||
|
||||
object1.put("template_id", "IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY");
|
||||
object1.put("touser", tbUserShopMsg.getOpenId());
|
||||
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
|
||||
JSONObject thing1 = new JSONObject();
|
||||
thing1.put("value", shopInfo.getShopName());
|
||||
|
||||
JSONObject thing5 = new JSONObject();
|
||||
thing5.put("value", "耗材库存不足,请及时补充。");
|
||||
|
||||
JSONObject thing6 = new JSONObject();
|
||||
thing6.put("value", product.getName());
|
||||
|
||||
|
||||
JSONObject thing7 = new JSONObject();
|
||||
thing7.put("value", tbConsInfo.getStockNumber().toPlainString());
|
||||
|
||||
data.put("thing1", thing1);
|
||||
data.put("thing6", thing6);
|
||||
data.put("number7", thing7);
|
||||
data.put("thing5", thing5);
|
||||
|
||||
object1.put("data", data);
|
||||
|
||||
object1.put("miniprogram_state", miniprogramState);
|
||||
object1.put("lang", "zh_CN");
|
||||
|
||||
String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("返回结果:{}", response);
|
||||
JSONObject resObj = JSONObject.parseObject(response);
|
||||
if (ObjectUtil.isNotEmpty(resObj) && ObjectUtil.isNotNull(resObj) && "0".equals(String.valueOf(resObj.get("errcode")))) {
|
||||
redisUtil.saveMessage(key, object1.toString(),10*60*1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
@ -167,88 +192,44 @@ public class ConsMsgConsumer {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject getAccessToken1() {
|
||||
String requestUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
Map<String, String> requestUrlParam = new HashMap<>();
|
||||
|
||||
|
||||
requestUrlParam.put("appid", "wxcf0fe8cdba153fd6");
|
||||
//小程序secret
|
||||
requestUrlParam.put("secret", "c33e06467c6879a62af633d50ed6b720");
|
||||
//默认参数
|
||||
requestUrlParam.put("grant_type", "client_credential");
|
||||
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doGet(requestUrl, requestUrlParam));
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@Data
|
||||
static class MsgInfo{
|
||||
private String openId;
|
||||
private String shopName;
|
||||
|
||||
private String productName;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
public MsgInfo(String openId, String shopName, String productName, BigDecimal amount) {
|
||||
this.openId = openId;
|
||||
this.shopName = shopName;
|
||||
this.productName = productName;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
//
|
||||
// List<MsgInfo> list=new ArrayList<>();
|
||||
//
|
||||
// list.add(new MsgInfo("oeQYq5KEjN1-laurB3oRbqEllVzs","双屿Pisces","茄汁肉酱意面",new BigDecimal(24)));
|
||||
// list.add(new MsgInfo("oeQYq5KEjN1-laurB3oRbqEllVzs","森食界创意轻食(未央店)","番茄鸳鸯锅",new BigDecimal(36)));
|
||||
//
|
||||
// for (MsgInfo msgInfo : list) {
|
||||
// JSONObject access_token = new ConsMsgConsumer().getAccessToken1();
|
||||
// String accessToken = String.valueOf(access_token.get("access_token"));
|
||||
//
|
||||
// JSONObject object1 = new JSONObject();
|
||||
//
|
||||
// object1.put("template_id", "IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY");
|
||||
// object1.put("touser", msgInfo.getOpenId());
|
||||
//
|
||||
//
|
||||
// JSONObject data = new JSONObject();
|
||||
//
|
||||
// JSONObject thing1 = new JSONObject();
|
||||
// thing1.put("value", msgInfo.getShopName());
|
||||
//
|
||||
// JSONObject thing5 = new JSONObject();
|
||||
// thing5.put("value", "耗材库存不足,请及时补充。");
|
||||
//
|
||||
// JSONObject thing6 = new JSONObject();
|
||||
// thing6.put("value", msgInfo.getProductName());
|
||||
//
|
||||
//
|
||||
// JSONObject thing7 = new JSONObject();
|
||||
// thing7.put("value", msgInfo.getAmount().toPlainString());
|
||||
//
|
||||
// data.put("thing1", thing1);
|
||||
// data.put("thing6", thing6);
|
||||
// data.put("number7", thing7);
|
||||
// data.put("thing5", thing5);
|
||||
//
|
||||
// object1.put("data", data);
|
||||
//
|
||||
// object1.put("miniprogram_state", "formal");
|
||||
// object1.put("lang", "zh_CN");
|
||||
//
|
||||
// String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
// log.info("返回结果:{}", response);
|
||||
// JSONObject resObj = JSONObject.parseObject(response);
|
||||
// }
|
||||
JSONObject access_token = new ConsMsgConsumer().getAccessToken();
|
||||
String accessToken = String.valueOf(access_token.get("access_token"));
|
||||
|
||||
JSONObject object1 = new JSONObject();
|
||||
|
||||
object1.put("template_id", "IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY");
|
||||
object1.put("touser", "oeQYq5CAuSpdeX9uZz52DJiSUO9M");
|
||||
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
|
||||
JSONObject thing1 = new JSONObject();
|
||||
thing1.put("value", "水");
|
||||
|
||||
JSONObject thing5 = new JSONObject();
|
||||
thing5.put("value", "耗材库存不足,请及时补充。");
|
||||
|
||||
JSONObject thing6 = new JSONObject();
|
||||
thing6.put("value", "咖啡");
|
||||
|
||||
|
||||
JSONObject thing7 = new JSONObject();
|
||||
thing7.put("value", "3.2");
|
||||
|
||||
data.put("thing1", thing1);
|
||||
data.put("thing6", thing6);
|
||||
data.put("number7", thing7);
|
||||
data.put("thing5", thing5);
|
||||
|
||||
object1.put("data", data);
|
||||
|
||||
object1.put("miniprogram_state", "trial");
|
||||
object1.put("lang", "zh_CN");
|
||||
|
||||
String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("返回结果:{}", response);
|
||||
JSONObject resObj = JSONObject.parseObject(response);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -185,28 +185,34 @@ public class PrintMechineConsumer {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
List<TbOrderDetail> tbOrderDetails=tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||
if(ObjectUtil.isNotEmpty(tbOrderDetails)&&tbOrderDetails.size()>0) {
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(),"final");
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetails.stream().forEach(it -> {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
String categoryId;
|
||||
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
} else {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
|
||||
Long count= categoryInfos.stream().filter(c->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
log.info("获取当前类别是否未打印类别:{}",count);
|
||||
|
||||
if (count > 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
if(count>0){
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), it.getPriceAmount().toPlainString(), remark);
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), it.getTotalAmount().toPlainString(), remark);
|
||||
detailList.add(detail);
|
||||
}
|
||||
});
|
||||
|
||||
String balance = "0";
|
||||
|
||||
if ("deposit".equals(orderInfo.getPayType())) {
|
||||
|
|
@ -215,18 +221,18 @@ public class PrintMechineConsumer {
|
|||
balance = user.getAmount().toPlainString();
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0", detailList, orderInfo.getRemark());
|
||||
if(ObjectUtil.isNotEmpty(detailList)&&detailList.size()>0){
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp")?orderInfo.getTableName():orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance,(ObjectUtil.isEmpty(orderInfo.getPayType())||ObjectUtil.isNull(orderInfo.getPayType())?"":orderInfo.getPayType() ), "0", detailList,orderInfo.getRemark());
|
||||
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
||||
detailPO.setOutNumber(orderInfo.getOutNumber());
|
||||
String printType = "结算单";
|
||||
String printType="结算单";
|
||||
|
||||
String data = PrinterUtils.getCashPrintData(detailPO, printType, orderInfo.getOrderType());
|
||||
String data= PrinterUtils.getCashPrintData(detailPO,printType,orderInfo.getOrderType());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
PrinterUtils.printTickets(voiceJson,3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case "one": //一菜一品
|
||||
|
|
@ -256,25 +262,32 @@ public class PrintMechineConsumer {
|
|||
}
|
||||
return;
|
||||
}else {
|
||||
tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId,"final");
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
|
||||
tbOrderDetails.parallelStream().forEach(it -> {
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
String categoryId;
|
||||
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
} else {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
|
||||
Long count= categoryInfos.stream().filter(c->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
|
||||
log.info("获取当前类别是否未打印类别:{}",count);
|
||||
|
||||
if(count>0){
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
String data = PrinterUtils.getPrintData("",orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark);
|
||||
String data = PrinterUtils.getPrintData("",orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class RabbitConfig {
|
|||
|
||||
@Bean
|
||||
public Binding bindingcons_Register() {
|
||||
return BindingBuilder.bind(queuecons_Register()).to(consExchange_Register()).with(RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT);
|
||||
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -120,11 +120,12 @@ public class RabbitConfig {
|
|||
|
||||
@Bean
|
||||
public Binding bindingcons_msg_Register() {
|
||||
return BindingBuilder.bind(queuecons_msg_Register()).to(cons_msg_Exchange_Register()).with(RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT);
|
||||
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -45,6 +45,4 @@ public interface RabbitConstants {
|
|||
public static final String CONS_MSG_COLLECT_ROUTINGKEY_PUT = "cons_msg_collect_routingkey_put";
|
||||
|
||||
|
||||
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
||||
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
|
|
@ -13,7 +12,7 @@ import java.util.UUID;
|
|||
|
||||
@Component
|
||||
public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
||||
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
|
@ -23,7 +22,7 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||
this.rabbitTemplate = rabbitTemplate;
|
||||
rabbitTemplate.setConfirmCallback(this); //rabbitTemplate如果为单例的话,那回调就是最后设置的内容
|
||||
}
|
||||
|
||||
|
||||
public void putOrderCollect(String content) {
|
||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||
rabbitTemplate.convertAndSend(RabbitConstants.CART_ORDER_COLLECT_PUT, RabbitConstants.CART_ORDER_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
||||
|
|
@ -46,6 +45,9 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void con_msg(String content){
|
||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||
rabbitTemplate.convertAndSend(RabbitConstants.CONS_MSG_COLLECT_PUT, RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
||||
|
|
@ -62,13 +64,4 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||
}
|
||||
}
|
||||
|
||||
private <T> void sendMsg(String exchange, String routingKey, T data, String note) {
|
||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||
logger.info("开始发送{}mq消息, msgId: {}, exchange: {}, routingKey: {}, data: {}", correlationId.getId(), note, exchange, routingKey, data);
|
||||
rabbitTemplate.convertAndSend(exchange, routingKey, JSONObject.toJSONString(data), correlationId);
|
||||
}
|
||||
|
||||
public <T> void sendStockSaleMsg(T data) {
|
||||
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, data, "商品售出增加库存记录");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,8 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
|
|
@ -564,7 +562,7 @@ public class CloudPrinterService {
|
|||
}
|
||||
|
||||
|
||||
public Result handoverprintData(String token,Integer id,String loginName,boolean isprintProduct){
|
||||
public Result handoverprintData(String token,Integer id,String loginName){
|
||||
|
||||
|
||||
JSONObject info= TokenUtil.parseParamFromToken(token);
|
||||
|
|
@ -644,17 +642,10 @@ public class CloudPrinterService {
|
|||
productCategories=JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries),HandoverInfo.ProductCategory.class);
|
||||
}
|
||||
|
||||
List<ProductInfoPO> productInfoPOS=null;
|
||||
List<ProductInfo> productInfos=null;
|
||||
if(isprintProduct){
|
||||
// productInfoPOS=shopUserDutyPayMapper.selectProductByDutyId(shopUserDuty.getId());
|
||||
productInfos=shopUserDutyMapper.selectByDutyId(shopUserDuty.getId());
|
||||
}
|
||||
|
||||
|
||||
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())?DateUtils.getTime(shopUserDuty.getLoginTime()):null,
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):DateUtils.getTime(new Date()),
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):"",
|
||||
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
|
||||
list,memberData,shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
"0",
|
||||
|
|
@ -662,54 +653,12 @@ public class CloudPrinterService {
|
|||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
shopUserDuty.getReturnAmount().toPlainString(),
|
||||
shopUserDuty.getOrderNum().toString(),
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString(),
|
||||
productInfoPOS,
|
||||
productInfos
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString()
|
||||
|
||||
);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,1,1,it.getAddress(),PrinterUtils.handoverprintData(handoverInfo));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Result printInvoice(String shopId,String content,String remark,String amount){
|
||||
|
||||
List<TbPrintMachineWithBLOBs> bloBsList = tbPrintMachineMapper.selectByShopId(shopId);
|
||||
|
||||
if (ObjectUtil.isEmpty(bloBsList) || bloBsList.size() <= 0) {
|
||||
log.error("此店铺没有对应的打印机设备");
|
||||
return Result.fail(CodeEnum.printmachinenoexsit);
|
||||
}
|
||||
|
||||
bloBsList.parallelStream().forEach(it->{
|
||||
if (!"network".equals(it.getConnectionType())) {
|
||||
log.error("非网络打印机");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"1".equals(it.getStatus().toString())) {
|
||||
log.error("打印机状态异常");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!it.getSubType().equals("cash")){
|
||||
log.error("非小票打印机");
|
||||
return;
|
||||
}
|
||||
String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,1,1,it.getAddress(),PrinterUtils.printInvoice(content, remark, amount));
|
||||
});
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,20 @@ package com.chaozhanggui.system.cashierservice.service;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoFlowMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.util.N;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
|
|
@ -33,12 +36,6 @@ public class ConsService {
|
|||
@Autowired
|
||||
TbConsInfoFlowMapper tbConsInfoFlowMapper;
|
||||
|
||||
@Autowired
|
||||
TbOrderDetailMapper tbOrderDetailMapper;
|
||||
|
||||
@Autowired
|
||||
TbOrderInfoMapper tbOrderInfoMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void exect(String message) throws Exception {
|
||||
log.info("耗材信息更新开始:{}",message);
|
||||
|
|
@ -46,106 +43,109 @@ public class ConsService {
|
|||
|
||||
String type=jsonObject.getString("type");
|
||||
|
||||
String orderId=jsonObject.getString("orderId");
|
||||
|
||||
|
||||
Thread.sleep(1000L);
|
||||
|
||||
TbOrderInfo tbOrderInfo=tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
|
||||
if(Objects.isNull(tbOrderInfo)){
|
||||
log.info("订单信息不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
List<TbOrderDetail> orderDetails= tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||
if(Objects.isNull(orderDetails)||orderDetails.size()<=0){
|
||||
log.info("订单信息不存在");
|
||||
return;
|
||||
}
|
||||
List<ConsInfoPO> consInfoPOS=new ArrayList<>();
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
|
||||
for (TbOrderDetail orderDetail : orderDetails) {
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
if(Objects.isNull(proskuCons)||proskuCons.size()<=0){
|
||||
log.info("不存在的耗材信息配置:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
continue;
|
||||
}
|
||||
for (TbProskuCon proskuCon : proskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){
|
||||
BigDecimal amount=BigDecimal.ZERO;
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setProSkuId(proskuCon.getProductSkuId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setProSkuId(proskuCon.getProductSkuId());
|
||||
if("create".equals(type)){
|
||||
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum()));
|
||||
|
||||
flow.setAmount(amount);
|
||||
|
||||
flow.setBizCode("createCart");
|
||||
flow.setBizName("销售扣除");
|
||||
flow.setBizType("-");
|
||||
|
||||
tbConsInfo.setStockConsume(tbConsInfo.getStockConsume().add(amount));
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
|
||||
}else if("delete".equals(type)){
|
||||
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum())).negate();
|
||||
|
||||
flow.setAmount(amount.abs());
|
||||
flow.setBizCode("cancelCart");
|
||||
flow.setBizName("退单返还");
|
||||
flow.setBizType("+");
|
||||
|
||||
tbConsInfo.setStockConsume(tbConsInfo.getStockConsume().add(amount));
|
||||
|
||||
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
if(N.gt(BigDecimal.ZERO,tbConsInfo.getStockNumber())){
|
||||
if(N.gt(BigDecimal.ZERO,tbConsInfo.getStockConsume())){
|
||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbConsInfo.getStockConsume()));
|
||||
}else {
|
||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbConsInfo.getStockConsume().negate()));
|
||||
}
|
||||
|
||||
}else {
|
||||
if(N.gt(BigDecimal.ZERO,tbConsInfo.getStockConsume())){
|
||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbConsInfo.getStockConsume().negate()));
|
||||
}else {
|
||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbConsInfo.getStockConsume().negate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
flow.setOrderId(tbOrderInfo.getId());
|
||||
flow.setOrderNo(tbOrderInfo.getOrderNo());
|
||||
|
||||
flow.setCreateTime(new Date());
|
||||
// flow.setUpdateTime(new Date());
|
||||
// consInfoFlows.add(flow);
|
||||
|
||||
if(amount.equals(BigDecimal.ZERO)){
|
||||
log.info("变动金额为 0:{}",amount);
|
||||
continue;
|
||||
}
|
||||
|
||||
tbConsInfoMapper.updateByPrimaryKey(tbConsInfo);
|
||||
tbConsInfoFlowMapper.insert(flow);
|
||||
if(Objects.nonNull(type)){
|
||||
|
||||
if("create".equals(type)){
|
||||
|
||||
String cartId=jsonObject.getString("cartId");
|
||||
|
||||
TbCashierCart cart= tbCashierCartMapper.selectByPrimaryKey(Integer.valueOf(cartId));
|
||||
if(Objects.isNull(cart)){
|
||||
log.info("不存在的购物车信息::{}",cartId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//减少耗材库存信息
|
||||
List<TbProskuCon> tbProskuCons= tbProskuConMapper.selectBySkuIdAndShopId(Integer.valueOf(cart.getSkuId()),Integer.valueOf(cart.getShopId()));
|
||||
if(Objects.isNull(tbProskuCons)||tbProskuCons.size()<=0){
|
||||
log.info("没有对应的耗材配置: skuId:{},shopId:{}",cart.getSkuId(),cart.getShopId());
|
||||
return;
|
||||
}
|
||||
|
||||
List<ConsInfoPO> consInfoPOS=new ArrayList<>();
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)){
|
||||
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbProskuCon.getSurplusStock());
|
||||
consInfoPOS.add(consInfoPO);
|
||||
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setAmount(tbProskuCon.getSurplusStock());
|
||||
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbProskuCon.getSurplusStock()));
|
||||
flow.setBizCode("createCart");
|
||||
flow.setBizName("加入购物陈消耗");
|
||||
flow.setBizType("-");
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setUpdateTime(new Date());
|
||||
consInfoFlows.add(flow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//更新耗材信息
|
||||
tbConsInfoMapper.batchStock(consInfoPOS);
|
||||
//记录更新日志
|
||||
tbConsInfoFlowMapper.insertBatch(consInfoFlows);
|
||||
return;
|
||||
}
|
||||
//更新耗材信息
|
||||
// tbConsInfoMapper.batchStock(consInfoPOS);
|
||||
// //记录更新日志
|
||||
// tbConsInfoFlowMapper.insertBatch(consInfoFlows);
|
||||
|
||||
|
||||
if("delete".equals(type)){
|
||||
|
||||
List jsonArray= Arrays.asList(jsonObject.getJSONArray("skuIds"));
|
||||
|
||||
String shopId= jsonObject.getString("shopId");
|
||||
if(Objects.isNull(jsonArray)||jsonArray.size()<=0){
|
||||
log.info("错误的商品规格信息");
|
||||
return;
|
||||
}
|
||||
List<ConsInfoPO> consInfoPOS=new ArrayList<>();
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
|
||||
for(int i=0;i<jsonArray.size();i++){
|
||||
//减少耗材库存信息
|
||||
List<TbProskuCon> tbProskuCons= tbProskuConMapper.selectBySkuIdAndShopId(Integer.valueOf(jsonArray.get(i)+""),Integer.valueOf(shopId));
|
||||
if(Objects.isNull(tbProskuCons)||tbProskuCons.size()<=0){
|
||||
log.info("没有对应的耗材配置: skuId:{},shopId:{}",jsonArray.get(i),shopId);
|
||||
return;
|
||||
}
|
||||
|
||||
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)){
|
||||
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbProskuCon.getSurplusStock().negate());
|
||||
consInfoPOS.add(consInfoPO);
|
||||
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setAmount(tbProskuCon.getSurplusStock());
|
||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbProskuCon.getSurplusStock()));
|
||||
flow.setBizCode("cancelCart");
|
||||
flow.setBizName("取消购物车返回");
|
||||
flow.setBizType("+");
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setUpdateTime(new Date());
|
||||
consInfoFlows.add(flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更新耗材信息
|
||||
tbConsInfoMapper.batchStock(consInfoPOS);
|
||||
//记录更新日志
|
||||
tbConsInfoFlowMapper.insertBatch(consInfoFlows);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
|
|
@ -19,9 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.USERNOLOGIN;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
|
@ -48,12 +46,6 @@ public class DataService {
|
|||
@Autowired
|
||||
ShopUserDutyPayMapper shopUserDutyPayMapper;
|
||||
|
||||
@Autowired
|
||||
tbHandoverMapper tbHandoverMapper;
|
||||
|
||||
@Autowired
|
||||
TbTokenMapper tbTokenMapper;
|
||||
|
||||
|
||||
public Result handoverprintData(String token, Integer id){
|
||||
|
||||
|
|
@ -61,15 +53,6 @@ public class DataService {
|
|||
JSONObject info= TokenUtil.parseParamFromToken(token);
|
||||
MsgException.checkNull(info,"获取信息失败");
|
||||
|
||||
|
||||
TbToken tbToken = tbTokenMapper.selectByToken(token);
|
||||
|
||||
if (ObjectUtil.isEmpty(tbToken)) {
|
||||
return Result.fail(USERNOLOGIN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TbmerchantAccount tbmerchantAccount= tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(info.get("accountId").toString()));
|
||||
MsgException.checkNull(tbmerchantAccount,"商户信息不存在");
|
||||
|
||||
|
|
@ -84,278 +67,55 @@ public class DataService {
|
|||
}
|
||||
|
||||
|
||||
ShopUserDuty shopUserDuty=shopUserDutyMapper.selectByPrimaryKey(id);
|
||||
// ShopUserDuty shopUserDuty=shopUserDutyMapper.selectByShopIdAndDay(tbShopInfo.getId(),tradeDay);
|
||||
MsgException.checkNull(shopUserDuty,"交班信息不存在");
|
||||
|
||||
|
||||
TbPlussShopStaff shopStaff= tbPlussShopStaffMapper.selectByPrimaryKey(Integer.valueOf(info.get("staffId").toString()));
|
||||
MsgException.checkNull(shopStaff,"员工信息不存在");
|
||||
|
||||
ShopUserDuty shopUserDuty=shopUserDutyMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(ObjectUtil.isNotNull(shopUserDuty)&&ObjectUtil.isNotEmpty(shopUserDuty)){
|
||||
List<HandoverInfo.PayInfo> list=null;
|
||||
List<HandoverInfo.MemberData> memberData=null;
|
||||
List<HandoverInfo.ProductCategory> productCategories=null;
|
||||
List<Map<String,Object>> mapList= shopUserDutyPayMapper.selectByDutyId(shopUserDuty.getId());
|
||||
if(ObjectUtil.isNotEmpty(mapList)&&mapList.size()>0){
|
||||
list= JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(mapList), HandoverInfo.PayInfo.class);
|
||||
}
|
||||
|
||||
memberData=new ArrayList<>();
|
||||
ShopUserDutyPay shopUserDutyPay=shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(),"deposit");
|
||||
if(ObjectUtil.isNotEmpty(shopUserDutyPay)){
|
||||
memberData.add(new HandoverInfo.MemberData(shopUserDutyPay.getAmount().toPlainString(),"会员卡消费"));
|
||||
}
|
||||
|
||||
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())? BigDecimal.ZERO.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(),"会员卡充值"));
|
||||
|
||||
|
||||
|
||||
|
||||
List<Map<String,Object>> categries= shopUserDutyPayMapper.selectCetoryBydutyId(shopUserDuty.getId());
|
||||
if(ObjectUtil.isNotEmpty(categries)&&categries.size()>0){
|
||||
productCategories=JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries),HandoverInfo.ProductCategory.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<ProductInfoPO> productInfoPOS = shopUserDutyPayMapper.selectProductByDutyId(shopUserDuty.getId());
|
||||
List<ProductInfo> productInfos = shopUserDutyMapper.selectByDutyId(shopUserDuty.getId());
|
||||
|
||||
|
||||
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())? DateUtils.getTime(shopUserDuty.getLoginTime()):null,
|
||||
DateUtils.getTime(new Date()),
|
||||
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
|
||||
list,memberData,shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
"0",
|
||||
shopUserDuty.getAmount().subtract(shopUserDuty.getReturnAmount()).toPlainString(),
|
||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
shopUserDuty.getReturnAmount().toPlainString(),
|
||||
shopUserDuty.getOrderNum().toString(),
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString(),
|
||||
productInfoPOS,productInfos
|
||||
|
||||
);
|
||||
|
||||
|
||||
tbHandover tbHandover=new tbHandover();
|
||||
|
||||
if(ObjectUtil.isNotNull(shopStaff)){
|
||||
tbHandover.setStaffId(shopStaff.getId());
|
||||
tbHandover.setStaffName(shopStaff.getName());
|
||||
}
|
||||
tbHandover.setTradeDay(DateUtils.getDays());
|
||||
tbHandover.setPrintNo("usb");
|
||||
tbHandover.setDutyId(shopUserDuty.getId());
|
||||
tbHandover.setShopId(shopInfo.getId());
|
||||
tbHandover.setMerchantName(handoverInfo.getMerchantName());
|
||||
tbHandover.setStartTime(handoverInfo.getStartTime());
|
||||
tbHandover.setEndTime(handoverInfo.getEndTime());
|
||||
tbHandover.setPayInfos(JSONUtil.toJSONString(handoverInfo.getPayInfos()));
|
||||
tbHandover.setMemberData(JSONUtil.toJSONString(handoverInfo.getMemberData()));
|
||||
tbHandover.setProductCategories(JSONUtil.toJSONString(handoverInfo.getProductCategories()));
|
||||
tbHandover.setTotalAmount(handoverInfo.getTotalAmount());
|
||||
tbHandover.setImprest(handoverInfo.getImprest());
|
||||
tbHandover.setPayable(handoverInfo.getPayable());
|
||||
tbHandover.setHandIn(handoverInfo.getHandIn());
|
||||
tbHandover.setReturnAmount(handoverInfo.getReturnAmount());
|
||||
tbHandover.setOrderNum(handoverInfo.getOrderNum());
|
||||
tbHandover.setQuickAmount(handoverInfo.getQuickAmount());
|
||||
tbHandover.setProductInfoPos(JSONUtil.toJSONString(handoverInfo.getProductInfoPOS()));
|
||||
tbHandover.setProductInfos(JSONUtil.toJSONString(handoverInfo.getProductInfos()));
|
||||
tbHandover.setCreateTime(new Date());
|
||||
tbHandoverMapper.insert(tbHandover);
|
||||
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS,handoverInfo);
|
||||
}else{
|
||||
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),
|
||||
ObjectUtil.isNotEmpty(tbToken.getCreateTime())? DateUtils.getTime(tbToken.getCreateTime()):DateUtils.getTime(new Date()),
|
||||
DateUtils.getTime(new Date()),
|
||||
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
|
||||
null,null,"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
null,"0",
|
||||
null,null
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
tbHandover tbHandover=new tbHandover();
|
||||
|
||||
if(ObjectUtil.isNotNull(shopStaff)){
|
||||
tbHandover.setStaffId(shopStaff.getId());
|
||||
tbHandover.setStaffName(shopStaff.getName());
|
||||
}
|
||||
tbHandover.setTradeDay(DateUtils.getDays());
|
||||
tbHandover.setPrintNo("usb");
|
||||
tbHandover.setDutyId(0);
|
||||
tbHandover.setShopId(shopInfo.getId());
|
||||
tbHandover.setMerchantName(handoverInfo.getMerchantName());
|
||||
tbHandover.setStartTime(handoverInfo.getStartTime());
|
||||
tbHandover.setEndTime(handoverInfo.getEndTime());
|
||||
tbHandover.setPayInfos(JSONUtil.toJSONString(handoverInfo.getPayInfos()));
|
||||
tbHandover.setMemberData(JSONUtil.toJSONString(handoverInfo.getMemberData()));
|
||||
tbHandover.setProductCategories(JSONUtil.toJSONString(handoverInfo.getProductCategories()));
|
||||
tbHandover.setTotalAmount(handoverInfo.getTotalAmount());
|
||||
tbHandover.setImprest(handoverInfo.getImprest());
|
||||
tbHandover.setPayable(handoverInfo.getPayable());
|
||||
tbHandover.setHandIn(handoverInfo.getHandIn());
|
||||
tbHandover.setReturnAmount(handoverInfo.getReturnAmount());
|
||||
tbHandover.setOrderNum(handoverInfo.getOrderNum());
|
||||
tbHandover.setQuickAmount(handoverInfo.getQuickAmount());
|
||||
tbHandover.setProductInfoPos(JSONUtil.toJSONString(handoverInfo.getProductInfoPOS()));
|
||||
tbHandover.setProductInfos(JSONUtil.toJSONString(handoverInfo.getProductInfos()));
|
||||
tbHandover.setCreateTime(new Date());
|
||||
tbHandoverMapper.insert(tbHandover);
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS,handoverInfo);
|
||||
List<HandoverInfo.PayInfo> list=null;
|
||||
List<HandoverInfo.MemberData> memberData=null;
|
||||
List<HandoverInfo.ProductCategory> productCategories=null;
|
||||
List<Map<String,Object>> mapList= shopUserDutyPayMapper.selectByDutyId(shopUserDuty.getId());
|
||||
if(ObjectUtil.isNotEmpty(mapList)&&mapList.size()>0){
|
||||
list= JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(mapList), HandoverInfo.PayInfo.class);
|
||||
}
|
||||
|
||||
}
|
||||
memberData=new ArrayList<>();
|
||||
ShopUserDutyPay shopUserDutyPay=shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(),"deposit");
|
||||
if(ObjectUtil.isNotEmpty(shopUserDutyPay)){
|
||||
memberData.add(new HandoverInfo.MemberData(shopUserDutyPay.getAmount().toPlainString(),"会员卡消费"));
|
||||
}
|
||||
|
||||
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())? BigDecimal.ZERO.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(),"会员卡充值"));
|
||||
|
||||
|
||||
|
||||
public Result handoverprint(String token,Integer id,boolean isprintProduct){
|
||||
if(ObjectUtil.isNotEmpty(id)){
|
||||
|
||||
JSONObject jsonObject= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(jsonObject)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
TbPlussShopStaff shopStaff;
|
||||
|
||||
String staffId = jsonObject.getString("staffId");
|
||||
if(ObjectUtil.isNotEmpty(staffId)){
|
||||
shopStaff= tbPlussShopStaffMapper.selectByPrimaryKey(Integer.valueOf(staffId));
|
||||
} else {
|
||||
shopStaff = null;
|
||||
}
|
||||
|
||||
|
||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByPrimaryKey(id);
|
||||
if(ObjectUtil.isNotEmpty(shopUserDuty)){
|
||||
|
||||
TbShopInfo tbShopInfo= tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopUserDuty.getShopId()));
|
||||
MsgException.checkNull(tbShopInfo,"店铺信息不存在");
|
||||
|
||||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(tbShopInfo.getId());
|
||||
if (ObjectUtil.isEmpty(shopInfo)) {
|
||||
log.error("店铺信息不存在");
|
||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||
}
|
||||
|
||||
List<TbPrintMachineWithBLOBs> bloBsList = tbPrintMachineMapper.selectByShopId(tbShopInfo.getId().toString());
|
||||
if(Objects.nonNull(bloBsList)&&ObjectUtil.isNotEmpty(bloBsList)){
|
||||
bloBsList.parallelStream().forEach(it-> {
|
||||
|
||||
if (!"network".equals(it.getConnectionType())) {
|
||||
log.error("非网络打印机");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"1".equals(it.getStatus().toString())) {
|
||||
log.error("打印机状态异常");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!it.getSubType().equals("cash")) {
|
||||
log.error("非小票打印机");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<HandoverInfo.PayInfo> list = null;
|
||||
List<HandoverInfo.MemberData> memberData = null;
|
||||
List<HandoverInfo.ProductCategory> productCategories = null;
|
||||
List<Map<String, Object>> mapList = shopUserDutyPayMapper.selectByDutyId(shopUserDuty.getId());
|
||||
if (ObjectUtil.isNotEmpty(mapList) && mapList.size() > 0) {
|
||||
list = JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(mapList), HandoverInfo.PayInfo.class);
|
||||
}
|
||||
|
||||
memberData = new ArrayList<>();
|
||||
ShopUserDutyPay shopUserDutyPay = shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(), "deposit");
|
||||
if (ObjectUtil.isNotEmpty(shopUserDutyPay)) {
|
||||
memberData.add(new HandoverInfo.MemberData(shopUserDutyPay.getAmount().toPlainString(), "会员卡消费"));
|
||||
}
|
||||
|
||||
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount()) ? BigDecimal.ZERO.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(), "会员卡充值"));
|
||||
|
||||
|
||||
List<Map<String, Object>> categries = shopUserDutyPayMapper.selectCetoryBydutyId(shopUserDuty.getId());
|
||||
if (ObjectUtil.isNotEmpty(categries) && categries.size() > 0) {
|
||||
productCategories = JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries), HandoverInfo.ProductCategory.class);
|
||||
}
|
||||
|
||||
|
||||
List<ProductInfoPO> productInfoPOS = null;
|
||||
List<ProductInfo> productInfos = null;
|
||||
if (isprintProduct) {
|
||||
//
|
||||
//
|
||||
// productInfoPOS=shopUserDutyPayMapper.selectProductByDutyId(shopUserDuty.getId());
|
||||
productInfos = shopUserDutyMapper.selectByDutyId(shopUserDuty.getId());
|
||||
}
|
||||
|
||||
HandoverInfo handoverInfo = new HandoverInfo(tbShopInfo.getShopName(),
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime()) ? DateUtils.getTime(shopUserDuty.getLoginTime()) : null,
|
||||
DateUtils.getTime(new Date()),
|
||||
ObjectUtil.isNull(shopStaff)?"":ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
|
||||
list, memberData, shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount()) ? BigDecimal.ZERO : shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
"0",
|
||||
shopUserDuty.getAmount().subtract(shopUserDuty.getReturnAmount()).toPlainString(),
|
||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount()) ? BigDecimal.ZERO : shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
shopUserDuty.getReturnAmount().toPlainString(),
|
||||
shopUserDuty.getOrderNum().toString(),
|
||||
productCategories, ObjectUtil.isNull(shopUserDuty.getQuickAmount()) ? "0" : shopUserDuty.getQuickAmount().toPlainString(),
|
||||
null, productInfos
|
||||
|
||||
);
|
||||
|
||||
// tbHandover tbHandover=new tbHandover();
|
||||
//
|
||||
// if(ObjectUtil.isNotNull(shopStaff)){
|
||||
// tbHandover.setStaffId(shopStaff.getId());
|
||||
// tbHandover.setStaffName(shopStaff.getName());
|
||||
// }
|
||||
// tbHandover.setTradeDay(DateUtils.getDays());
|
||||
// tbHandover.setPrintNo(it.getAddress());
|
||||
// tbHandover.setDutyId(shopUserDuty.getId());
|
||||
// tbHandover.setShopId(shopInfo.getId());
|
||||
// tbHandover.setMerchantName(handoverInfo.getMerchantName());
|
||||
// tbHandover.setStartTime(handoverInfo.getStartTime());
|
||||
// tbHandover.setEndTime(handoverInfo.getEndTime());
|
||||
// tbHandover.setPayInfos(JSONUtil.toJSONString(handoverInfo.getPayInfos()));
|
||||
// tbHandover.setMemberData(JSONUtil.toJSONString(handoverInfo.getMemberData()));
|
||||
// tbHandover.setProductCategories(JSONUtil.toJSONString(handoverInfo.getProductCategories()));
|
||||
// tbHandover.setTotalAmount(handoverInfo.getTotalAmount());
|
||||
// tbHandover.setImprest(handoverInfo.getImprest());
|
||||
// tbHandover.setPayable(handoverInfo.getPayable());
|
||||
// tbHandover.setHandIn(handoverInfo.getHandIn());
|
||||
// tbHandover.setReturnAmount(handoverInfo.getReturnAmount());
|
||||
// tbHandover.setOrderNum(handoverInfo.getOrderNum());
|
||||
// tbHandover.setQuickAmount(handoverInfo.getQuickAmount());
|
||||
// tbHandover.setProductInfoPos(JSONUtil.toJSONString(handoverInfo.getProductInfoPOS()));
|
||||
// tbHandover.setProductInfos(JSONUtil.toJSONString(handoverInfo.getProductInfos()));
|
||||
// tbHandover.setCreateTime(new Date());
|
||||
// tbHandoverMapper.insert(tbHandover);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 1, 1, it.getAddress(), PrinterUtils.handoverprintData(handoverInfo));
|
||||
});
|
||||
}
|
||||
}
|
||||
List<Map<String,Object>> categries= shopUserDutyPayMapper.selectCetoryBydutyId(shopUserDuty.getId());
|
||||
if(ObjectUtil.isNotEmpty(categries)&&categries.size()>0){
|
||||
productCategories=JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries),HandoverInfo.ProductCategory.class);
|
||||
}
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())? DateUtils.getTime(shopUserDuty.getLoginTime()):null,
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):"",
|
||||
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
|
||||
list,memberData,shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
"0",
|
||||
shopUserDuty.getAmount().subtract(shopUserDuty.getReturnAmount()).toPlainString(),
|
||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
shopUserDuty.getReturnAmount().toPlainString(),
|
||||
shopUserDuty.getOrderNum().toString(),
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString()
|
||||
|
||||
);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS,handoverInfo);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,11 +156,11 @@ public class DutyService {
|
|||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tokenId);
|
||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId, day);
|
||||
// ShopUserDuty shopU serDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
|
||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
|
||||
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||
|
||||
if (type.equals("create")) {
|
||||
if ("cash".equals(orderInfo.getPayType())) {
|
||||
if (orderInfo.getPayType().equals("cash")) {
|
||||
cashAmount = orderInfo.getPayAmount();
|
||||
}
|
||||
if (Objects.isNull(shopUserDuty)) {
|
||||
|
|
@ -267,7 +267,7 @@ public class DutyService {
|
|||
}
|
||||
List<TbOrderDetail> list = orderDetailMapper.selectAllByOrderId(orderId);
|
||||
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||
if ("cash".equals(orderInfo.getPayType())) {
|
||||
if (orderInfo.getPayType().equals("cash")) {
|
||||
cashAmount = orderInfo.getPayAmount();
|
||||
}
|
||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(Integer.valueOf(orderInfo.getShopId()), "0");
|
||||
|
|
@ -296,7 +296,7 @@ public class DutyService {
|
|||
shopUserDutyDetail.setProductId(orderDetail.getProductId());
|
||||
shopUserDutyDetail.setProductName(orderDetail.getProductName());
|
||||
detaiList.add(shopUserDutyDetail);
|
||||
// productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
}
|
||||
if (detaiList.size() > 0) {
|
||||
shopUserDutyDetailMapper.batchInsert(detaiList);
|
||||
|
|
@ -336,7 +336,7 @@ public class DutyService {
|
|||
detaiList.add(shopUserDutyDetail);
|
||||
|
||||
}
|
||||
// productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
}
|
||||
|
||||
if (detaiList.size() > 0) {
|
||||
|
|
@ -362,12 +362,9 @@ public class DutyService {
|
|||
Integer shopId = tokenJson.getInteger("shopId");
|
||||
Integer staffId = tokenJson.getInteger("staffId");
|
||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
||||
// cloudPrinterService.handoverprintData(token, shopUserDuty.getId(), "",true);
|
||||
cloudPrinterService.handoverprintData(token, shopUserDuty.getId(), "");
|
||||
// shopUserDutyMapper.updateStatusByTokenId(day, shopId, staffId);
|
||||
if(Objects.nonNull(shopUserDuty)){
|
||||
shopUserDutyMapper.updateStatusById(shopUserDuty.getId(), staffId);
|
||||
}
|
||||
|
||||
shopUserDutyMapper.updateStatusById(shopUserDuty.getId(), staffId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -389,9 +386,9 @@ public class DutyService {
|
|||
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + skuId.toString(), num.toString());
|
||||
if (ObjectUtil.isNotEmpty(tbProductSku)) {
|
||||
if (num > tbProductSku.getStockNumber()) {
|
||||
// productSkuMapper.updateStockNum(skuId,num);
|
||||
productSkuMapper.updateStockNum(skuId,num);
|
||||
} else {
|
||||
// productSkuMapper.updateByskuIdSub(skuId, num);
|
||||
productSkuMapper.updateByskuIdSub(skuId, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,18 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPlussShopStaff;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbToken;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbmerchantAccount;
|
||||
import com.chaozhanggui.system.cashierservice.model.LoginReq;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.chaozhanggui.system.cashierservice.util.MD5Util;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -32,8 +38,6 @@ public class LoginService {
|
|||
|
||||
@Autowired
|
||||
TbShopInfoMapper tbShopInfoMapper;
|
||||
@Autowired
|
||||
TbUserInfoMapper userInfoMapper;
|
||||
|
||||
@Autowired
|
||||
TbProductMapper tbProductMapper;
|
||||
|
|
@ -42,7 +46,7 @@ public class LoginService {
|
|||
TbPlussShopStaffMapper tbPlussShopStaffMapper;
|
||||
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
RedisUtils redisUtil;
|
||||
|
||||
@Autowired
|
||||
TbTokenMapper tbTokenMapper;
|
||||
|
|
@ -56,8 +60,6 @@ public class LoginService {
|
|||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (ObjectUtil.isEmpty(loginReq.getSerialNumber())) {
|
||||
return Result.fail(CodeEnum.SERIALNUMBER);
|
||||
}
|
||||
|
|
@ -77,7 +79,6 @@ public class LoginService {
|
|||
String key = RedisCst.ONLINE_USER.concat(":").concat(loginReq.getClientType()).concat(":").concat(loginReq.getLoginName());
|
||||
//
|
||||
// String data = redisUtil.getMessage(key);
|
||||
// log.info("key:{},data:{}",key,data);
|
||||
// if(ObjectUtil.isNotEmpty(data)){
|
||||
// return Result.fail(CodeEnum.USERHAVEDLOGIN);
|
||||
// }
|
||||
|
|
@ -87,11 +88,9 @@ public class LoginService {
|
|||
return Result.fail(CodeEnum.MERCHANTEIXST);
|
||||
}
|
||||
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffMapper.selectByAccountAndShopId(loginReq.getLoginName(),account.getShopId());
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffMapper.selectByAccount(loginReq.getLoginName());
|
||||
if (ObjectUtil.isEmpty(tbPlussShopStaff)) {
|
||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
} else if (!tbPlussShopStaff.getStatus()) {
|
||||
return Result.fail(CodeEnum.UNAUTHORIZED);
|
||||
} else if (tbPlussShopStaff.getType().equals("staff")) {
|
||||
Integer isPc = tbPlussShopStaff.getIsPc();
|
||||
if (isPc != null && isPc != 1) {
|
||||
|
|
@ -116,7 +115,7 @@ public class LoginService {
|
|||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(account.getShopId()));
|
||||
|
||||
redisUtil.saveMessage(key, token, 365 * 24 * 60 * 60);
|
||||
redisUtil.set(key, token, 365 * 24 * 60 * 60);
|
||||
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
|
||||
|
|
@ -124,7 +123,6 @@ public class LoginService {
|
|||
accountMap.put("accountId", account.getId());
|
||||
accountMap.put("merchantName", account.getAccount());
|
||||
accountMap.put("loginName", tbPlussShopStaff.getAccount());
|
||||
accountMap.put("loginAccount",tbPlussShopStaff.getName());
|
||||
accountMap.put("clientType", loginReq.getClientType());
|
||||
accountMap.put("shopId", account.getShopId());
|
||||
accountMap.put("staffId", tbPlussShopStaff.getId());
|
||||
|
|
@ -135,7 +133,7 @@ public class LoginService {
|
|||
accountMap.put("shopName", shopInfo.getShopName());
|
||||
}
|
||||
accountMap.put("uuid", uuid);
|
||||
redisUtil.saveMessage("CART:UUID:" + account.getShopId().concat(account.getId().toString()), uuid);
|
||||
redisUtil.set("CART:UUID:" + account.getShopId().concat(account.getId().toString()), uuid);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, accountMap);
|
||||
}
|
||||
|
|
@ -145,17 +143,17 @@ public class LoginService {
|
|||
|
||||
String key = RedisCst.ONLINE_USER.concat(":").concat(clientType).concat(":").concat(loginName);
|
||||
|
||||
String cacheToken = redisUtil.getMessage(key)+"";
|
||||
String cacheToken = redisUtil.get(key)+"";
|
||||
|
||||
TbToken tbToken = tbTokenMapper.selectByToken(token);
|
||||
|
||||
if (ObjectUtil.isEmpty(tbToken)) {
|
||||
redisUtil.deleteByKey(key);
|
||||
redisUtil.del(key);
|
||||
return Result.fail(USERNOLOGIN);
|
||||
}
|
||||
|
||||
if (!"1".equals(tbToken.getStatus()) || "2".equals(tbToken.getStatus()) || "3".equals(tbToken.getStatus())) {
|
||||
redisUtil.deleteByKey(key);
|
||||
redisUtil.del(key);
|
||||
return Result.fail(USERNOLOGIN);
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +164,7 @@ public class LoginService {
|
|||
if (!cacheToken.equals(token)) {
|
||||
return Result.fail(TOKENTERROR);
|
||||
}
|
||||
redisUtil.deleteByKey(key);
|
||||
redisUtil.del(key);
|
||||
tbToken.setStatus(status);
|
||||
tbToken.setUpdateTime(new Date());
|
||||
tbTokenMapper.updateByPrimaryKey(tbToken);
|
||||
|
|
@ -175,8 +173,6 @@ public class LoginService {
|
|||
jsonObject.put("type", "close");
|
||||
jsonObject.put("token", token);
|
||||
rabbitProducer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
return Result.success(SUCCESS);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import java.math.RoundingMode;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class MemberService {
|
||||
|
|
@ -74,9 +73,6 @@ public class MemberService {
|
|||
@Value("${thirdPay.callBack}")
|
||||
private String callBack;
|
||||
|
||||
@Autowired
|
||||
TbmerchantAccountMapper tbmerchantAccountMapper;
|
||||
|
||||
public Result queryMember(String shopId, String phone, int page, int pageSize) {
|
||||
|
||||
PageHelperUtil.startPage(page, pageSize);
|
||||
|
|
@ -523,28 +519,10 @@ public class MemberService {
|
|||
|| !map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))
|
||||
|| !map.containsKey("memberId") || ObjectUtil.isEmpty(map.get("memberId"))
|
||||
|| !map.containsKey("amount") || ObjectUtil.isEmpty(map.get("amount"))
|
||||
||!map.containsKey("pwd")||ObjectUtil.isEmpty(map.get("pwd"))
|
||||
) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
|
||||
String accountId= TokenUtil.parseParamFromToken(token).getString("accountId");
|
||||
|
||||
TbmerchantAccount account= tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
|
||||
if(Objects.isNull(account)){
|
||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
|
||||
if(Objects.isNull(account.getPwd())||ObjectUtil.isEmpty(account.getPwd())){
|
||||
return Result.fail(CodeEnum.PWDNOSET);
|
||||
}
|
||||
|
||||
if(!account.getPwd().equals(MD5Util.encrypt(map.get("pwd").toString().concat(account.getAccount()).concat(account.getId().toString())))){
|
||||
return Result.fail(CodeEnum.PWDERROE);
|
||||
}
|
||||
|
||||
|
||||
String memberId = String.valueOf(map.get("memberId"));
|
||||
|
||||
String shopId = String.valueOf(map.get("shopId"));
|
||||
|
|
@ -624,15 +602,14 @@ public class MemberService {
|
|||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("token", token);
|
||||
jsonObject.put("type", "memberIn");
|
||||
jsonObject.put("amount", memberIn.getAmount());
|
||||
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("token", token);
|
||||
jsonObject.put("type", "memberIn");
|
||||
jsonObject.put("amount", memberIn.getAmount());
|
||||
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
|
@ -25,11 +22,9 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.CARTEXIST;
|
||||
|
||||
|
|
@ -66,29 +61,12 @@ public class OrderService {
|
|||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
|
||||
private final WxAccountUtil wxAccountUtil;
|
||||
|
||||
@Autowired
|
||||
RabbitProducer producer;
|
||||
|
||||
private final WechatUtil wechatUtil;
|
||||
|
||||
private final TbUserShopMsgMapper tbUserShopMsgMapper;
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
|
||||
|
||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
public OrderService(WxAccountUtil wxAccountUtil, WechatUtil wechatUtil, TbUserShopMsgMapper tbUserShopMsgMapper, TbShopOpenIdMapper shopOpenIdMapper) {
|
||||
this.wxAccountUtil = wxAccountUtil;
|
||||
this.wechatUtil = wechatUtil;
|
||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||
this.shopOpenIdMapper = shopOpenIdMapper;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createCart(String masterId, String productId, String shopId, Integer skuId, Integer number,
|
||||
|
|
@ -122,31 +100,21 @@ public class OrderService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
|
||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||
if (exists == null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0) {
|
||||
number = skuWithBLOBs.getSuit();
|
||||
// 低于起售,删除商品
|
||||
}else if (exists != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number < skuWithBLOBs.getSuit()){
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
delCart(masterId, cartId);
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
}
|
||||
|
||||
if("1".equals(product.getIsStock().toString())){
|
||||
if ("1".equals(product.getIsDistribute().toString())) {
|
||||
if(product.getStockNumber()-number<0){
|
||||
return Result.fail(CodeEnum.STOCKERROR);
|
||||
}
|
||||
} else if (product.getId().intValue()==Integer.valueOf(skuWithBLOBs.getProductId()).intValue()){
|
||||
if(product.getId().intValue()==Integer.valueOf(skuWithBLOBs.getProductId()).intValue()){
|
||||
if(skuWithBLOBs.getStockNumber()-number<0){
|
||||
return Result.fail(CodeEnum.STOCKERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject objectMsg=new JSONObject();
|
||||
objectMsg.put("skuId",skuWithBLOBs.getId());
|
||||
objectMsg.put("shopId",shopInfo.getId());
|
||||
|
||||
|
||||
producer.con_msg(objectMsg.toString());
|
||||
|
||||
if (StringUtils.isEmpty(masterId)) {
|
||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||
if (flag) {
|
||||
|
|
@ -180,7 +148,6 @@ public class OrderService {
|
|||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
|
||||
} else {
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||
|
|
@ -221,7 +188,6 @@ public class OrderService {
|
|||
cashierCart.setCategoryId(product.getCategoryId());
|
||||
list.add(cashierCart);
|
||||
cashierCartMapper.insert(cashierCart);
|
||||
cart=cashierCart;
|
||||
} else {
|
||||
if (type.equals("add")) {
|
||||
cashierCart.setNumber(cashierCart.getNumber() + number);
|
||||
|
|
@ -240,59 +206,24 @@ public class OrderService {
|
|||
} else {
|
||||
cashierCartMapper.updateStatus(cashierCart.getId(), "close");
|
||||
}
|
||||
|
||||
cart=cashierCart;
|
||||
redisUtil.saveMessage(RedisCst.ORDER_CART_EXISTS + cart.getId(), "1", 60 * 60 * 24);
|
||||
}
|
||||
|
||||
redisUtil.saveMessage(RedisCst.ORDER_CART_EXISTS + cart.getId(), "1", 60 * 60 * 24);
|
||||
|
||||
|
||||
// skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()-number);
|
||||
skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()-number);
|
||||
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
|
||||
redisUtil.saveMessage("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + DateUtils.getDay(),masterId.substring(1,masterId.length()));
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("cartId",cart.getId());
|
||||
jsonObject.put("type","create");
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验商品库存警戒线并通知商户
|
||||
*
|
||||
* @param productSku sku
|
||||
*/
|
||||
private void checkWarnLineAndSendMsg(TbProductSku productSku, TbProduct product, Integer shopId, Integer num) {
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId);
|
||||
if (productSku.getWarnLine() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (product.getIsStock() == null || product.getIsStock() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (productSku.getStockNumber() == null) {
|
||||
productSku.setStockNumber((double) 0);
|
||||
}
|
||||
|
||||
if (product.getStockNumber() == null) {
|
||||
product.setStockNumber(0);
|
||||
}
|
||||
if (
|
||||
(product.getIsDistribute() == 1 && product.getStockNumber() - num <= productSku.getWarnLine())
|
||||
|| (product.getIsDistribute() != 1) && productSku.getStockNumber() - num <= productSku.getWarnLine()
|
||||
) {
|
||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
||||
shopOpenIds.forEach(item -> {
|
||||
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
||||
product.getIsDistribute() == 1 ? product.getStockNumber()-num : (int) (productSku.getStockNumber() - num), item.getOpenId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Result queryCart(String masterId, String shopId) {
|
||||
if (StringUtils.isEmpty(shopId)) {
|
||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||
|
|
@ -367,21 +298,14 @@ public class OrderService {
|
|||
if(ObjectUtil.isEmpty(product)){
|
||||
return Result.fail(CodeEnum.PRODUCTINFOERROR);
|
||||
}
|
||||
// if("1".equals(product.getIsStock().toString())){
|
||||
// TbProductSkuWithBLOBs skuWithBLOBs= tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
// if(ObjectUtil.isEmpty(skuWithBLOBs)){
|
||||
// return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||
// }
|
||||
// skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()+cashierCart.getTotalNumber());
|
||||
// skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
// tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
// }
|
||||
// 数量减少, 返还库存
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
|
||||
if (message != null) {
|
||||
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Integer.parseInt(message));
|
||||
if("1".equals(product.getIsStock().toString())){
|
||||
TbProductSkuWithBLOBs skuWithBLOBs= tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
if(ObjectUtil.isEmpty(skuWithBLOBs)){
|
||||
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||
}
|
||||
skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()+cashierCart.getTotalNumber());
|
||||
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
}
|
||||
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
|
|
@ -389,6 +313,14 @@ public class OrderService {
|
|||
|
||||
cashierCartMapper.deleteByCartId(masterId, cartId);
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("type","delete");
|
||||
jsonObject.put("skuIds",skuIds);
|
||||
jsonObject.put("shopId",cashierCart.getShopId());
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -416,7 +348,6 @@ public class OrderService {
|
|||
return Result.fail(CARTEXIST);
|
||||
}
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
|
||||
TbProductSkuWithBLOBs tbProduct = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
totalAmount = totalAmount.add(cashierCart.getTotalAmount());
|
||||
packAMount = packAMount.add(cashierCart.getPackFee());
|
||||
|
|
@ -464,7 +395,6 @@ public class OrderService {
|
|||
orderInfo.setStatus("unpaid");
|
||||
orderInfo.setOrderAmount(totalAmount);
|
||||
// orderInfo.setOrderAmount(totalAmount.add(packAMount));
|
||||
orderInfo.setRemark(orderVo.getRemark());
|
||||
orderInfo.setFreightAmount(feeAmount);
|
||||
orderInfo.setProductAmount(saleAmount);
|
||||
orderInfo.setTradeDay(DateUtils.getDay());
|
||||
|
|
@ -512,33 +442,8 @@ public class OrderService {
|
|||
}
|
||||
boolean flag = true;
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
|
||||
log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId());
|
||||
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(skuWithBLOBs, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber()));
|
||||
|
||||
// 已经添加的商品,修改数量
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
flag = false;
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
if (message != null) {
|
||||
int lastNum = Integer.parseInt(message);
|
||||
// 数量减少, 返还库存
|
||||
if (lastNum > cashierCart.getNumber()) {
|
||||
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), lastNum - cashierCart.getNumber());
|
||||
} else {
|
||||
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber() - lastNum);
|
||||
}
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60);
|
||||
|
||||
}
|
||||
|
||||
// 首次添加的商品
|
||||
}else {
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60);
|
||||
// 修改库存
|
||||
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber());
|
||||
}
|
||||
cashierCart.setOrderId(orderId + "");
|
||||
cashierCart.setUpdatedAt(System.currentTimeMillis());
|
||||
|
|
@ -568,26 +473,6 @@ public class OrderService {
|
|||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(orderInfo.getShopId().toString()),object.toString());
|
||||
|
||||
|
||||
|
||||
|
||||
log.info("创建订单,发送更新耗材消息,订单id:{}", orderInfo.getId());
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("orderId",orderInfo.getId());
|
||||
jsonObject.put("type","create");
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
List<TbCashierCart> finalList = list;
|
||||
ThreadUtil.execAsync(() -> {
|
||||
ThreadUtil.sleep(5, TimeUnit.SECONDS);
|
||||
for (TbCashierCart cashierCart : finalList) {
|
||||
JSONObject objectMsg = new JSONObject();
|
||||
objectMsg.put("skuId", Integer.valueOf(cashierCart.getSkuId()));
|
||||
objectMsg.put("shopId", Integer.valueOf(cashierCart.getShopId()));
|
||||
producer.con_msg(objectMsg.toString());
|
||||
}
|
||||
});
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, orderInfo);
|
||||
}
|
||||
|
||||
|
|
@ -743,7 +628,7 @@ public class OrderService {
|
|||
} else {
|
||||
String orderNo = generateOrderNumber();
|
||||
TbOrderInfo orderInfo = new TbOrderInfo(orderNo, totalAmount, packAMount, totalAmount, saleAmount, totalAmount, feeAmount, "",
|
||||
"table", "cash", userId, shopId.toString(),
|
||||
"table", "case", userId, shopId.toString(),
|
||||
"", (byte) 1, day, masterId);
|
||||
orderInfo.setStatus("pending");
|
||||
tbOrderInfoMapper.insert(orderInfo);
|
||||
|
|
@ -837,35 +722,20 @@ public class OrderService {
|
|||
List<ProductSkuPo> productSkuPos=new ArrayList<>();
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
// 数量减少, 返还库存
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
|
||||
if (message != null) {
|
||||
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Integer.parseInt(message));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
orderId = Integer.parseInt(cashierCart.getOrderId());
|
||||
|
||||
orderId = Integer.valueOf(cashierCart.getOrderId());
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
}
|
||||
TbProductWithBLOBs product= tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
if(ObjectUtil.isNotEmpty(product)&&"1".equals(product.getIsStock().toString())){
|
||||
ProductSkuPo skuPo=new ProductSkuPo(Integer.valueOf(cashierCart.getSkuId()),cashierCart.getTotalNumber());
|
||||
productSkuPos.add(skuPo);
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (orderId > 0) {
|
||||
// 返还耗材
|
||||
JSONObject jsonObject1=new JSONObject();
|
||||
jsonObject1.put("orderId", orderId);
|
||||
jsonObject1.put("type","delete");
|
||||
log.info("清空购物车 发送返还耗材mq消息,订单id:{},消息内容:{}", orderId, jsonObject1);
|
||||
producer.cons(jsonObject1.toString());
|
||||
|
||||
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(orderId);
|
||||
if (Objects.nonNull(orderInfo) && !orderInfo.getStatus().equals("pending")){
|
||||
tbOrderInfoMapper.updateStatusById(orderId, "cancelled");
|
||||
|
|
@ -875,26 +745,25 @@ public class OrderService {
|
|||
|
||||
cashierCartMapper.deleteBymasterId(cartVo.getMasterId(), Integer.valueOf(cartVo.getShopId()), day, "create", cartVo.getUuid());
|
||||
|
||||
// if(ObjectUtil.isNotEmpty(productSkuPos)&&productSkuPos.size()>0){
|
||||
// tbProductSkuMapper.batchStockNum(productSkuPos);
|
||||
// }
|
||||
if(ObjectUtil.isNotEmpty(productSkuPos)&&productSkuPos.size()>0){
|
||||
tbProductSkuMapper.batchStockNum(productSkuPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("type","delete");
|
||||
jsonObject.put("skuIds",skuIds);
|
||||
jsonObject.put("shopId",cartVo.getShopId());
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo,
|
||||
Date startTime, Date endTime) {
|
||||
|
||||
String day = null;
|
||||
if (startTime == null && endTime == null) {
|
||||
startTime = DateUtil.beginOfDay(DateUtil.date());
|
||||
endTime = DateUtil.endOfDay(DateUtil.date());
|
||||
day = DateUtils.getDay();
|
||||
}
|
||||
|
||||
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo) {
|
||||
String day = DateUtils.getDay();
|
||||
PageHelperUtil.startPage(page, size);
|
||||
String orderType = "";
|
||||
if (StringUtils.isNotEmpty(status)) {
|
||||
|
|
@ -906,31 +775,20 @@ public class OrderService {
|
|||
}
|
||||
log.info("orderType:" + orderType);
|
||||
log.info("status:" + status);
|
||||
List<OrderPo> list = tbOrderInfoMapper.selectAllByShop(shopId, orderType, day, orderNo,
|
||||
startTime == null ? null : startTime.getTime(), endTime == null ? null : endTime.getTime());
|
||||
List<OrderPo> list = tbOrderInfoMapper.selectAllByShop(shopId, orderType, day, orderNo);
|
||||
|
||||
for (OrderPo orderInfo : list) {
|
||||
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
||||
orderInfo.setImgUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240223/a04e0d3beef74d099ebd0fd1f7c41873.jpg");
|
||||
}
|
||||
|
||||
|
||||
if(orderInfo.getOrderType().equals("return")){
|
||||
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderIdAndType(orderInfo.getId().toString());
|
||||
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
|
||||
skuInfoPos=new ArrayList<>();
|
||||
}
|
||||
orderInfo.setSkuInfos(skuInfoPos);
|
||||
}else {
|
||||
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
|
||||
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
|
||||
skuInfoPos=new ArrayList<>();
|
||||
}
|
||||
orderInfo.setSkuInfos(skuInfoPos);
|
||||
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
|
||||
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
|
||||
skuInfoPos=new ArrayList<>();
|
||||
}
|
||||
|
||||
orderInfo.setSkuInfos(skuInfoPos);
|
||||
orderInfo.setZdNo("POS");
|
||||
orderInfo.setNames(orderInfo.getProductName() == null ? new String[]{""} : orderInfo.getProductName().split(","));
|
||||
orderInfo.setNames(orderInfo.getProductName().split(","));
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
||||
|
|
@ -1088,13 +946,6 @@ public class OrderService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Result getOrder(Integer orderId){
|
||||
return Result.success(CodeEnum.SUCCESS, tbOrderInfoMapper.selectById(orderId)) ;
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
TbUserInfoMapper tbUserInfoMapper;
|
||||
|
||||
|
|
@ -1185,9 +1036,6 @@ public class OrderService {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
TbOrderOutNumberMapper tbOrderOutNumberMapper;
|
||||
public Result scanSendMessage(String outNumber,String shopId){
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@ import com.chaozhanggui.system.cashierservice.sign.Result;
|
|||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.*;
|
||||
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -90,12 +92,6 @@ public class PayService {
|
|||
@Autowired
|
||||
private TbProductMapper productMapper;
|
||||
|
||||
@Autowired
|
||||
private TbShopUnitMapper shopUnitMapper;
|
||||
|
||||
@Autowired
|
||||
private TbProductStockDetailMapper productStockDetailMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtil;
|
||||
|
||||
|
|
@ -111,10 +107,6 @@ public class PayService {
|
|||
private String callBack;
|
||||
|
||||
|
||||
@Autowired
|
||||
TbmerchantAccountMapper tbmerchantAccountMapper;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.printf("%.2f%n", new BigDecimal(1).setScale(2, RoundingMode.DOWN));
|
||||
|
|
@ -536,12 +528,6 @@ public class PayService {
|
|||
|
||||
producer.printMechine(orderId);
|
||||
|
||||
// 发送库存记录mq消息
|
||||
JSONObject mqData = new JSONObject();
|
||||
mqData.put("orderId", orderId);
|
||||
mqData.put("type", "pc");
|
||||
producer.sendStockSaleMsg(mqData);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -627,12 +613,6 @@ public class PayService {
|
|||
|
||||
producer.printMechine(orderId);
|
||||
|
||||
// 发送库存记录mq消息
|
||||
JSONObject mqData = new JSONObject();
|
||||
mqData.put("orderId", orderId);
|
||||
mqData.put("type", "pc");
|
||||
producer.sendStockSaleMsg(mqData);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -681,12 +661,6 @@ public class PayService {
|
|||
|
||||
producer.printMechine(orderId);
|
||||
|
||||
// 发送库存记录mq消息
|
||||
JSONObject mqData = new JSONObject();
|
||||
mqData.put("orderId", orderId);
|
||||
mqData.put("type", "pc");
|
||||
producer.sendStockSaleMsg(mqData);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -734,37 +708,14 @@ public class PayService {
|
|||
|
||||
producer.printMechine(orderId);
|
||||
|
||||
// 发送库存记录mq消息
|
||||
JSONObject mqData = new JSONObject();
|
||||
mqData.put("orderId", orderId);
|
||||
mqData.put("type", "pc");
|
||||
producer.sendStockSaleMsg(mqData);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result returnOrder(List<TbOrderDetail> list, String token, String pwd, boolean isOnline) {
|
||||
public Result returnOrder(List<TbOrderDetail> list, String token) {
|
||||
if (ObjectUtil.isEmpty(list) || list.size() <= 0) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
//
|
||||
// String accountId= TokenUtil.parseParamFromToken(token).getString("accountId");
|
||||
//
|
||||
// TbmerchantAccount account= tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
|
||||
// if(Objects.isNull(account)){
|
||||
// return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if(Objects.isNull(account.getPwd())||ObjectUtil.isEmpty(account.getPwd())){
|
||||
// return Result.fail(CodeEnum.PWDNOSET);
|
||||
// }
|
||||
//
|
||||
// if(!account.getPwd().equals(MD5Util.encrypt(pwd.concat(account.getAccount()).concat(account.getId().toString())))){
|
||||
// return Result.fail(CodeEnum.PWDERROE);
|
||||
// }
|
||||
|
||||
|
||||
Integer orderId = list.get(0).getOrderId();
|
||||
|
||||
|
|
@ -784,9 +735,6 @@ public class PayService {
|
|||
String masterId = orderInfo.getMasterId();
|
||||
String payType = orderInfo.getPayType();
|
||||
String orderNo = generateReturnOrderNumber();
|
||||
if (!isOnline) {
|
||||
orderNo = "XX" + orderNo;
|
||||
}
|
||||
BigDecimal orderAmount = orderInfo.getPayAmount();
|
||||
|
||||
|
||||
|
|
@ -833,8 +781,7 @@ public class PayService {
|
|||
// totalAmount = totalAmount.add(it.getPriceAmount());
|
||||
totalAmount = totalAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
|
||||
saleAmount = saleAmount.add(it.getPrice());
|
||||
payAmount = payAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN)
|
||||
.multiply(new BigDecimal(map1.get(it.getId()))));
|
||||
payAmount = payAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
|
||||
// payAmount=payAmount.add(it.getPriceAmount());
|
||||
packAMount = packAMount.add(it.getPackAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
|
||||
|
||||
|
|
@ -865,88 +812,76 @@ public class PayService {
|
|||
"table", "return", merchantId, shopId,
|
||||
"", (byte) 1, day, masterId, "refund", payAmount, orderInfo.getPayType(), orderInfo.getTableName());
|
||||
|
||||
// 线上退款
|
||||
if (isOnline) {
|
||||
if ("scanCode".equals(payType) || "wx_lite".equals(payType)) {
|
||||
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(merchantId));
|
||||
MsgException.checkNull(thirdApply, "支付参数配置错误");
|
||||
if ("scanCode".equals(payType) || "wx_lite".equals(payType)) {
|
||||
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(merchantId));
|
||||
MsgException.checkNull(thirdApply, "支付参数配置错误");
|
||||
|
||||
if ("ysk".equals(thirdPayType)) {
|
||||
ReturnOrderReq req = new ReturnOrderReq();
|
||||
req.setAppId(thirdApply.getAppId());
|
||||
req.setTimestamp(System.currentTimeMillis());
|
||||
req.setOrderNumber(orderInfo.getPayOrderNo());
|
||||
req.setAmount(String.format("%.2f", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
req.setMercRefundNo(orderInfo.getOrderNo());
|
||||
req.setRefundReason("退货");
|
||||
req.setPayPassword(thirdApply.getPayPassword());
|
||||
Map<String, Object> map = BeanUtil.transBean2Map(req);
|
||||
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
|
||||
log.info("merchantOrderReturn req:{}", JSONUtil.toJsonStr(req));
|
||||
ResponseEntity<String> response = restTemplate.postForEntity(gateWayUrl.concat("merchantOrder/returnOrder"), req, String.class);
|
||||
log.info("merchantOrderReturn:{}", response.getBody());
|
||||
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
|
||||
JSONObject object = JSONObject.parseObject(response.getBody());
|
||||
if (!object.get("code").equals("0")) {
|
||||
MsgException.check(true, "退款渠道调用失败");
|
||||
}
|
||||
if ("ysk".equals(thirdPayType)) {
|
||||
ReturnOrderReq req = new ReturnOrderReq();
|
||||
req.setAppId(thirdApply.getAppId());
|
||||
req.setTimestamp(System.currentTimeMillis());
|
||||
req.setOrderNumber(orderInfo.getPayOrderNo());
|
||||
req.setAmount(String.format("%.2f", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
req.setMercRefundNo(orderInfo.getOrderNo());
|
||||
req.setRefundReason("退货");
|
||||
req.setPayPassword(thirdApply.getPayPassword());
|
||||
Map<String, Object> map = BeanUtil.transBean2Map(req);
|
||||
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
|
||||
log.info("merchantOrderReturn req:{}", JSONUtil.toJsonStr(req));
|
||||
ResponseEntity<String> response = restTemplate.postForEntity(gateWayUrl.concat("merchantOrder/returnOrder"), req, String.class);
|
||||
log.info("merchantOrderReturn:{}", response.getBody());
|
||||
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
|
||||
JSONObject object = JSONObject.parseObject(response.getBody());
|
||||
if (!object.get("code").equals("0")) {
|
||||
MsgException.check(true, "退款渠道调用失败");
|
||||
}
|
||||
// newOrderInfo.setPayOrderNo(object.getJSONObject("data").getString("refundOrderNumber"));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
|
||||
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderId+"");
|
||||
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), newOrderInfo.getOrderNo(), payment.getTradeNumber(), null, "订单退款", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
|
||||
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderId+"");
|
||||
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), newOrderInfo.getOrderNo(), payment.getTradeNumber(), null, "订单退款", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
|
||||
|
||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||
if ("000000".equals(publicResp.getCode())) {
|
||||
if (!"SUCCESS".equals(publicResp.getObjData().getState())&&!publicResp.getObjData().getState().equals("ING")) {
|
||||
MsgException.check(true, "退款渠道调用失败");
|
||||
}
|
||||
} else {
|
||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||
if ("000000".equals(publicResp.getCode())) {
|
||||
if (!"SUCCESS".equals(publicResp.getObjData().getState())&&!publicResp.getObjData().getState().equals("ING")) {
|
||||
MsgException.check(true, "退款渠道调用失败");
|
||||
}
|
||||
} else {
|
||||
MsgException.check(true, "退款渠道调用失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else if("deposit".equals(payType)){
|
||||
TbShopUser user= tbShopUserMapper.selectByUserIdAndShopId(orderInfo.getUserId(),orderInfo.getShopId());
|
||||
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
|
||||
user=tbShopUserMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMemberId()));
|
||||
}
|
||||
|
||||
|
||||
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
|
||||
return Result.fail(ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
if(!user.getShopId().equals(orderInfo.getShopId())){
|
||||
return Result.fail(ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
|
||||
newOrderInfo.setMemberId(orderInfo.getMemberId());
|
||||
newOrderInfo.setUserId(orderInfo.getUserId());
|
||||
|
||||
user.setAmount(user.getAmount().add( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
user.setConsumeAmount(user.getConsumeAmount().subtract( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
user.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKeySelective(user);
|
||||
|
||||
|
||||
TbShopUserFlow flow = new TbShopUserFlow();
|
||||
flow.setShopUserId(user.getId());
|
||||
flow.setBizCode("accountReturnPay");
|
||||
flow.setBizName("会员储值卡退款");
|
||||
flow.setType("+");
|
||||
flow.setAmount(newOrderInfo.getOrderAmount());
|
||||
flow.setBalance(user.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
}
|
||||
|
||||
}else if("deposit".equals(payType)){
|
||||
TbShopUser user= tbShopUserMapper.selectByUserIdAndShopId(orderInfo.getUserId(),orderInfo.getShopId());
|
||||
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
|
||||
return Result.fail(ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
newOrderInfo.setMemberId(orderInfo.getMemberId());
|
||||
newOrderInfo.setUserId(orderInfo.getUserId());
|
||||
|
||||
user.setAmount(user.getAmount().add( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
user.setConsumeAmount(user.getConsumeAmount().subtract( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
|
||||
user.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKeySelective(user);
|
||||
|
||||
|
||||
TbShopUserFlow flow = new TbShopUserFlow();
|
||||
flow.setShopUserId(user.getId());
|
||||
flow.setBizCode("accountReturnPay");
|
||||
flow.setBizName("会员储值卡退款");
|
||||
flow.setType("+");
|
||||
flow.setAmount(orderInfo.getOrderAmount());
|
||||
flow.setBalance(user.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//判断是否修改主单状态
|
||||
BigDecimal returnAmount = tbOrderDetailMapper.selectByOrderId(orderId.toString());
|
||||
if (N.egt(returnAmount.add(payAmount), orderAmount)) {
|
||||
|
|
@ -983,59 +918,23 @@ public class PayService {
|
|||
|
||||
producer.printMechine(String.valueOf(newOrderInfo.getId()));
|
||||
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject1=new JSONObject();
|
||||
jsonObject1.put("orderId",newOrderInfo.getId());
|
||||
jsonObject1.put("type","delete");
|
||||
producer.cons(jsonObject1.toString());
|
||||
|
||||
// 更新商品库存
|
||||
for (TbOrderDetail detail : returnDetail) {
|
||||
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
|
||||
|
||||
TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId());
|
||||
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(detail.getProductId());
|
||||
|
||||
TbProductStockDetail tbProductStockDetail = new TbProductStockDetail();
|
||||
tbProductStockDetail.setCreatedAt(System.currentTimeMillis());
|
||||
tbProductStockDetail.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductStockDetail.setShopId(detail.getShopId().toString());
|
||||
tbProductStockDetail.setSourcePath("NORMAL");
|
||||
tbProductStockDetail.setType("退单");
|
||||
tbProductStockDetail.setSubType((byte) 1);
|
||||
tbProductStockDetail.setRemark("退单: " + detail.getOrderId());
|
||||
tbProductStockDetail.setOrderId(String.valueOf(detail.getOrderId()));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(product)) {
|
||||
TbShopUnit shopUnit = shopUnitMapper.selectByPrimaryKey(Integer.valueOf(product.getUnitId()));
|
||||
|
||||
tbProductStockDetail.setProductName(product.getName());
|
||||
tbProductStockDetail.setIsStock(product.getIsStock());
|
||||
tbProductStockDetail.setStockSnap(product.getSelectSpec());
|
||||
tbProductStockDetail.setUnitName(shopUnit.getName());
|
||||
tbProductStockDetail.setProductId(product.getId().toString());
|
||||
|
||||
if (product.getIsDistribute() == 1) {
|
||||
// redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":product" + product.getId().toString(), String.valueOf(detail.getReturnNum() + product.getStockNumber().intValue()));
|
||||
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":product" + product.getId().toString(), String.valueOf(detail.getReturnNum() + product.getStockNumber().intValue()));
|
||||
productMapper.updateStockById(product.getId(), detail.getReturnNum() * -1);
|
||||
|
||||
tbProductStockDetail.setLeftNumber(product.getStockNumber());
|
||||
tbProductStockDetail.setStockNumber(Double.valueOf(detail.getReturnNum()));
|
||||
} else {
|
||||
if (ObjectUtil.isNotEmpty(productSku)) {
|
||||
// redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + productSku.getId().toString(), String.valueOf(detail.getReturnNum() + productSku.getStockNumber().intValue()));
|
||||
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + productSku.getId().toString(), String.valueOf(detail.getReturnNum() + productSku.getStockNumber().intValue()));
|
||||
productSkuMapper.updateByskuIdSub(productSku.getId(), detail.getReturnNum() * -1);
|
||||
|
||||
tbProductStockDetail.setSkuId(productSku.getId().toString());
|
||||
tbProductStockDetail.setLeftNumber(productSku.getStockNumber().intValue());
|
||||
tbProductStockDetail.setStockNumber(Double.valueOf(detail.getReturnNum()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
productStockDetailMapper.insert(tbProductStockDetail);
|
||||
}
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.interceptor.LimitSubmitAspect;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
|
|
@ -19,7 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
|
@ -41,11 +35,9 @@ public class ProductService {
|
|||
|
||||
@Autowired
|
||||
TbProductSkuResultMapper tbProductSkuResultMapper;
|
||||
@Autowired
|
||||
private LimitSubmitAspect limitSubmitAspect;
|
||||
|
||||
|
||||
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
||||
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
||||
PageHelperUtil.startPage(page, pageSize);
|
||||
List<TbShopCategory> list=tbShopCategoryMapper.selectByAll(shopId);
|
||||
PageInfo pageInfo=new PageInfo(list);
|
||||
|
|
@ -104,9 +96,9 @@ public class ProductService {
|
|||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||
PageHelperUtil.startPage(page,pageSize);
|
||||
if(ObjectUtil.isEmpty(categoryId)){
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
|
||||
}else {
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
||||
}
|
||||
|
||||
String day = DateUtils.getDay();
|
||||
|
|
@ -121,105 +113,13 @@ public class ProductService {
|
|||
it.setTbProductSpec(tbProductSpec);
|
||||
|
||||
TbProductSkuResult skuResult=tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
|
||||
|
||||
|
||||
// 上下架对应的sku
|
||||
String selectSpec = it.getSelectSpec();
|
||||
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
|
||||
HashSet<String> specSet = new HashSet<>();
|
||||
tbProductSkus.forEach(item -> {
|
||||
String specSnap = item.getSpecSnap();
|
||||
if (specSnap != null) {
|
||||
specSet.addAll(Arrays.asList(specSnap.split(",")));
|
||||
}
|
||||
});
|
||||
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
if (tagSnap != null) {
|
||||
JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
|
||||
JSONObject snapJSON;
|
||||
|
||||
JSONArray finalSnap = new JSONArray();
|
||||
|
||||
HashMap<String, String> snapMap = new HashMap<>();
|
||||
for (Object snap : tagSnaps) {
|
||||
StringBuilder finalValues = new StringBuilder();
|
||||
snapJSON = (JSONObject) snap;
|
||||
String values = snapJSON.getString("value");
|
||||
if (StrUtil.isNotBlank(values)) {
|
||||
String[] valueList = values.split(",");
|
||||
for (String value : valueList) {
|
||||
if (specSet.contains(value)) {
|
||||
finalValues.append(value).append(",");
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(finalValues.toString())) {
|
||||
finalValues = new StringBuilder(StrUtil.removeSuffix(finalValues.toString(), ","));
|
||||
snapJSON.put("value", finalValues.toString());
|
||||
finalSnap.add(snapJSON);
|
||||
snapMap.put(snapJSON.getString("name"), snapJSON.getString("value"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (selectSpec != null) {
|
||||
JSONArray selectSpecJSON = JSONObject.parseArray(selectSpec);
|
||||
for (Object selectSpecInfo : selectSpecJSON) {
|
||||
JSONObject specInfo = (JSONObject) selectSpecInfo;
|
||||
String name = snapMap.get(specInfo.getString("name"));
|
||||
if (name != null) {
|
||||
specInfo.put("value", name.split(","));
|
||||
specInfo.put("selectSpecResult", name.split(","));
|
||||
}
|
||||
}
|
||||
|
||||
it.setSelectSpec(selectSpecJSON.toJSONString());
|
||||
}
|
||||
|
||||
skuResult.setTagSnap(finalSnap.toJSONString());
|
||||
if(ObjectUtil.isEmpty(skuResult)){
|
||||
skuResult=new TbProductSkuResult();
|
||||
}
|
||||
it.setProductSkuResult(skuResult);
|
||||
|
||||
|
||||
|
||||
// 查询sku信息
|
||||
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
|
||||
it.setSkuList(skuWithBLOBs);
|
||||
});
|
||||
}
|
||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
||||
public void incrStock(String productId, String skuId, int addNum) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
if (product.getIsDistribute() == 1) {
|
||||
tbProductMapper.incrStock(productId, addNum);
|
||||
}else {
|
||||
tbProductSkuMapper.incrStock(skuId, addNum);
|
||||
}
|
||||
}
|
||||
|
||||
public void decrStock(String productId, String skuId, int decrNum) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
if (product.getIsDistribute() == 1) {
|
||||
if (product.getIsStock() == 1) {
|
||||
if (tbProductMapper.decrStock(productId, decrNum) < 1) {
|
||||
throw new MsgException("库存不足,下单失败");
|
||||
}
|
||||
}else {
|
||||
tbProductMapper.decrStockUnCheck(productId, decrNum);
|
||||
}
|
||||
}else {
|
||||
if (product.getIsStock() == 1) {
|
||||
if (tbProductSkuMapper.decrStock(String.valueOf(skuId), decrNum) < 1) {
|
||||
throw new MsgException("库存不足,下单失败");
|
||||
}
|
||||
}else {
|
||||
tbProductSkuMapper.decrStockUnCheck(String.valueOf(skuId), decrNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,11 +98,8 @@ public enum CodeEnum {
|
|||
|
||||
CONSERROR("100036",false,"商品已售罄","fail"),
|
||||
|
||||
PWDNOSET("100037",false,"操作密码未设置","fail"),
|
||||
|
||||
|
||||
PWDERROE("100038",false,"操作密码错误","fail"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||
import org.springframework.http.HttpEntity;
|
||||
|
|
@ -12,7 +10,6 @@ import org.springframework.util.LinkedMultiValueMap;
|
|||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
@ -31,7 +28,6 @@ public class PrinterUtils {
|
|||
|
||||
/**
|
||||
* 获取TOKEN值
|
||||
*
|
||||
* @param timestamp 时间戳,13位
|
||||
* @param requestId 请求ID,自定义
|
||||
* @return
|
||||
|
|
@ -52,10 +48,10 @@ public class PrinterUtils {
|
|||
token += key + value;
|
||||
encode += key + "=" + value + "&";
|
||||
}
|
||||
System.out.println("token" + token);
|
||||
System.out.println("token"+token);
|
||||
Map<String, String> finalMap = new HashMap<>();
|
||||
finalMap.put("ENCODE", encode);
|
||||
System.out.println("+++++++++++++++" + token + APP_SECRET);
|
||||
finalMap.put("ENCODE",encode);
|
||||
System.out.println("+++++++++++++++"+token + APP_SECRET);
|
||||
finalMap.put("TOKEN", MD5Util.encrypt(token + APP_SECRET).toUpperCase());
|
||||
return finalMap;
|
||||
}
|
||||
|
|
@ -63,7 +59,6 @@ public class PrinterUtils {
|
|||
|
||||
/**
|
||||
* 厨房打印机
|
||||
*
|
||||
* @param pickupNumber
|
||||
* @param date
|
||||
* @param productName
|
||||
|
|
@ -71,23 +66,23 @@ public class PrinterUtils {
|
|||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
public static String getPrintData(String type, String pickupNumber, String date, String productName, Integer number, String remark) {
|
||||
public static String getPrintData(String type,String pickupNumber,String date,String productName,Integer number,String remark) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if ("return".equals(type)) {
|
||||
builder.append("<C><B>" + pickupNumber + "【退】</B></C><BR><BR>");
|
||||
} else {
|
||||
builder.append("<C><B>" + pickupNumber + "</B></C><BR><BR>");
|
||||
if("return".equals(type)){
|
||||
builder.append("<C><B>"+pickupNumber+"【退】</B></C><BR><BR>");
|
||||
}else {
|
||||
builder.append("<C><B>"+pickupNumber+"</B></C><BR><BR>");
|
||||
}
|
||||
|
||||
|
||||
builder.append("<S><L>时间: " + date + " </L></S><BR><BR><BR>");
|
||||
builder.append("<S><L>时间: "+date+" </L></S><BR><BR><BR>");
|
||||
|
||||
if (productName.length() > 4 || remark.length() > 4) {
|
||||
builder.append("<CS:32>" + productName + " " + number + "</CS><BR>");
|
||||
builder.append("<CS:32>" + remark + " </CS><BR>");
|
||||
} else {
|
||||
builder.append("<B>" + productName + " " + number + "</B><BR>");
|
||||
builder.append("<B>" + remark + " </B><BR>");
|
||||
if(productName.length()>4||remark.length()>4){
|
||||
builder.append("<CS:32>"+productName+" "+number+"</CS><BR>");
|
||||
builder.append("<CS:32>"+remark+" </CS><BR>");
|
||||
}else {
|
||||
builder.append("<B>"+productName+" "+number+"</B><BR>");
|
||||
builder.append("<B>"+remark+" </B><BR>");
|
||||
}
|
||||
builder.append("<OUT:150>");
|
||||
builder.append("<PCUT>");
|
||||
|
|
@ -96,23 +91,22 @@ public class PrinterUtils {
|
|||
}
|
||||
|
||||
|
||||
public static String getCashPrintData(OrderDetailPO detailPO, String type, String orderType) {
|
||||
public static String getCashPrintData(OrderDetailPO detailPO,String type,String orderType){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("<C><B>" + detailPO.getMerchantName() + "</B></C><BR><BR>");
|
||||
sb.append("<C><BOLD>" + type + "【" + detailPO.getMasterId() + "】</BOLD></C><BR><BR>");
|
||||
if (Objects.nonNull(detailPO.getOutNumber())) {
|
||||
sb.append("<CB><BOLD>" + detailPO.getOutNumber() + "</BOLD></CB><BR><BR>");
|
||||
sb.append("<C><B>"+detailPO.getMerchantName()+"</B></C><BR><BR>");
|
||||
sb.append("<C><BOLD>"+type+"【"+detailPO.getMasterId()+"】</BOLD></C><BR><BR>");
|
||||
if(Objects.nonNull(detailPO.getOutNumber())){
|
||||
sb.append("<CB><BOLD>"+detailPO.getOutNumber()+"</BOLD></CB><BR><BR>");
|
||||
}
|
||||
|
||||
sb.append("<S><L>订单号: " + detailPO.getOrderNo() + " </L></S><BR>");
|
||||
sb.append("<S><L>交易时间: " + detailPO.getTradeDate() + " </L></S><BR>");
|
||||
sb.append("<S><L>收银员: " + detailPO.getOperator() + " </L></S><BR><BR><BR>");
|
||||
sb.append("<S><L>订单号: "+detailPO.getOrderNo()+" </L></S><BR>");
|
||||
sb.append("<S><L>交易时间: "+detailPO.getTradeDate()+" </L></S><BR>");
|
||||
sb.append("<S><L>收银员: "+detailPO.getOperator()+" </L></S><BR><BR><BR>");
|
||||
sb.append("------------------------<BR>");
|
||||
char paddingCharacter = ' ';
|
||||
sb.append("<S>" + String.format("%-15s", "品名").replace(' ', paddingCharacter) + String.format("%-4s", "数量").replace(' ', paddingCharacter) + String.format("%4s", "小计").replace(' ', paddingCharacter) + "</S><BR>");
|
||||
sb.append("<S>"+String.format("%-15s","品名").replace(' ', paddingCharacter)+String.format("%-4s","数量").replace(' ', paddingCharacter)+String.format("%4s","小计").replace(' ', paddingCharacter)+"</S><BR>");
|
||||
for (OrderDetailPO.Detail detail : detailPO.getDetailList()) {
|
||||
|
||||
if(detail.getProductName().length()>4&&detail.getProductName().length()<=10){
|
||||
|
||||
int count=getProducrName(detail.getProductName());
|
||||
|
|
@ -137,35 +131,37 @@ public class PrinterUtils {
|
|||
sb.append("<S>规格:"+detail.getSpec()+"</S><BR>");
|
||||
}
|
||||
|
||||
sb.append("<BR>");
|
||||
|
||||
}
|
||||
sb.append("------------------------<BR>");
|
||||
String t = "¥" + detailPO.getReceiptsAmount();
|
||||
t = String.format("%11s", t).replace(' ', paddingCharacter);
|
||||
if (orderType.equals("return")) {
|
||||
sb.append("<F>应退" + t + "</F><BR>");
|
||||
} else {
|
||||
sb.append("<F>应收" + t + "</F><BR>");
|
||||
String t="¥"+detailPO.getReceiptsAmount();
|
||||
t=String.format("%11s",t).replace(' ', paddingCharacter);
|
||||
if(orderType.equals("return")){
|
||||
sb.append("<F>应退"+t+"</F><BR>");
|
||||
}else {
|
||||
sb.append("<F>应收"+t+"</F><BR>");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(detailPO.getPayType()) && ObjectUtil.isNotNull(detailPO.getPayType()) && detailPO.getPayType().equals("deposit")) {
|
||||
sb.append("<S>储值¥" + detailPO.getReceiptsAmount() + " </S><BR>");
|
||||
if(ObjectUtil.isNotEmpty(detailPO.getPayType())&&ObjectUtil.isNotNull(detailPO.getPayType())&&detailPO.getPayType().equals("deposit")){
|
||||
sb.append("<S>储值¥"+detailPO.getReceiptsAmount()+" </S><BR>");
|
||||
sb.append("------------------------<BR>");
|
||||
sb.append("<S>积分:" + detailPO.getIntegral() + "</S><BR>");
|
||||
sb.append("<S>积分:"+detailPO.getIntegral()+"</S><BR>");
|
||||
}
|
||||
|
||||
sb.append("<S>余额:" + detailPO.getBalance() + "</S><BR>");
|
||||
sb.append("<S>余额:"+detailPO.getBalance()+"</S><BR>");
|
||||
sb.append("------------------------<BR>");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailPO.getRemark()) && ObjectUtil.isNotNull(detailPO.getRemark())) {
|
||||
sb.append("<L>备注:" + detailPO.getRemark() + "</L><BR>");
|
||||
if(ObjectUtil.isNotEmpty(detailPO.getRemark())&&ObjectUtil.isNotNull(detailPO.getRemark())){
|
||||
sb.append("<L>备注:"+detailPO.getRemark()+"</L><BR>");
|
||||
}
|
||||
|
||||
|
||||
if (Objects.nonNull(detailPO.getOutNumber())) {
|
||||
if(Objects.nonNull(detailPO.getOutNumber())){
|
||||
sb.append("<QR>".concat(detailPO.getOutNumber()).concat("</QR><BR>"));
|
||||
}
|
||||
|
||||
|
||||
sb.append("<S>打印时间:" + DateUtils.getTime(new Date()) + "</S><BR>");
|
||||
sb.append("<S>打印时间:"+DateUtils.getTime(new Date())+"</S><BR>");
|
||||
|
||||
sb.append("<OUT:180>");
|
||||
sb.append("<PCUT>");
|
||||
|
|
@ -174,108 +170,45 @@ public class PrinterUtils {
|
|||
}
|
||||
|
||||
|
||||
public static String handoverprintData(HandoverInfo handoverInfo) {
|
||||
public static String handoverprintData(HandoverInfo handoverInfo){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("<C><B>" + handoverInfo.getMerchantName() + "</B></C><BR><BR>");
|
||||
sb.append("<C><B>"+handoverInfo.getMerchantName()+"</B></C><BR><BR>");
|
||||
sb.append("<C> </C><BR><BR>");
|
||||
sb.append("<C><S><L>交班小票</L></S></C><BR>");
|
||||
sb.append("<S>当班时间: " + handoverInfo.getStartTime() + "</S><BR>");
|
||||
sb.append("<S>交班时间: " + handoverInfo.getEndTime() + "</S><BR>");
|
||||
sb.append("<S>收银员: " + handoverInfo.getStaff() + "</S><BR>");
|
||||
sb.append("<S>当班收入: " + handoverInfo.getTotalAmount() + "</S><BR>");
|
||||
if (ObjectUtil.isNotEmpty(handoverInfo.getPayInfos()) && handoverInfo.getPayInfos().size() > 0) {
|
||||
sb.append("<S>当班时间: "+handoverInfo.getStartTime()+"</S><BR>");
|
||||
sb.append("<S>交班时间: "+handoverInfo.getEndTime()+"</S><BR>");
|
||||
sb.append("<S>收银员: "+handoverInfo.getStaff()+"</S><BR>");
|
||||
sb.append("<S>当班收入: "+handoverInfo.getTotalAmount()+"</S><BR>");
|
||||
if(ObjectUtil.isNotEmpty(handoverInfo.getPayInfos())&&handoverInfo.getPayInfos().size()>0){
|
||||
for (HandoverInfo.PayInfo payInfo : handoverInfo.getPayInfos()) {
|
||||
sb.append("<S> " + payInfo.getPayType() + ": " + payInfo.getAmount() + "</S><BR>");
|
||||
sb.append("<S> "+payInfo.getPayType()+": "+payInfo.getAmount()+"</S><BR>");
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handoverInfo.getMemberData()) && handoverInfo.getMemberData().size() > 0) {
|
||||
if(ObjectUtil.isNotEmpty(handoverInfo.getMemberData())&&handoverInfo.getMemberData().size()>0){
|
||||
sb.append("<S>会员数据</S><BR>");
|
||||
for (HandoverInfo.MemberData memberDatum : handoverInfo.getMemberData()) {
|
||||
sb.append("<S> " + memberDatum.getDeposit() + ": " + memberDatum.getAmount() + "</S><BR>");
|
||||
sb.append("<S> "+memberDatum.getDeposit()+": "+memberDatum.getAmount()+"</S><BR>");
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handoverInfo.getProductCategories()) && handoverInfo.getProductCategories().size() > 0) {
|
||||
if(ObjectUtil.isNotEmpty(handoverInfo.getProductCategories())&&handoverInfo.getProductCategories().size()>0){
|
||||
sb.append("<S>分类数据</S><BR>");
|
||||
for (HandoverInfo.ProductCategory productCategory : handoverInfo.getProductCategories()) {
|
||||
sb.append("<S> " + productCategory.getCategoryName() + " " + productCategory.getNum() + " " + productCategory.getAmount() + "</S><BR>");
|
||||
for(HandoverInfo.ProductCategory productCategory:handoverInfo.getProductCategories()){
|
||||
sb.append("<S> "+productCategory.getCategoryName()+" "+ productCategory.getNum()+" "+productCategory.getAmount()+"</S><BR>");
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handoverInfo.getProductInfos()) && handoverInfo.getProductInfos().size() > 0) {
|
||||
sb.append("<S>商品数据</S><BR>");
|
||||
|
||||
|
||||
char paddingCharacter = ' ';
|
||||
|
||||
sb.append("<S> 品名" + String.format("%18s", "数量").replace(' ', paddingCharacter) + "</S><BR>");
|
||||
|
||||
for (ProductInfo productInfo : handoverInfo.getProductInfos()) {
|
||||
|
||||
|
||||
if (productInfo.getProductName().length() >= 14) {
|
||||
|
||||
sb.append("<S> " + productInfo.getProductName() + "</S><BR>");
|
||||
sb.append("<S> " + String.format("%27s", "*" + productInfo.getNum()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
|
||||
} else {
|
||||
//计算英文和数字数量
|
||||
//计算中文数量
|
||||
int m = getProducrName(productInfo.getProductName());
|
||||
int tt = 23 - productInfo.getProductName().length();
|
||||
|
||||
sb.append("<S> " + productInfo.getProductName() + String.format("%" + 6 + "s", "*" + productInfo.getNum()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
}
|
||||
sb.append("<BR>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handoverInfo.getProductInfoPOS()) && handoverInfo.getProductInfoPOS().size() > 0) {
|
||||
sb.append("<S>商品数据</S><BR>");
|
||||
char paddingCharacter = ' ';
|
||||
|
||||
for (ProductInfoPO productInfoPO : handoverInfo.getProductInfoPOS()) {
|
||||
|
||||
if (ObjectUtil.isNotEmpty(productInfoPO.getSkuName())) {
|
||||
productInfoPO.setProductName(productInfoPO.getProductName().concat("(").concat(productInfoPO.getSkuName()).concat(")"));
|
||||
}
|
||||
if (productInfoPO.getProductName().length() > 4 && productInfoPO.getProductName().length() <= 10) {
|
||||
|
||||
int count = getProducrName(productInfoPO.getProductName());
|
||||
if (count <= 0) {
|
||||
int length = 15 - (productInfoPO.getProductName().length() - 4);
|
||||
sb.append("<S>" + String.format("%-" + length + "s", productInfoPO.getProductName()).replace(' ', paddingCharacter) + String.format("%-2s", productInfoPO.getNum()).replace(' ', paddingCharacter) + String.format("%8s", productInfoPO.getAmount()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
} else {
|
||||
int length = 15 + count - (productInfoPO.getProductName().length() - 4);
|
||||
sb.append("<S>" + String.format("%-" + length + "s", productInfoPO.getProductName()).replace(' ', paddingCharacter) + String.format("%-2s", productInfoPO.getNum()).replace(' ', paddingCharacter) + String.format("%8s", productInfoPO.getAmount()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
}
|
||||
|
||||
} else if (productInfoPO.getProductName().length() > 10) {
|
||||
|
||||
sb.append("<S>" + productInfoPO.getProductName() + "</S><BR>");
|
||||
sb.append("<S>" + String.format("%20s", productInfoPO.getNum()).replace(' ', paddingCharacter) + String.format("%11s", productInfoPO.getAmount()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
|
||||
} else {
|
||||
sb.append("<S>" + String.format("%-15s", productInfoPO.getProductName()).replace(' ', paddingCharacter) + String.format("%-4s", productInfoPO.getNum()).replace(' ', paddingCharacter) + String.format("%8s", productInfoPO.getAmount()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
}
|
||||
|
||||
sb.append("<BR>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sb.append("<S>快捷收款金额 :".concat(ObjectUtil.isNull(handoverInfo.getQuickAmount()) ? "0" : handoverInfo.getQuickAmount()) + "</S><BR>");
|
||||
sb.append("<S>退款金额 :".concat(handoverInfo.getReturnAmount()) + "</S><BR>");
|
||||
sb.append("<S>总收入: " + handoverInfo.getTotalAmount() + "</S><BR>");
|
||||
sb.append("<S>备用金: " + handoverInfo.getImprest() + "</S><BR>");
|
||||
sb.append("<S>应交金额: " + handoverInfo.getPayable() + "</S><BR>");
|
||||
sb.append("<S>上交金额: " + handoverInfo.getHandIn() + "</S><BR>");
|
||||
sb.append("<S>快捷收款金额 :".concat(ObjectUtil.isNull(handoverInfo.getQuickAmount())?"0":handoverInfo.getQuickAmount())+"</S><BR>");
|
||||
sb.append("<S>退款金额 :".concat(handoverInfo.getReturnAmount())+"</S><BR>");
|
||||
sb.append("<S>总收入: "+handoverInfo.getTotalAmount()+"</S><BR>");
|
||||
sb.append("<S>备用金: "+handoverInfo.getImprest()+"</S><BR>");
|
||||
sb.append("<S>应交金额: "+handoverInfo.getPayable()+"</S><BR>");
|
||||
sb.append("<S>上交金额: "+handoverInfo.getHandIn()+"</S><BR>");
|
||||
|
||||
sb.append("<C> </C><BR><BR>");
|
||||
sb.append("<S>总订单数:" + handoverInfo.getOrderNum() + "</S><BR>");
|
||||
sb.append("<S>打印时间:" + DateUtils.getTime(new Date()) + "</S><BR>");
|
||||
sb.append("<S>总订单数:"+handoverInfo.getOrderNum()+"</S><BR>");
|
||||
sb.append("<S>打印时间:"+DateUtils.getTime(new Date())+"</S><BR>");
|
||||
// sb.append("<QR>".concat(handoverInfo.getMerchantName())+"</QR><BR>");
|
||||
|
||||
sb.append("<OUT:200>");
|
||||
|
|
@ -285,22 +218,20 @@ public class PrinterUtils {
|
|||
}
|
||||
|
||||
|
||||
public static String printInvoice(String content, String remark, String amount) {
|
||||
String sb = "<C><QR>".concat(content.concat("</QR></C><BR>")) +
|
||||
"<C><BOLD>".concat(remark).concat("</BOLD></C><BR>") +
|
||||
"<C><BOLD>【开票金额:".concat(amount).concat("】</BOLD></C>") +
|
||||
"<OUT:200>" +
|
||||
"<PCUT>";
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 打印票据
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void printTickets(String voiceJson, Integer actWay, Integer cn, String devName, String data) {
|
||||
public static void printTickets(String voiceJson,Integer actWay ,Integer cn,String devName,String data) {
|
||||
//设备名称
|
||||
//行为方式 1:只打印数据 2:只播放信息 3:打印数据并播放信息
|
||||
// actWay = 3;
|
||||
|
|
@ -314,88 +245,81 @@ public class PrinterUtils {
|
|||
Map<String, String> param = getToken(time, uuid);
|
||||
//参数
|
||||
MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
|
||||
multiValueMap.add("token", param.get("TOKEN"));
|
||||
multiValueMap.add("devName", devName);
|
||||
multiValueMap.add("actWay", actWay);
|
||||
multiValueMap.add("cn", cn);
|
||||
multiValueMap.add("data", data);
|
||||
multiValueMap.add("voiceJson", voiceJson);
|
||||
multiValueMap.add("appId", APP_ID);
|
||||
multiValueMap.add("timestamp", time);
|
||||
multiValueMap.add("requestId", uuid);
|
||||
multiValueMap.add("userCode", USER_CODE);
|
||||
multiValueMap.add("token",param.get("TOKEN"));
|
||||
multiValueMap.add("devName",devName);
|
||||
multiValueMap.add("actWay",actWay);
|
||||
multiValueMap.add("cn",cn);
|
||||
multiValueMap.add("data",data);
|
||||
multiValueMap.add("voiceJson",voiceJson);
|
||||
multiValueMap.add("appId",APP_ID);
|
||||
multiValueMap.add("timestamp",time);
|
||||
multiValueMap.add("requestId",uuid);
|
||||
multiValueMap.add("userCode",USER_CODE);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpHeaders header = new HttpHeaders();
|
||||
header.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
|
||||
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap, header);
|
||||
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap,header);
|
||||
String httpResponse = restTemplate.postForObject(URL_STR,
|
||||
httpEntity, String.class);
|
||||
|
||||
System.out.println("map" + httpResponse);
|
||||
System.out.println("map"+httpResponse);
|
||||
}
|
||||
|
||||
|
||||
public static int getProducrName(String str) {
|
||||
|
||||
|
||||
public static int getProducrName(String str){
|
||||
int count = 0;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char c = str.charAt(i);
|
||||
if (c >= '0' && c <= '9') {
|
||||
count++;
|
||||
} else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
|
||||
int digitCount=0;
|
||||
for (int i=0;i<str.length();i++){
|
||||
if ((str.charAt(i)>='a' && str.charAt(i)<='z') || (str.charAt(i)>='A' && str.charAt(i)<='Z')){
|
||||
count++;
|
||||
}
|
||||
|
||||
if (Character.isDigit(str.charAt(i))) {
|
||||
digitCount++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return count+digitCount;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
public static void main(String[] args)throws Exception {
|
||||
|
||||
//
|
||||
List<HandoverInfo.PayInfo> payInfos = new ArrayList<>();
|
||||
|
||||
payInfos.add(new HandoverInfo.PayInfo("现金", "39.00"));
|
||||
payInfos.add(new HandoverInfo.PayInfo("微信支付", "0.01"));
|
||||
payInfos.add(new HandoverInfo.PayInfo("储值卡支付", "43.00"));
|
||||
payInfos.add(new HandoverInfo.PayInfo("银行卡支付", "20.00"));
|
||||
|
||||
List<HandoverInfo.MemberData> memberDatas = new ArrayList<>();
|
||||
memberDatas.add(new HandoverInfo.MemberData("43.00", "会员消费"));
|
||||
memberDatas.add(new HandoverInfo.MemberData("43.00", "储值支付"));
|
||||
|
||||
|
||||
List<ProductInfo> productInfos = new ArrayList<>();
|
||||
|
||||
productInfos.add(new ProductInfo("161616161616161616161616161", 16, new BigDecimal("65.00")));
|
||||
|
||||
productInfos.add(new ProductInfo("张三", 16, new BigDecimal("65.00")));
|
||||
|
||||
|
||||
productInfos.add(new ProductInfo("牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪", 16, new BigDecimal("65.00")));
|
||||
|
||||
HandoverInfo handoverInfo = new HandoverInfo("牛叉闪闪", DateUtils.getTime(new Date()), DateUtils.getTime(new Date()), "李四", payInfos, memberDatas, "5000.00", "5000.00", "5000.00", "5000.00", "50.00", "80", null, "5000.00", null, productInfos);
|
||||
|
||||
|
||||
printTickets("3", 1, 1, "ZF544PG03W00005", handoverprintData(handoverInfo));
|
||||
|
||||
// List<HandoverInfo.PayInfo> payInfos=new ArrayList<>();
|
||||
//
|
||||
// List<OrderDetailPO.Detail> detailList= new ArrayList<>();
|
||||
// OrderDetailPO.Detail detail=new OrderDetailPO.Detail("花香水牛拿铁","1","19000.90","不甜,麻辣");
|
||||
// payInfos.add(new HandoverInfo.PayInfo("现金","39.00"));
|
||||
// payInfos.add(new HandoverInfo.PayInfo("微信支付","0.01"));
|
||||
// payInfos.add(new HandoverInfo.PayInfo("储值卡支付","43.00"));
|
||||
// payInfos.add(new HandoverInfo.PayInfo("银行卡支付","20.00"));
|
||||
//
|
||||
// OrderDetailPO.Detail detail3=new OrderDetailPO.Detail("单位iiii","4","40000.00",null);
|
||||
// OrderDetailPO.Detail detail4=new OrderDetailPO.Detail("喔喔奶茶","1","19000.90","微甜,微辣");
|
||||
// detailList.add(detail);
|
||||
// detailList.add(detail3);
|
||||
// detailList.add(detail4);
|
||||
// OrderDetailPO detailPO=new OrderDetailPO("牛叉闪闪","普通打印","#365","DD20240306134718468","2024-03-06 15:00:00","【POS-1】001","79000.80","5049758.96","deposit","0",detailList,"变态辣");
|
||||
// List<HandoverInfo.MemberData> memberDatas=new ArrayList<>();
|
||||
// memberDatas.add(new HandoverInfo.MemberData("43.00","会员消费"));
|
||||
// memberDatas.add(new HandoverInfo.MemberData("43.00","储值支付"));
|
||||
//
|
||||
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
// printTickets(voiceJson,1,1,"ZF544PG03W00002",getCashPrintData(detailPO,"结算单",""));\\
|
||||
//
|
||||
//
|
||||
//
|
||||
// HandoverInfo handoverInfo=new HandoverInfo("冠军","2024-03-15 14:57:00","2024-03-15 14:59:00","【POS-1】 001",payInfos,memberDatas,"102.01","0.00","39.00","39.00","4");
|
||||
//
|
||||
//
|
||||
// printTickets(3,1,"ZF544PG03W00002",handoverprintData(handoverInfo));
|
||||
|
||||
|
||||
// String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
// printTickets(voiceJson,1,1,"ZF544PG03W00002", printInvoice("http://weixin.qq.com/q/020fVS8lcLeiG1ID3SxCcH","【30天内开票有效】","1000000"));
|
||||
List<OrderDetailPO.Detail> detailList= new ArrayList<>();
|
||||
OrderDetailPO.Detail detail=new OrderDetailPO.Detail("花香水牛拿铁","1","19000.90","不甜,麻辣");
|
||||
|
||||
OrderDetailPO.Detail detail3=new OrderDetailPO.Detail("单位iiii","4","40000.00",null);
|
||||
OrderDetailPO.Detail detail4=new OrderDetailPO.Detail("喔喔奶茶","1","19000.90","微甜,微辣");
|
||||
detailList.add(detail);
|
||||
detailList.add(detail3);
|
||||
detailList.add(detail4);
|
||||
OrderDetailPO detailPO=new OrderDetailPO("牛叉闪闪","普通打印","#365","DD20240306134718468","2024-03-06 15:00:00","【POS-1】001","79000.80","5049758.96","deposit","0",detailList,"变态辣");
|
||||
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
printTickets(voiceJson,1,1,"ZF544PG03W00002",getCashPrintData(detailPO,"结算单",""));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,4 @@ public class RedisCst {
|
|||
public static final String OUT_NUMBER="ORDER:NUMBER:";
|
||||
|
||||
public static final String ORDER_MESSAGE="ORDER:MESSAGE:";
|
||||
public static final String ORDER_PRODUCT_NUM = "ORDER_NUM:";
|
||||
public static final String ORDER_CART_EXISTS = "ORDER_CART_EXISTS:";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,104 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class WechatUtil {
|
||||
@Value("${wx.msg.appId}")
|
||||
private String appId;
|
||||
|
||||
@Value("${wx.msg.secrete}")
|
||||
private String secrete;
|
||||
|
||||
@Value("${wx.msg.warnMsgTmpId}")
|
||||
private String msgTmpId;
|
||||
|
||||
static LinkedHashMap<String,String> linkedHashMap=new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
|
||||
linkedHashMap.put("40001","获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40003","不合法的 OpenID ,请开发者确认 OpenID (该用户)是否已关注公众号,或是否是其他公众号的 OpenID");
|
||||
linkedHashMap.put("40014","不合法的 access_token ,请开发者认真比对 access_token 的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40037","不合法的 template_id");
|
||||
linkedHashMap.put("43101","用户未订阅消息");
|
||||
linkedHashMap.put("43107","订阅消息能力封禁");
|
||||
linkedHashMap.put("43108","并发下发消息给同一个粉丝");
|
||||
linkedHashMap.put("45168","命中敏感词");
|
||||
linkedHashMap.put("47003","参数错误");
|
||||
|
||||
}
|
||||
|
||||
public JSONObject getAccessToken(){
|
||||
String requestUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
Map<String, String> requestUrlParam = new HashMap<>();
|
||||
//小程序appId
|
||||
requestUrlParam.put("appid", appId);
|
||||
//小程序secret
|
||||
requestUrlParam.put("secret", secrete);
|
||||
//默认参数
|
||||
requestUrlParam.put("grant_type", "client_credential");
|
||||
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doGet(requestUrl,requestUrlParam));
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String id ="kSxJL9TR4s_UmOmNLE";
|
||||
// sendStockWarnMsg("123", "1231", "1231", "23321", id);
|
||||
}
|
||||
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, String stock, String note, String toUserOpenId) {
|
||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||
put("thing1", new HashMap<String, Object>(){{
|
||||
put("value", shopName);
|
||||
}});
|
||||
put("thing6", new HashMap<String, Object>(){{
|
||||
put("value", productName);
|
||||
}});
|
||||
put("number7", new HashMap<String, Object>(){{
|
||||
put("value", stock);
|
||||
}});
|
||||
put("thing5", new HashMap<String, Object>(){{
|
||||
put("value", note);
|
||||
}});
|
||||
}};
|
||||
log.info("开始发送库存预警消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||
return sendTempMsg(msgTmpId, toUserOpenId, data);
|
||||
}
|
||||
|
||||
|
||||
public JSONObject sendTempMsg(String tempId, String toUserOpenId, Map<String, Object> data) {
|
||||
log.info("开始发送微信模板消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||
JSONObject object= getAccessToken();
|
||||
String accessToken=object.get("access_token")+"";
|
||||
|
||||
JSONObject object1=new JSONObject();
|
||||
|
||||
object1.put("template_id", tempId);
|
||||
object1.put("touser", toUserOpenId);
|
||||
object1.put("data",data);
|
||||
|
||||
object1.put("miniprogram_state","trial");
|
||||
object1.put("lang","zh_CN");
|
||||
|
||||
String response= HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("微信模板消息发送成功,相应内容:{}",response);
|
||||
JSONObject resObj=JSONObject.parseObject(response);
|
||||
if(ObjectUtil.isNotEmpty(resObj)&&ObjectUtil.isNotNull(resObj)&&"0".equals(resObj.get("errcode")+"")){
|
||||
return resObj;
|
||||
}
|
||||
|
||||
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Component
|
||||
public class WxAccountUtil {
|
||||
@Value("${wx.ysk.appId}")
|
||||
private static String appId = "wx212769170d2c6b2a";
|
||||
@Value("${wx.ysk.secrete}")
|
||||
private static String secrete = "8492a7e8d55bbb1b57f5c8276ea1add0";
|
||||
@Value("${wx.ysk.warnMsgTmpId}")
|
||||
private static String msgTmpId = "C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0";
|
||||
|
||||
static LinkedHashMap<String,String> linkedHashMap=new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
|
||||
linkedHashMap.put("40001","获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40003","不合法的 OpenID ,请开发者确认 OpenID (该用户)是否已关注公众号,或是否是其他公众号的 OpenID");
|
||||
linkedHashMap.put("40014","不合法的 access_token ,请开发者认真比对 access_token 的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40037","不合法的 template_id");
|
||||
linkedHashMap.put("43101","用户未订阅消息");
|
||||
linkedHashMap.put("43107","订阅消息能力封禁");
|
||||
linkedHashMap.put("43108","并发下发消息给同一个粉丝");
|
||||
linkedHashMap.put("45168","命中敏感词");
|
||||
linkedHashMap.put("47003","参数错误");
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// sendStockWarnMsg("13213", "31123", "234", "ojC-S6n2DDlpj52iVMoiLL0Ry4HI");
|
||||
}
|
||||
|
||||
public static String getRadarQrCode(Integer shopId) {
|
||||
HashMap<String, Object> req = new HashMap<>();
|
||||
req.put("expire_seconds", 300);
|
||||
req.put("action_name", "QR_STR_SCENE");
|
||||
HashMap<Object, Object> actionInfo = new HashMap<>();
|
||||
HashMap<String, Object> scene = new HashMap<>();
|
||||
scene.put("scene_str", "msg" + shopId);
|
||||
actionInfo.put("scene", scene);
|
||||
req.put("action_info", actionInfo);
|
||||
log.info("开始获取公众号二维码, 请求数据: {}", req);
|
||||
String resp = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + getAccessToken(), JSONObject.toJSONString(req));
|
||||
JSONObject respInfo = JSONObject.parseObject(resp);
|
||||
log.warn("获取微信公众号二维码结束,响应: {}", resp);
|
||||
if (!respInfo.containsKey("url")) {
|
||||
log.warn("获取微信公众号二维码失败,响应: {}", resp);
|
||||
throw new MsgException(resp);
|
||||
}
|
||||
return respInfo.getString("url");
|
||||
}
|
||||
|
||||
|
||||
public static String getAccessToken() {
|
||||
String resp = HttpUtil.get(StrUtil.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={}&secret={}", appId, secrete));
|
||||
JSONObject respInfo = JSONObject.parseObject(resp);
|
||||
if (!respInfo.containsKey("access_token")) {
|
||||
log.warn("公众号获取token失败, 响应内容: {}", resp);
|
||||
throw new MsgException(resp);
|
||||
}
|
||||
return respInfo.getString("access_token");
|
||||
}
|
||||
|
||||
public static JSONObject sendTemplateMsg(String templateId, String toUserOpenId, Map<String, Object> data) {
|
||||
log.info("开始发送微信模板消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||
String accessToken = getAccessToken();
|
||||
|
||||
JSONObject object1=new JSONObject();
|
||||
|
||||
object1.put("template_id", templateId);
|
||||
object1.put("touser", toUserOpenId);
|
||||
object1.put("data",data);
|
||||
|
||||
String response= HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("微信模板消息发送成功,响应内容:{}",response);
|
||||
JSONObject resObj=JSONObject.parseObject(response);
|
||||
if(ObjectUtil.isNotEmpty(resObj)&&ObjectUtil.isNotNull(resObj)&&"0".equals(resObj.get("errcode")+"")){
|
||||
return resObj;
|
||||
}
|
||||
|
||||
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
||||
}
|
||||
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId) {
|
||||
stock = stock < 0 ? 0 : stock;
|
||||
Integer finalStock = stock;
|
||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||
put("thing22", new HashMap<String, Object>(){{
|
||||
put("value", shopName);
|
||||
}});
|
||||
put("thing4", new HashMap<String, Object>(){{
|
||||
put("value", productName);
|
||||
}});
|
||||
put("number5", new HashMap<String, Object>(){{
|
||||
put("value", finalStock);
|
||||
}});
|
||||
}};
|
||||
log.info("开始发送库存预警消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||
try {
|
||||
return sendTemplateMsg(msgTmpId, toUserOpenId, data);
|
||||
}catch (Exception e) {
|
||||
log.error("发送失败, openId:{}, msg: {}", toUserOpenId, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20,11 +20,11 @@ logging:
|
|||
file:
|
||||
# 切记,该文件表示正在产出日志的日志文件。并不会打包,当文件大于max-file-size,会根据file-name-pattern格式打包
|
||||
# 名称为log/cashier-client.log文件夹会在项目根目录下,打包后会在启动包同目录下;名称为/log/cashier-client.log的文件夹会在项目所在磁盘的跟目录下
|
||||
name: cashier-client.log
|
||||
name: log/cashier-client.log
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 单文件的大小,默认10M, 超过之后打包成一个日志文件
|
||||
max-file-size: 10MB
|
||||
max-file-size: 1MB
|
||||
# 日志保存的天数
|
||||
max-history: 30
|
||||
# 打包文件格式,默认: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,书写格式为:文件路径/文件名.%i.文件后缀,其中%i不可省去,否则无日志显示
|
||||
|
|
@ -32,7 +32,6 @@ logging:
|
|||
# 如果是压缩包,里面会多一个名log/ota.2021-11-05.0的日志文件
|
||||
# 如下面的例子,打包之后为: log/2021-11/cashier-client.2020-11-5.0.log,这是一个日志文件
|
||||
file-name-pattern: log/%d{yyyy-MM}/cashier-client.%d{yyyy-MM-dd}.%i.log
|
||||
# file-name-pattern: log/%d{yyyy-MM}/cashier-client.%d{yyyy-MM-dd}.%i.log.gz
|
||||
|
||||
|
||||
gateway:
|
||||
|
|
@ -49,12 +48,6 @@ wx:
|
|||
msg:
|
||||
appId: wxcf0fe8cdba153fd6
|
||||
secrete: c33e06467c6879a62af633d50ed6b720
|
||||
warnMsgTmpId: IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY
|
||||
|
||||
ysk:
|
||||
appId: wx212769170d2c6b2a
|
||||
secrete: 8492a7e8d55bbb1b57f5c8276ea1add0
|
||||
warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,14 @@
|
|||
|
||||
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
|
||||
<!-- <table tableName="%" schema="fycashier" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>-->
|
||||
<table tableName="tb_cons_info" domainObjectName="TbConsInfo"
|
||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||
</table>
|
||||
|
||||
<table tableName="tb_handover" domainObjectName="tbHandover"
|
||||
|
||||
|
||||
<table tableName="tb_prosku_con" domainObjectName="TbProskuCon"
|
||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -250,18 +250,4 @@
|
|||
select * from tb_shop_user_duty where status = #{status} and shop_id = #{shopId} order by id desc limit 1
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectByDutyId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProductInfo">
|
||||
SELECT
|
||||
d.product_name,
|
||||
sum( d.num ) AS num,
|
||||
sum( d.amount ) AS amount
|
||||
FROM
|
||||
tb_shop_user_duty_detail d
|
||||
WHERE
|
||||
d.duty_id = #{dutyId}
|
||||
GROUP BY
|
||||
d.product_id;
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -118,17 +118,4 @@
|
|||
ORDER BY
|
||||
c.sort DESC
|
||||
</select>
|
||||
|
||||
<select id="selectProductByDutyId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO">
|
||||
SELECT
|
||||
d.product_id,
|
||||
d.product_name,
|
||||
d.sku_name,
|
||||
d.num,
|
||||
d.amount
|
||||
FROM
|
||||
tb_shop_user_duty_detail d
|
||||
WHERE
|
||||
d.duty_id = #{dutyId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="cons_id" jdbcType="INTEGER" property="consId" />
|
||||
<result column="pro_sku_id" jdbcType="INTEGER" property="proSkuId" />
|
||||
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||
<result column="balance" jdbcType="DECIMAL" property="balance" />
|
||||
|
|
@ -14,12 +13,10 @@
|
|||
<result column="biz_type" jdbcType="VARCHAR" property="bizType" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="order_id" jdbcType="INTEGER" property="orderId" />
|
||||
<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, cons_id, con_name, amount, balance, biz_code, biz_name, biz_type, create_time,
|
||||
update_time,order_id,order_no
|
||||
update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
|
|
@ -32,14 +29,14 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
|
||||
insert into tb_cons_info_flow (id, shop_id, cons_id, pro_sku_id,
|
||||
insert into tb_cons_info_flow (id, shop_id, cons_id,
|
||||
con_name, amount, balance,
|
||||
biz_code, biz_name, biz_type,
|
||||
create_time, update_time,order_id,order_no)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{consId,jdbcType=INTEGER}, #{proSkuId,jdbcType=INTEGER},
|
||||
create_time, update_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{consId,jdbcType=INTEGER},
|
||||
#{conName,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{balance,jdbcType=DECIMAL},
|
||||
#{bizCode,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR}, #{bizType,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{orderId,jdbcType=INTEGER},#{orderNo,jdbcType=VARCHAR})
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
|
||||
insert into tb_cons_info_flow
|
||||
|
|
@ -166,17 +163,15 @@
|
|||
</update>
|
||||
|
||||
<insert id="insertBatch">
|
||||
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
insert into tb_cons_info_flow (shop_id, cons_id,
|
||||
con_name, amount, balance,
|
||||
biz_code, biz_name, biz_type,
|
||||
create_time)
|
||||
values
|
||||
<foreach collection ="list" item="item" separator =",">
|
||||
( #{item.shopId,jdbcType=INTEGER}, #{item.consId,jdbcType=INTEGER},
|
||||
create_time, update_time)
|
||||
values #{item.shopId,jdbcType=INTEGER}, #{item.consId,jdbcType=INTEGER},
|
||||
#{item.conName,jdbcType=VARCHAR}, #{item.amount,jdbcType=DECIMAL}, #{item.balance,jdbcType=DECIMAL},
|
||||
#{item.bizCode,jdbcType=VARCHAR}, #{item.bizName,jdbcType=VARCHAR}, #{item.bizType,jdbcType=VARCHAR},
|
||||
now())
|
||||
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=TIMESTAMP})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@
|
|||
<result column="con_code" jdbcType="VARCHAR" property="conCode" />
|
||||
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
||||
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
|
||||
<result column="price" jdbcType="DECIMAL" property="price" />
|
||||
<result column="stock_consume" jdbcType="DECIMAL" property="stockConsume" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
|
||||
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
|
||||
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
||||
|
|
@ -19,7 +16,7 @@
|
|||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number,price,stock_consume,status, con_unit,
|
||||
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number, con_unit,
|
||||
laster_in_stock, con_warning, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
|
|
@ -174,8 +171,7 @@
|
|||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
stock_consume=#{stockConsume,jdbcType=DECIMAL}
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
|
|
@ -191,7 +187,7 @@
|
|||
<update id="batchStock">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
update tb_cons_info
|
||||
set stock_consume= stock_consume + #{item.amount},
|
||||
set stock_number= stock_number- #{item.amount},
|
||||
update_time = now()
|
||||
where id = #{item.id}
|
||||
</foreach>
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@
|
|||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
|
||||
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
|
||||
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
|
||||
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
|
||||
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
|
||||
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
|
||||
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
|
||||
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
|
||||
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
|
||||
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
|
||||
updated_at, `system_time`, created_at, is_accepted, pay_order_no,trade_day,`source`,remark,master_id,`table_name`,out_number
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
|
|
@ -75,10 +75,7 @@
|
|||
GROUP_CONCAT(tod.product_name) AS productName,
|
||||
toi.STATUS,
|
||||
toi.out_number AS outNumber,
|
||||
toi.table_name AS tableName,
|
||||
toi.remark,
|
||||
toi.master_id as masterId
|
||||
|
||||
toi.table_name AS tableName
|
||||
|
||||
FROM
|
||||
tb_order_info toi
|
||||
|
|
@ -86,13 +83,6 @@
|
|||
|
||||
WHERE
|
||||
toi.shop_id = #{shopId}
|
||||
<if test="startTime != null">
|
||||
and created_at >= #{startTime}
|
||||
</if>
|
||||
|
||||
<if test="endTime != null">
|
||||
and created_at <= #{endTime}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="orderType == 'return'">
|
||||
and toi.order_type = 'return' and toi.status in ('refund','closed')
|
||||
|
|
@ -120,32 +110,32 @@
|
|||
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderInfo"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_order_info (id, order_no, settlement_amount,
|
||||
pack_fee, origin_amount, product_amount,
|
||||
amount, refund_amount, pay_type,
|
||||
pay_amount, order_amount, freight_amount,
|
||||
discount_ratio, discount_amount, table_id,
|
||||
small_change, send_type, order_type,
|
||||
product_type, status, billing_id,
|
||||
merchant_id, shop_id, is_vip,
|
||||
member_id, user_id, product_score,
|
||||
deduct_score, user_coupon_id, user_coupon_amount,
|
||||
refund_able, paid_time, is_effect,
|
||||
is_group, updated_at, system_time,
|
||||
insert into tb_order_info (id, order_no, settlement_amount,
|
||||
pack_fee, origin_amount, product_amount,
|
||||
amount, refund_amount, pay_type,
|
||||
pay_amount, order_amount, freight_amount,
|
||||
discount_ratio, discount_amount, table_id,
|
||||
small_change, send_type, order_type,
|
||||
product_type, status, billing_id,
|
||||
merchant_id, shop_id, is_vip,
|
||||
member_id, user_id, product_score,
|
||||
deduct_score, user_coupon_id, user_coupon_amount,
|
||||
refund_able, paid_time, is_effect,
|
||||
is_group, updated_at, system_time,
|
||||
created_at, is_accepted, pay_order_no,trade_day,source,remark,master_id,table_name,out_number
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
|
||||
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
|
||||
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
|
||||
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
|
||||
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
|
||||
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
|
||||
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
|
||||
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
|
||||
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
|
||||
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
|
||||
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
|
||||
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
|
||||
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
|
||||
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
|
||||
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
|
||||
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
|
||||
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
|
||||
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
|
||||
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
|
||||
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
|
||||
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
|
||||
#{createdAt,jdbcType=BIGINT}, #{isAccepted,jdbcType=TINYINT}, #{payOrderNo,jdbcType=VARCHAR},
|
||||
#{tradeDay,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{masterId,jdbcType=VARCHAR},#{tableName,jdbcType=VARCHAR},
|
||||
#{outNumber,jdbcType=VARCHAR}
|
||||
|
|
@ -512,9 +502,6 @@
|
|||
<if test="masterId != null">
|
||||
master_id = #{masterId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null and remark!=''">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
|
@ -598,34 +585,11 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
|
|||
d.product_name AS productName,
|
||||
d.num,
|
||||
d.product_sku_name AS productSkuName,
|
||||
c.category_id AS categoryId,
|
||||
d.price_amount as priceAmount,
|
||||
d.pack_amount as packAmount
|
||||
c.category_id AS categoryId
|
||||
FROM
|
||||
tb_order_detail d
|
||||
LEFT JOIN tb_cashier_cart c ON d.order_id = c.order_id
|
||||
AND d.product_sku_id = c.sku_id
|
||||
where c.order_id=#{orderId}
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
select * from tb_order_info where id=#{id} and status='closed'
|
||||
</select>
|
||||
|
||||
<select id="selectSkuByOrderIdAndType" resultType="com.chaozhanggui.system.cashierservice.entity.po.SkuInfoPo">
|
||||
SELECT
|
||||
d.product_name AS productName,
|
||||
d.num,
|
||||
d.product_sku_name AS productSkuName,
|
||||
'' AS categoryId,
|
||||
d.price_amount as priceAmount,
|
||||
d.pack_amount as packAmount
|
||||
FROM
|
||||
tb_order_detail d
|
||||
where d.order_id=#{orderId}
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
@ -202,10 +202,4 @@
|
|||
<select id="selectByAccount" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_shop_staff where account=#{account}
|
||||
</select>
|
||||
<select id="selectByAccountAndShopId" resultMap="BaseResultMap">
|
||||
select * from tb_pluss_shop_staff where account=#{account}
|
||||
<if test="shopId != null and shopId!=''">
|
||||
and shop_id=#{shopId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -902,17 +902,6 @@
|
|||
</if>
|
||||
order by `sort` asc
|
||||
|
||||
</select>
|
||||
<select id="selectByShopIdAndCheckGrounding" resultMap="ResultMapWithBLOBs">
|
||||
select a.* from tb_product as a
|
||||
left join tb_product_sku as b on a.id = b.product_id
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and a.name like CONCAT('%',#{commdityName},'%')
|
||||
</if>
|
||||
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectByShopIdAndShopType" resultMap="ResultMapWithBLOBs">
|
||||
|
|
@ -927,19 +916,6 @@
|
|||
|
||||
</select>
|
||||
|
||||
<select id="selectByShopIdAndShopTypeCheckGrounding" resultMap="ResultMapWithBLOBs">
|
||||
|
||||
select a.* from tb_product as a
|
||||
left join tb_product_sku as b on a.id = b.product_id
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and a.name like CONCAT('%',#{commdityName},'%')
|
||||
</if>
|
||||
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
|
||||
|
||||
</select>
|
||||
|
||||
<select id="countOrderByshopIdAndProductId" resultType="INTEGER">
|
||||
SELECT
|
||||
IFNULL(sum( number ) ,0)
|
||||
|
|
@ -956,7 +932,7 @@
|
|||
|
||||
<update id="updateStockById">
|
||||
update tb_product
|
||||
set stock_number = stock_number - #{num,jdbcType=INTEGER}
|
||||
set stock_number = stock_number - #{number,jdbcType=INTEGER}
|
||||
where id = #{productId}
|
||||
</update>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
<result column="stock_number" jdbcType="DOUBLE" property="stockNumber" />
|
||||
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
|
||||
<result column="warn_line" jdbcType="INTEGER" property="warnLine" />
|
||||
<result column="suit" jdbcType="INTEGER" property="suit" />
|
||||
<result column="weight" jdbcType="DOUBLE" property="weight" />
|
||||
<result column="volume" jdbcType="REAL" property="volume" />
|
||||
<result column="real_sales_number" jdbcType="DOUBLE" property="realSalesNumber" />
|
||||
|
|
@ -30,15 +29,15 @@
|
|||
<result column="spec_snap" jdbcType="LONGVARCHAR" property="specSnap" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at,suit
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
spec_info, spec_snap
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
|
|
@ -50,21 +49,21 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
spec_info, spec_snap)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
#{specInfo,jdbcType=LONGVARCHAR}, #{specSnap,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
|
|
@ -345,7 +344,7 @@
|
|||
</update>
|
||||
|
||||
<select id="selectByShopIdAndProductIdAndSpec" resultMap="ResultMapWithBLOBs">
|
||||
select * from tb_product_sku where shop_id=#{shopId} and product_id=#{productId} and is_del=0
|
||||
select * from tb_product_sku where shop_id=#{shopId} and product_id=#{productId}
|
||||
|
||||
<if test="spec != null and spec !=''">
|
||||
and spec_snap = #{spec}
|
||||
|
|
@ -365,4 +364,4 @@
|
|||
</foreach>
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
@ -4,7 +4,6 @@
|
|||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="product_id" jdbcType="INTEGER" property="productId" />
|
||||
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
|
||||
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
|
||||
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
|
||||
|
|
@ -12,7 +11,7 @@
|
|||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||
id, shop_id, product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
|
|
@ -120,7 +119,7 @@
|
|||
|
||||
|
||||
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
|
||||
select * from tb_prosku_con where product_sku_id=#{shopId} and shop_id=#{shopId} and status=1
|
||||
</select>
|
||||
|
||||
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
|
||||
|
|
@ -134,9 +133,4 @@
|
|||
AND p.`status` = 1
|
||||
group by p.con_info_id
|
||||
</select>
|
||||
|
||||
<select id="selectByShopIdAndSkuIdAndProductId" resultMap="BaseResultMap">
|
||||
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbShopOpenIdMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="openId" column="open_id" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="TINYINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,shop_id,open_id,
|
||||
status,create_time,update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_open_id
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from tb_shop_open_id
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId" useGeneratedKeys="true">
|
||||
insert into tb_shop_open_id
|
||||
( id,shop_id,open_id
|
||||
,status,create_time,update_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER},#{shopId,jdbcType=INTEGER},#{openId,jdbcType=VARCHAR}
|
||||
,#{status,jdbcType=TINYINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId" useGeneratedKeys="true">
|
||||
insert into tb_shop_open_id
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="shopId != null">shop_id,</if>
|
||||
<if test="openId != null">open_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id,jdbcType=INTEGER},</if>
|
||||
<if test="shopId != null">#{shopId,jdbcType=INTEGER},</if>
|
||||
<if test="openId != null">#{openId,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">#{status,jdbcType=TINYINT},</if>
|
||||
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId">
|
||||
update tb_shop_open_id
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="openId != null">
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId">
|
||||
update tb_shop_open_id
|
||||
set
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -2,8 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbUserShopMsgMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<id column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="open_id" jdbcType="VARCHAR" property="openId" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
|
|
@ -11,32 +10,29 @@
|
|||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, open_id, remark, status, create_time, update_time
|
||||
shop_id, open_id, remark, status, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_user_shop_msg
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_user_shop_msg
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
insert into tb_user_shop_msg (id, shop_id, open_id,
|
||||
remark, status, create_time,
|
||||
update_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR},
|
||||
#{remark,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP})
|
||||
insert into tb_user_shop_msg (shop_id, open_id, remark,
|
||||
status, create_time, update_time
|
||||
)
|
||||
values (#{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
insert into tb_user_shop_msg
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
|
|
@ -57,9 +53,6 @@
|
|||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
|
|
@ -83,9 +76,6 @@
|
|||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
update tb_user_shop_msg
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="openId != null">
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
|
@ -102,20 +92,15 @@
|
|||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
update tb_user_shop_msg
|
||||
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
set open_id = #{openId,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectAllByShopId" resultMap="BaseResultMap">
|
||||
select * from tb_user_shop_msg where shop_id=#{shopId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -22,8 +22,6 @@
|
|||
<result column="msg_able" jdbcType="TINYINT" property="msgAble" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
|
||||
<result column="pwd" jdbcType="VARCHAR" property="pwd" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbmerchantAccount">
|
||||
<result column="head_img" jdbcType="LONGVARCHAR" property="headImg" />
|
||||
|
|
@ -31,7 +29,7 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile,
|
||||
name, sex, email, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able,
|
||||
created_at, updated_at,pwd
|
||||
created_at, updated_at
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
head_img
|
||||
|
|
|
|||
|
|
@ -1,306 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.tbHandoverMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.tbHandover">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="trade_day" jdbcType="VARCHAR" property="tradeDay" />
|
||||
<result column="print_no" jdbcType="VARCHAR" property="printNo" />
|
||||
<result column="duty_id" jdbcType="INTEGER" property="dutyId" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
|
||||
<result column="start_time" jdbcType="VARCHAR" property="startTime" />
|
||||
<result column="end_time" jdbcType="VARCHAR" property="endTime" />
|
||||
<result column="staff_id" jdbcType="INTEGER" property="staffId" />
|
||||
<result column="staff_name" jdbcType="VARCHAR" property="staffName" />
|
||||
<result column="pay_infos" jdbcType="VARCHAR" property="payInfos" />
|
||||
<result column="member_data" jdbcType="VARCHAR" property="memberData" />
|
||||
<result column="product_categories" jdbcType="VARCHAR" property="productCategories" />
|
||||
<result column="total_amount" jdbcType="VARCHAR" property="totalAmount" />
|
||||
<result column="imprest" jdbcType="VARCHAR" property="imprest" />
|
||||
<result column="payable" jdbcType="VARCHAR" property="payable" />
|
||||
<result column="hand_in" jdbcType="VARCHAR" property="handIn" />
|
||||
<result column="return_amount" jdbcType="VARCHAR" property="returnAmount" />
|
||||
<result column="order_num" jdbcType="VARCHAR" property="orderNum" />
|
||||
<result column="quick_amount" jdbcType="VARCHAR" property="quickAmount" />
|
||||
<result column="product_info_pos" jdbcType="VARCHAR" property="productInfoPos" />
|
||||
<result column="product_infos" jdbcType="VARCHAR" property="productInfos" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, trade_day, print_no, duty_id, shop_id, merchant_name, start_time, end_time, staff_id,
|
||||
staff_name, pay_infos, member_data, product_categories, total_amount, imprest, payable,
|
||||
hand_in, return_amount, order_num, quick_amount, product_info_pos, product_infos,
|
||||
create_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_handover
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_handover
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
|
||||
insert into tb_handover (id, trade_day, print_no,
|
||||
duty_id, shop_id, merchant_name,
|
||||
start_time, end_time, staff_id,
|
||||
staff_name, pay_infos, member_data,
|
||||
product_categories, total_amount, imprest,
|
||||
payable, hand_in, return_amount,
|
||||
order_num, quick_amount, product_info_pos,
|
||||
product_infos, create_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{tradeDay,jdbcType=VARCHAR}, #{printNo,jdbcType=VARCHAR},
|
||||
#{dutyId,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{merchantName,jdbcType=VARCHAR},
|
||||
#{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{staffId,jdbcType=INTEGER},
|
||||
#{staffName,jdbcType=VARCHAR}, #{payInfos,jdbcType=VARCHAR}, #{memberData,jdbcType=VARCHAR},
|
||||
#{productCategories,jdbcType=VARCHAR}, #{totalAmount,jdbcType=VARCHAR}, #{imprest,jdbcType=VARCHAR},
|
||||
#{payable,jdbcType=VARCHAR}, #{handIn,jdbcType=VARCHAR}, #{returnAmount,jdbcType=VARCHAR},
|
||||
#{orderNum,jdbcType=VARCHAR}, #{quickAmount,jdbcType=VARCHAR}, #{productInfoPos,jdbcType=VARCHAR},
|
||||
#{productInfos,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
|
||||
insert into tb_handover
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="tradeDay != null">
|
||||
trade_day,
|
||||
</if>
|
||||
<if test="printNo != null">
|
||||
print_no,
|
||||
</if>
|
||||
<if test="dutyId != null">
|
||||
duty_id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
<if test="merchantName != null">
|
||||
merchant_name,
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time,
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time,
|
||||
</if>
|
||||
<if test="staffId != null">
|
||||
staff_id,
|
||||
</if>
|
||||
<if test="staffName != null">
|
||||
staff_name,
|
||||
</if>
|
||||
<if test="payInfos != null">
|
||||
pay_infos,
|
||||
</if>
|
||||
<if test="memberData != null">
|
||||
member_data,
|
||||
</if>
|
||||
<if test="productCategories != null">
|
||||
product_categories,
|
||||
</if>
|
||||
<if test="totalAmount != null">
|
||||
total_amount,
|
||||
</if>
|
||||
<if test="imprest != null">
|
||||
imprest,
|
||||
</if>
|
||||
<if test="payable != null">
|
||||
payable,
|
||||
</if>
|
||||
<if test="handIn != null">
|
||||
hand_in,
|
||||
</if>
|
||||
<if test="returnAmount != null">
|
||||
return_amount,
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num,
|
||||
</if>
|
||||
<if test="quickAmount != null">
|
||||
quick_amount,
|
||||
</if>
|
||||
<if test="productInfoPos != null">
|
||||
product_info_pos,
|
||||
</if>
|
||||
<if test="productInfos != null">
|
||||
product_infos,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="tradeDay != null">
|
||||
#{tradeDay,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="printNo != null">
|
||||
#{printNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dutyId != null">
|
||||
#{dutyId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="merchantName != null">
|
||||
#{merchantName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
#{startTime,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
#{endTime,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="staffId != null">
|
||||
#{staffId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="staffName != null">
|
||||
#{staffName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="payInfos != null">
|
||||
#{payInfos,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="memberData != null">
|
||||
#{memberData,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productCategories != null">
|
||||
#{productCategories,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="totalAmount != null">
|
||||
#{totalAmount,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="imprest != null">
|
||||
#{imprest,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="payable != null">
|
||||
#{payable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="handIn != null">
|
||||
#{handIn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="returnAmount != null">
|
||||
#{returnAmount,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
#{orderNum,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="quickAmount != null">
|
||||
#{quickAmount,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productInfoPos != null">
|
||||
#{productInfoPos,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productInfos != null">
|
||||
#{productInfos,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
|
||||
update tb_handover
|
||||
<set>
|
||||
<if test="tradeDay != null">
|
||||
trade_day = #{tradeDay,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="printNo != null">
|
||||
print_no = #{printNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dutyId != null">
|
||||
duty_id = #{dutyId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="merchantName != null">
|
||||
merchant_name = #{merchantName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time = #{startTime,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="staffId != null">
|
||||
staff_id = #{staffId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="staffName != null">
|
||||
staff_name = #{staffName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="payInfos != null">
|
||||
pay_infos = #{payInfos,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="memberData != null">
|
||||
member_data = #{memberData,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productCategories != null">
|
||||
product_categories = #{productCategories,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="totalAmount != null">
|
||||
total_amount = #{totalAmount,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="imprest != null">
|
||||
imprest = #{imprest,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="payable != null">
|
||||
payable = #{payable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="handIn != null">
|
||||
hand_in = #{handIn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="returnAmount != null">
|
||||
return_amount = #{returnAmount,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="quickAmount != null">
|
||||
quick_amount = #{quickAmount,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productInfoPos != null">
|
||||
product_info_pos = #{productInfoPos,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productInfos != null">
|
||||
product_infos = #{productInfos,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
|
||||
update tb_handover
|
||||
set trade_day = #{tradeDay,jdbcType=VARCHAR},
|
||||
print_no = #{printNo,jdbcType=VARCHAR},
|
||||
duty_id = #{dutyId,jdbcType=INTEGER},
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
merchant_name = #{merchantName,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=VARCHAR},
|
||||
end_time = #{endTime,jdbcType=VARCHAR},
|
||||
staff_id = #{staffId,jdbcType=INTEGER},
|
||||
staff_name = #{staffName,jdbcType=VARCHAR},
|
||||
pay_infos = #{payInfos,jdbcType=VARCHAR},
|
||||
member_data = #{memberData,jdbcType=VARCHAR},
|
||||
product_categories = #{productCategories,jdbcType=VARCHAR},
|
||||
total_amount = #{totalAmount,jdbcType=VARCHAR},
|
||||
imprest = #{imprest,jdbcType=VARCHAR},
|
||||
payable = #{payable,jdbcType=VARCHAR},
|
||||
hand_in = #{handIn,jdbcType=VARCHAR},
|
||||
return_amount = #{returnAmount,jdbcType=VARCHAR},
|
||||
order_num = #{orderNum,jdbcType=VARCHAR},
|
||||
quick_amount = #{quickAmount,jdbcType=VARCHAR},
|
||||
product_info_pos = #{productInfoPos,jdbcType=VARCHAR},
|
||||
product_infos = #{productInfos,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue