40 changed files with 900 additions and 76 deletions
@ -0,0 +1,29 @@ |
|||
package com.yxt.yythmall.api.newcomerrecorecord; |
|||
|
|||
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 NewcomerRecoRecord { |
|||
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 recommendSid; |
|||
private String recommendedSid; |
|||
private String giftBagSid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date assistanceDate; |
|||
private String giftName; |
|||
|
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.yythmall.api.newcomerrecorecord; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class NewcomerRecoRecordDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String recommendSid;//推荐人
|
|||
private String recommendedSid;//被推荐人
|
|||
private String giftBagSid;//礼包sid
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date assistanceDate;//助力时间
|
|||
private String state; |
|||
private String giftName;//礼包名
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.yxt.yythmall.api.newcomerrecorecord; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class NewcomerRecoRecordQuery implements Query { |
|||
private String startDate; //开始时间
|
|||
private String endDate; //结束时间
|
|||
private String countNumber; //总数
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.yythmall.api.newcomerrecorecord; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class NewcomerRecoRecordVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String recommendSid; |
|||
private String recommendedSid; |
|||
private String giftBagSid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date assistanceDate; |
|||
private String giftName; |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.yythmall.api.transferrecords; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class TransferRecords { |
|||
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 customerSid;//客户sid
|
|||
private String transferCode;//转赠code
|
|||
private String affiliation;//所属菜窖
|
|||
private String state;//
|
|||
private String recipientSid;//领取人
|
|||
|
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.yxt.yythmall.api.transferrecords; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class TransferRecordsDto implements Dto { |
|||
private String customerSid;//客户sid
|
|||
private String transferCode;//转赠code
|
|||
private String affiliation;//所属菜窖
|
|||
private String state;//
|
|||
private String recipientSid;//领取人
|
|||
private String orderSid; |
|||
private List<GoodsVo> goodsVos; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.yythmall.api.transferrecords; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:30 |
|||
*/ |
|||
@Data |
|||
public class TransferRecordsQuery implements Query { |
|||
private String userName; //用户名
|
|||
private String store; // 门店
|
|||
private String startDate; //预约开始日期
|
|||
private String endDate; // 预约结束日期
|
|||
private String userSid; |
|||
private String storeSid; |
|||
private String bankSid; |
|||
private String bankName; |
|||
private String serialNumber; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.yxt.yythmall.api.transferrecords; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.yythmall.api.vegecallerreserveorder.OrderGoodsVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/27 15:11 |
|||
*/ |
|||
@Data |
|||
public class TransferRecordsVo implements Vo { |
|||
private String customerSid;//客户sid
|
|||
private String transferCode;//转赠code
|
|||
private String affiliation;//所属菜窖
|
|||
private String state;//
|
|||
private String recipientSid;//领取人
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.yxt.yythmall.api.transferrecordsgoodsdetails; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class TransferRecordsGoodsDetails { |
|||
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 orderSid; |
|||
private String goodsSid; |
|||
private double goodsNumber; |
|||
|
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.yxt.yythmall.api.transferrecordsgoodsdetails; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class TransferRecordsGoodsDetailsDto implements Dto { |
|||
private String orderSid; |
|||
private String goodsSid; |
|||
private String goodsNumber; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.yythmall.api.transferrecordsgoodsdetails; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:30 |
|||
*/ |
|||
@Data |
|||
public class TransferRecordsGoodsDetailsQuery implements Query { |
|||
private String userName; //用户名
|
|||
private String store; // 门店
|
|||
private String startDate; //预约开始日期
|
|||
private String endDate; // 预约结束日期
|
|||
private String userSid; |
|||
private String storeSid; |
|||
private String bankSid; |
|||
private String bankName; |
|||
private String serialNumber; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.yxt.yythmall.api.transferrecordsgoodsdetails; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.yythmall.api.vegecallerreserveorder.OrderGoodsVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/27 15:11 |
|||
*/ |
|||
@Data |
|||
public class TransferRecordsGoodsDetailsVo implements Vo { |
|||
private String sid; //预约订单sid
|
|||
private String userName; //用户名
|
|||
private String userPhone; //用户电话
|
|||
private String store; //门店
|
|||
private String storeSid; //门店
|
|||
@JsonFormat(pattern = "yyyy-MM-dd ",timezone="GMT+8") |
|||
private Date reserveDate; //预约时间
|
|||
private String bagName; //礼包
|
|||
private String code; //卡号
|
|||
private String goodsInfo; |
|||
private List<OrderGoodsVo> goodsVo = new ArrayList<>(); |
|||
private List<String> goods=new ArrayList<>(); |
|||
private String bankName; |
|||
private String goodsSid; |
|||
private String goodsName; |
|||
private String goodsNumber; |
|||
private String serialNumber; |
|||
private String linker; |
|||
private String linkPhone; |
|||
private String address; |
|||
private String cardType; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.yxt.yythmall.biz.newcomerrecorecord; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecord; |
|||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Mapper |
|||
public interface NewcomerRecoRecordMapper extends BaseMapper<NewcomerRecoRecord> { |
|||
@Select("select sum(goodsNumber) as goodsNumber , goodsSid as goodsSid from lpk_reserve_order_goods where cardSid=#{cardSid} and goodsSid=#{goodsSid}") |
|||
NewcomerRecoRecord getReserveByCardSid(@Param("cardSid") String cardSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
NewcomerRecoRecord selByOrderSidAndGoodSid(@Param("orderSid") String orderSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
@Select("select * from lpk_reserve_order_goods where orderSid=#{orderSid}") |
|||
List<NewcomerRecoRecord> selByOrderSid(String orderSid); |
|||
|
|||
List<NewcomerRecoRecord> selInOrderSid(@Param("orderSids") List<String> orderSids); |
|||
@Select("select *,goodsNumber as num from lpk_reserve_order_goods where orderSid=#{orderSid}") |
|||
List<NewcomerRecoRecord> selByOrderSids(String orderSid); |
|||
@Select("select * from newcomer_reco_record r where customerSid =#{customerSid} limit 5") |
|||
List<NewcomerRecoRecordVo> recordList(@Param("customerSid")String customerSid); |
|||
} |
@ -0,0 +1,46 @@ |
|||
<?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.newcomerrecorecord.NewcomerRecoRecordMapper"> |
|||
<!-- <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> |
|||
<select id="selByOrderSidAndGoodSid" |
|||
resultType="com.yxt.yythmall.api.lpkreserveordergoods.LpkReserveOrderGoods"> |
|||
select * |
|||
from lpk_reserve_order_goods |
|||
where orderSid = #{orderSid} |
|||
and goodsSid = #{goodsSid} |
|||
</select> |
|||
<select id="selInOrderSid" resultType="com.yxt.yythmall.api.lpkreserveordergoods.LpkReserveOrderGoods"> |
|||
select s.sid,s.createTime,s.remarks,s.cardSid,s.goodsSid,s.orderSid,sum(s.goodsNumber) as goodsNumber |
|||
from lpk_reserve_order_goods s |
|||
where orderSid in |
|||
<foreach collection="orderSids" item="item" index="index" open="(" close=")" separator=","> |
|||
#{item} |
|||
</foreach> |
|||
GROUP BY s.goodsSid |
|||
</select> |
|||
<select id="recordList" resultType="com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordVo"> |
|||
select |
|||
from newcomer_reco_record s |
|||
left join lpk_customer d on d.sid=s.recommendSid |
|||
left join lpk_customer c on c.sid=s.recommendedSid |
|||
where orderSid in |
|||
|
|||
GROUP BY s.goodsSid |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,41 @@ |
|||
package com.yxt.yythmall.biz.newcomerrecorecord; |
|||
|
|||
import com.yxt.common.core.result.ResultBean; |
|||
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.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:35 |
|||
*/ |
|||
@Api(tags = "预约订单信息") |
|||
@RestController |
|||
@RequestMapping("newcomerrecorecord") |
|||
public class NewcomerRecoRecordRest { |
|||
@Autowired |
|||
NewcomerRecoRecordService newcomerRecoRecordService; |
|||
|
|||
|
|||
@ApiOperation("推荐新人用户") |
|||
@PostMapping("/recommendNewUsers") |
|||
public ResultBean recommendNewUsers(NewcomerRecoRecordDto dto){ |
|||
return newcomerRecoRecordService.recommendNewUsers(dto); |
|||
} |
|||
@ApiOperation("新人助力") |
|||
@PostMapping("/recommendedAssistance") |
|||
public ResultBean recommendedAssistance(NewcomerRecoRecordDto dto){ |
|||
return newcomerRecoRecordService.recommendedAssistance(dto); |
|||
} |
|||
@ApiOperation("新人助力") |
|||
@PostMapping("/recordList/{customerSid}") |
|||
public ResultBean recordList(@PathVariable("customerSid") String customerSid){ |
|||
return newcomerRecoRecordService.recordList(customerSid); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,76 @@ |
|||
package com.yxt.yythmall.biz.newcomerrecorecord; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
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.appletgiftbaggoods.AppletGiftBagGoods; |
|||
import com.yxt.yythmall.api.empcardgiftgoods.EmpCardGiftGoodsVo; |
|||
import com.yxt.yythmall.api.lpkgiftcard.AppletVo; |
|||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo; |
|||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecord; |
|||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordDto; |
|||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordVo; |
|||
import com.yxt.yythmall.biz.appletgiftbag.AppletGiftBagService; |
|||
import com.yxt.yythmall.biz.appletgiftbaggoods.AppletGiftBagGoodsService; |
|||
import com.yxt.yythmall.biz.empcardgiftgoods.EmpCardGiftGoodsService; |
|||
import com.yxt.yythmall.biz.lpkcustomer.LpkCustomerService; |
|||
import com.yxt.yythmall.biz.lpkgiftcard.LpkGiftCardService; |
|||
import com.yxt.yythmall.biz.vegetablecellar.VegetableCellarService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Service |
|||
public class NewcomerRecoRecordService extends MybatisBaseService<NewcomerRecoRecordMapper, NewcomerRecoRecord> { |
|||
@Autowired |
|||
AppletGiftBagGoodsService appletGiftBagGoodsService; |
|||
@Autowired |
|||
EmpCardGiftGoodsService empCardGiftGoodsService; |
|||
@Autowired |
|||
LpkCustomerService lpkCustomerService; |
|||
@Autowired |
|||
VegetableCellarService vegetableCellarService; |
|||
public ResultBean<NewcomerRecoRecord> getReserveByCardSid(String carSid, String goodsSid) { |
|||
ResultBean rb = new ResultBean(); |
|||
NewcomerRecoRecord goods = baseMapper.getReserveByCardSid(carSid, goodsSid); |
|||
return rb.success().setData(goods); |
|||
} |
|||
|
|||
public ResultBean recommendNewUsers(NewcomerRecoRecordDto dto) { |
|||
ResultBean rb = new ResultBean(); |
|||
NewcomerRecoRecord newcomerRecoRecord = new NewcomerRecoRecord(); |
|||
|
|||
BeanUtil.copyProperties(dto, newcomerRecoRecord, "id", "sid"); |
|||
newcomerRecoRecord.setCreateTime(new Date()); |
|||
baseMapper.insert(newcomerRecoRecord); |
|||
return rb.success().setData("推荐成功"); |
|||
} |
|||
public ResultBean recommendedAssistance(NewcomerRecoRecordDto dto) { |
|||
ResultBean rb = new ResultBean(); |
|||
NewcomerRecoRecord newcomerRecoRecord = baseMapper.selectOne(new QueryWrapper<NewcomerRecoRecord>().eq("sid",dto.getSid())); |
|||
newcomerRecoRecord.setRecommendedSid(dto.getRecommendedSid()); |
|||
newcomerRecoRecord.setAssistanceDate(new Date()); |
|||
baseMapper.updateById(newcomerRecoRecord); |
|||
List<AppletGiftBagGoods>list=appletGiftBagGoodsService.list(new QueryWrapper<AppletGiftBagGoods>().eq("giftbagSid",dto.getGiftBagSid())); |
|||
// vegetableCellarService.receiveTransferGoods()
|
|||
return rb.success().setData("助力成功"); |
|||
} |
|||
public ResultBean recordList(String customerSid) { |
|||
ResultBean rb = new ResultBean(); |
|||
|
|||
List<NewcomerRecoRecordVo> vos=baseMapper.recordList(customerSid); |
|||
|
|||
// vos.forEach(s->{
|
|||
// s.
|
|||
// });
|
|||
return rb.success().setData("助力成功"); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.yythmall.biz.transferrecords; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.yxt.yythmall.api.transferrecords.TransferRecords; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Mapper |
|||
public interface TransferRecordsMapper extends BaseMapper<TransferRecords> { |
|||
@Select("select sum(goodsNumber) as goodsNumber , goodsSid as goodsSid from lpk_reserve_order_goods where cardSid=#{cardSid} and goodsSid=#{goodsSid}") |
|||
TransferRecords getReserveByCardSid(@Param("cardSid") String cardSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
TransferRecords selByOrderSidAndGoodSid(@Param("orderSid") String orderSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
@Select("select * from lpk_reserve_order_goods where orderSid=#{orderSid}") |
|||
List<TransferRecords> selByOrderSid(String orderSid); |
|||
|
|||
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); |
|||
} |
@ -0,0 +1,23 @@ |
|||
<?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.transferrecords.TransferRecordsMapper"> |
|||
<!-- <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> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,30 @@ |
|||
package com.yxt.yythmall.biz.transferrecords; |
|||
|
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.yythmall.api.transferrecords.TransferRecordsDto; |
|||
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; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:35 |
|||
*/ |
|||
@Api(tags = "预约订单信息") |
|||
@RestController |
|||
@RequestMapping("transferrecords") |
|||
public class TransferRecordsRest { |
|||
@Autowired |
|||
TransferRecordsService TransferRecordsService; |
|||
|
|||
@ApiOperation("转赠蔬菜") |
|||
@PostMapping("/submission") |
|||
public ResultBean submission(@RequestBody TransferRecordsDto dto) { |
|||
return TransferRecordsService.submission(dto); |
|||
} |
|||
} |
@ -0,0 +1,51 @@ |
|||
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.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.transferrecords.TransferRecords; |
|||
import com.yxt.yythmall.api.transferrecords.TransferRecordsDto; |
|||
|
|||
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.transferrecordsgoodsdetails.TransferRecordsGoodsDetailsService; |
|||
import com.yxt.yythmall.biz.vegetablecellar.VegetableCellarService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Service |
|||
public class TransferRecordsService extends MybatisBaseService<TransferRecordsMapper, TransferRecords> { |
|||
@Autowired |
|||
LpkGiftCardService lpkGiftCardService; |
|||
@Autowired |
|||
TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService; |
|||
@Autowired |
|||
CustomerStoreService customerStoreService; |
|||
|
|||
|
|||
public ResultBean submission(TransferRecordsDto dto) { |
|||
ResultBean rb = new ResultBean().fail(); |
|||
TransferRecords order = new TransferRecords(); |
|||
BeanUtil.copyProperties(dto, order, "id", "sid"); |
|||
|
|||
order.setCreateTime(new DateTime()); |
|||
String uuid = UniqueIdGenerator.generateUniqueID(); |
|||
order.setTransferCode(uuid); |
|||
baseMapper.insert(order); |
|||
dto.setOrderSid(order.getSid()); |
|||
transferRecordsGoodsDetailsService.submissionDetail(dto); |
|||
return rb.success().setData("转赠成功"); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.yythmall.biz.transferrecordsgoodsdetails; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.yxt.yythmall.api.transferrecordsgoodsdetails.TransferRecordsGoodsDetails; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Mapper |
|||
public interface TransferRecordsGoodsDetailsMapper extends BaseMapper<TransferRecordsGoodsDetails> { |
|||
@Select("select sum(goodsNumber) as goodsNumber , goodsSid as goodsSid from lpk_reserve_order_goods where cardSid=#{cardSid} and goodsSid=#{goodsSid}") |
|||
TransferRecordsGoodsDetails getReserveByCardSid(@Param("cardSid") String cardSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
TransferRecordsGoodsDetails selByOrderSidAndGoodSid(@Param("orderSid") String orderSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
@Select("select * from lpk_reserve_order_goods where orderSid=#{orderSid}") |
|||
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}") |
|||
List<TransferRecordsGoodsDetails> selByOrderSids(String orderSid); |
|||
} |
@ -0,0 +1,37 @@ |
|||
<?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.transferrecordsgoodsdetails.TransferRecordsGoodsDetailsMapper"> |
|||
<!-- <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> |
|||
<select id="selByOrderSidAndGoodSid" |
|||
resultType="com.yxt.yythmall.api.lpkreserveordergoods.LpkReserveOrderGoods"> |
|||
select * |
|||
from lpk_reserve_order_goods |
|||
where orderSid = #{orderSid} |
|||
and goodsSid = #{goodsSid} |
|||
</select> |
|||
<select id="selInOrderSid" resultType="com.yxt.yythmall.api.lpkreserveordergoods.LpkReserveOrderGoods"> |
|||
select s.sid,s.createTime,s.remarks,s.cardSid,s.goodsSid,s.orderSid,sum(s.goodsNumber) as goodsNumber |
|||
from lpk_reserve_order_goods s |
|||
where orderSid in |
|||
<foreach collection="orderSids" item="item" index="index" open="(" close=")" separator=","> |
|||
#{item} |
|||
</foreach> |
|||
GROUP BY s.goodsSid |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,25 @@ |
|||
package com.yxt.yythmall.biz.transferrecordsgoodsdetails; |
|||
|
|||
import io.swagger.annotations.Api; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:35 |
|||
*/ |
|||
@Api(tags = "预约订单信息") |
|||
@RestController |
|||
@RequestMapping("TransferRecordsGoodsDetailsRest") |
|||
public class TransferRecordsGoodsDetailsRest { |
|||
@Autowired |
|||
TransferRecordsGoodsDetailsService vegeCellarReserveOrderService; |
|||
|
|||
|
|||
// @ApiOperation("预约提交")
|
|||
// @PostMapping("/submissionDetail")
|
|||
// public ResultBean submissionDetail(VegeCellarReserveOrderDto dto){
|
|||
// return VegeCellarReserveOrderService.submissionDetail(dto);
|
|||
// }
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.yxt.yythmall.biz.transferrecordsgoodsdetails; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
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.customerstore.CustomerStoreDto; |
|||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo; |
|||
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.biz.customerstore.CustomerStoreService; |
|||
import com.yxt.yythmall.biz.lpkgiftcard.LpkGiftCardService; |
|||
import com.yxt.yythmall.biz.vegetablecellar.VegetableCellarService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Service |
|||
public class TransferRecordsGoodsDetailsService extends MybatisBaseService<TransferRecordsGoodsDetailsMapper, TransferRecordsGoodsDetails> { |
|||
@Autowired |
|||
LpkGiftCardService lpkGiftCardService; |
|||
@Autowired |
|||
VegetableCellarService vegetableCellarService; |
|||
@Autowired |
|||
CustomerStoreService customerStoreService; |
|||
|
|||
|
|||
public ResultBean<TransferRecordsGoodsDetails> getReserveByCardSid(String carSid, String goodsSid) { |
|||
ResultBean rb = new ResultBean(); |
|||
TransferRecordsGoodsDetails goods = baseMapper.getReserveByCardSid(carSid, goodsSid); |
|||
return rb.success().setData(goods); |
|||
} |
|||
|
|||
public ResultBean submissionDetail(TransferRecordsDto dto) { |
|||
ResultBean rb = new ResultBean(); |
|||
TransferRecordsGoodsDetails goods = new TransferRecordsGoodsDetails(); |
|||
BeanUtil.copyProperties(dto, goods, "id", "sid"); |
|||
// goods.setCardSid(dto.getSid());
|
|||
for (GoodsVo goods1 : dto.getGoodsVos()) { |
|||
if (goods1.getSelect() != 0) { |
|||
// goods.setCardSid(dto.getSid());
|
|||
goods.setGoodsSid(goods1.getGoodsSid()); |
|||
goods.setGoodsNumber(goods1.getSelect()); |
|||
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); |
|||
double d=Double.valueOf(vegetableCellar.getGoodsNumber()); |
|||
double c=Double.valueOf(goods1.getSelect()); |
|||
if(Double.compare(d,c)==0){ |
|||
vegetableCellarService.deleteBySid(vegetableCellar.getSid()); |
|||
}else{ |
|||
vegetableCellar.setGoodsNumber(String.valueOf((int)(Double.valueOf(vegetableCellar.getGoodsNumber())-Double.valueOf(goods1.getSelect())))); |
|||
vegetableCellarService.updateById(vegetableCellar); |
|||
} |
|||
} |
|||
} |
|||
return rb.success().setData("转赠成功"); |
|||
} |
|||
|
|||
public TransferRecordsGoodsDetails selByOrderSidAndGoodSid(String orderSid, String goodsSid) { |
|||
return baseMapper.selByOrderSidAndGoodSid(orderSid,goodsSid); |
|||
} |
|||
public List<TransferRecordsGoodsDetails> selByOrderSid(String orderSid) { |
|||
return baseMapper.selByOrderSid(orderSid); |
|||
} |
|||
public List<TransferRecordsGoodsDetails> selInOrderSid(List<String> orderSids) { |
|||
return baseMapper.selInOrderSid(orderSids); |
|||
} |
|||
public List<TransferRecordsGoodsDetails> selByOrderSids(String orderSid) { |
|||
return baseMapper.selByOrderSids(orderSid); |
|||
} |
|||
} |
Loading…
Reference in new issue