Commit 7ffbff7a by 张新旗

代码提交

parent e77d1763
...@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication; ...@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
/** /**
......
...@@ -44,7 +44,16 @@ public class MachineApiController { ...@@ -44,7 +44,16 @@ public class MachineApiController {
}catch (Exception e){ }catch (Exception e){
return ResultVo.error(e.getMessage()); return ResultVo.error(e.getMessage());
} }
}
@PostMapping("/down/order/check")
public ResultVo checkOrder(@RequestBody String body){
log.info("/down/order/check 请求内容为 【{}】",body);
JSONObject jsonObject = JSONObject.parseObject(body);
try{
return ResultVo.success(machineApiService.checkOrder(jsonObject));
}catch (Exception e){
return ResultVo.error(e.getMessage());
}
} }
@GetMapping("/testOrder") @GetMapping("/testOrder")
......
...@@ -71,18 +71,20 @@ public class OrderRefundController extends BaseController ...@@ -71,18 +71,20 @@ public class OrderRefundController extends BaseController
Object obejct = ajaxResult.get(AjaxResult.DATA_TAG); Object obejct = ajaxResult.get(AjaxResult.DATA_TAG);
if(obejct!=null && obejct instanceof OrderRefund){ if(obejct!=null && obejct instanceof OrderRefund){
OrderRefund orderRefund1 = (OrderRefund) obejct; OrderRefund orderRefund1 = (OrderRefund) obejct;
if("0".equals(orderRefund1.getState())){
int totalFee = orderRefund1.getTotalFee().movePointRight(2).intValue(); int totalFee = orderRefund1.getTotalFee().movePointRight(2).intValue();
int refundAmount = orderRefund1.getRefundAmount().movePointRight(2).intValue(); int refundAmount = orderRefund1.getRefundAmount().movePointRight(2).intValue();
weixinService.refund(orderRefund1.getRefundNo(),orderRefund1.getOrderNo(),1,1); weixinService.refund(orderRefund1.getOrderNo(),orderRefund1.getRefundNo(),1,1);
orderRefund1.setState("1"); orderRefund1.setState("1");
orderRefundService.updateOrderRefund(orderRefund1); orderRefundService.updateOrderRefund(orderRefund1);
} }
}
return ajaxResult; return ajaxResult;
} }
@GetMapping("/refund") @PostMapping("/refund")
public AjaxResult refund(String id){ public AjaxResult refund(@RequestBody OrderRefund orderRefund){
OrderRefund orderRefund = orderRefundService.getOrderRefund(id);
int totalFee = orderRefund.getTotalFee().movePointRight(2).intValue(); int totalFee = orderRefund.getTotalFee().movePointRight(2).intValue();
int refundAmount = orderRefund.getRefundAmount().movePointRight(2).intValue(); int refundAmount = orderRefund.getRefundAmount().movePointRight(2).intValue();
orderRefund.setState("1"); orderRefund.setState("1");
......
...@@ -91,6 +91,7 @@ public class WeixinController { ...@@ -91,6 +91,7 @@ public class WeixinController {
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/refundNotify") @RequestMapping(method = RequestMethod.POST, value = "/refundNotify")
public String refundNotify(@RequestBody String xmlData) { public String refundNotify(@RequestBody String xmlData) {
log.info("微信退款回调数据为;【{}】",xmlData);
return weixinService.refundNotify(xmlData); return weixinService.refundNotify(xmlData);
} }
......
...@@ -21,16 +21,13 @@ import com.ruoyi.common.utils.QRCodeUtil; ...@@ -21,16 +21,13 @@ import com.ruoyi.common.utils.QRCodeUtil;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.sign.Base64; import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.system.domain.Customer; import com.ruoyi.system.domain.Customer;
import com.ruoyi.system.domain.Order; import com.ruoyi.system.domain.Order;
import com.ruoyi.system.domain.OrderOperationLog; import com.ruoyi.system.domain.OrderOperationLog;
import com.ruoyi.system.domain.OrderRefund; import com.ruoyi.system.domain.OrderRefund;
import com.ruoyi.system.jiguang.JiGuangPushService;
import com.ruoyi.system.jiguang.impl.JiGuangPushServiceImpl; import com.ruoyi.system.jiguang.impl.JiGuangPushServiceImpl;
import com.ruoyi.system.mapper.CustomerMapper; import com.ruoyi.system.mapper.CustomerMapper;
import com.ruoyi.system.mapper.MachineMapper;
import com.ruoyi.system.mapper.OrderMapper; import com.ruoyi.system.mapper.OrderMapper;
import com.ruoyi.system.mapper.OrderRefundMapper; import com.ruoyi.system.mapper.OrderRefundMapper;
import com.ruoyi.system.service.impl.MachineApiServiceImpl; import com.ruoyi.system.service.impl.MachineApiServiceImpl;
...@@ -56,27 +53,23 @@ import org.springframework.stereotype.Service; ...@@ -56,27 +53,23 @@ import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLContext;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetAddress; import java.net.InetAddress;
import java.security.KeyStore;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
@Service @Service
public class WeixinServiceImpl { public class WeixinServiceImpl {
private static final Logger log = LoggerFactory.getLogger(WeixinServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(WeixinServiceImpl.class);
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Autowired @Autowired
...@@ -427,6 +420,11 @@ public class WeixinServiceImpl { ...@@ -427,6 +420,11 @@ public class WeixinServiceImpl {
JSONObject jsonObject =new JSONObject(); JSONObject jsonObject =new JSONObject();
jsonObject.put("orderId",order.getId()); jsonObject.put("orderId",order.getId());
jsonObject.put("userId",order.getUserId()); jsonObject.put("userId",order.getUserId());
String uid = UUID.randomUUID().toString();
stringRedisTemplate.opsForValue().set(uid, String.valueOf(order.getId()));
stringRedisTemplate.expire(uid,1, TimeUnit.DAYS);
jsonObject.put("secret",uid);
order.setPickCode(QRCodeUtil.getBase64QRCode(jsonObject.toJSONString())); order.setPickCode(QRCodeUtil.getBase64QRCode(jsonObject.toJSONString()));
orderMapper.updateOrder(order); orderMapper.updateOrder(order);
...@@ -501,6 +499,7 @@ public class WeixinServiceImpl { ...@@ -501,6 +499,7 @@ public class WeixinServiceImpl {
return WxPayNotifyResponse.fail("退款失败"); return WxPayNotifyResponse.fail("退款失败");
} }
OrderRefund orderRefund1 = orderRefunds.get(0); OrderRefund orderRefund1 = orderRefunds.get(0);
if("1".equals(orderRefund1.getState())){ if("1".equals(orderRefund1.getState())){
orderRefund1.setState("2"); orderRefund1.setState("2");
orderRefundMapper.updateOrderRefund(orderRefund1); orderRefundMapper.updateOrderRefund(orderRefund1);
......
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 订单快照对象 order_snapshot
*
* @author ruoyi
* @date 2022-05-22
*/
public class OrderSnapshot extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long orderId;
/** 快照数据 */
@Excel(name = "快照数据")
private String snapshot;
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
public void setSnapshot(String snapshot)
{
this.snapshot = snapshot;
}
public String getSnapshot()
{
return snapshot;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("orderId", getOrderId())
.append("snapshot", getSnapshot())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.OrderSnapshot;
/**
* 订单快照Mapper接口
*
* @author ruoyi
* @date 2022-05-22
*/
public interface OrderSnapshotMapper
{
/**
* 查询订单快照
*
* @param orderId 订单快照主键
* @return 订单快照
*/
public OrderSnapshot selectOrderSnapshotByOrderId(String orderId);
/**
* 查询订单快照列表
*
* @param orderSnapshot 订单快照
* @return 订单快照集合
*/
public List<OrderSnapshot> selectOrderSnapshotList(OrderSnapshot orderSnapshot);
/**
* 新增订单快照
*
* @param orderSnapshot 订单快照
* @return 结果
*/
public int insertOrderSnapshot(OrderSnapshot orderSnapshot);
/**
* 修改订单快照
*
* @param orderSnapshot 订单快照
* @return 结果
*/
public int updateOrderSnapshot(OrderSnapshot orderSnapshot);
/**
* 删除订单快照
*
* @param orderId 订单快照主键
* @return 结果
*/
public int deleteOrderSnapshotByOrderId(String orderId);
/**
* 批量删除订单快照
*
* @param orderIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteOrderSnapshotByOrderIds(String[] orderIds);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Order;
import com.ruoyi.system.domain.OrderSnapshot;
/**
* 订单快照Service接口
*
* @author ruoyi
* @date 2022-05-22
*/
public interface IOrderSnapshotService
{
/**
* 查询订单快照
*
* @param orderId 订单快照主键
* @return 订单快照
*/
public OrderSnapshot selectOrderSnapshotByOrderId(String orderId);
/**
* 查询订单快照列表
*
* @param orderSnapshot 订单快照
* @return 订单快照集合
*/
public List<OrderSnapshot> selectOrderSnapshotList(OrderSnapshot orderSnapshot);
/**
* 新增订单快照
*
* @param orderSnapshot 订单快照
* @return 结果
*/
public int insertOrderSnapshot(OrderSnapshot orderSnapshot);
/**
* 修改订单快照
*
* @param orderSnapshot 订单快照
* @return 结果
*/
public int updateOrderSnapshot(OrderSnapshot orderSnapshot);
/**
* 批量删除订单快照
*
* @param orderIds 需要删除的订单快照主键集合
* @return 结果
*/
public int deleteOrderSnapshotByOrderIds(String[] orderIds);
/**
* 删除订单快照信息
*
* @param orderId 订单快照主键
* @return 结果
*/
public int deleteOrderSnapshotByOrderId(String orderId);
public void saveOrderSnapshot(Order order);
}
...@@ -10,6 +10,7 @@ import com.ruoyi.system.mapper.*; ...@@ -10,6 +10,7 @@ import com.ruoyi.system.mapper.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -37,6 +38,8 @@ public class MachineApiServiceImpl { ...@@ -37,6 +38,8 @@ public class MachineApiServiceImpl {
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Autowired @Autowired
private MachineMapper machineMapper; private MachineMapper machineMapper;
@Autowired
private StringRedisTemplate stringRedisTemplate;
public String shopGoodsUpdate(JSONObject jsonObject) { public String shopGoodsUpdate(JSONObject jsonObject) {
String shopID = jsonObject.getString("shopId"); String shopID = jsonObject.getString("shopId");
String skuIDs = jsonObject.getString("skuId"); String skuIDs = jsonObject.getString("skuId");
...@@ -175,7 +178,21 @@ public class MachineApiServiceImpl { ...@@ -175,7 +178,21 @@ public class MachineApiServiceImpl {
} }
public void updateOrder(Order order1) { public void updateOrder(Order order) {
}
public Object checkOrder(JSONObject jsonObject) {
String orderId = jsonObject.getString("orderId");
String secret = jsonObject.getString("secret");
String value = stringRedisTemplate.opsForValue().get(secret);
if(value ==null){
throw new ServiceException("该密钥错误或者已经失效");
}
if(orderId.equals(value)){
throw new ServiceException("密钥获取订单失败");
}
return null;
} }
} }
...@@ -49,7 +49,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService ...@@ -49,7 +49,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
/** /**
* 新增【请填写功能名称】 * 新增【请填写功能名称】
* *
* @param orderOperationLog 【请填写功能名称】 * @param 【请填写功能名称】
* @return 结果 * @return 结果
*/ */
@Override @Override
...@@ -60,6 +60,8 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService ...@@ -60,6 +60,8 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
operationLog.setOrderId(String.valueOf(orderId)); operationLog.setOrderId(String.valueOf(orderId));
operationLog.setContent(content); operationLog.setContent(content);
operationLog.setCreateAt(new Date()); operationLog.setCreateAt(new Date());
operationLog.setOperationUser(operationUser);
operationLog.setOperation(operation);
if(StringUtils.isEmpty(operationUser)){ if(StringUtils.isEmpty(operationUser)){
operationLog.setOperationUser("接口"); operationLog.setOperationUser("接口");
} }
......
...@@ -91,6 +91,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService ...@@ -91,6 +91,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
orderRefund.setOrderNo(order.getOrderNo()); orderRefund.setOrderNo(order.getOrderNo());
orderRefund.setRefundNo(GenerateCode.getCode("R","%09d")); orderRefund.setRefundNo(GenerateCode.getCode("R","%09d"));
orderRefund.setTotalFee(order.getAmount()); orderRefund.setTotalFee(order.getAmount());
orderRefund.setOrderNo(order.getOrderNo());
int i = orderRefundMapper.insertOrderRefund(orderRefund); int i = orderRefundMapper.insertOrderRefund(orderRefund);
return AjaxResult.success(orderRefund); return AjaxResult.success(orderRefund);
} }
......
...@@ -15,6 +15,7 @@ import com.ruoyi.system.domain.*; ...@@ -15,6 +15,7 @@ import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.IOrderService; import com.ruoyi.system.service.IOrderService;
import com.ruoyi.system.domain.vo.OrderQuery; import com.ruoyi.system.domain.vo.OrderQuery;
import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.*;
import org.aspectj.weaver.ast.Or;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.support.atomic.RedisAtomicInteger; import org.springframework.data.redis.support.atomic.RedisAtomicInteger;
...@@ -46,6 +47,8 @@ public class OrderServiceImpl implements IOrderService ...@@ -46,6 +47,8 @@ public class OrderServiceImpl implements IOrderService
private ShopMapper shopMapper; private ShopMapper shopMapper;
@Autowired @Autowired
private OrderOperationLogServiceImpl orderOperationLogService; private OrderOperationLogServiceImpl orderOperationLogService;
@Autowired
private OrderSnapshotServiceImpl orderSnapshotService;
...@@ -126,12 +129,13 @@ public class OrderServiceImpl implements IOrderService ...@@ -126,12 +129,13 @@ public class OrderServiceImpl implements IOrderService
orderDetail.setCreatedAt(new Date()); orderDetail.setCreatedAt(new Date());
orderDetail.setUpdatedAt(new Date()); orderDetail.setUpdatedAt(new Date());
orderDetail.setMachineId(machineId); orderDetail.setMachineId(machineId);
orderDetailMapper.insertOrderDetail(orderDetail);
} }
} }
//发送数据给机器 //发送数据给机器
machineApiService.createOrder(order); // machineApiService.createOrder(order);
orderOperationLogService.insertOrderOperationLog("待付款",order.getId(),"创建了订单",order.getUserName(),"创建订单"); orderOperationLogService.insertOrderOperationLog("待付款",order.getId(),"创建了订单",order.getUserName(),"创建订单");
orderSnapshotService.saveOrderSnapshot(order);
return AjaxResult.success(order.getOrderNo()); return AjaxResult.success(order.getOrderNo());
} }
...@@ -208,6 +212,7 @@ public class OrderServiceImpl implements IOrderService ...@@ -208,6 +212,7 @@ public class OrderServiceImpl implements IOrderService
for (OrderDetail detail : orderDetails) { for (OrderDetail detail : orderDetails) {
detail.setGoods(goodsMapper.selectGoodsById(detail.getGoodsId())); detail.setGoods(goodsMapper.selectGoodsById(detail.getGoodsId()));
} }
order.setOrderDetails(orderDetails);
} }
return orders; return orders;
} }
...@@ -224,7 +229,7 @@ public class OrderServiceImpl implements IOrderService ...@@ -224,7 +229,7 @@ public class OrderServiceImpl implements IOrderService
String format = simpleDateFormat.format(new Date()); String format = simpleDateFormat.format(new Date());
String redisKey = "shopId"+format+shopId; String redisKey = "shopId"+format+shopId;
RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(redisKey,SpringUtils.getBean(StringRedisTemplate.class).getConnectionFactory()); RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(redisKey,SpringUtils.getBean(StringRedisTemplate.class).getConnectionFactory());
if(0 == redisAtomicInteger.getAndIncrement()){ if(0 == redisAtomicInteger.get()){
redisAtomicInteger.set(30); redisAtomicInteger.set(30);
} }
redisAtomicInteger.expire(1, TimeUnit.DAYS); redisAtomicInteger.expire(1, TimeUnit.DAYS);
......
package com.ruoyi.system.service.impl;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.domain.Order;
import com.ruoyi.system.domain.OrderDetail;
import com.ruoyi.system.mapper.GoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OrderSnapshotMapper;
import com.ruoyi.system.domain.OrderSnapshot;
import com.ruoyi.system.service.IOrderSnapshotService;
/**
* 订单快照Service业务层处理
*
* @author ruoyi
* @date 2022-05-22
*/
@Service
public class OrderSnapshotServiceImpl implements IOrderSnapshotService
{
@Autowired
private OrderSnapshotMapper orderSnapshotMapper;
@Autowired
private GoodsMapper goodsMapper;
/**
* 查询订单快照
*
* @param orderId 订单快照主键
* @return 订单快照
*/
@Override
public OrderSnapshot selectOrderSnapshotByOrderId(String orderId)
{
return orderSnapshotMapper.selectOrderSnapshotByOrderId(orderId);
}
/**
* 查询订单快照列表
*
* @param orderSnapshot 订单快照
* @return 订单快照
*/
@Override
public List<OrderSnapshot> selectOrderSnapshotList(OrderSnapshot orderSnapshot)
{
return orderSnapshotMapper.selectOrderSnapshotList(orderSnapshot);
}
/**
* 新增订单快照
*
* @param orderSnapshot 订单快照
* @return 结果
*/
@Override
public int insertOrderSnapshot(OrderSnapshot orderSnapshot)
{
return orderSnapshotMapper.insertOrderSnapshot(orderSnapshot);
}
/**
* 修改订单快照
*
* @param orderSnapshot 订单快照
* @return 结果
*/
@Override
public int updateOrderSnapshot(OrderSnapshot orderSnapshot)
{
return orderSnapshotMapper.updateOrderSnapshot(orderSnapshot);
}
/**
* 批量删除订单快照
*
* @param orderIds 需要删除的订单快照主键
* @return 结果
*/
@Override
public int deleteOrderSnapshotByOrderIds(String[] orderIds)
{
return orderSnapshotMapper.deleteOrderSnapshotByOrderIds(orderIds);
}
/**
* 删除订单快照信息
*
* @param orderId 订单快照主键
* @return 结果
*/
@Override
public int deleteOrderSnapshotByOrderId(String orderId)
{
return orderSnapshotMapper.deleteOrderSnapshotByOrderId(orderId);
}
@Override
public void saveOrderSnapshot(Order order) {
List<OrderDetail> orderDetails = order.getOrderDetails();
Long orderId = null;
if(orderDetails!=null && !orderDetails.isEmpty()){
for (OrderDetail orderDetail : orderDetails) {
orderId = orderDetail.getOrderId();
orderDetail.setGoods(goodsMapper.selectGoodsById(orderDetail.getGoodsId()));
}
String s = JSONObject.toJSONString(orderDetails);
OrderSnapshot orderSnapshot = new OrderSnapshot();
orderSnapshot.setOrderId(orderId);
orderSnapshot.setSnapshot(s);
orderSnapshotMapper.insertOrderSnapshot(orderSnapshot);
}
}
}
...@@ -188,6 +188,7 @@ public class OrderTakingServiceImpl { ...@@ -188,6 +188,7 @@ public class OrderTakingServiceImpl {
skuRuleVo.setPrice(specRule.getAmount().stripTrailingZeros().toPlainString()); skuRuleVo.setPrice(specRule.getAmount().stripTrailingZeros().toPlainString());
skuRuleVo.setRuleId(String.valueOf(specRule.getId())); skuRuleVo.setRuleId(String.valueOf(specRule.getId()));
skuRuleVo.setSpecId(String.valueOf(specRule.getSpecId())); skuRuleVo.setSpecId(String.valueOf(specRule.getSpecId()));
skuRuleVo.setRuleName(specRule.getName());
if(0L == specRule.getIsDefault()){ if(0L == specRule.getIsDefault()){
boo =false; boo =false;
} }
......
...@@ -9,13 +9,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -9,13 +9,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="refundAmount" column="refund_amount" /> <result property="refundAmount" column="refund_amount" />
<result property="state" column="state" /> <result property="state" column="state" />
<result property="refundNo" column="refund_no"/>
<result property="desc" column="desc" /> <result property="desc" column="desc" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" /> <result property="updatedAt" column="updated_at" />
<result property="orderNo" column="order_no"/>
</resultMap> </resultMap>
<sql id="selectOrderRefundVo"> <sql id="selectOrderRefundVo">
select id, order_id, refund_amount, state, desc, created_at, updated_at from order_refund select id, order_id, refund_amount, state, `desc`, created_at, updated_at,refund_no,order_no from order_refund
</sql> </sql>
<select id="selectOrderRefundList" parameterType="OrderRefund" resultMap="OrderRefundResult"> <select id="selectOrderRefundList" parameterType="OrderRefund" resultMap="OrderRefundResult">
...@@ -24,9 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -24,9 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="refundAmount != null "> and refund_amount = #{refundAmount}</if> <if test="refundAmount != null "> and refund_amount = #{refundAmount}</if>
<if test="state != null and state != ''"> and state = #{state}</if> <if test="state != null and state != ''"> and state = #{state}</if>
<if test="desc != null and desc != ''"> and desc = #{desc}</if> <if test="desc != null and desc != ''"> and `desc` = #{desc}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if> <if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if> <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="refundNo != null "> and refund_no = #{refundNo}</if>
<if test="orderNo != null "> and order_no = #{orderNo}</if>
</where> </where>
</select> </select>
...@@ -41,9 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -41,9 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null and orderId != ''">order_id,</if> <if test="orderId != null and orderId != ''">order_id,</if>
<if test="refundAmount != null">refund_amount,</if> <if test="refundAmount != null">refund_amount,</if>
<if test="state != null and state != ''">state,</if> <if test="state != null and state != ''">state,</if>
<if test="desc != null">desc,</if> <if test="desc != null">`desc`,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
<if test="refundNo != null">refund_no,</if>
<if test="orderNo != null">order_no,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null and orderId != ''">#{orderId},</if> <if test="orderId != null and orderId != ''">#{orderId},</if>
...@@ -52,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -52,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="desc != null">#{desc},</if> <if test="desc != null">#{desc},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null">#{updatedAt},</if>
<if test="refundNo != null">#{refundNo},</if>
<if test="orderNo != null">#{orderNo},</if>
</trim> </trim>
</insert> </insert>
...@@ -61,9 +70,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -61,9 +70,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null and orderId != ''">order_id = #{orderId},</if> <if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
<if test="refundAmount != null">refund_amount = #{refundAmount},</if> <if test="refundAmount != null">refund_amount = #{refundAmount},</if>
<if test="state != null and state != ''">state = #{state},</if> <if test="state != null and state != ''">state = #{state},</if>
<if test="desc != null">desc = #{desc},</if> <if test="desc != null">`desc` = #{desc},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> <if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="refundNo != null">refund_no = #{refundNo},</if>
<if test="orderNo != null">order_no = #{orderNo},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
<?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.ruoyi.system.mapper.OrderSnapshotMapper">
<resultMap type="OrderSnapshot" id="OrderSnapshotResult">
<result property="orderId" column="order_id" />
<result property="snapshot" column="snapshot" />
</resultMap>
<sql id="selectOrderSnapshotVo">
select order_id, snapshot from order_snapshot
</sql>
<select id="selectOrderSnapshotList" parameterType="OrderSnapshot" resultMap="OrderSnapshotResult">
<include refid="selectOrderSnapshotVo"/>
<where>
<if test="snapshot != null and snapshot != ''"> and snapshot = #{snapshot}</if>
</where>
</select>
<select id="selectOrderSnapshotByOrderId" parameterType="String" resultMap="OrderSnapshotResult">
<include refid="selectOrderSnapshotVo"/>
where order_id = #{orderId}
</select>
<insert id="insertOrderSnapshot" parameterType="OrderSnapshot">
insert into order_snapshot
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,</if>
<if test="snapshot != null">snapshot,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
<if test="snapshot != null">#{snapshot},</if>
</trim>
</insert>
<update id="updateOrderSnapshot" parameterType="OrderSnapshot">
update order_snapshot
<trim prefix="SET" suffixOverrides=",">
<if test="snapshot != null">snapshot = #{snapshot},</if>
</trim>
where order_id = #{orderId}
</update>
<delete id="deleteOrderSnapshotByOrderId" parameterType="String">
delete from order_snapshot where order_id = #{orderId}
</delete>
<delete id="deleteOrderSnapshotByOrderIds" parameterType="String">
delete from order_snapshot where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment