parent
56d66097c7
commit
b27b364848
|
|
@ -215,11 +215,13 @@ public class PayController {
|
|||
public Result returnOrder(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestBody List<TbOrderDetail> list
|
||||
@RequestBody List<TbOrderDetail> list,
|
||||
@RequestParam("pwd") String pwd,
|
||||
@RequestParam(defaultValue = "true") boolean isOnline
|
||||
){
|
||||
|
||||
|
||||
return payService.returnOrder(list,token,null);
|
||||
return payService.returnOrder(list,token,null, isOnline);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,12 @@ 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);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
|
|
@ -49,4 +50,7 @@ public interface TbProductSkuMapper {
|
|||
|
||||
@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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||
private String images;
|
||||
|
|
@ -15,8 +16,18 @@ 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,4 +45,6 @@ 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,5 +1,6 @@
|
|||
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;
|
||||
|
|
@ -61,4 +62,13 @@ 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, "商品售出增加库存记录");
|
||||
}
|
||||
}
|
||||
|
|
@ -17,11 +17,9 @@ 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;
|
||||
|
|
@ -538,6 +536,12 @@ 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);
|
||||
}
|
||||
|
||||
|
|
@ -623,6 +627,12 @@ 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);
|
||||
}
|
||||
|
||||
|
|
@ -671,6 +681,12 @@ 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);
|
||||
}
|
||||
|
||||
|
|
@ -718,11 +734,17 @@ 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) {
|
||||
public Result returnOrder(List<TbOrderDetail> list, String token, String pwd, boolean isOnline) {
|
||||
if (ObjectUtil.isEmpty(list) || list.size() <= 0) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
|
|
@ -839,6 +861,8 @@ 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, "支付参数配置错误");
|
||||
|
|
@ -917,7 +941,7 @@ public class PayService {
|
|||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//判断是否修改主单状态
|
||||
BigDecimal returnAmount = tbOrderDetailMapper.selectByOrderId(orderId.toString());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
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;
|
||||
|
|
@ -14,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
|
@ -97,9 +102,9 @@ public class ProductService {
|
|||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||
PageHelperUtil.startPage(page,pageSize);
|
||||
if(ObjectUtil.isEmpty(categoryId)){
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
||||
}else {
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
|
||||
}
|
||||
|
||||
String day = DateUtils.getDay();
|
||||
|
|
@ -118,6 +123,11 @@ public class ProductService {
|
|||
skuResult=new TbProductSkuResult();
|
||||
}
|
||||
it.setProductSkuResult(skuResult);
|
||||
|
||||
|
||||
// 查询sku信息
|
||||
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
|
||||
it.setSkuList(skuWithBLOBs);
|
||||
});
|
||||
}
|
||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||
|
|
|
|||
|
|
@ -902,6 +902,17 @@
|
|||
</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">
|
||||
|
|
@ -916,6 +927,19 @@
|
|||
|
||||
</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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue