1/21
This commit is contained in:
@@ -26,4 +26,5 @@ public class NewcomerRecoRecordDto implements Dto {
|
||||
private Date assistanceDate;//助力时间
|
||||
private String state;
|
||||
private String giftName;//礼包名
|
||||
private String customerSid;//礼包名
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ public class OrdOrder {
|
||||
private Date payTime;
|
||||
private int cardNumber;
|
||||
private int source;
|
||||
private String totalTee;
|
||||
private String totalTee;//实际价格
|
||||
private String openId;
|
||||
private String userSid;
|
||||
private String name;
|
||||
private int timeRemarks;
|
||||
private String returnUrl;
|
||||
private String vegeCellarType;
|
||||
// private String receivablePrice;//应收价格
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,15 +23,17 @@ public class OrdOrderDto implements Dto {
|
||||
private int payStatus;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date payTime;
|
||||
private int cardNumber;
|
||||
private int source;
|
||||
private String totalTee;
|
||||
private String openId;
|
||||
private String userSid;
|
||||
private int cardNumber;//卡的张数
|
||||
private int source;//来源:0、云菜窖
|
||||
private String totalTee;//金额
|
||||
private String openId;//微信唯一标识openid
|
||||
private String userSid;//用户sid
|
||||
private String name;
|
||||
private int timeRemarks;
|
||||
private String returnUrl;
|
||||
private String customerSid;
|
||||
private String vegeCellarType; //菜窖类型 0 百姓菜窖 1 精品菜窖 2 企业菜窖
|
||||
private String brandId;
|
||||
// private String receivablePrice;
|
||||
|
||||
private List<OrdOrderDetailVo> ordOrderDetailsVoList;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ public class OrdOrderDetailVo implements Vo {
|
||||
private Date createTime;
|
||||
private String remarks;
|
||||
private String orderSid;
|
||||
private String goodsSid;
|
||||
private String goodsName;
|
||||
private int partNumber;
|
||||
private double numofPart;
|
||||
private double priceUnit;
|
||||
private double pricePart;
|
||||
private String goodsSid;//商品Sid
|
||||
private String goodsName;//商品名称
|
||||
private int partNumber;//份数
|
||||
private double numofPart;//每份数量
|
||||
private double priceUnit;//商品单价
|
||||
private double pricePart;//每份价格
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class ShoppingCartVo implements Vo {
|
||||
private String unitName;
|
||||
private String iconUrl;
|
||||
private String specificationUnit;
|
||||
// private String text;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ public class TransferRecords {
|
||||
private String affiliation;//所属菜窖
|
||||
private String state;//
|
||||
private String recipientSid;//领取人
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Date recipientTime;//领取人
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public class TransferRecordsDto implements Dto {
|
||||
private String state;//
|
||||
private String recipientSid;//领取人
|
||||
private String orderSid;
|
||||
private String remarks;
|
||||
private List<GoodsVo> vos;
|
||||
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@ public class TransferRecordsVo implements Vo {
|
||||
private String goodss;
|
||||
private String createTime;
|
||||
private String remarks;
|
||||
private String fxNick;
|
||||
private String lqNick;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ public class CustomerStoreService extends MybatisBaseService<CustomerStoreMapper
|
||||
vo1.setStoreSid(list.getSid());
|
||||
vo1.setBusinessHours(list.getBusinessHours());
|
||||
vo1.setStoreName(list.getName());
|
||||
vo1.setName("张三");
|
||||
vo1.setPhone("11111111111");
|
||||
vo1=getStart(vo1);
|
||||
return rb.success().setData(vo1);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -32,7 +33,7 @@ public class NewcomerRecoRecordRest {
|
||||
public ResultBean recommendedAssistance(NewcomerRecoRecordDto dto){
|
||||
return newcomerRecoRecordService.recommendedAssistance(dto);
|
||||
}
|
||||
@ApiOperation("新人助力")
|
||||
@ApiOperation("新人推荐列表")
|
||||
@PostMapping("/recordList/{customerSid}")
|
||||
public ResultBean recordList(@PathVariable("customerSid") String customerSid){
|
||||
return newcomerRecoRecordService.recordList(customerSid);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yythmall.api.appletgiftbaggoods.AppletGiftBagGoods;
|
||||
import com.yxt.yythmall.api.empcardgiftgoods.EmpCardGiftGoodsVo;
|
||||
import com.yxt.yythmall.api.lpkcustomer.LpkCustomer;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.AppletVo;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
||||
@@ -24,6 +25,7 @@ import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
|
||||
import com.yxt.yythmall.biz.vegetablecellar.VegetableCellarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -60,8 +62,13 @@ public class NewcomerRecoRecordService extends MybatisBaseService<NewcomerRecoRe
|
||||
baseMapper.insert(newcomerRecoRecord);
|
||||
return rb.success().setData("推荐成功");
|
||||
}
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean recommendedAssistance(NewcomerRecoRecordDto dto) {
|
||||
ResultBean rb = new ResultBean();
|
||||
ResultBean rb = new ResultBean().fail();
|
||||
LpkCustomer customer=lpkCustomerService.getOne(new QueryWrapper<LpkCustomer>().eq("sid",dto.getCustomerSid()));
|
||||
if(!customer.getIsNewUser().equals("1")){
|
||||
return rb.setMsg("您不是新人");
|
||||
}
|
||||
NewcomerRecoRecord newcomerRecoRecord = baseMapper.selectOne(new QueryWrapper<NewcomerRecoRecord>().eq("sid",dto.getSid()));
|
||||
newcomerRecoRecord.setRecommendedSid(dto.getRecommendedSid());
|
||||
newcomerRecoRecord.setAssistanceDate(new Date());
|
||||
@@ -80,6 +87,9 @@ public class NewcomerRecoRecordService extends MybatisBaseService<NewcomerRecoRe
|
||||
}
|
||||
dto1.setVos(vos);
|
||||
vegetableCellarService.save1Goods(dto1);
|
||||
//改变新人状态
|
||||
customer.setIsNewUser("0");
|
||||
lpkCustomerService.updateById(customer);
|
||||
return rb.success().setData("助力成功");
|
||||
}
|
||||
public ResultBean recordList(String customerSid) {
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package com.yxt.yythmall.biz.ordorder;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yythmall.api.lpkcustomer.LpkCustomerVo;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
||||
import com.yxt.yythmall.api.ordorder.*;
|
||||
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail;
|
||||
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetailVo;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCart;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCartQuery;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCartVo;
|
||||
import com.yxt.yythmall.biz.lpkcustomer.LpkCustomerService;
|
||||
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
|
||||
import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService;
|
||||
import com.yxt.yythmall.biz.shoppingcart.ShoppingCartService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,10 +32,15 @@ import java.util.*;
|
||||
public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder> {
|
||||
|
||||
private static final String OrderUrl="https://supervise.yxtsoft.com/lpkapi/empcardgift/generateTopEmpCard?mainSid=";
|
||||
private static final String or="https://supervise.yxtsoft.com/lpkapi/vegetablecellar/addGoods?mainSid=";
|
||||
@Autowired
|
||||
OrdOrderDetailService ordOrderDetailsService;
|
||||
@Autowired
|
||||
LpkCustomerService lpkCustomerService;
|
||||
@Autowired
|
||||
ShoppingCartService shoppingCartService;
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -115,9 +127,28 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean createVegeOrder(OrdOrderDto dto) {
|
||||
String or="";
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
PayResult result=new PayResult();
|
||||
List<OrdOrderDetailVo> ordOrderDetailVos=new ArrayList<>();
|
||||
|
||||
ShoppingCartQuery query=new ShoppingCartQuery();
|
||||
query.setCustomerSid(dto.getCustomerSid());
|
||||
query.setBrandId(dto.getBrandId());
|
||||
List<ShoppingCartVo> vos=shoppingCartService.shoppingCartList(query).getData();
|
||||
List<String> strings=new ArrayList<>();
|
||||
for (ShoppingCartVo vo : vos) {
|
||||
OrdOrderDetailVo vo1 =new OrdOrderDetailVo();
|
||||
LpkGoods goods = lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid", vo.getGoodsSid()));
|
||||
vo1.setGoodsSid(vo.getGoodsSid());
|
||||
vo1.setGoodsName(vo.getGoodsName());
|
||||
vo1.setPartNumber(Integer.parseInt(vo.getGoodsNumber()));
|
||||
vo1.setNumofPart(Double.valueOf(vo.getWeight()));
|
||||
vo1.setPriceUnit(Double.valueOf(goods.getPrice()));
|
||||
vo1.setPricePart((Double.valueOf(goods.getPrice())*Double.valueOf(goods.getWeight())));
|
||||
ordOrderDetailVos.add(vo1);
|
||||
strings.add(vo.getSid());
|
||||
}
|
||||
dto.setOrdOrderDetailsVoList(ordOrderDetailVos);
|
||||
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);
|
||||
@@ -139,7 +170,6 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
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{
|
||||
@@ -160,6 +190,9 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
|
||||
});
|
||||
ordOrderDetailsService.saveBatch(ordOrders);
|
||||
//生成订单 删除购物车
|
||||
String [] sids=strings.toArray(new String [0]);
|
||||
shoppingCartService.delBySids(sids);
|
||||
if(dto.getOrdOrderDetailsVoList().size()>1){
|
||||
result.setGoods(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"等"+(dto.getOrdOrderDetailsVoList().size()-1)+"件商品");
|
||||
}else{
|
||||
@@ -213,5 +246,23 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
mp_template_msg.put("returnUrl", returnUrl);
|
||||
return mp_template_msg;
|
||||
}
|
||||
|
||||
// private OrdOrderDto price(OrdOrderDto dto){
|
||||
// int weight=0;
|
||||
// for (OrdOrderDetailVo s : dto.getOrdOrderDetailsVoList()) {
|
||||
// weight= (int) (s.getNumofPart()*s.getPartNumber()+weight);
|
||||
// }
|
||||
//
|
||||
// if(weight>=20 && weight<=100){
|
||||
// dto.setReceivablePrice(dto.getTotalTee());
|
||||
// double a =1.1;
|
||||
// dto.setTotalTee(String.valueOf(Double.valueOf(dto.getTotalTee())*a));
|
||||
// }else if(weight>=101 && weight<=200){
|
||||
// dto.setReceivablePrice(dto.getTotalTee());
|
||||
// double a =1.05;
|
||||
// dto.setTotalTee(String.valueOf(Double.valueOf(dto.getTotalTee())*a));
|
||||
// }else {
|
||||
// dto.setReceivablePrice(dto.getTotalTee());
|
||||
// }
|
||||
// return dto;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -13,16 +13,21 @@ import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.empcardbuildrecord.EmpCardBuildRecord;
|
||||
import com.yxt.yythmall.api.empcardbuildrecord.EmpCardBuildRecordQuery;
|
||||
import com.yxt.yythmall.api.empcardbuildrecord.EmpCardBuildRecordVo;
|
||||
import com.yxt.yythmall.api.lpkcustomer.LpkCustomer;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.LpkGiftCardQuery;
|
||||
import com.yxt.yythmall.api.ordorder.OrdOrderDto;
|
||||
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetailVo;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCart;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCartDto;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCartQuery;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCartVo;
|
||||
import com.yxt.yythmall.biz.empcard.EmpCardService;
|
||||
import com.yxt.yythmall.biz.lpkcustomer.LpkCustomerService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -34,6 +39,8 @@ import java.util.List;
|
||||
public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper, ShoppingCart> {
|
||||
@Autowired
|
||||
private FileUploadComponent fileUploadComponent;
|
||||
@Autowired
|
||||
LpkCustomerService lpkCustomerService;
|
||||
|
||||
public ResultBean save(ShoppingCartDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
@@ -100,8 +107,77 @@ public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper,
|
||||
weight=Double.valueOf(vo.getWeight())*Double.valueOf(vo.getGoodsNumber())+weight;
|
||||
}
|
||||
ShoppingCartVo vo =new ShoppingCartVo();
|
||||
// vo.setText("1.20斤起订量。\n" +
|
||||
// "2.新用户正好20斤5折。\n" +
|
||||
// "3.20-100斤加10%附加额。\n" +
|
||||
// "4.101斤-200斤加5%附加额。");
|
||||
vo.setCustomerSid(query.getCustomerSid());
|
||||
vo.setTotalPrice(String.valueOf((int) price));
|
||||
vo.setTotalWeight(String.valueOf((int)weight));
|
||||
vo=price(vo);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
private ShoppingCartVo price(ShoppingCartVo vo){
|
||||
int weight=Integer.parseInt(vo.getTotalWeight());
|
||||
LpkCustomer lpkCustomer=lpkCustomerService.getOne(new QueryWrapper<LpkCustomer>().eq("sid",vo.getCustomerSid()));
|
||||
vo.setRemarks("已减免附加费");
|
||||
if(weight<=100){
|
||||
if(weight==20){
|
||||
if(lpkCustomer.getIsPurchase().equals("1")){
|
||||
double a =0.5;
|
||||
double t=Double.valueOf(vo.getTotalPrice())*a;
|
||||
BigDecimal bg = new BigDecimal(t);
|
||||
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||
vo.setRemarks("已享受新人专享5折优惠");
|
||||
}else{
|
||||
double a =1.1;
|
||||
double d=Double.valueOf(vo.getTotalPrice());
|
||||
double t=Double.valueOf(vo.getTotalPrice())*a;
|
||||
BigDecimal bg = new BigDecimal(t);
|
||||
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||
double f=Double.valueOf(vo.getTotalPrice())-d;
|
||||
BigDecimal bgd = new BigDecimal(f);
|
||||
String c =String.valueOf(bgd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
vo.setRemarks("包含附加费"+removeZeros(c)+"元");
|
||||
}
|
||||
}else{
|
||||
double a =1.1;
|
||||
double d=Double.valueOf(vo.getTotalPrice());
|
||||
double t=Double.valueOf(vo.getTotalPrice())*a;
|
||||
BigDecimal bg = new BigDecimal(t);
|
||||
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||
// String c =String.valueOf(Double.valueOf(vo.getTotalPrice())-d);
|
||||
double f=Double.valueOf(vo.getTotalPrice())-d;
|
||||
BigDecimal bgd = new BigDecimal(f);
|
||||
String c =String.valueOf(bgd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
vo.setRemarks("包含附加费"+removeZeros(c)+"元");
|
||||
}
|
||||
}else if(weight>=101 && weight<=200){
|
||||
double a =1.05;
|
||||
double d=Double.valueOf(vo.getTotalPrice());
|
||||
double t=Double.valueOf(vo.getTotalPrice())*a;
|
||||
BigDecimal bg = new BigDecimal(t);
|
||||
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||
// String c =String.valueOf(Double.valueOf(vo.getTotalPrice())-d);
|
||||
double f=Double.valueOf(vo.getTotalPrice())-d;
|
||||
BigDecimal bgd = new BigDecimal(f);
|
||||
String c =String.valueOf(bgd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
vo.setRemarks("包含附加费"+removeZeros(c)+"元");
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
/**
|
||||
* 去除多余.0
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String removeZeros(String num) {
|
||||
if (num.indexOf(".") > 0) {
|
||||
// 去掉多余的0
|
||||
num = num.replaceAll("0+?$", "");
|
||||
// 如果最后一位是. 则去掉
|
||||
num = num.replaceAll("[.]$", "");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,38 +6,53 @@
|
||||
|
||||
<select id="orderListByUserSid" resultType="com.yxt.yythmall.api.transferrecords.TransferRecordsVo">
|
||||
SELECT
|
||||
sid ,
|
||||
'转赠' as type,
|
||||
transferCode,
|
||||
createTime ,
|
||||
remarks,
|
||||
case state
|
||||
when 1 then '已分享'
|
||||
when 2 then '已领取'
|
||||
end stateValue
|
||||
s.sid,
|
||||
'转赠' AS type,
|
||||
s.transferCode,
|
||||
s.createTime,
|
||||
s.remarks,
|
||||
r.nick as fxNick,
|
||||
d.nick as lqNick,
|
||||
s.state,
|
||||
CASE
|
||||
state
|
||||
WHEN 1 THEN
|
||||
'已分享'
|
||||
WHEN 2 THEN
|
||||
'已领取'
|
||||
END stateValue
|
||||
FROM
|
||||
transfer_records
|
||||
transfer_records s
|
||||
LEFT JOIN lpk_customer r on r.sid =s.customerSid
|
||||
left join lpk_customer d on d.sid =s.recipientSid
|
||||
WHERE
|
||||
customerSid=#{query.customerSid}
|
||||
|
||||
|
||||
order by s.createTime desc
|
||||
</select>
|
||||
<select id="orderListByUserSid1" resultType="com.yxt.yythmall.api.transferrecords.TransferRecordsVo">
|
||||
SELECT
|
||||
sid,
|
||||
'领取' as type,
|
||||
transferCode,
|
||||
createTime ,
|
||||
remarks,
|
||||
case state
|
||||
when 1 then '已分享'
|
||||
when 2 then '已领取'
|
||||
end stateValue
|
||||
s.sid,
|
||||
'转赠' AS type,
|
||||
s.transferCode,
|
||||
s.createTime,
|
||||
s.remarks,
|
||||
r.nick as fxNick,
|
||||
d.nick as lqNick,
|
||||
s.state,
|
||||
CASE
|
||||
state
|
||||
WHEN 1 THEN
|
||||
'已分享'
|
||||
WHEN 2 THEN
|
||||
'已领取'
|
||||
END stateValue
|
||||
FROM
|
||||
transfer_records
|
||||
transfer_records s
|
||||
LEFT JOIN lpk_customer r on r.sid =s.customerSid
|
||||
left join lpk_customer d on d.sid =s.recipientSid
|
||||
WHERE
|
||||
recipientSid =#{query.customerSid}
|
||||
|
||||
order by s.createTime desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -10,6 +10,7 @@ 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.customerstore.CustomerStoreDto;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
||||
@@ -90,14 +91,28 @@ public class TransferRecordsService extends MybatisBaseService<TransferRecordsMa
|
||||
// orderGoodsVo.setUnitName(lpkGoods.getUnitName());
|
||||
// goodsVo.add(orderGoodsVo);
|
||||
if(StringUtils.isBlank(vo.getGoodss())){
|
||||
vo.setGoodss(lpkGoods.getName()+":"+goods1.getGoodsNumber()+lpkGoods.getUnitName());
|
||||
vo.setGoodss(lpkGoods.getName()+":"+removeZeros(String.valueOf(goods1.getGoodsNumber()))+lpkGoods.getUnitName());
|
||||
}else{
|
||||
vo.setGoodss(vo.getGoodss()+" "+lpkGoods.getName()+":"+goods1.getGoodsNumber()+lpkGoods.getUnitName());
|
||||
vo.setGoodss(vo.getGoodss()+" "+lpkGoods.getName()+":"+removeZeros(String.valueOf(goods1.getGoodsNumber()))+lpkGoods.getUnitName());
|
||||
}
|
||||
}
|
||||
// vo.setGoodsVo(goodsVo);
|
||||
}
|
||||
return rb.success().setData(1);
|
||||
PagerVo<TransferRecordsVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
/**
|
||||
* 去除多余.0
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String removeZeros(String num) {
|
||||
if (num.indexOf(".") > 0) {
|
||||
// 去掉多余的0
|
||||
num = num.replaceAll("0+?$", "");
|
||||
// 如果最后一位是. 则去掉
|
||||
num = num.replaceAll("[.]$", "");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ public interface TransferRecordsGoodsDetailsMapper extends BaseMapper<TransferRe
|
||||
List<TransferRecordsGoodsDetails> selByOrderSid(String orderSid);
|
||||
|
||||
List<TransferRecordsGoodsDetails> selInOrderSid(@Param("orderSids") List<String> orderSids);
|
||||
@Select("select *,goodsNumber as goodsNumber from lpk_reserve_order_goods where orderSid=#{orderSid}")
|
||||
@Select("select *,goodsNumber as goodsNumber from transfer_records_goods_details where orderSid=#{orderSid}")
|
||||
List<TransferRecordsGoodsDetails> selByOrderSids(String orderSid);
|
||||
}
|
||||
|
||||
@@ -259,6 +259,7 @@
|
||||
<where>
|
||||
o.customerSid=#{query.customerSid} and state=#{query.state}
|
||||
</where>
|
||||
order by o.reserveDate desc
|
||||
</select>
|
||||
<select id="exportExcel" resultType="com.yxt.yythmall.api.lpkreserveorder.ReserveOrderExport">
|
||||
select
|
||||
|
||||
@@ -24,7 +24,9 @@ import com.yxt.yythmall.biz.transferrecords.TransferRecordsService;
|
||||
import com.yxt.yythmall.biz.transferrecordsgoodsdetails.TransferRecordsGoodsDetailsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -46,16 +48,18 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService;
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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){
|
||||
LpkGoods cl=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",detail.getGoodsSid()));
|
||||
VegetableCellar vegetableCellar=baseMapper.selectOne(new QueryWrapper<VegetableCellar>().eq("customerSid",ordOrder.getUserSid())
|
||||
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",ordOrder.getVegeCellarType()));
|
||||
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",cl.getBrandId()));
|
||||
if(vegetableCellar==null){
|
||||
VegetableCellar vegetable=new VegetableCellar();
|
||||
vegetable.setAffiliation(ordOrder.getVegeCellarType());
|
||||
vegetable.setAffiliation(String.valueOf(cl.getBrandId()));
|
||||
vegetable.setGoodsSid(detail.getGoodsSid());
|
||||
vegetable.setGoodsNumber(String.valueOf(detail.getPartNumber()));
|
||||
vegetable.setCustomerSid(ordOrder.getUserSid());
|
||||
@@ -67,6 +71,7 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean saveGoods(VegetableCellarDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
|
||||
@@ -92,6 +97,7 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean save1Goods(VegetableCellarDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
for(vegeVo detail:dto.getVos()){
|
||||
@@ -111,9 +117,10 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean receiveTransferGoods(VegetableCellarDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
TransferRecords transferRecords=transferRecordsService.getOne(new QueryWrapper<TransferRecords>().eq("sid",dto.getTransferSid()).eq("state","0"));
|
||||
TransferRecords transferRecords=transferRecordsService.getOne(new QueryWrapper<TransferRecords>().eq("sid",dto.getTransferSid()).eq("state","1"));
|
||||
if(transferRecords==null){
|
||||
return rb.setMsg("已经被领取");
|
||||
}
|
||||
@@ -121,7 +128,7 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
for(TransferRecordsGoodsDetails detail:list){
|
||||
LpkGoods cl=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",detail.getGoodsSid()));
|
||||
VegetableCellar vegetableCellar=baseMapper.selectOne(new QueryWrapper<VegetableCellar>().eq("customerSid",dto.getCustomerSid())
|
||||
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",transferRecords.getAffiliation()));
|
||||
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",cl.getBrandId()));
|
||||
if(vegetableCellar==null){
|
||||
VegetableCellar vegetable=new VegetableCellar();
|
||||
vegetable.setAffiliation(String.valueOf(cl.getBrandId()));
|
||||
@@ -135,6 +142,7 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
}
|
||||
transferRecords.setState("2");
|
||||
transferRecords.setRecipientSid(dto.getCustomerSid());
|
||||
transferRecords.setRecipientTime(new Date());
|
||||
transferRecordsService.updateById(transferRecords);
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
|
||||
@@ -43,6 +43,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
.excludePathPatterns("/lpksreservoorder/orderByCardSid/**")
|
||||
.excludePathPatterns("/lpksreservoorder/orderListByUserSid/**")
|
||||
.excludePathPatterns("/lpksreservoorder/orderDetails/**")
|
||||
.excludePathPatterns("/transferrecords/transferRecordsList")
|
||||
.excludePathPatterns("/empsreservoorder/createVegeOrder")
|
||||
.excludePathPatterns("/lpkgoods/goodsDetails/**")
|
||||
.excludePathPatterns("/lpkstore/getAllStoreByQuery")
|
||||
.excludePathPatterns("/vegetablecellar/receiveTransferGoods")
|
||||
|
||||
Reference in New Issue
Block a user