1/21
This commit is contained in:
@@ -18,6 +18,6 @@ public class TransferRecordsDto implements Dto {
|
||||
private String state;//
|
||||
private String recipientSid;//领取人
|
||||
private String orderSid;
|
||||
private List<GoodsVo> goodsVos;
|
||||
private List<GoodsVo> vos;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class TransferRecordsQuery implements Query {
|
||||
private String store; // 门店
|
||||
private String startDate; //预约开始日期
|
||||
private String endDate; // 预约结束日期
|
||||
private String userSid;
|
||||
private String customerSid;
|
||||
private String storeSid;
|
||||
private String bankSid;
|
||||
private String bankName;
|
||||
|
||||
@@ -16,9 +16,15 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
public class TransferRecordsVo implements Vo {
|
||||
private String sid;
|
||||
private String customerSid;//客户sid
|
||||
private String transferCode;//转赠code
|
||||
private String affiliation;//所属菜窖
|
||||
private String state;//
|
||||
private String stateValue;//
|
||||
private String type;
|
||||
private String recipientSid;//领取人
|
||||
private String goodss;
|
||||
private String createTime;
|
||||
private String remarks;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class VegeCellarReserveOrder {
|
||||
private Date createTime;
|
||||
private String remarks;
|
||||
private String isEnable;
|
||||
|
||||
private String affiliation;
|
||||
private String customerSid;
|
||||
private String reserveDate;
|
||||
private String storeSid;
|
||||
|
||||
@@ -20,6 +20,7 @@ public class VegeCellarReserveOrderDto implements Dto {
|
||||
private String userPhone;
|
||||
private String userAddress;
|
||||
private String affiliation;
|
||||
private String brandId;
|
||||
private List<GoodsVo> goodsVos;
|
||||
private String goodsSid;
|
||||
private double select;
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.yxt.yythmall.biz.transferrecords;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecords;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsQuery;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsVo;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrder;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderQuery;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@@ -25,4 +31,6 @@ public interface TransferRecordsMapper extends BaseMapper<TransferRecords> {
|
||||
List<TransferRecords> selInOrderSid(@Param("orderSids") List<String> orderSids);
|
||||
@Select("select *,goodsNumber as num from lpk_reserve_order_goods where orderSid=#{orderSid}")
|
||||
List<TransferRecords> selByOrderSids(String orderSid);
|
||||
|
||||
IPage<TransferRecordsVo> orderListByUserSid(IPage<TransferRecords> page, @Param("query") TransferRecordsQuery query);
|
||||
}
|
||||
|
||||
@@ -4,19 +4,37 @@
|
||||
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||
<!-- ${ew.customSqlSegment} -->
|
||||
|
||||
<select id="storeListPage" resultType="com.yxt.yythmall.api.lpkstore.LpkStoreVo">
|
||||
select
|
||||
sid,
|
||||
date_format(createTime, '%Y-%m-%d') as createTime,
|
||||
code,
|
||||
`name`,
|
||||
address,
|
||||
phone,
|
||||
businessHours
|
||||
from lpk_store
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
<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
|
||||
FROM
|
||||
transfer_records
|
||||
WHERE
|
||||
customerSid=#{query.customerSid}
|
||||
UNION
|
||||
SELECT
|
||||
sid,
|
||||
'领取' as type,
|
||||
transferCode,
|
||||
createTime ,
|
||||
remarks,
|
||||
case state
|
||||
when 1 then '已分享'
|
||||
when 2 then '已领取'
|
||||
end stateValue
|
||||
FROM
|
||||
transfer_records
|
||||
WHERE
|
||||
recipientSid =#{query.customerSid}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package com.yxt.yythmall.biz.transferrecords;
|
||||
|
||||
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.transferrecords.TransferRecordsDto;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsQuery;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsVo;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
@@ -27,4 +28,9 @@ public class TransferRecordsRest {
|
||||
public ResultBean submission(@RequestBody TransferRecordsDto dto) {
|
||||
return TransferRecordsService.submission(dto);
|
||||
}
|
||||
@ApiOperation("转赠记录表")
|
||||
@PostMapping("/transferRecordsList")
|
||||
public ResultBean<PagerVo<TransferRecordsVo>> transferRecordsList(@RequestBody PagerQuery<TransferRecordsQuery> pq) {
|
||||
return TransferRecordsService.transferRecordsList(pq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,22 +3,37 @@ package com.yxt.yythmall.biz.transferrecords;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
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.yythmall.api.customerstore.CustomerStoreDto;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecords;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsDto;
|
||||
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsQuery;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsVo;
|
||||
import com.yxt.yythmall.api.transferrecordsgoodsdetails.TransferRecordsGoodsDetails;
|
||||
import com.yxt.yythmall.api.vegecallerreservedetails.VegeCellarReserveDetails;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.OrderGoodsVo;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrder;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderQuery;
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderVo;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellar;
|
||||
import com.yxt.yythmall.biz.customerstore.CustomerStoreService;
|
||||
import com.yxt.yythmall.biz.lpkgiftcard.LpkGiftCardService;
|
||||
import com.yxt.yythmall.biz.lpkgiftcard.generateRule.UniqueIdGenerator;
|
||||
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
|
||||
import com.yxt.yythmall.biz.transferrecordsgoodsdetails.TransferRecordsGoodsDetailsService;
|
||||
import com.yxt.yythmall.biz.vegetablecellar.VegetableCellarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -33,6 +48,8 @@ public class TransferRecordsService extends MybatisBaseService<TransferRecordsMa
|
||||
TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService;
|
||||
@Autowired
|
||||
CustomerStoreService customerStoreService;
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
|
||||
|
||||
public ResultBean submission(TransferRecordsDto dto) {
|
||||
@@ -46,6 +63,35 @@ public class TransferRecordsService extends MybatisBaseService<TransferRecordsMa
|
||||
baseMapper.insert(order);
|
||||
dto.setOrderSid(order.getSid());
|
||||
transferRecordsGoodsDetailsService.submissionDetail(dto);
|
||||
return rb.success().setData("转赠成功");
|
||||
return rb.success().setData(order);
|
||||
}
|
||||
public ResultBean transferRecordsList(PagerQuery<TransferRecordsQuery> pq) {
|
||||
ResultBean rb = new ResultBean().fail();
|
||||
TransferRecordsQuery query = pq.getParams();
|
||||
QueryWrapper<VegeCellarReserveOrder> qw = new QueryWrapper<>();
|
||||
qw.eq("o.customerSid", query.getCustomerSid());
|
||||
IPage<TransferRecords> page = PagerUtil.queryToPage(pq);
|
||||
|
||||
IPage<TransferRecordsVo> pagging = baseMapper.orderListByUserSid(page, query);
|
||||
List<OrderGoodsVo> goodsVo = new ArrayList<>();
|
||||
for(TransferRecordsVo vo:pagging.getRecords()){
|
||||
List<TransferRecordsGoodsDetails> goods =transferRecordsGoodsDetailsService.selByOrderSids(vo.getSid());
|
||||
for(TransferRecordsGoodsDetails goods1:goods){
|
||||
LpkGoods lpkGoods=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",goods1.getGoodsSid()));
|
||||
// OrderGoodsVo orderGoodsVo=new OrderGoodsVo();
|
||||
// orderGoodsVo.setGoodName(lpkGoods.getName());
|
||||
// orderGoodsVo.setNum(Integer.parseInt(goods1.getNum()));
|
||||
// orderGoodsVo.setUnitName(lpkGoods.getUnitName());
|
||||
// goodsVo.add(orderGoodsVo);
|
||||
if(StringUtils.isBlank(vo.getGoodss())){
|
||||
vo.setGoodss(lpkGoods.getName()+":"+goods1.getGoodsNumber()+lpkGoods.getUnitName());
|
||||
}else{
|
||||
vo.setGoodss(vo.getGoodss()+" "+lpkGoods.getName()+":"+goods1.getGoodsNumber()+lpkGoods.getUnitName());
|
||||
}
|
||||
}
|
||||
// vo.setGoodsVo(goodsVo);
|
||||
}
|
||||
return rb.success().setData(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 num from lpk_reserve_order_goods where orderSid=#{orderSid}")
|
||||
@Select("select *,goodsNumber as goodsNumber from lpk_reserve_order_goods where orderSid=#{orderSid}")
|
||||
List<TransferRecordsGoodsDetails> selByOrderSids(String orderSid);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,16 @@ import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yythmall.api.customerstore.CustomerStoreDto;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
||||
import com.yxt.yythmall.api.transferrecords.TransferRecordsDto;
|
||||
import com.yxt.yythmall.api.transferrecordsgoodsdetails.TransferRecordsGoodsDetails;
|
||||
|
||||
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderDto;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellar;
|
||||
import com.yxt.yythmall.api.vegetablecellar.vegeVo;
|
||||
import com.yxt.yythmall.biz.customerstore.CustomerStoreService;
|
||||
import com.yxt.yythmall.biz.lpkgiftcard.LpkGiftCardService;
|
||||
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;
|
||||
@@ -32,7 +35,8 @@ public class TransferRecordsGoodsDetailsService extends MybatisBaseService<Trans
|
||||
VegetableCellarService vegetableCellarService;
|
||||
@Autowired
|
||||
CustomerStoreService customerStoreService;
|
||||
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
|
||||
public ResultBean<TransferRecordsGoodsDetails> getReserveByCardSid(String carSid, String goodsSid) {
|
||||
ResultBean rb = new ResultBean();
|
||||
@@ -45,15 +49,16 @@ public class TransferRecordsGoodsDetailsService extends MybatisBaseService<Trans
|
||||
TransferRecordsGoodsDetails goods = new TransferRecordsGoodsDetails();
|
||||
BeanUtil.copyProperties(dto, goods, "id", "sid");
|
||||
// goods.setCardSid(dto.getSid());
|
||||
for (GoodsVo goods1 : dto.getGoodsVos()) {
|
||||
for (GoodsVo goods1 : dto.getVos()) {
|
||||
if (goods1.getSelect() != 0) {
|
||||
// goods.setCardSid(dto.getSid());
|
||||
goods.setGoodsSid(goods1.getGoodsSid());
|
||||
goods.setGoodsNumber(goods1.getSelect());
|
||||
goods.setCreateTime(new DateTime());
|
||||
baseMapper.insert(goods);
|
||||
LpkGoods l= lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",goods1.getGoodsSid()));
|
||||
VegetableCellar vegetableCellar= vegetableCellarService.list(new QueryWrapper<VegetableCellar>().eq("customerSid",dto.getCustomerSid())
|
||||
.eq("goodsSid",goods1.getGoodsSid()).eq("affiliation",dto.getAffiliation())).get(0);
|
||||
.eq("goodsSid",goods1.getGoodsSid()).eq("affiliation",l.getBrandId())).get(0);
|
||||
double d=Double.valueOf(vegetableCellar.getGoodsNumber());
|
||||
double c=Double.valueOf(goods1.getSelect());
|
||||
if(Double.compare(d,c)==0){
|
||||
|
||||
@@ -60,7 +60,7 @@ public class VegeCellarReserveDetailsService extends MybatisBaseService<VegeCell
|
||||
goods.setCreateTime(new DateTime());
|
||||
baseMapper.insert(goods);
|
||||
VegetableCellar vegetableCellar= vegetableCellarService.list(new QueryWrapper<VegetableCellar>().eq("customerSid",dto.getCustomerSid())
|
||||
.eq("goodsSid",goods1.getGoodsSid()).eq("affiliation",dto.getAffiliation())).get(0);
|
||||
.eq("goodsSid",goods1.getGoodsSid()).eq("affiliation",goods2.getBrandId())).get(0);
|
||||
double d=Double.valueOf(vegetableCellar.getGoodsNumber());
|
||||
double c=Double.valueOf(goods1.getSelect());
|
||||
if(c>d){
|
||||
|
||||
@@ -8,6 +8,7 @@ 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.lpkgoods.LpkGoods;
|
||||
import com.yxt.yythmall.api.ordorder.OrdOrder;
|
||||
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail;
|
||||
import com.yxt.yythmall.api.shoppingcart.ShoppingCart;
|
||||
@@ -15,6 +16,7 @@ import com.yxt.yythmall.api.transferrecords.TransferRecords;
|
||||
import com.yxt.yythmall.api.transferrecordsgoodsdetails.TransferRecordsGoodsDetails;
|
||||
import com.yxt.yythmall.api.vegetablecellar.*;
|
||||
import com.yxt.yythmall.biz.empcard.EmpCardService;
|
||||
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
|
||||
import com.yxt.yythmall.biz.ordorder.OrdOrderService;
|
||||
import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService;
|
||||
import com.yxt.yythmall.biz.shoppingcart.ShoppingCartService;
|
||||
@@ -42,6 +44,8 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
TransferRecordsService transferRecordsService;
|
||||
@Autowired
|
||||
TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService;
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
public ResultBean addGoods(String mainSid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
OrdOrder ordOrder=ordOrderService.getOne(new QueryWrapper<OrdOrder>().eq("mainSid",mainSid));
|
||||
@@ -65,12 +69,15 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
}
|
||||
public ResultBean saveGoods(VegetableCellarDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
for(vegeVo detail:dto.getVos()){
|
||||
|
||||
List<ShoppingCart> carts=shoppingCartService.list(new QueryWrapper<ShoppingCart>().eq("customerSid",dto.getCustomerSid()).eq("affiliation",dto.getBrandId()));
|
||||
for(ShoppingCart detail:carts){
|
||||
VegetableCellar vegetableCellar=baseMapper.selectOne(new QueryWrapper<VegetableCellar>().eq("customerSid",dto.getCustomerSid())
|
||||
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",dto.getBrandId()));
|
||||
LpkGoods cl=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",detail.getGoodsSid()));
|
||||
if(vegetableCellar==null){
|
||||
VegetableCellar vegetable=new VegetableCellar();
|
||||
vegetable.setAffiliation(dto.getBrandId());
|
||||
vegetable.setAffiliation(String.valueOf(cl.getBrandId()));
|
||||
vegetable.setGoodsSid(detail.getGoodsSid());
|
||||
vegetable.setGoodsNumber(detail.getGoodsNumber());
|
||||
vegetable.setCustomerSid(dto.getCustomerSid());
|
||||
@@ -112,11 +119,12 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
}
|
||||
List<TransferRecordsGoodsDetails>list=transferRecordsGoodsDetailsService.list(new QueryWrapper<TransferRecordsGoodsDetails>().eq("orderSid",dto.getTransferSid()));
|
||||
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()));
|
||||
if(vegetableCellar==null){
|
||||
VegetableCellar vegetable=new VegetableCellar();
|
||||
vegetable.setAffiliation(transferRecords.getAffiliation());
|
||||
vegetable.setAffiliation(String.valueOf(cl.getBrandId()));
|
||||
vegetable.setGoodsSid(detail.getGoodsSid());
|
||||
vegetable.setGoodsNumber(String.valueOf((int)detail.getGoodsNumber()));
|
||||
vegetable.setCustomerSid(dto.getCustomerSid());
|
||||
@@ -125,7 +133,7 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
|
||||
vegetableCellar.setGoodsNumber(String.valueOf((int) (Double.valueOf(vegetableCellar.getGoodsNumber())+Double.valueOf(detail.getGoodsNumber()))));
|
||||
baseMapper.updateById(vegetableCellar);
|
||||
}
|
||||
transferRecords.setState("1");
|
||||
transferRecords.setState("2");
|
||||
transferRecords.setRecipientSid(dto.getCustomerSid());
|
||||
transferRecordsService.updateById(transferRecords);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
.excludePathPatterns("/lpksreservoorder/orderDetails/**")
|
||||
.excludePathPatterns("/lpkgoods/goodsDetails/**")
|
||||
.excludePathPatterns("/lpkstore/getAllStoreByQuery")
|
||||
.excludePathPatterns("/vegetablecellar/receiveTransferGoods")
|
||||
.excludePathPatterns("/transferrecords/submission")
|
||||
.excludePathPatterns("/lpkgiftcard/getCardByBank")
|
||||
.excludePathPatterns("/empcard/getEmpCard")
|
||||
.excludePathPatterns("/empcardgift/shareEmpCard/**")
|
||||
|
||||
Reference in New Issue
Block a user