购物车 多规格商品返回规格信息
团购卷列表 团购卷退款 员工登录管理
This commit is contained in:
1
pom.xml
1
pom.xml
@@ -12,7 +12,6 @@
|
||||
<groupId>com.chaozhangui.system.cashservice</groupId>
|
||||
<artifactId>cashier-client</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.PayService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
||||
@@ -105,7 +106,6 @@ public class PayController {
|
||||
* @param token
|
||||
* @param loginName
|
||||
* @param clientType
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("queryQuickPayStatus")
|
||||
@@ -217,4 +217,9 @@ public class PayController {
|
||||
@RequestParam("orderId") String orderId){
|
||||
return payService.queryOrder(orderId,token);
|
||||
}
|
||||
|
||||
@RequestMapping("returnGpOrder")
|
||||
public Result returnOrder(@RequestBody ReturnGroupOrderDto param){
|
||||
return payService.returnGroupOrder(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbGroupOrderInfoService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 团购卷订单(TbGroupOrderInfo)表控制层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-05-20 10:04:50
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
@RequestMapping("groupOrder")
|
||||
public class TbGroupOrderInfoController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbGroupOrderInfoService tbGroupOrderInfoService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @return 查询结果
|
||||
*/
|
||||
@RequestMapping("list")
|
||||
public Result queryByPage(@RequestBody GroupOrderDto param) {
|
||||
return tbGroupOrderInfoService.queryByPage(param);
|
||||
}
|
||||
|
||||
@RequestMapping("details")
|
||||
public Result queryById(Integer id) {
|
||||
return tbGroupOrderInfoService.queryById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 团购卷核销前回显
|
||||
*
|
||||
* @param coupon
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("orderInfo")
|
||||
public Result groupOrderInfo(String coupon) {
|
||||
return tbGroupOrderInfoService.groupOrderInfo(coupon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购卷扫码核销
|
||||
*
|
||||
* @param loginName
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("groupScan")
|
||||
public Result groupScan(@RequestHeader("loginName") String loginName, Integer id) {
|
||||
return tbGroupOrderInfoService.groupScan(loginName, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 团购卷 卷码表(TbGroupOrderCoupon)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-05-20 10:42:18
|
||||
*/
|
||||
public interface TbGroupOrderCouponMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbGroupOrderCoupon queryById(Integer id);
|
||||
|
||||
TbGroupOrderCoupon queryByCoupon(String coupon);
|
||||
|
||||
List<TbGroupOrderCoupon> queryNoRefundByOrderId(Integer orderId);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param tbGroupOrderCoupon 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbGroupOrderCoupon> queryAll(TbGroupOrderCoupon tbGroupOrderCoupon, @Param("pageable") Pageable pageable);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbGroupOrderCoupon 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbGroupOrderCoupon tbGroupOrderCoupon);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbGroupOrderCoupon> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbGroupOrderCoupon> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbGroupOrderCoupon 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbGroupOrderCoupon tbGroupOrderCoupon);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 团购卷订单(TbGroupOrderInfo)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-05-20 10:04:50
|
||||
*/
|
||||
public interface TbGroupOrderInfoMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbGroupOrderInfo queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param tbGroupOrderInfo 查询条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbGroupOrderInfo> queryAll(TbGroupOrderInfo tbGroupOrderInfo);
|
||||
|
||||
List<TbGroupOrderInfo> queryList(GroupOrderDto tbGroupOrderInfo);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbGroupOrderInfo 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbGroupOrderInfo tbGroupOrderInfo);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbGroupOrderInfo> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbGroupOrderInfo> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbGroupOrderInfo 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbGroupOrderInfo tbGroupOrderInfo);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class TbCashierCart implements Serializable {
|
||||
private Integer userId;
|
||||
private String tableId;
|
||||
private TbProductSpec tbProductSpec;
|
||||
private String selectSpec="";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 团购卷 卷码表(TbGroupOrderCoupon)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-05-20 10:42:18
|
||||
*/
|
||||
@Data
|
||||
public class TbGroupOrderCoupon implements Serializable {
|
||||
private static final long serialVersionUID = -79087167053650793L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 团购订单id
|
||||
*/
|
||||
private Integer orderId;
|
||||
/**
|
||||
* 团购卷码
|
||||
*/
|
||||
private String couponNo;
|
||||
/**
|
||||
* 是否已退款
|
||||
* 0:否
|
||||
* 1:是
|
||||
*/
|
||||
private Integer isRefund;
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 退款原因
|
||||
*/
|
||||
private String refundReason;
|
||||
/**
|
||||
* 退款说明
|
||||
*/
|
||||
private String refundDesc;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 团购卷订单(TbGroupOrderInfo)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-05-20 10:04:50
|
||||
*/
|
||||
@Data
|
||||
public class TbGroupOrderInfo implements Serializable {
|
||||
private static final long serialVersionUID = -54354891204103762L;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
private Integer merchantId;
|
||||
/**
|
||||
* 商户Id
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer proId;
|
||||
/**
|
||||
* 商品图
|
||||
*/
|
||||
private String proImg;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String proName;
|
||||
/**
|
||||
* 团购卷到期日期
|
||||
*/
|
||||
private Date expDate;
|
||||
/**
|
||||
* 订单类型 预留字段
|
||||
*/
|
||||
private String orderType;
|
||||
/**
|
||||
* 支付方式 wechatPay微信支付,aliPay支付宝支付
|
||||
*/
|
||||
private String payType;
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal saveAmount;
|
||||
/**
|
||||
* 实付金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
/**
|
||||
* 退单金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 退单数量
|
||||
*/
|
||||
private Integer refundNumber;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer number;
|
||||
/**
|
||||
* 订单状态
|
||||
* 状态: unpaid-待付款;unused-待使用;closed-已完成;refunding-退款中;refund-已退款;cancelled-已取消;
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 付款时间
|
||||
*/
|
||||
private Date payTime;
|
||||
/**
|
||||
* 是否支持退款 0:不支持 1:支持
|
||||
*/
|
||||
private Integer refundAble;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 卷码核销员
|
||||
*/
|
||||
private String verifier;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 支付订单号
|
||||
*/
|
||||
private String payOrderNo;
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
private Date tradeDay;
|
||||
/**
|
||||
* 原订单id 退单
|
||||
*/
|
||||
private Integer source;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ public class TbPlussShopStaff implements Serializable {
|
||||
private Long updatedAt;
|
||||
|
||||
private String type;
|
||||
private Integer isManage;
|
||||
private Integer isPc;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -122,6 +124,22 @@ public class TbPlussShopStaff implements Serializable {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Integer getIsManage() {
|
||||
return isManage;
|
||||
}
|
||||
|
||||
public void setIsManage(Integer isManage) {
|
||||
this.isManage = isManage;
|
||||
}
|
||||
|
||||
public Integer getIsPc() {
|
||||
return isPc;
|
||||
}
|
||||
|
||||
public void setIsPc(Integer isPc) {
|
||||
this.isPc = isPc;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type == null ? null : type.trim();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasePageDto {
|
||||
private Integer page = 1;
|
||||
|
||||
private Integer size = 10;
|
||||
|
||||
private String shopId;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GroupOrderDto extends BasePageDto{
|
||||
private String orderNo;
|
||||
|
||||
private String proName;
|
||||
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ReturnGroupOrderDto {
|
||||
/**
|
||||
* 退单数
|
||||
*/
|
||||
private Integer num;
|
||||
/**
|
||||
* 团购订单id
|
||||
*/
|
||||
private Integer orderId;
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
/**
|
||||
* 退款原因
|
||||
*/
|
||||
private String refundReason;
|
||||
/**
|
||||
* 退款说明
|
||||
*/
|
||||
private String refundDesc;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
@Data
|
||||
public class GroupOrderInfoVo {
|
||||
private Integer id;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private JSONArray images;
|
||||
|
||||
/**
|
||||
* 现价
|
||||
*/
|
||||
private BigDecimal salePrice;
|
||||
/**
|
||||
* 原价
|
||||
*/
|
||||
private BigDecimal originPrice;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 套餐详情
|
||||
*/
|
||||
List<ProductVo> productList = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ProductVo {
|
||||
//选几个
|
||||
private Integer number;
|
||||
|
||||
//类别
|
||||
private String title;
|
||||
|
||||
//食物
|
||||
private List<Food> goods=new ArrayList<>(); // 食品列表
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Food {
|
||||
private Integer id;
|
||||
private String name; // 商品名称
|
||||
private BigDecimal lowPrice; // 售价
|
||||
private String groupNum; // 数量
|
||||
private String unitName; // 单位
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class LoginService {
|
||||
return Result.fail(CodeEnum.PASSWORD);
|
||||
}
|
||||
|
||||
String key=RedisCst.ONLINE_USER.concat(":").concat(loginReq.getClientType()).concat(":").concat(loginReq.getLoginName());
|
||||
String key = RedisCst.ONLINE_USER.concat(":").concat(loginReq.getClientType()).concat(":").concat(loginReq.getLoginName());
|
||||
//
|
||||
// String data = redisUtil.getMessage(key);
|
||||
// if(ObjectUtil.isNotEmpty(data)){
|
||||
@@ -91,6 +91,11 @@ public class LoginService {
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffMapper.selectByAccount(loginReq.getLoginName());
|
||||
if (ObjectUtil.isEmpty(tbPlussShopStaff)) {
|
||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
} else if (tbPlussShopStaff.getType().equals("staff")) {
|
||||
Integer isPc = tbPlussShopStaff.getIsPc();
|
||||
if (isPc != null && isPc != 1) {
|
||||
return Result.fail(CodeEnum.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,15 +104,13 @@ public class LoginService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//生成token 信息
|
||||
String token = TokenUtil.generateToken(account.getId().toString(), loginReq.getLoginName(), loginReq.getClientType()
|
||||
, account.getShopId(), tbPlussShopStaff.getId().toString(), tbPlussShopStaff.getCode());
|
||||
|
||||
|
||||
//存储登录记录
|
||||
TbToken tbToken = new TbToken(account.getId(), tbPlussShopStaff.getId(),loginReq.getClientType(), token, ip, "1", new Date());
|
||||
TbToken tbToken = new TbToken(account.getId(), tbPlussShopStaff.getId(), loginReq.getClientType(), token, ip, "1", new Date());
|
||||
tbTokenMapper.insert(tbToken);
|
||||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(account.getShopId()));
|
||||
@@ -126,7 +129,7 @@ public class LoginService {
|
||||
accountMap.put("userCode", tbPlussShopStaff.getCode());
|
||||
accountMap.put("token", token);
|
||||
accountMap.put("loginTime", System.currentTimeMillis());
|
||||
if (Objects.nonNull(shopInfo)){
|
||||
if (Objects.nonNull(shopInfo)) {
|
||||
accountMap.put("shopName", shopInfo.getShopName());
|
||||
}
|
||||
accountMap.put("uuid", uuid);
|
||||
@@ -166,10 +169,10 @@ public class LoginService {
|
||||
tbToken.setUpdateTime(new Date());
|
||||
tbTokenMapper.updateByPrimaryKey(tbToken);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type","close");
|
||||
jsonObject.put("token",token);
|
||||
rabbitProducer.putOrderCollect(jsonObject.toJSONString());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type", "close");
|
||||
jsonObject.put("token", token);
|
||||
rabbitProducer.putOrderCollect(jsonObject.toJSONString());
|
||||
return Result.success(SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
@@ -227,10 +227,13 @@ public class OrderService {
|
||||
if (Objects.nonNull(skuWithBLOBs)) {
|
||||
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
|
||||
}
|
||||
TbProduct tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProductWithBLOBs tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
cashierCart.setSelectSpec(tbProduct.getSelectSpec());
|
||||
if (Objects.nonNull(tbProduct)) {
|
||||
TbProductSpec tbProductSpec = tbProductSpecMapper.selectByPrimaryKey(tbProduct.getSpecId());
|
||||
cashierCart.setTbProductSpec(tbProductSpec);
|
||||
if(tbProduct.getSpecId()!=null){
|
||||
TbProductSpec tbProductSpec = tbProductSpecMapper.selectByPrimaryKey(tbProduct.getSpecId());
|
||||
cashierCart.setTbProductSpec(tbProductSpec);
|
||||
}
|
||||
}
|
||||
// TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPr imaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.dto.ReturnGroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.OrderDetailPo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.model.ReturnOrderReq;
|
||||
@@ -13,10 +14,7 @@ import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
||||
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.thirdpay.resp.MainScanResp;
|
||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderReturnResp;
|
||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp;
|
||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
||||
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;
|
||||
@@ -29,6 +27,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
@@ -71,6 +70,10 @@ public class PayService {
|
||||
|
||||
@Autowired
|
||||
RabbitProducer producer;
|
||||
@Resource
|
||||
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
|
||||
@Resource
|
||||
private TbGroupOrderCouponMapper couponMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
@@ -91,6 +94,8 @@ public class PayService {
|
||||
private String url;
|
||||
@Value("${thirdPay.callBack}")
|
||||
private String callBack;
|
||||
@Value("${thirdPay.groupCallBack}")
|
||||
private String groupCallBack;
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -1025,4 +1030,59 @@ public class PayService {
|
||||
int randomNum = random.nextInt(900) + 100;
|
||||
return "RO" + date + randomNum;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result returnGroupOrder(ReturnGroupOrderDto param) {
|
||||
TbGroupOrderInfo groupOrderInfo = tbGroupOrderInfoMapper.queryById(param.getOrderId());
|
||||
List<TbGroupOrderCoupon> tbGroupOrderCoupons = couponMapper.queryNoRefundByOrderId(param.getOrderId());
|
||||
if (param.getNum() > tbGroupOrderCoupons.size()) {
|
||||
return Result.fail("可退数量不足");
|
||||
}
|
||||
for (int i = 0; i < param.getNum(); i++) {
|
||||
TbGroupOrderCoupon coupon = tbGroupOrderCoupons.get(i);
|
||||
coupon.setIsRefund(1);
|
||||
coupon.setRefundAmount(param.getRefundAmount());
|
||||
coupon.setRefundDesc(param.getRefundDesc());
|
||||
coupon.setRefundReason(param.getRefundReason());
|
||||
couponMapper.update(coupon);
|
||||
}
|
||||
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(groupOrderInfo.getMerchantId());
|
||||
MsgException.checkNull(thirdApply, "支付参数配置错误");
|
||||
|
||||
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(param.getOrderId()+"");
|
||||
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(
|
||||
url,
|
||||
thirdApply.getAppId(),
|
||||
groupOrderInfo.getOrderNo(),
|
||||
payment.getTradeNumber(),
|
||||
null,
|
||||
"团购卷订单退款",
|
||||
param.getRefundAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(),
|
||||
groupCallBack,
|
||||
null,
|
||||
thirdApply.getAppToken());
|
||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||
GroupOrderReturnResp returnInfo = com.chaozhanggui.system.cashierservice.util.JSONUtil.parseJSONStr2T(publicResp.getBizData(), GroupOrderReturnResp.class);
|
||||
if ("000000".equals(publicResp.getCode())) {
|
||||
//TRADE_REFUND
|
||||
if (!"SUCCESS".equals(returnInfo.getState()) && !"TRADE_SUCCESS".equals(returnInfo.getState()) && !returnInfo.getState().equals("ING")) {
|
||||
return Result.fail("退款渠道调用失败,"+returnInfo.getNote());
|
||||
}
|
||||
} else {
|
||||
return Result.fail("退款渠道调用失败:" + publicResp.getMsg());
|
||||
}
|
||||
}
|
||||
groupOrderInfo.setRefundNumber(groupOrderInfo.getRefundNumber() + param.getNum());
|
||||
if (groupOrderInfo.getRefundAmount() == null) {
|
||||
groupOrderInfo.setRefundAmount(param.getRefundAmount());
|
||||
}else {
|
||||
groupOrderInfo.setRefundAmount(groupOrderInfo.getRefundAmount().add(param.getRefundAmount()));
|
||||
}
|
||||
if (groupOrderInfo.getNumber().equals(groupOrderInfo.getRefundNumber())) {
|
||||
groupOrderInfo.setRefundAble(0);
|
||||
groupOrderInfo.setStatus("refund");
|
||||
}
|
||||
tbGroupOrderInfoMapper.update(groupOrderInfo);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderCouponMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbProductMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderInfoVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductVo;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 团购卷订单(TbGroupOrderInfo)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-05-20 10:04:50
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TbGroupOrderInfoService {
|
||||
@Resource
|
||||
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
|
||||
@Resource
|
||||
private TbGroupOrderCouponMapper couponMapper;
|
||||
@Resource
|
||||
private TbProductMapper productMapper;
|
||||
@Resource
|
||||
private TbProductSkuMapper skuMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
public Result queryById(Integer id) {
|
||||
TbGroupOrderInfo tbGroupOrderInfo = tbGroupOrderInfoMapper.queryById(id);
|
||||
TbProductWithBLOBs tbProduct = productMapper.selectByPrimaryKey(tbGroupOrderInfo.getProId());
|
||||
TbProductSkuWithBLOBs tbProductSku = skuMapper.selectByProduct(tbGroupOrderInfo.getProId());
|
||||
|
||||
GroupOrderInfoVo productInfo = new GroupOrderInfoVo();
|
||||
productInfo.setId(id);
|
||||
// 图片组装
|
||||
if (StringUtils.isNotBlank(tbProduct.getImages())) {
|
||||
productInfo.setImages(JSON.parseArray(tbProduct.getImages()));
|
||||
} else {
|
||||
productInfo.setImages(new JSONArray());
|
||||
}
|
||||
|
||||
//售价
|
||||
if (tbProductSku.getSalePrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||
if (tbProductSku.getOriginPrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||
productInfo.setOriginPrice(BigDecimal.ZERO);
|
||||
productInfo.setSalePrice(BigDecimal.ZERO);
|
||||
} else {
|
||||
productInfo.setOriginPrice(tbProductSku.getOriginPrice());
|
||||
productInfo.setSalePrice(tbProductSku.getOriginPrice());
|
||||
}
|
||||
} else {
|
||||
productInfo.setOriginPrice(tbProductSku.getOriginPrice());
|
||||
//现价
|
||||
productInfo.setSalePrice(tbProductSku.getSalePrice());
|
||||
}
|
||||
|
||||
//名称
|
||||
productInfo.setProductName(tbProduct.getName());
|
||||
|
||||
List<ProductVo> productVos = JSONUtil.parseListTNewList(tbProduct.getGroupSnap(), ProductVo.class);
|
||||
productInfo.setProductList(productVos);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, productInfo);
|
||||
}
|
||||
|
||||
public Result groupOrderInfo(String coupon) {
|
||||
TbGroupOrderCoupon tbGroupOrderCoupon = couponMapper.queryByCoupon(coupon);
|
||||
if (tbGroupOrderCoupon == null) {
|
||||
return Result.fail("该卷码不可用。");
|
||||
}
|
||||
return queryById(tbGroupOrderCoupon.getOrderId());
|
||||
}
|
||||
|
||||
public Result groupScan(String loginName, Integer orderId) {
|
||||
TbGroupOrderInfo groupOrder = tbGroupOrderInfoMapper.queryById(orderId);
|
||||
String status = groupOrder.getStatus();
|
||||
if(!status.equals("unused")){
|
||||
return Result.fail("卷码核销失败,订单状态异常");
|
||||
}
|
||||
groupOrder.setId(orderId);
|
||||
groupOrder.setVerifier(loginName);
|
||||
groupOrder.setStatus("closed");
|
||||
groupOrder.setUpdateTime(new Date());
|
||||
tbGroupOrderInfoMapper.update(groupOrder);
|
||||
return Result.success(CodeEnum.SUCCESS, groupOrder);
|
||||
}
|
||||
|
||||
public Result queryByPage(GroupOrderDto param) {
|
||||
PageHelper.startPage(param.getPage(), param.getSize());
|
||||
return Result.success(CodeEnum.SUCCESS, new PageInfo(tbGroupOrderInfoMapper.queryList(param)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbGroupOrderInfo 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
public Result update(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||
tbGroupOrderInfo.setUpdateTime(new Date());
|
||||
tbGroupOrderInfoMapper.update(tbGroupOrderInfo);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -63,6 +63,8 @@ public enum CodeEnum {
|
||||
|
||||
CARTEXIST("100020",false,"购物车信息不存在","fail"),
|
||||
|
||||
UNAUTHORIZED("100021",false,"该账号无权限登录,请联系管理员","fail"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.chaozhanggui.system.cashierservice.thirdpay.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class GroupOrderReturnResp implements Serializable {
|
||||
|
||||
private String ifCode;
|
||||
private String mchRefundNo;
|
||||
private String mercNo;
|
||||
private String note;
|
||||
private Integer oriAmount;
|
||||
private String oriPayOrderId;
|
||||
private String payType;
|
||||
private Integer refundAmt;
|
||||
private String refundOrderId;
|
||||
private String refundReason;
|
||||
private Integer refundType;
|
||||
private String state;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -199,6 +200,17 @@ public class JSONUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> List<T> parseListTNewList(String json, Class<T> clazz) {
|
||||
ObjectMapper objectMapper = new ObjectMapper(); // 创建JSON转换器
|
||||
try {
|
||||
// 将JSON字符串转换为List<T>
|
||||
return objectMapper.readValue(json, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class JSONEntity {
|
||||
public JSONEntity() {
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ pagehelper:
|
||||
reasonable: true
|
||||
helperDialect: mysql
|
||||
params: count=countSql
|
||||
|
||||
thirdPay:
|
||||
groupCallBack: https:///cashierService/notify/notifyCallBackGroup
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
@@ -49,6 +49,9 @@ pagehelper:
|
||||
helperDialect: mysql
|
||||
params: count=countSql
|
||||
|
||||
thirdPay:
|
||||
groupCallBack: https://cashierclient.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
|
||||
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
127
src/main/resources/mapper/TbGroupOrderCouponMapper.xml
Normal file
127
src/main/resources/mapper/TbGroupOrderCouponMapper.xml
Normal file
@@ -0,0 +1,127 @@
|
||||
<?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.TbGroupOrderCouponMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon" id="TbGroupOrderCouponMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
|
||||
<result property="couponNo" column="coupon_no" jdbcType="VARCHAR"/>
|
||||
<result property="isRefund" column="is_refund" jdbcType="INTEGER"/>
|
||||
<result property="refundAmount" column="refund_amount" jdbcType="NUMERIC"/>
|
||||
<result property="refundReason" column="refund_reason" jdbcType="VARCHAR"/>
|
||||
<result property="refundDesc" column="refund_desc" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbGroupOrderCouponMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_group_order_coupon
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByCoupon" resultMap="TbGroupOrderCouponMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_group_order_coupon
|
||||
where coupon_no = #{couponNo}
|
||||
and is_refund = 0;
|
||||
</select>
|
||||
|
||||
<select id="queryNoRefundByOrderId" resultMap="TbGroupOrderCouponMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_group_order_coupon
|
||||
where order_id = #{orderId}
|
||||
and is_refund = 0;
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbGroupOrderCouponMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_group_order_coupon
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="orderId != null">
|
||||
and order_id = #{orderId}
|
||||
</if>
|
||||
<if test="couponNo != null and couponNo != ''">
|
||||
and coupon_no = #{couponNo}
|
||||
</if>
|
||||
<if test="isRefund != null">
|
||||
and is_refund = #{isRefund}
|
||||
</if>
|
||||
<if test="refundAmount != null">
|
||||
and refund_amount = #{refundAmount}
|
||||
</if>
|
||||
<if test="refundReason != null and refundReason != ''">
|
||||
and refund_reason = #{refundReason}
|
||||
</if>
|
||||
<if test="refundDesc != null and refundDesc != ''">
|
||||
and refund_desc = #{refundDesc}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
|
||||
values (#{orderId}, #{couponNo}, #{isRefund}, #{refundAmount}, #{refundReason}, #{refundDesc})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.orderId}, #{entity.couponNo}, #{entity.isRefund}, #{entity.refundAmount}, #{entity.refundReason},
|
||||
#{entity.refundDesc})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_group_order_coupon
|
||||
<set>
|
||||
<if test="orderId != null">
|
||||
order_id = #{orderId},
|
||||
</if>
|
||||
<if test="couponNo != null and couponNo != ''">
|
||||
coupon_no = #{couponNo},
|
||||
</if>
|
||||
<if test="isRefund != null">
|
||||
is_refund = #{isRefund},
|
||||
</if>
|
||||
<if test="refundAmount != null">
|
||||
refund_amount = #{refundAmount},
|
||||
</if>
|
||||
<if test="refundReason != null and refundReason != ''">
|
||||
refund_reason = #{refundReason},
|
||||
</if>
|
||||
<if test="refundDesc != null and refundDesc != ''">
|
||||
refund_desc = #{refundDesc},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from tb_group_order_coupon
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
288
src/main/resources/mapper/TbGroupOrderInfoMapper.xml
Normal file
288
src/main/resources/mapper/TbGroupOrderInfoMapper.xml
Normal file
@@ -0,0 +1,288 @@
|
||||
<?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.TbGroupOrderInfoMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo" id="TbGroupOrderInfoMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
|
||||
<result property="merchantId" column="merchant_id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
|
||||
<result property="proImg" column="pro_img" jdbcType="VARCHAR"/>
|
||||
<result property="proName" column="pro_name" jdbcType="VARCHAR"/>
|
||||
<result property="expDate" column="exp_date" jdbcType="TIMESTAMP"/>
|
||||
<result property="orderType" column="order_type" jdbcType="VARCHAR"/>
|
||||
<result property="payType" column="pay_type" jdbcType="VARCHAR"/>
|
||||
<result property="orderAmount" column="order_amount" jdbcType="NUMERIC"/>
|
||||
<result property="saveAmount" column="save_amount" jdbcType="NUMERIC"/>
|
||||
<result property="payAmount" column="pay_amount" jdbcType="NUMERIC"/>
|
||||
<result property="refundAmount" column="refund_amount" jdbcType="NUMERIC"/>
|
||||
<result property="refundNumber" column="refund_number" jdbcType="INTEGER"/>
|
||||
<result property="number" column="number" jdbcType="INTEGER"/>
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||
<result property="payTime" column="pay_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="refundAble" column="refund_able" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="verifier" column="verifier" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="payOrderNo" column="pay_order_no" jdbcType="VARCHAR"/>
|
||||
<result property="tradeDay" column="trade_day" jdbcType="TIMESTAMP"/>
|
||||
<result property="source" column="source" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, order_no, merchant_id, shop_id, user_id, pro_id, pro_img, pro_name, exp_date, order_type, pay_type, order_amount, save_amount, pay_amount, refund_amount, refund_number, number, status, remark, phone, pay_time, refund_able, create_time, verifier, update_time, pay_order_no, trade_day, source </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbGroupOrderInfoMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_group_order_info
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbGroupOrderInfoMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_group_order_info
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
and order_no = #{orderNo}
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
and merchant_id = #{merchantId}
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
and shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and pro_id = #{proId}
|
||||
</if>
|
||||
<if test="proImg != null and proImg != ''">
|
||||
and pro_img = #{proImg}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
and pro_name = #{proName}
|
||||
</if>
|
||||
<if test="expDate != null">
|
||||
and exp_date = #{expDate}
|
||||
</if>
|
||||
<if test="orderType != null and orderType != ''">
|
||||
and order_type = #{orderType}
|
||||
</if>
|
||||
<if test="payType != null and payType != ''">
|
||||
and pay_type = #{payType}
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
and order_amount = #{orderAmount}
|
||||
</if>
|
||||
<if test="saveAmount != null">
|
||||
and save_amount = #{saveAmount}
|
||||
</if>
|
||||
<if test="payAmount != null">
|
||||
and pay_amount = #{payAmount}
|
||||
</if>
|
||||
<if test="refundAmount != null">
|
||||
and refund_amount = #{refundAmount}
|
||||
</if>
|
||||
<if test="refundNumber != null">
|
||||
and refund_number = #{refundNumber}
|
||||
</if>
|
||||
<if test="number != null">
|
||||
and number = #{number}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark = #{remark}
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
and phone = #{phone}
|
||||
</if>
|
||||
<if test="payTime != null">
|
||||
and pay_time = #{payTime}
|
||||
</if>
|
||||
<if test="refundAble != null">
|
||||
and refund_able = #{refundAble}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="verifier != null and verifier != ''">
|
||||
and verifier = #{verifier}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="payOrderNo != null and payOrderNo != ''">
|
||||
and pay_order_no = #{payOrderNo}
|
||||
</if>
|
||||
<if test="tradeDay != null">
|
||||
and trade_day = #{tradeDay}
|
||||
</if>
|
||||
<if test="source != null">
|
||||
and source = #{source}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryList" resultMap="TbGroupOrderInfoMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_group_order_info
|
||||
<where>
|
||||
shop_id = #{shopId}
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
and order_no = #{orderNo}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
and pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_group_order_info(order_no, merchant_id, shop_id, user_id, pro_id, pro_img, pro_name, exp_date,
|
||||
order_type, pay_type, order_amount, save_amount, pay_amount, refund_amount,
|
||||
refund_number, number, status, remark, phone, pay_time, refund_able,
|
||||
create_time, verifier, update_time, pay_order_no, trade_day, source)
|
||||
values (#{orderNo}, #{merchantId}, #{shopId}, #{userId}, #{proId}, #{proImg}, #{proName}, #{expDate},
|
||||
#{orderType}, #{payType}, #{orderAmount}, #{saveAmount}, #{payAmount}, #{refundAmount}, #{refundNumber},
|
||||
#{number}, #{status}, #{remark}, #{phone}, #{payTime}, #{refundAble}, #{createTime}, #{verifier},
|
||||
#{updateTime}, #{payOrderNo}, #{tradeDay}, #{source})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_group_order_info(order_no, merchant_id, shop_id, user_id, pro_id, pro_img, pro_name, exp_date,
|
||||
order_type, pay_type, order_amount, save_amount, pay_amount, refund_amount, refund_number, number, status,
|
||||
remark, phone, pay_time, refund_able, create_time, verifier, update_time, pay_order_no, trade_day, source)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.orderNo}, #{entity.merchantId}, #{entity.shopId}, #{entity.userId}, #{entity.proId},
|
||||
#{entity.proImg}, #{entity.proName}, #{entity.expDate}, #{entity.orderType}, #{entity.payType},
|
||||
#{entity.orderAmount}, #{entity.saveAmount}, #{entity.payAmount}, #{entity.refundAmount},
|
||||
#{entity.refundNumber}, #{entity.number}, #{entity.status}, #{entity.remark}, #{entity.phone},
|
||||
#{entity.payTime}, #{entity.refundAble}, #{entity.createTime}, #{entity.verifier}, #{entity.updateTime},
|
||||
#{entity.payOrderNo}, #{entity.tradeDay}, #{entity.source})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_group_order_info
|
||||
<set>
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
order_no = #{orderNo},
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
merchant_id = #{merchantId},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
pro_id = #{proId},
|
||||
</if>
|
||||
<if test="proImg != null and proImg != ''">
|
||||
pro_img = #{proImg},
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
pro_name = #{proName},
|
||||
</if>
|
||||
<if test="expDate != null">
|
||||
exp_date = #{expDate},
|
||||
</if>
|
||||
<if test="orderType != null and orderType != ''">
|
||||
order_type = #{orderType},
|
||||
</if>
|
||||
<if test="payType != null and payType != ''">
|
||||
pay_type = #{payType},
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
order_amount = #{orderAmount},
|
||||
</if>
|
||||
<if test="saveAmount != null">
|
||||
save_amount = #{saveAmount},
|
||||
</if>
|
||||
<if test="payAmount != null">
|
||||
pay_amount = #{payAmount},
|
||||
</if>
|
||||
<if test="refundAmount != null">
|
||||
refund_amount = #{refundAmount},
|
||||
</if>
|
||||
<if test="refundNumber != null">
|
||||
refund_number = #{refundNumber},
|
||||
</if>
|
||||
<if test="number != null">
|
||||
number = #{number},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="payTime != null">
|
||||
pay_time = #{payTime},
|
||||
</if>
|
||||
<if test="refundAble != null">
|
||||
refund_able = #{refundAble},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="verifier != null and verifier != ''">
|
||||
verifier = #{verifier},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="payOrderNo != null and payOrderNo != ''">
|
||||
pay_order_no = #{payOrderNo},
|
||||
</if>
|
||||
<if test="tradeDay != null">
|
||||
trade_day = #{tradeDay},
|
||||
</if>
|
||||
<if test="source != null">
|
||||
source = #{source},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from tb_group_order_info
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -14,10 +14,13 @@
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="is_manage" jdbcType="INTEGER" property="isManage" />
|
||||
<result column="is_pc" jdbcType="INTEGER" property="isPc" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, code, name, account, password, max_discount_amount, status, employee, shop_id,
|
||||
created_at, updated_at, type
|
||||
id
|
||||
, code, name, account, password, max_discount_amount, status, employee, shop_id,
|
||||
created_at, updated_at, type,is_manage,is_pc
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -33,12 +36,13 @@
|
||||
insert into tb_pluss_shop_staff (id, code, name,
|
||||
account, password, max_discount_amount,
|
||||
status, employee, shop_id,
|
||||
created_at, updated_at, type
|
||||
created_at, updated_at, type,is_manage,is_pc
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{account,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{maxDiscountAmount,jdbcType=DECIMAL},
|
||||
#{status,jdbcType=BIT}, #{employee,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},
|
||||
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}
|
||||
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR},
|
||||
#{isManage,jdbcType=INTEGER},#{isPc,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbPlussShopStaff">
|
||||
@@ -80,6 +84,12 @@
|
||||
<if test="type != null">
|
||||
type,
|
||||
</if>
|
||||
<if test="isManage != null">
|
||||
is_manage,
|
||||
</if>
|
||||
<if test="isPc != null">
|
||||
is_pc,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -118,6 +128,12 @@
|
||||
<if test="type != null">
|
||||
#{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isManage != null">
|
||||
#{isManage,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isPc != null">
|
||||
#{isPc,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbPlussShopStaff">
|
||||
@@ -156,23 +172,31 @@
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isManage != null">
|
||||
is_manage = #{isManage,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isPc != null">
|
||||
is_pc = #{isPc,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbPlussShopStaff">
|
||||
update tb_pluss_shop_staff
|
||||
set code = #{code,jdbcType=VARCHAR},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
account = #{account,jdbcType=VARCHAR},
|
||||
password = #{password,jdbcType=VARCHAR},
|
||||
max_discount_amount = #{maxDiscountAmount,jdbcType=DECIMAL},
|
||||
status = #{status,jdbcType=BIT},
|
||||
employee = #{employee,jdbcType=VARCHAR},
|
||||
shop_id = #{shopId,jdbcType=VARCHAR},
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
type = #{type,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
update tb_pluss_shop_staff
|
||||
set code = #{code,jdbcType=VARCHAR},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
account = #{account,jdbcType=VARCHAR},
|
||||
password = #{password,jdbcType=VARCHAR},
|
||||
max_discount_amount = #{maxDiscountAmount,jdbcType=DECIMAL},
|
||||
status = #{status,jdbcType=BIT},
|
||||
employee = #{employee,jdbcType=VARCHAR},
|
||||
shop_id = #{shopId,jdbcType=VARCHAR},
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
is_manage = #{isManage,jdbcType=INTEGER},
|
||||
is_pc = #{isPc,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectByAccount" resultMap="BaseResultMap">
|
||||
|
||||
Reference in New Issue
Block a user