Commit 14c7a993 by 不悦

ycf0721

parent 31c86a90
...@@ -2,16 +2,16 @@ server: ...@@ -2,16 +2,16 @@ server:
port: 8085 port: 8085
spring: spring:
datasource: datasource:
# url: jdbc:mysql://rm-m5ee12omj4y0g741d0o.mysql.rds.aliyuncs.com:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true url: jdbc:mysql://rm-m5ee12omj4y0g741d0o.mysql.rds.aliyuncs.com:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
# username: kszzshop username: kszzshop
# password: eE12omj4y0g7# password: eE12omj4y0g7#
# driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:mysql://localhost:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
# username: root
# password: root
# driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.zaxxer.hikari.HikariDataSource
hikari: hikari:
minimum-idle: 0 minimum-idle: 0
maximum-pool-size: 20 maximum-pool-size: 20
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
<version>${yami.shop.version}</version> <version>${yami.shop.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -24,6 +24,7 @@ import org.springframework.context.annotation.ComponentScan; ...@@ -24,6 +24,7 @@ import org.springframework.context.annotation.ComponentScan;
@ComponentScan(basePackages = {"com.yami.shop"}) @ComponentScan(basePackages = {"com.yami.shop"})
public class ApiApplication extends SpringBootServletInitializer{ public class ApiApplication extends SpringBootServletInitializer{
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ApiApplication.class, args); SpringApplication.run(ApiApplication.class, args);
} }
......
...@@ -14,8 +14,11 @@ import java.util.*; ...@@ -14,8 +14,11 @@ import java.util.*;
import javax.validation.Valid; import javax.validation.Valid;
import cn.hutool.core.util.ObjectUtil;
import com.yami.shop.bean.app.dto.*; import com.yami.shop.bean.app.dto.*;
import com.yami.shop.bean.event.ConfirmOrderEvent; import com.yami.shop.bean.event.ConfirmOrderEvent;
import com.yami.shop.bean.model.BargainHelp;
import com.yami.shop.bean.model.BargainSend;
import com.yami.shop.common.exception.YamiShopBindException; import com.yami.shop.common.exception.YamiShopBindException;
import com.yami.shop.security.util.SecurityUtils; import com.yami.shop.security.util.SecurityUtils;
import com.yami.shop.service.*; import com.yami.shop.service.*;
...@@ -58,8 +61,12 @@ public class OrderController { ...@@ -58,8 +61,12 @@ public class OrderController {
private BasketService basketService; private BasketService basketService;
@Autowired @Autowired
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired
private BargainSendService bargainSendService;
@Autowired
private BargainHelpService bargainHelpService;
@Autowired
private ProdController prodController;
/** /**
* 生成订单 * 生成订单
*/ */
...@@ -71,10 +78,12 @@ public class OrderController { ...@@ -71,10 +78,12 @@ public class OrderController {
// 订单的地址信息 // 订单的地址信息
UserAddr userAddr = userAddrService.getUserAddrByUserId(orderParam.getAddrId(), userId); UserAddr userAddr = userAddrService.getUserAddrByUserId(orderParam.getAddrId(), userId);
UserAddrDto userAddrDto = mapperFacade.map(userAddr, UserAddrDto.class); UserAddrDto userAddrDto = mapperFacade.map(userAddr, UserAddrDto.class);
String isBargain="";
if("1".equals(orderParam.getOrderItem().getIsBargain())){
isBargain=orderParam.getOrderItem().getIsBargain();
}
// 组装获取用户提交的购物车商品项 // 组装获取用户提交的购物车商品项
List<ShopCartItemDto> shopCartItems = basketService.getShopCartItemsByOrderItems(orderParam.getBasketIds(),orderParam.getOrderItem(),userId); List<ShopCartItemDto> shopCartItems = basketService.getShopCartItemsByOrderItems(isBargain,orderParam.getBasketIds(),orderParam.getOrderItem(),userId);
if (CollectionUtil.isEmpty(shopCartItems)) { if (CollectionUtil.isEmpty(shopCartItems)) {
throw new YamiShopBindException("请选择您需要的商品加入购物车"); throw new YamiShopBindException("请选择您需要的商品加入购物车");
...@@ -116,7 +125,6 @@ public class OrderController { ...@@ -116,7 +125,6 @@ public class OrderController {
shopCartOrder.setShopCartItemDiscounts(shopCartItemDiscounts); shopCartOrder.setShopCartItemDiscounts(shopCartItemDiscounts);
applicationContext.publishEvent(new ConfirmOrderEvent(shopCartOrder,orderParam,shopAllShopCartItems)); applicationContext.publishEvent(new ConfirmOrderEvent(shopCartOrder,orderParam,shopAllShopCartItems));
actualTotal = Arith.add(actualTotal,shopCartOrder.getActualTotal()); actualTotal = Arith.add(actualTotal,shopCartOrder.getActualTotal());
total = Arith.add(total,shopCartOrder.getTotal()); total = Arith.add(total,shopCartOrder.getTotal());
totalCount = totalCount + shopCartOrder.getTotalCount(); totalCount = totalCount + shopCartOrder.getTotalCount();
...@@ -126,6 +134,20 @@ public class OrderController { ...@@ -126,6 +134,20 @@ public class OrderController {
} }
if("1".equals(orderParam.getOrderItem().getIsBargain())){
BargainSend BS=bargainSendService.selectBargainTask(userId,orderParam.getOrderItem().getActivityId());
List<BargainHelp> bargainHelpList = bargainHelpService.selectListByBargainOrderId(BS.getId());
double cutMoney = 0;
if(bargainHelpList.size()>0){
for(BargainHelp bargainHelp:bargainHelpList){
cutMoney += bargainHelp.getBargainMoney();
}
}
ProductDto product = prodController.prodInfoBargain(orderParam.getOrderItem().getProdId());
actualTotal=product.getPrice()-cutMoney;
total = actualTotal;
}
shopCartOrderMergerDto.setActualTotal(actualTotal); shopCartOrderMergerDto.setActualTotal(actualTotal);
shopCartOrderMergerDto.setTotal(total); shopCartOrderMergerDto.setTotal(total);
shopCartOrderMergerDto.setTotalCount(totalCount); shopCartOrderMergerDto.setTotalCount(totalCount);
...@@ -195,4 +217,32 @@ public class OrderController { ...@@ -195,4 +217,32 @@ public class OrderController {
return ResponseEntity.ok(new OrderNumbersDto(orderNumbers.toString())); return ResponseEntity.ok(new OrderNumbersDto(orderNumbers.toString()));
} }
/**
* 生成订单
*/
@PostMapping("/confirmBargin")
@ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
public ResponseEntity<ShopCartOrderMergerDto> confirmBargin(@Valid @RequestBody OrderParam orderParam) {
String userId = SecurityUtils.getUser().getUserId();
// 订单的地址信息
UserAddr userAddr = userAddrService.getUserAddrByUserId(orderParam.getAddrId(), userId);
UserAddrDto userAddrDto = mapperFacade.map(userAddr, UserAddrDto.class);
// 将要返回给前端的完整的订单信息
ShopCartOrderMergerDto shopCartOrderMergerDto = new ShopCartOrderMergerDto();
shopCartOrderMergerDto.setUserAddr(userAddrDto);
double actualTotal = 0.0;
double total = 0.0;
int totalCount = 0;
double orderReduce = 0.0;
shopCartOrderMergerDto.setActualTotal(actualTotal);
shopCartOrderMergerDto.setTotal(total);
shopCartOrderMergerDto.setTotalCount(totalCount);
shopCartOrderMergerDto.setOrderReduce(orderReduce);
orderService.putConfirmOrderCache(userId,shopCartOrderMergerDto);
return ResponseEntity.ok(shopCartOrderMergerDto);
}
} }
...@@ -41,6 +41,7 @@ public class ProdCommController { ...@@ -41,6 +41,7 @@ public class ProdCommController {
@GetMapping("/prodCommData") @GetMapping("/prodCommData")
@ApiOperation(value = "返回商品评论数据(好评率 好评数量 中评数 差评数)", notes = "根据商品id获取") @ApiOperation(value = "返回商品评论数据(好评率 好评数量 中评数 差评数)", notes = "根据商品id获取")
public ResponseEntity<ProdCommDataDto> getProdCommData(Long prodId) { public ResponseEntity<ProdCommDataDto> getProdCommData(Long prodId) {
return ResponseEntity.ok(prodCommService.getProdCommDataByProdId(prodId, SecurityUtils.getUser().getUserId())); return ResponseEntity.ok(prodCommService.getProdCommDataByProdId(prodId, SecurityUtils.getUser().getUserId()));
......
...@@ -129,5 +129,30 @@ public class ProdController { ...@@ -129,5 +129,30 @@ public class ProdController {
} }
public ProductDto prodInfoBargain(Long prodId) {
Product product = prodService.getProductByProdId(prodId);
if (product == null) {
return null;
}
List<Sku> skuList = skuService.listByProdId(prodId);
// 启用的sku列表
List<Sku> useSkuList = skuList.stream().filter(sku -> sku.getStatus() == 1).collect(Collectors.toList());
product.setSkuList(useSkuList);
ProductDto productDto = mapperFacade.map(product, ProductDto.class);
// 商品的配送方式
Product.DeliveryModeVO deliveryModeVO = Json.parseObject(product.getDeliveryMode(), Product.DeliveryModeVO.class);
// 有店铺配送的方式, 且存在运费模板,才返回运费模板的信息,供前端查阅
if (deliveryModeVO.getHasShopDelivery() && product.getDeliveryTemplateId() != null) {
Transport transportAndAllItems = transportService.getTransportAndAllItems(product.getDeliveryTemplateId());
productDto.setTransport(transportAndAllItems);
}
return productDto;
}
} }
...@@ -13,11 +13,13 @@ package com.yami.shop.api.controller; ...@@ -13,11 +13,13 @@ package com.yami.shop.api.controller;
import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.yami.shop.api.config.WxAppConfiguration; import com.yami.shop.api.config.WxAppConfiguration;
import com.yami.shop.bean.model.SmsLog;
import com.yami.shop.bean.vo.WxParamsVo; import com.yami.shop.bean.vo.WxParamsVo;
import com.yami.shop.common.util.CacheManagerUtil; import com.yami.shop.common.util.CacheManagerUtil;
import com.yami.shop.security.enums.App; import com.yami.shop.security.enums.App;
import com.yami.shop.security.service.YamiUser; import com.yami.shop.security.service.YamiUser;
import com.yami.shop.security.util.SecurityUtils; import com.yami.shop.security.util.SecurityUtils;
import com.yami.shop.service.SmsLogService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -33,6 +35,9 @@ import io.swagger.annotations.Api; ...@@ -33,6 +35,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import ma.glasnost.orika.MapperFacade; import ma.glasnost.orika.MapperFacade;
import java.util.Date;
import java.util.UUID;
@RestController @RestController
@RequestMapping("/p/user") @RequestMapping("/p/user")
@Api(tags="用户接口") @Api(tags="用户接口")
...@@ -44,6 +49,9 @@ public class UserController { ...@@ -44,6 +49,9 @@ public class UserController {
private final MapperFacade mapperFacade; private final MapperFacade mapperFacade;
private final CacheManagerUtil cacheManagerUtil; private final CacheManagerUtil cacheManagerUtil;
@Autowired
private SmsLogService smsLogService;
/** /**
* 查看用户接口 * 查看用户接口
*/ */
...@@ -78,5 +86,4 @@ public class UserController { ...@@ -78,5 +86,4 @@ public class UserController {
return ResponseEntity.ok(userService.registerPhone(wxParamsVo, wxService, userId)); return ResponseEntity.ok(userService.registerPhone(wxParamsVo, wxService, userId));
} }
} }
...@@ -43,7 +43,7 @@ public class MiniAppAuthenticationProvider extends AbstractUserDetailsAuthentica ...@@ -43,7 +43,7 @@ public class MiniAppAuthenticationProvider extends AbstractUserDetailsAuthentica
private final CacheManagerUtil cacheManagerUtil; private final CacheManagerUtil cacheManagerUtil;
private final static String APPID = "wx72780b89fe2ee6f4"; private final static String APPID = "wx50a14d592be6735e";
@Override @Override
protected Authentication createSuccessAuthentication(Authentication authentication, UserDetails user) { protected Authentication createSuccessAuthentication(Authentication authentication, UserDetails user) {
......
...@@ -2,16 +2,16 @@ server: ...@@ -2,16 +2,16 @@ server:
port: 8086 port: 8086
spring: spring:
datasource: datasource:
# url: jdbc:mysql://127.0.0.1:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true url: jdbc:mysql://127.0.0.1:3306/retail_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
# username: root
# password: 123
# driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://127.0.0.1:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root username: root
password: root password: 123
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:mysql://127.0.0.1:3306/yami_shops?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
# username: root
# password: root
# driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.zaxxer.hikari.HikariDataSource
hikari: hikari:
minimum-idle: 0 minimum-idle: 0
maximum-pool-size: 20 maximum-pool-size: 20
......
...@@ -54,6 +54,8 @@ management: ...@@ -54,6 +54,8 @@ management:
wx: wx:
miniapp: miniapp:
configs: configs:
# - appId: wx50a14d592be6735e
# secret: f6323624efa19fcaaa18b9f95b7d2207
- appid: wx72780b89fe2ee6f4 - appid: wx72780b89fe2ee6f4
secret: 78837e61297df3135e60c3701ab0b005 secret: 78837e61297df3135e60c3701ab0b005
# - appid: wx42732c972778dc69 #微信小程序的appid # - appid: wx42732c972778dc69 #微信小程序的appid
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
package com.yami.shop.bean.app.dto; package com.yami.shop.bean.app.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -43,4 +44,5 @@ public class ShopCartOrderMergerDto implements Serializable{ ...@@ -43,4 +44,5 @@ public class ShopCartOrderMergerDto implements Serializable{
@ApiModelProperty(value = "整个订单可以使用的优惠券列表", required = true) @ApiModelProperty(value = "整个订单可以使用的优惠券列表", required = true)
private List<CouponOrderDto> coupons; private List<CouponOrderDto> coupons;
} }
...@@ -10,27 +10,19 @@ ...@@ -10,27 +10,19 @@
package com.yami.shop.bean.app.dto; package com.yami.shop.bean.app.dto;
import com.yami.shop.bean.model.User;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class UserDto { public class UserDto {
private User user;
@ApiModelProperty(value = "用户状态:0禁用 1正常",required=true) @ApiModelProperty(value = "用户状态:0禁用 1正常",required=true)
private Integer status; private Integer status;
@ApiModelProperty(value = "token",required=true) @ApiModelProperty(value = "token",required=true)
private String token; private String token;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
} }
\ No newline at end of file
...@@ -40,4 +40,10 @@ public class OrderItemParam { ...@@ -40,4 +40,10 @@ public class OrderItemParam {
@ApiModelProperty(value = "推广员使用的推销卡号") @ApiModelProperty(value = "推广员使用的推销卡号")
private String distributionCardNo; private String distributionCardNo;
@ApiModelProperty(value = "1、砍价页面,0,、其他页面")
private String isBargain;
@ApiModelProperty(value = "发起人表主键")
private Long activityId;
} }
...@@ -41,6 +41,7 @@ public class OrderParam { ...@@ -41,6 +41,7 @@ public class OrderParam {
@ApiModelProperty(value = "优惠券id数组") @ApiModelProperty(value = "优惠券id数组")
private List<Long> couponIds; private List<Long> couponIds;
// @ApiModelProperty(value = "每次订单提交时的uuid") // @ApiModelProperty(value = "每次订单提交时的uuid")
// private String uuid; // private String uuid;
// @ApiModelProperty(value = "订单入口 SHOP_CART购物车,BUY_NOW立即购买") // @ApiModelProperty(value = "订单入口 SHOP_CART购物车,BUY_NOW立即购买")
......
...@@ -3,6 +3,7 @@ package com.yami.shop.bean.model; ...@@ -3,6 +3,7 @@ package com.yami.shop.bean.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yami.shop.bean.app.dto.ProductDto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -29,82 +30,81 @@ public class Bargain implements Serializable { ...@@ -29,82 +30,81 @@ public class Bargain implements Serializable {
/** /**
* 商品ID * 商品ID
*/ */
@ApiModelProperty(value = "商品ID", required = true) @ApiModelProperty(value = "商品ID", required = false)
private Long prodId; private Long prodId;
/** /**
* 活动名称 * 活动名称
*/ */
@ApiModelProperty(value = "活动名称", required = true) @ApiModelProperty(value = "活动名称", required = false)
private String prodName; private String prodName;
/** /**
* 开始时间 * 开始时间
*/ */
@ApiModelProperty(value = "开始时间", required = true) @ApiModelProperty(value = "开始时间", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime; private Date startTime;
/** /**
* 结束时间 * 结束时间
*/ */
@ApiModelProperty(value = "结束时间", required = true) @ApiModelProperty(value = "结束时间", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date overTime; private Date overTime;
/** /**
* 状态:0未开始,1进行中,2已结束 * 状态:0未开始,1进行中,2已结束
*/ */
@ApiModelProperty(value = "状态:0未开始,1进行中,2已结束", required = true) @ApiModelProperty(value = "状态:0未开始,1进行中,2已结束", required = false)
private Integer status; private Integer status;
/** /**
* 序号 * 序号
*/ */
@ApiModelProperty(value = "序号", required = true) @ApiModelProperty(value = "序号", required = false)
private Long sort; private Long sort;
/** /**
* 砍价最大金额(新用户) * 砍价最大金额(新用户)
*/ */
@ApiModelProperty(value = "砍价最大金额(新用户)", required = true) @ApiModelProperty(value = "砍价最大金额(新用户)", required = false)
private Double newMax; private Double newMax;
/** /**
* 砍价最小金额(新用户) * 砍价最小金额(新用户)
*/ */
@ApiModelProperty(value = "砍价最小金额(新用户)", required = true) @ApiModelProperty(value = "砍价最小金额(新用户)", required = false)
private Double newMin; private Double newMin;
/** /**
* 砍价最大金额(老用户) * 砍价最大金额(老用户)
*/ */
@ApiModelProperty(value = "砍价最大金额(老用户)", required = true) @ApiModelProperty(value = "砍价最大金额(老用户)", required = false)
private Double oldMax; private Double oldMax;
/** /**
* 砍价最小金额(老用户) * 砍价最小金额(老用户)
*/ */
@ApiModelProperty(value = "砍价最小金额(老用户)", required = true) @ApiModelProperty(value = "砍价最小金额(老用户)", required = false)
private Double oldMin; private Double oldMin;
/** /**
* 最低价格 * 最低价格
*/ */
@ApiModelProperty(value = "最低价格", required = true) @ApiModelProperty(value = "最低价格", required = false)
private Double minPrice; private Double minPrice;
/** /**
* 库存 * 库存
*/ */
@ApiModelProperty(value = "库存", required = true) @ApiModelProperty(value = "库存", required = false)
private Integer stocks; private Integer stocks;
/** /**
* 创建用户 * 创建用户
*/ */
@ApiModelProperty(value = "创建时间", required = false) @ApiModelProperty(value = "创建人", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String createdUser; private String createdUser;
/** /**
...@@ -119,7 +119,7 @@ public class Bargain implements Serializable { ...@@ -119,7 +119,7 @@ public class Bargain implements Serializable {
*/ */
@ApiModelProperty(value = "商品信息", required = false) @ApiModelProperty(value = "商品信息", required = false)
@TableField(exist = false) @TableField(exist = false)
private Product product; private ProductDto productDto;
/** /**
* 砍价发起人 * 砍价发起人
...@@ -138,4 +138,7 @@ public class Bargain implements Serializable { ...@@ -138,4 +138,7 @@ public class Bargain implements Serializable {
@ApiModelProperty(value = "正在砍价人数", required = false) @ApiModelProperty(value = "正在砍价人数", required = false)
@TableField(exist = false) @TableField(exist = false)
private Integer SendCount; private Integer SendCount;
@ApiModelProperty(value = "单品id", required = false)
private Long skuId;
} }
...@@ -8,7 +8,7 @@ public class BargainDetailParm { ...@@ -8,7 +8,7 @@ public class BargainDetailParm {
/** /**
* 砍价活动id * 砍价活动id
*/ */
@ApiModelProperty(value = "砍价活动id", required = true) @ApiModelProperty(value = "砍价活动id", required = false)
private Long id; private Long id;
/** /**
......
...@@ -24,32 +24,32 @@ public class BargainHelp { ...@@ -24,32 +24,32 @@ public class BargainHelp {
/** /**
* 砍价表id * 砍价表id
*/ */
@ApiModelProperty(value = "发起砍价表id", required = true) @ApiModelProperty(value = "发起砍价表id", required = false)
private Long bargainOrderId; private Long bargainOrderId;
/** /**
* 帮助者ID * 帮助者ID
*/ */
@ApiModelProperty(value = "帮助者ID", required = true) @ApiModelProperty(value = "帮助者ID", required = false)
private String assistorId; private String assistorId;
/** /**
* 帮助者昵称 * 帮助者昵称
*/ */
@ApiModelProperty(value = "帮助者昵称", required = true) @ApiModelProperty(value = "帮助者昵称", required = false)
private String nickName; private String nickName;
/** /**
* 帮助者头像 * 帮助者头像
*/ */
@ApiModelProperty(value = "帮助者头像", required = true) @ApiModelProperty(value = "帮助者头像", required = false)
private String headImg; private String headImg;
/** /**
* 砍掉的价格 * 砍掉的价格
*/ */
@ApiModelProperty(value = "砍掉的价格", required = true) @ApiModelProperty(value = "砍掉的价格", required = false)
private Double bargainMoney; private Double bargainMoney;
/** /**
......
...@@ -7,19 +7,22 @@ import lombok.Data; ...@@ -7,19 +7,22 @@ import lombok.Data;
public class BargainHelpParm { public class BargainHelpParm {
@ApiModelProperty(value = "帮助者电话", required = true) @ApiModelProperty(value = "帮助者电话", required = false)
private String userMobile; private String userMobile;
@ApiModelProperty(value = "验证码", required = true) @ApiModelProperty(value = "验证码", required = false)
private String code; private String code;
@ApiModelProperty(value = "商品ID", required = true) @ApiModelProperty(value = "商品ID", required = false)
private Long prodId; private Long prodId;
@ApiModelProperty(value = "发起砍价表id", required = true) @ApiModelProperty(value = "发起砍价表id", required = false)
private Long bargainOrderId; private Long bargainOrderId;
@ApiModelProperty(value = "砍价活动id", required = true) @ApiModelProperty(value = "砍价活动id", required = false)
private Long activityId; private Long activityId;
@ApiModelProperty(value = "帮助者昵称", required = true) @ApiModelProperty(value = "帮助者昵称", required = false)
private String nickName; private String nickName;
@ApiModelProperty(value = "帮助者头像", required = true) @ApiModelProperty(value = "帮助者头像", required = false)
private String headImg; private String headImg;
@ApiModelProperty(value = "0为老用户,1为新用户", required = false)
private String isCode;
} }
...@@ -3,6 +3,7 @@ package com.yami.shop.bean.model; ...@@ -3,6 +3,7 @@ package com.yami.shop.bean.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yami.shop.bean.app.dto.ProductDto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -26,19 +27,19 @@ public class BargainSend { ...@@ -26,19 +27,19 @@ public class BargainSend {
/** /**
* 砍价活动id * 砍价活动id
*/ */
@ApiModelProperty(value = "砍价活动id", required = true) @ApiModelProperty(value = "砍价活动id", required = false)
private Long activityId; private Long activityId;
/** /**
* 参与活动的商品id * 参与活动的商品id
*/ */
@ApiModelProperty(value = "参与活动的商品id", required = true) @ApiModelProperty(value = "参与活动的商品id", required = false)
private Long prodId; private Long prodId;
/** /**
* 砍价商品发起的用户ID * 砍价商品发起的用户ID
*/ */
@ApiModelProperty(value = "砍价商品发起的用户ID", required = true) @ApiModelProperty(value = "砍价商品发起的用户ID", required = false)
private String userId; private String userId;
/** /**
...@@ -50,13 +51,13 @@ public class BargainSend { ...@@ -50,13 +51,13 @@ public class BargainSend {
/** /**
* 最终交易价格 * 最终交易价格
*/ */
@ApiModelProperty(value = "最终交易价格", required = true) @ApiModelProperty(value = "最终交易价格", required = false)
private Double endPrice; private Double endPrice;
/** /**
* 是否下单(0:未下单,1:已下单) * 是否下单(0:未下单,1:已下单)
*/ */
@ApiModelProperty(value = "是否下单(0:未下单,1:已下单)", required = true) @ApiModelProperty(value = "是否下单(0:未下单,1:已下单)", required = false)
private Integer isAddorder; private Integer isAddorder;
/** /**
...@@ -66,12 +67,15 @@ public class BargainSend { ...@@ -66,12 +67,15 @@ public class BargainSend {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt; private Date createdAt;
@ApiModelProperty(value = "创建人", required = false)
private String createdUser;
/** /**
* 商品信息 * 商品信息
*/ */
@ApiModelProperty(value = "商品信息", required = false) @ApiModelProperty(value = "商品信息", required = false)
@TableField(exist = false) @TableField(exist = false)
private Product product; private ProductDto productDto;
/** /**
* 砍价活动 * 砍价活动
...@@ -83,8 +87,10 @@ public class BargainSend { ...@@ -83,8 +87,10 @@ public class BargainSend {
* 帮砍好友信息 * 帮砍好友信息
*/ */
@ApiModelProperty(value = "帮砍好友信息", required = false) @ApiModelProperty(value = "帮砍好友信息", required = false)
@TableField(exist = false)
private List<BargainHelp> bargainHelpList; private List<BargainHelp> bargainHelpList;
@ApiModelProperty(value = "砍掉的金额", required = false) @ApiModelProperty(value = "砍掉的金额", required = false)
@TableField(exist = false)
private double cutMoney; private double cutMoney;
} }
...@@ -21,7 +21,6 @@ public class SmsLog { ...@@ -21,7 +21,6 @@ public class SmsLog {
* ID * ID
*/ */
@TableId @TableId
private Long id; private Long id;
/** /**
......
...@@ -22,4 +22,6 @@ public interface UserMapper extends BaseMapper<User> { ...@@ -22,4 +22,6 @@ public interface UserMapper extends BaseMapper<User> {
User getUserByBizUserId(@Param("appId")Integer appId, @Param("bizUserId")String bizUserId); User getUserByBizUserId(@Param("appId")Integer appId, @Param("bizUserId")String bizUserId);
User getUserByUserMobile(@Param("userMobile")String userMobile); User getUserByUserMobile(@Param("userMobile")String userMobile);
Integer updatePhone(@Param("userMobile")String userMobile,@Param("userId")String userId);
} }
...@@ -63,6 +63,6 @@ public interface BasketService extends IService<Basket> { ...@@ -63,6 +63,6 @@ public interface BasketService extends IService<Basket> {
* @param userId 当前用户的用户id * @param userId 当前用户的用户id
* @return 所有的商品购物项 * @return 所有的商品购物项
*/ */
List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Long> basketId, OrderItemParam orderItem,String userId); List<ShopCartItemDto> getShopCartItemsByOrderItems(String isBargain,List<Long> basketId, OrderItemParam orderItem,String userId);
} }
...@@ -33,4 +33,6 @@ public interface UserService extends IService<User> { ...@@ -33,4 +33,6 @@ public interface UserService extends IService<User> {
String registerPhone(WxParamsVo wxParamsVo, WxMaService wxService, String userId); String registerPhone(WxParamsVo wxParamsVo, WxMaService wxService, String userId);
User getUserByUserMobile(String userMobile); User getUserByUserMobile(String userMobile);
Integer updatePhone(String userMobile,String userId);
} }
...@@ -7,6 +7,7 @@ import com.yami.shop.dao.BargainSendMapper; ...@@ -7,6 +7,7 @@ import com.yami.shop.dao.BargainSendMapper;
import com.yami.shop.service.BargainSendService; import com.yami.shop.service.BargainSendService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
...@@ -39,6 +40,7 @@ public class BargainSendServiceImpl extends ServiceImpl<BargainSendMapper, Barga ...@@ -39,6 +40,7 @@ public class BargainSendServiceImpl extends ServiceImpl<BargainSendMapper, Barga
} }
@Override @Override
@Transactional
public BargainSend selectBargainTask(String userId, long activityId) { public BargainSend selectBargainTask(String userId, long activityId) {
return bargainSendMapper.selectBargainTask(userId,activityId); return bargainSendMapper.selectBargainTask(userId,activityId);
} }
......
...@@ -161,7 +161,7 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme ...@@ -161,7 +161,7 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
} }
@Override @Override
public List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Long> basketId, OrderItemParam orderItem,String userId) { public List<ShopCartItemDto> getShopCartItemsByOrderItems(String isBargain,List<Long> basketId, OrderItemParam orderItem,String userId) {
if (orderItem == null && CollectionUtil.isEmpty(basketId)) { if (orderItem == null && CollectionUtil.isEmpty(basketId)) {
return Collections.emptyList(); return Collections.emptyList();
} }
...@@ -189,6 +189,9 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme ...@@ -189,6 +189,9 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
shopCartItemDto.setProdName(sku.getProdName()); shopCartItemDto.setProdName(sku.getProdName());
shopCartItemDto.setProductTotalAmount(Arith.mul(sku.getPrice(),orderItem.getProdCount())); shopCartItemDto.setProductTotalAmount(Arith.mul(sku.getPrice(),orderItem.getProdCount()));
shopCartItemDto.setPrice(sku.getPrice()); shopCartItemDto.setPrice(sku.getPrice());
if("1".equals(isBargain)){
shopCartItemDto.setPrice(prod.getPrice());
}
shopCartItemDto.setDistributionCardNo(orderItem.getDistributionCardNo()); shopCartItemDto.setDistributionCardNo(orderItem.getDistributionCardNo());
shopCartItemDto.setBasketDate(new Date()); shopCartItemDto.setBasketDate(new Date());
ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(orderItem.getShopId()); ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(orderItem.getShopId());
...@@ -205,5 +208,4 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme ...@@ -205,5 +208,4 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
...@@ -53,7 +53,7 @@ import java.util.Map.Entry; ...@@ -53,7 +53,7 @@ import java.util.Map.Entry;
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLog> implements SmsLogService { public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLog> implements SmsLogService {
@Autowired
private SmsLogMapper smsLogMapper; private SmsLogMapper smsLogMapper;
private ALiDaYu aLiDaYu; private ALiDaYu aLiDaYu;
......
...@@ -13,12 +13,15 @@ package com.yami.shop.service.impl; ...@@ -13,12 +13,15 @@ package com.yami.shop.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.enums.SmsType;
import com.yami.shop.bean.model.User; import com.yami.shop.bean.model.User;
import com.yami.shop.bean.vo.WxParamsVo; import com.yami.shop.bean.vo.WxParamsVo;
import com.yami.shop.common.util.CacheManagerUtil; import com.yami.shop.common.util.CacheManagerUtil;
import com.yami.shop.dao.SmsLogMapper;
import com.yami.shop.dao.UserMapper; import com.yami.shop.dao.UserMapper;
import com.yami.shop.service.UserService; import com.yami.shop.service.UserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -32,6 +35,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -32,6 +35,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
private final CacheManagerUtil cacheManagerUtil; private final CacheManagerUtil cacheManagerUtil;
@Autowired
private SmsLogMapper smsLogMapper;
public UserServiceImpl(CacheManagerUtil cacheManagerUtil, UserMapper userMapper) { public UserServiceImpl(CacheManagerUtil cacheManagerUtil, UserMapper userMapper) {
this.cacheManagerUtil = cacheManagerUtil; this.cacheManagerUtil = cacheManagerUtil;
this.userMapper = userMapper; this.userMapper = userMapper;
...@@ -67,4 +72,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -67,4 +72,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
public User getUserByUserMobile(String userMobile) { public User getUserByUserMobile(String userMobile) {
return userMapper.getUserByUserMobile(userMobile); return userMapper.getUserByUserMobile(userMobile);
} }
@Override
public Integer updatePhone(String userMobile, String userId) {
smsLogMapper.invalidSmsByMobileAndType(userMobile, SmsType.VALID.value());
return userMapper.updatePhone(userMobile,userId);
}
} }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<result column="stocks" jdbcType="INTEGER" property="stocks" /> <result column="stocks" jdbcType="INTEGER" property="stocks" />
<result column="created_user" jdbcType="VARCHAR" property="createdUser" /> <result column="created_user" jdbcType="VARCHAR" property="createdUser" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="sku_id" jdbcType="BIGINT" property="skuId" />
</resultMap> </resultMap>
<select id="selectBargainTotalList" resultType="com.yami.shop.bean.model.BargainParm"> <select id="selectBargainTotalList" resultType="com.yami.shop.bean.model.BargainParm">
......
...@@ -20,6 +20,6 @@ ...@@ -20,6 +20,6 @@
update tz_sms_log set status = 0 where user_phone = #{mobile} and type = #{type} update tz_sms_log set status = 0 where user_phone = #{mobile} and type = #{type}
</update> </update>
<select id="selectSmsByMobileAndType" resultMap="BaseResultMap"> <select id="selectSmsByMobileAndType" resultMap="BaseResultMap">
select * from tz_sms_log where user_phone=#{mobile} and status= #{status} order by rec_date desc limit 1 select * from tz_sms_log where user_phone=#{mobile} and status= #{status}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
select * from tz_user u where user_mobile=#{userMobile} select * from tz_user u where user_mobile=#{userMobile}
</select> </select>
<update id="updatePhone" parameterType="com.yami.shop.bean.model.User">
update tz_user
set user_mobile = #{userMobile}
where user_id = #{userId}
</update>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment