1/18
This commit is contained in:
@@ -17,6 +17,8 @@ public class MyGoodsVo {
|
||||
private String remark; //备注
|
||||
private String type; //0 百姓菜窖 1 精品菜窖 2 企业菜窖
|
||||
private String specificationUnit; //规格单位
|
||||
private String unitName; //份
|
||||
private String count="0";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,4 +10,5 @@ import lombok.Data;
|
||||
public class GoodsTypeVo {
|
||||
private String name;
|
||||
private String sid;
|
||||
private String count;
|
||||
}
|
||||
|
||||
@@ -12,4 +12,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class LpkGoodsQuery implements Query {
|
||||
private String name;
|
||||
private String customerSid;
|
||||
private String affiliation;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class OrdOrder {
|
||||
private String name;
|
||||
private int timeRemarks;
|
||||
private String returnUrl;
|
||||
private String vegeCellarType;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,5 +32,6 @@ public class OrdOrderDto implements Dto {
|
||||
private int timeRemarks;
|
||||
private String returnUrl;
|
||||
private String customerSid;
|
||||
private String vegeCellarType; //菜窖类型 0 百姓菜窖 1 精品菜窖 2 企业菜窖
|
||||
private List<OrdOrderDetailVo> ordOrderDetailsVoList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yxt.yythmall.api.vegetablecellar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/8 9:10
|
||||
*/
|
||||
@Data
|
||||
public class VegetableCellar {
|
||||
private String id;
|
||||
private String sid= UUID.randomUUID().toString();
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String remarks;
|
||||
// private String isEnable;
|
||||
private String goodsSid;
|
||||
private String customerSid;
|
||||
private String affiliation;
|
||||
private String goodsNumber;
|
||||
private String totalNumber;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yxt.yythmall.api.vegetablecellar;
|
||||
|
||||
import com.yxt.common.core.dto.Dto;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/8 9:11
|
||||
*/
|
||||
@Data
|
||||
public class VegetableCellarDto implements Dto {
|
||||
private String id;
|
||||
private String sid;
|
||||
private String createTime;
|
||||
private String remarks;
|
||||
private String isEnable;
|
||||
private String recordId;
|
||||
private String recordSid;
|
||||
private String giftbagSid;
|
||||
private String serialNumber;
|
||||
private String code;
|
||||
private String codeKey;
|
||||
private String state;
|
||||
private String grantName;
|
||||
private String grantDate;
|
||||
private String customerSid;
|
||||
private String customerMobile;
|
||||
private String Num;
|
||||
private String cardArea;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.yxt.yythmall.api.vegetablecellar;
|
||||
|
||||
import com.yxt.common.core.query.Query;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/8 9:11
|
||||
*/
|
||||
@Data
|
||||
public class VegetableCellarQuery implements Query {
|
||||
private String startDate; //开始时间
|
||||
private String endDate; //结束时间
|
||||
private String countNumber; //总数
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yxt.yythmall.api.vegetablecellar;
|
||||
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/8 9:11
|
||||
*/
|
||||
@Data
|
||||
public class VegetableCellarVo implements Vo {
|
||||
private String sid;
|
||||
private String buildDate; //创建时间
|
||||
private String countNumber; //总数
|
||||
private String startNumber; //起始号
|
||||
private String endNumber; //结束号
|
||||
private String bagName;
|
||||
private String grantCountNumber; //发放总数
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.yythmall.api.appletgiftbag.GiftBagGoods;
|
||||
import com.yxt.yythmall.api.appletgiftbag.GiftBagGoodss;
|
||||
import com.yxt.yythmall.api.appletgiftbag.MyGoodsVo;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.LpkGiftCardQuery;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoodsQuery;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoodsVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -29,6 +31,6 @@ public interface LpkGoodsMapper extends BaseMapper<LpkGoods> {
|
||||
|
||||
LpkGoods getGoodsByName(@Param("goodName") String goodName);
|
||||
List<GiftBagGoods> getAllGoodsApplet();
|
||||
List<MyGoodsVo> getGoodsApplet();
|
||||
List<MyGoodsVo> getGoodsApplet( @Param("query") LpkGoodsQuery query);
|
||||
List<GiftBagGoodss> getAllGoodsApplets();
|
||||
}
|
||||
|
||||
@@ -81,19 +81,23 @@
|
||||
order by createTime desc
|
||||
</select>
|
||||
<select id="getGoodsApplet" resultType="com.yxt.yythmall.api.appletgiftbag.MyGoodsVo">
|
||||
select sid as goodsSid,
|
||||
date_format(createTime, '%Y-%m-%d') as createTime,
|
||||
`name`,
|
||||
unitName,
|
||||
price as jPrice,
|
||||
picUrl as iconUrl,
|
||||
specificationUnit,
|
||||
isAppletGrounding,
|
||||
content as remark,
|
||||
weight
|
||||
from lpk_goods
|
||||
where isAppletGrounding=1 and useTo=1
|
||||
order by createTime desc
|
||||
SELECT
|
||||
s.sid AS goodsSid,
|
||||
date_format( s.createTime, '%Y-%m-%d' ) AS createTime,
|
||||
s.`name`,
|
||||
s.unitName,
|
||||
s.price AS jPrice,
|
||||
s.picUrl AS iconUrl,
|
||||
s.specificationUnit,
|
||||
s.isAppletGrounding,
|
||||
s.content AS remark,
|
||||
s.weight ,
|
||||
r.goodsNumber as goodsNumber
|
||||
FROM
|
||||
lpk_goods s
|
||||
LEFT JOIN vegetable_cellar r ON s.sid = r.goodsSid
|
||||
WHERE
|
||||
r.customerSid =#{query.customerSid} and r.affiliation =#{query.affiliation}
|
||||
</select>
|
||||
<select id="getAllGoodsApplets" resultType="com.yxt.yythmall.api.appletgiftbag.GiftBagGoodss">
|
||||
select sid as goodsSid,
|
||||
|
||||
@@ -78,7 +78,12 @@ public class LpkGoodsRest {
|
||||
}
|
||||
@ApiOperation("我的菜窖列表")
|
||||
@PostMapping("/vegeCellarList")
|
||||
public ResultBean vegeCellarList(@RequestBody LpkGiftCardQuery query) {
|
||||
public ResultBean vegeCellarList(@RequestBody LpkGoodsQuery query) {
|
||||
return lpkGoodsService. vegeCellarList(query);
|
||||
}
|
||||
@ApiOperation("我的菜窖类别及数量")
|
||||
@PostMapping("/vegeCellarTypeList")
|
||||
public ResultBean vegeCellarTypeList(@RequestBody LpkGoodsQuery query) {
|
||||
return lpkGoodsService.vegeCellarTypeList(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.appletgiftbag.*;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.GoodsTypeVo;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.LpkGiftCardQuery;
|
||||
import com.yxt.yythmall.api.lpkgoods.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -194,13 +196,46 @@ public class LpkGoodsService extends MybatisBaseService<LpkGoodsMapper, LpkGoods
|
||||
return String.valueOf(c);
|
||||
}
|
||||
|
||||
public ResultBean vegeCellarList(LpkGiftCardQuery query) {
|
||||
public ResultBean vegeCellarList(LpkGoodsQuery query) {
|
||||
ResultBean rb=new ResultBean().fail();
|
||||
List<MyGoodsVo> vo =baseMapper.getGoodsApplet();
|
||||
List<MyGoodsVo> vo =baseMapper.getGoodsApplet(query);
|
||||
vo.forEach(s->{
|
||||
s.setResidue(String.valueOf((int)(Double.valueOf(s.getGoodsNumber())-2)));
|
||||
s.setType("0");
|
||||
s.setIconUrl(fileUploadComponent.getUrlPrefix()+s.getIconUrl());
|
||||
});
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
public ResultBean vegeCellarTypeList(LpkGoodsQuery query) {
|
||||
ResultBean rb=new ResultBean().fail();
|
||||
List<GoodsTypeVo> vo =new ArrayList<>();
|
||||
// GoodsTypeVo vo1=new GoodsTypeVo();
|
||||
// vo1.setSid("3");
|
||||
// vo1.setName("全部分类");
|
||||
// vo1.setCount("1");
|
||||
GoodsTypeVo vo2=new GoodsTypeVo();
|
||||
vo2.setSid("0");
|
||||
vo2.setName("百姓菜窖");
|
||||
query.setAffiliation(vo2.getSid());
|
||||
List<MyGoodsVo> myGoodsVos =baseMapper.getGoodsApplet(query);
|
||||
vo2.setCount(String.valueOf(myGoodsVos.size()));
|
||||
|
||||
GoodsTypeVo vo3=new GoodsTypeVo();
|
||||
vo3.setSid("1");
|
||||
vo3.setName("精品菜窖");
|
||||
query.setAffiliation(vo3.getSid());
|
||||
List<MyGoodsVo> myGoodsVos1 =baseMapper.getGoodsApplet(query);
|
||||
vo3.setCount(String.valueOf(myGoodsVos1.size()));
|
||||
|
||||
GoodsTypeVo vo4=new GoodsTypeVo();
|
||||
vo4.setSid("2");
|
||||
vo4.setName("企业菜窖");
|
||||
query.setAffiliation(vo4.getSid());
|
||||
List<MyGoodsVo> myGoodsVos2 =baseMapper.getGoodsApplet(query);
|
||||
vo4.setCount(String.valueOf(myGoodsVos2.size()));
|
||||
// vo.add(vo1);
|
||||
vo.add(vo2);
|
||||
vo.add(vo3);
|
||||
vo.add(vo4);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,4 +24,9 @@ public class OrdOrderRest {
|
||||
public ResultBean createOrder(@RequestBody OrdOrderDto dto) {
|
||||
return ordOrderService.createOrder(dto);
|
||||
}
|
||||
@PostMapping("/createVegeOrder")
|
||||
@ApiOperation(value = "创建订单")
|
||||
public ResultBean createVegeOrder(@RequestBody OrdOrderDto dto) {
|
||||
return ordOrderService.createVegeOrder(dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.*;
|
||||
@Service
|
||||
public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder> {
|
||||
|
||||
|
||||
private static final String OrderUrl="https://supervise.yxtsoft.com/lpkapi/empcardgift/generateTopEmpCard?mainSid=";
|
||||
@Autowired
|
||||
OrdOrderDetailService ordOrderDetailsService;
|
||||
@Autowired
|
||||
@@ -37,7 +37,7 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
PayResult result=new PayResult();
|
||||
Map<String,Object>map =new HashMap<>();
|
||||
LpkCustomerVo vo= lpkCustomerService.getCustomerInfo(dto.getCustomerSid()).getData();
|
||||
Map<String, Object> sendBody=buildMessageBody( vo.getSid(), vo.getWxMpOpenid(),dto.getTotalTee(),dto.getOrdOrderDetailsVoList());
|
||||
Map<String, Object> sendBody=buildMessageBody( vo.getSid(), vo.getWxMpOpenid(),dto.getTotalTee(),dto.getOrdOrderDetailsVoList(),OrderUrl);
|
||||
ResponseEntity<ResultBean> postForEntity=new RestTemplate().postForEntity("https://supervise.yxtsoft.com/wxPay/order/createOrder", sendBody,ResultBean.class);
|
||||
|
||||
ResultBean<PayOrderVo> rb1= postForEntity.getBody();
|
||||
@@ -59,11 +59,11 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
if(dto.getOrdOrderDetailsVoList().size()>1){
|
||||
order.setName(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"等"+(dto.getOrdOrderDetailsVoList().size()-1)+"件商品");
|
||||
}else{
|
||||
result.setGoods(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"商品");
|
||||
order.setName(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"商品");
|
||||
}
|
||||
// order.setName("商品");
|
||||
order.setTimeRemarks(10);
|
||||
order.setReturnUrl("https://supervise.yxtsoft.com/lpkapi/empcardgift/generateTopEmpCard?mainSid=");
|
||||
order.setReturnUrl(OrderUrl);
|
||||
baseMapper.insert(order);
|
||||
|
||||
|
||||
@@ -113,8 +113,89 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
return rb.success().setData(result);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean createVegeOrder(OrdOrderDto dto) {
|
||||
String or="";
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
PayResult result=new PayResult();
|
||||
Map<String,Object>map =new HashMap<>();
|
||||
LpkCustomerVo vo= lpkCustomerService.getCustomerInfo(dto.getCustomerSid()).getData();
|
||||
Map<String, Object> sendBody=buildMessageBody( vo.getSid(), vo.getWxMpOpenid(),dto.getTotalTee(),dto.getOrdOrderDetailsVoList(),or);
|
||||
ResponseEntity<ResultBean> postForEntity=new RestTemplate().postForEntity("https://supervise.yxtsoft.com/wxPay/order/createOrder", sendBody,ResultBean.class);
|
||||
|
||||
private static Map<String, Object> buildMessageBody(String userSid, String openId, String totalTee, List<OrdOrderDetailVo> detailVos){
|
||||
ResultBean<PayOrderVo> rb1= postForEntity.getBody();
|
||||
LinkedHashMap rb2= (LinkedHashMap)postForEntity.getBody().getData();
|
||||
if(!rb1.getCode().equals("200")){
|
||||
return rb1;
|
||||
}
|
||||
OrdOrder order=new OrdOrder();
|
||||
BeanUtil.copyProperties(dto, order, "id", "sid");
|
||||
|
||||
order.setMainSid(rb2.get("mainSid").toString());
|
||||
order.setPayStatus(1);
|
||||
order.setPayTime(new Date());
|
||||
order.setCardNumber(dto.getCardNumber());
|
||||
order.setSource(0);
|
||||
order.setUserSid(vo.getSid());
|
||||
order.setOpenId(vo.getWxMpOpenid());
|
||||
order.setTotalTee(dto.getTotalTee());
|
||||
order.setVegeCellarType(dto.getVegeCellarType());
|
||||
if(dto.getOrdOrderDetailsVoList().size()>1){
|
||||
order.setName(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"等"+(dto.getOrdOrderDetailsVoList().size()-1)+"件商品");
|
||||
}else{
|
||||
order.setName(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"商品");
|
||||
}
|
||||
// order.setName("商品");
|
||||
order.setTimeRemarks(10);
|
||||
order.setReturnUrl(or);
|
||||
baseMapper.insert(order);
|
||||
|
||||
|
||||
List<OrdOrderDetail> ordOrders=new ArrayList<>();
|
||||
dto.getOrdOrderDetailsVoList().forEach(s->{
|
||||
OrdOrderDetail ordOrderDetails=new OrdOrderDetail();
|
||||
BeanUtil.copyProperties(s, ordOrderDetails, "id", "sid");
|
||||
ordOrderDetails.setOrderSid(order.getSid());
|
||||
ordOrders.add(ordOrderDetails);
|
||||
|
||||
});
|
||||
ordOrderDetailsService.saveBatch(ordOrders);
|
||||
if(dto.getOrdOrderDetailsVoList().size()>1){
|
||||
result.setGoods(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"等"+(dto.getOrdOrderDetailsVoList().size()-1)+"件商品");
|
||||
}else{
|
||||
result.setGoods(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"商品");
|
||||
}
|
||||
|
||||
result.setPrice(dto.getTotalTee());
|
||||
// result.setOrderId(rbData.getOutTradeNo());
|
||||
result.setOrderId(rb2.get("outTradeNo").toString());
|
||||
result.setRemainder(String.valueOf(10*60));
|
||||
|
||||
PayUrl payUrl=new PayUrl();
|
||||
payUrl.setUrl("https://supervise.yxtsoft.com/wxPay/order/pay");
|
||||
PayParams aVoid=new PayParams();
|
||||
aVoid.setMainSid(rb2.get("mainSid").toString());
|
||||
payUrl.setParams(aVoid);
|
||||
|
||||
OrderUrl orderUrl=new OrderUrl();
|
||||
OrderParams orderParams=new OrderParams();
|
||||
orderParams.setMainSid("");
|
||||
orderUrl.setParams(orderParams);
|
||||
|
||||
TradeNoUrl tradeNoUrl=new TradeNoUrl();
|
||||
tradeNoUrl.setUrl("https://supervise.yxtsoft.com/wxPay/order/orderQuery");
|
||||
TradeParams tradeParams=new TradeParams();
|
||||
tradeParams.setMainSid(rb2.get("mainSid").toString());
|
||||
tradeNoUrl.setParams(tradeParams);
|
||||
|
||||
// result.setOrder_url(orderUrl);
|
||||
result.setPay_url(payUrl);
|
||||
result.setTrade_no_url(tradeNoUrl);
|
||||
String [] a =new String []{"pay"};
|
||||
result.setBus(a);
|
||||
return rb.success().setData(result);
|
||||
}
|
||||
private static Map<String, Object> buildMessageBody(String userSid, String openId, String totalTee, List<OrdOrderDetailVo> detailVos,String returnUrl){
|
||||
//拼接base参数
|
||||
String name ="";
|
||||
if(detailVos.size()>1){
|
||||
@@ -129,7 +210,8 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
mp_template_msg.put("userSid", userSid);
|
||||
mp_template_msg.put("name", name);
|
||||
mp_template_msg.put("timeRemarks", "10");
|
||||
mp_template_msg.put("returnUrl", "https://supervise.yxtsoft.com/lpkapi/empcardgift/generateTopEmpCard?mainSid=");
|
||||
mp_template_msg.put("returnUrl", returnUrl);
|
||||
return mp_template_msg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yxt.yythmall.biz.vegetablecellar;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellar;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/8 9:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface VegetableCellarMapper extends BaseMapper<VegetableCellar> {
|
||||
IPage<VegetableCellarVo> recordListPage(IPage<VegetableCellar> page, @Param(Constants.WRAPPER) QueryWrapper<VegetableCellar> qw);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.yxt.yythmall.biz.vegetablecellar.VegetableCellarMapper">
|
||||
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||
<!-- ${ew.customSqlSegment} -->
|
||||
|
||||
|
||||
<select id="recordListPage" resultType="com.yxt.yythmall.api.vegetablecellar.VegetableCellarVo">
|
||||
select
|
||||
r.sid,
|
||||
date_format(r.buildDate, '%Y-%m-%d') as buildDate,
|
||||
r.countNumber,
|
||||
r.startNumber,
|
||||
r.endNumber,
|
||||
g.name as bagName
|
||||
from emp_card_build_record as r
|
||||
left join lpk_giftbag as g on r.giftbagSid = g.sid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yxt.yythmall.biz.vegetablecellar;
|
||||
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarDto;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarQuery;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/8 9:19
|
||||
*/
|
||||
@Api(tags = "企业卡生成记录")
|
||||
@RestController
|
||||
@RequestMapping("vegetablecellar")
|
||||
public class VegetableCellarRest {
|
||||
@Autowired
|
||||
VegetableCellarService VegetableCellarService;
|
||||
@ApiOperation("创建记录列表")
|
||||
@PostMapping("/addGoods")
|
||||
public ResultBean addGoods(@RequestParam("mainSid") String mainSid) {
|
||||
return VegetableCellarService.addGoods(mainSid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.yxt.yythmall.biz.vegetablecellar;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.base.utils.PagerUtil;
|
||||
import com.yxt.common.base.utils.StringUtils;
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.ordorder.OrdOrder;
|
||||
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellar;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarDto;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarQuery;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarVo;
|
||||
import com.yxt.yythmall.biz.empcard.EmpCardService;
|
||||
import com.yxt.yythmall.biz.ordorder.OrdOrderService;
|
||||
import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/8 9:19
|
||||
*/
|
||||
@Service
|
||||
public class VegetableCellarService extends MybatisBaseService<VegetableCellarMapper, VegetableCellar> {
|
||||
|
||||
@Autowired
|
||||
OrdOrderService ordOrderService;
|
||||
@Autowired
|
||||
OrdOrderDetailService ordOrderDetailService;
|
||||
public ResultBean addGoods(String mainSid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
OrdOrder ordOrder=ordOrderService.getOne(new QueryWrapper<OrdOrder>().eq("mainSid",mainSid));
|
||||
List<OrdOrderDetail> detailList=ordOrderDetailService.list(new QueryWrapper<OrdOrderDetail>().eq("orderSid",ordOrder.getSid()));
|
||||
for(OrdOrderDetail detail:detailList){
|
||||
VegetableCellar vegetableCellar=baseMapper.selectOne(new QueryWrapper<VegetableCellar>().eq("customerSid",ordOrder.getUserSid())
|
||||
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",ordOrder.getVegeCellarType()));
|
||||
if(vegetableCellar==null){
|
||||
VegetableCellar vegetable=new VegetableCellar();
|
||||
vegetable.setAffiliation(ordOrder.getVegeCellarType());
|
||||
vegetable.setGoodsSid(detail.getGoodsSid());
|
||||
vegetable.setGoodsNumber(String.valueOf(detail.getPartNumber()));
|
||||
vegetable.setCustomerSid(ordOrder.getUserSid());
|
||||
baseMapper.insert(vegetable);
|
||||
}else{
|
||||
vegetableCellar.setGoodsNumber(String.valueOf(Double.valueOf(vegetableCellar.getGoodsNumber())+Double.valueOf(detail.getPartNumber())));
|
||||
baseMapper.updateById(vegetableCellar);
|
||||
}
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
.excludePathPatterns("/shoppingcart/getGoodsWeight")
|
||||
.excludePathPatterns("/shoppingcart/shoppingCartList")
|
||||
.excludePathPatterns("/shoppingcart/delShoppingCart/**")
|
||||
.excludePathPatterns("/lpkgoods/vegeCellarTypeList")
|
||||
.excludePathPatterns("/vegetablecellar/addGoods/**")
|
||||
.excludePathPatterns("/lpkgoods/vegeCellarList")
|
||||
.excludePathPatterns("/lpkgiftcard/bindAllCard");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user