diff --git a/src/main/java/com/sztzjy/trade/controller/stu/StuCommodityManageController.java b/src/main/java/com/sztzjy/trade/controller/stu/StuCommodityManageController.java new file mode 100644 index 0000000..1795ffb --- /dev/null +++ b/src/main/java/com/sztzjy/trade/controller/stu/StuCommodityManageController.java @@ -0,0 +1,17 @@ +package com.sztzjy.trade.controller.stu; + +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author tz + * @date 2024/10/28 16:12 + */ +@RequestMapping("api/stu/goodsManage") +@RestController +@Api(tags = "商品管理中心") +public class StuCommodityManageController { + + +} diff --git a/src/main/java/com/sztzjy/trade/controller/stu/StuGoodsTradingCenterController.java b/src/main/java/com/sztzjy/trade/controller/stu/StuGoodsTradingCenterController.java index e93ac98..833c5dc 100644 --- a/src/main/java/com/sztzjy/trade/controller/stu/StuGoodsTradingCenterController.java +++ b/src/main/java/com/sztzjy/trade/controller/stu/StuGoodsTradingCenterController.java @@ -5,6 +5,7 @@ import com.sztzjy.trade.service.StuGoodsTradingCenterService; import com.sztzjy.trade.util.ResultEntity; import com.sztzjy.trade.annotation.AnonymousAccess; import com.sztzjy.trade.entity.StuShoppingCartInfo; +import com.sztzjy.trade.entity.dto.StuSettlementDTO; import com.sztzjy.trade.service.StuGoodsTradingCenterService; import com.sztzjy.trade.util.ResultEntity; import io.swagger.annotations.Api; @@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; @@ -106,6 +108,61 @@ public class StuGoodsTradingCenterController { return new ResultEntity(HttpStatus.OK,"购物车信息", tradingCenterService.getShoppingCartInfo(userId,index,size)); } + @ApiOperation("购物车商品删除") + @PostMapping("/deleteShoppingCartInfo") + @AnonymousAccess + public ResultEntity deleteShoppingCartInfo(Integer id){ + + Integer result=tradingCenterService.deleteShoppingCartInfo(id); + + if(result>1){return new ResultEntity(HttpStatus.OK,"删除成功");} + + else {return new ResultEntity(HttpStatus.OK,"删除失败");} + } + + @ApiOperation("购物车商品移入关注") + @PostMapping("/attention") + @AnonymousAccess + public ResultEntity attention(@ApiParam("商品ID") Integer id, + @ApiParam("移入关注传1,移出关注传0") Integer attention){ + + Integer result=tradingCenterService.attention(id,attention); + + if(result>1){return new ResultEntity(HttpStatus.OK,"关注成功");} + + else {return new ResultEntity(HttpStatus.OK,"关注失败");} + } + + + @ApiOperation("余额展示") + @PostMapping("/getBalance") + @AnonymousAccess + public ResultEntity getBalance(String userId){ + + return new ResultEntity(HttpStatus.OK,"余额展示",tradingCenterService.getBalance(userId)); + } + + @ApiOperation("结算") + @PostMapping("/settlement") + @AnonymousAccess + public ResultEntity settlement(@RequestBody StuSettlementDTO stuSettlementDTO){ + tradingCenterService.settlement(stuSettlementDTO); + + return new ResultEntity(HttpStatus.OK,"支付成功"); + } + + @ApiOperation("我的订单列表展示") + @PostMapping("/getMyOrderInfo") + @AnonymousAccess + public ResultEntity getMyOrderInfo(@ApiParam("用户ID") String userId, + @ApiParam("当前页") Integer index, + @ApiParam("每页条数") Integer size, + @ApiParam("订单类型")@RequestParam(required = false) String orderType, + @ApiParam("商品名称,商品编号,订单编号")@RequestParam(required = false) String name){ + + return new ResultEntity(HttpStatus.OK,"我的订单展示",tradingCenterService.getMyOrderInfo(userId,index,size,orderType,name)); + } + @ApiOperation("商品排序") @PostMapping("/goodsOrder") diff --git a/src/main/java/com/sztzjy/trade/entity/StuGoodsOrderInfo.java b/src/main/java/com/sztzjy/trade/entity/StuGoodsOrderInfo.java index 8876dce..6b4ce68 100644 --- a/src/main/java/com/sztzjy/trade/entity/StuGoodsOrderInfo.java +++ b/src/main/java/com/sztzjy/trade/entity/StuGoodsOrderInfo.java @@ -2,7 +2,10 @@ package com.sztzjy.trade.entity; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; +import org.springframework.format.annotation.DateTimeFormat; + /** * 商品订单信息 * @@ -32,6 +35,8 @@ public class StuGoodsOrderInfo { private String consignee; @ApiModelProperty(notes = "下单时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date orderTime; @ApiModelProperty(notes = "商品链接") diff --git a/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManage.java b/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManage.java index d93dc6d..1c53010 100644 --- a/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManage.java +++ b/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManage.java @@ -26,7 +26,7 @@ public class StuGoodsSalesManage { private String goodsSubclass; @ApiModelProperty(notes = "上架数量") - private String onlineTotal; + private Integer onlineTotal; @ApiModelProperty(notes = "可用库存数量") private Integer availableInventoryQuantity; @@ -101,12 +101,12 @@ public class StuGoodsSalesManage { this.goodsSubclass = goodsSubclass == null ? null : goodsSubclass.trim(); } - public String getOnlineTotal() { + public Integer getOnlineTotal() { return onlineTotal; } - public void setOnlineTotal(String onlineTotal) { - this.onlineTotal = onlineTotal == null ? null : onlineTotal.trim(); + public void setOnlineTotal(Integer onlineTotal) { + this.onlineTotal = onlineTotal; } public Integer getAvailableInventoryQuantity() { diff --git a/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManageExample.java b/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManageExample.java index a8416ce..adf5bb3 100644 --- a/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManageExample.java +++ b/src/main/java/com/sztzjy/trade/entity/StuGoodsSalesManageExample.java @@ -445,62 +445,52 @@ public class StuGoodsSalesManageExample { return (Criteria) this; } - public Criteria andOnlineTotalEqualTo(String value) { + public Criteria andOnlineTotalEqualTo(Integer value) { addCriterion("online_total =", value, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalNotEqualTo(String value) { + public Criteria andOnlineTotalNotEqualTo(Integer value) { addCriterion("online_total <>", value, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalGreaterThan(String value) { + public Criteria andOnlineTotalGreaterThan(Integer value) { addCriterion("online_total >", value, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalGreaterThanOrEqualTo(String value) { + public Criteria andOnlineTotalGreaterThanOrEqualTo(Integer value) { addCriterion("online_total >=", value, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalLessThan(String value) { + public Criteria andOnlineTotalLessThan(Integer value) { addCriterion("online_total <", value, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalLessThanOrEqualTo(String value) { + public Criteria andOnlineTotalLessThanOrEqualTo(Integer value) { addCriterion("online_total <=", value, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalLike(String value) { - addCriterion("online_total like", value, "onlineTotal"); - return (Criteria) this; - } - - public Criteria andOnlineTotalNotLike(String value) { - addCriterion("online_total not like", value, "onlineTotal"); - return (Criteria) this; - } - - public Criteria andOnlineTotalIn(List values) { + public Criteria andOnlineTotalIn(List values) { addCriterion("online_total in", values, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalNotIn(List values) { + public Criteria andOnlineTotalNotIn(List values) { addCriterion("online_total not in", values, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalBetween(String value1, String value2) { + public Criteria andOnlineTotalBetween(Integer value1, Integer value2) { addCriterion("online_total between", value1, value2, "onlineTotal"); return (Criteria) this; } - public Criteria andOnlineTotalNotBetween(String value1, String value2) { + public Criteria andOnlineTotalNotBetween(Integer value1, Integer value2) { addCriterion("online_total not between", value1, value2, "onlineTotal"); return (Criteria) this; } diff --git a/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfo.java b/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfo.java index 2caec75..c802fe1 100644 --- a/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfo.java +++ b/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfo.java @@ -18,9 +18,15 @@ public class StuShoppingCartInfo { @ApiModelProperty(notes = "商品名称") private String goodsName; + @ApiModelProperty(notes = "商品类型") + private String goodsType; + @ApiModelProperty(notes = "商品图片") private String goodsImage; + @ApiModelProperty(notes = "商品链接") + private String goodsUrl; + @ApiModelProperty(notes = "单价") private BigDecimal unitPrice; @@ -66,6 +72,14 @@ public class StuShoppingCartInfo { this.goodsName = goodsName == null ? null : goodsName.trim(); } + public String getGoodsType() { + return goodsType; + } + + public void setGoodsType(String goodsType) { + this.goodsType = goodsType == null ? null : goodsType.trim(); + } + public String getGoodsImage() { return goodsImage; } @@ -74,6 +88,14 @@ public class StuShoppingCartInfo { this.goodsImage = goodsImage == null ? null : goodsImage.trim(); } + public String getGoodsUrl() { + return goodsUrl; + } + + public void setGoodsUrl(String goodsUrl) { + this.goodsUrl = goodsUrl == null ? null : goodsUrl.trim(); + } + public BigDecimal getUnitPrice() { return unitPrice; } diff --git a/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfoExample.java b/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfoExample.java index 6e4eff7..f14600a 100644 --- a/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfoExample.java +++ b/src/main/java/com/sztzjy/trade/entity/StuShoppingCartInfoExample.java @@ -295,6 +295,76 @@ public class StuShoppingCartInfoExample { return (Criteria) this; } + public Criteria andGoodsTypeIsNull() { + addCriterion("goods_type is null"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIsNotNull() { + addCriterion("goods_type is not null"); + return (Criteria) this; + } + + public Criteria andGoodsTypeEqualTo(String value) { + addCriterion("goods_type =", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotEqualTo(String value) { + addCriterion("goods_type <>", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeGreaterThan(String value) { + addCriterion("goods_type >", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeGreaterThanOrEqualTo(String value) { + addCriterion("goods_type >=", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeLessThan(String value) { + addCriterion("goods_type <", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeLessThanOrEqualTo(String value) { + addCriterion("goods_type <=", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeLike(String value) { + addCriterion("goods_type like", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotLike(String value) { + addCriterion("goods_type not like", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIn(List values) { + addCriterion("goods_type in", values, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotIn(List values) { + addCriterion("goods_type not in", values, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeBetween(String value1, String value2) { + addCriterion("goods_type between", value1, value2, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotBetween(String value1, String value2) { + addCriterion("goods_type not between", value1, value2, "goodsType"); + return (Criteria) this; + } + public Criteria andGoodsImageIsNull() { addCriterion("goods_image is null"); return (Criteria) this; @@ -365,6 +435,76 @@ public class StuShoppingCartInfoExample { return (Criteria) this; } + public Criteria andGoodsUrlIsNull() { + addCriterion("goods_url is null"); + return (Criteria) this; + } + + public Criteria andGoodsUrlIsNotNull() { + addCriterion("goods_url is not null"); + return (Criteria) this; + } + + public Criteria andGoodsUrlEqualTo(String value) { + addCriterion("goods_url =", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlNotEqualTo(String value) { + addCriterion("goods_url <>", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlGreaterThan(String value) { + addCriterion("goods_url >", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlGreaterThanOrEqualTo(String value) { + addCriterion("goods_url >=", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlLessThan(String value) { + addCriterion("goods_url <", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlLessThanOrEqualTo(String value) { + addCriterion("goods_url <=", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlLike(String value) { + addCriterion("goods_url like", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlNotLike(String value) { + addCriterion("goods_url not like", value, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlIn(List values) { + addCriterion("goods_url in", values, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlNotIn(List values) { + addCriterion("goods_url not in", values, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlBetween(String value1, String value2) { + addCriterion("goods_url between", value1, value2, "goodsUrl"); + return (Criteria) this; + } + + public Criteria andGoodsUrlNotBetween(String value1, String value2) { + addCriterion("goods_url not between", value1, value2, "goodsUrl"); + return (Criteria) this; + } + public Criteria andUnitPriceIsNull() { addCriterion("unit_price is null"); return (Criteria) this; diff --git a/src/main/java/com/sztzjy/trade/entity/StuTradeAccountInfo.java b/src/main/java/com/sztzjy/trade/entity/StuTradeAccountInfo.java new file mode 100644 index 0000000..9a7d70a --- /dev/null +++ b/src/main/java/com/sztzjy/trade/entity/StuTradeAccountInfo.java @@ -0,0 +1,130 @@ +package com.sztzjy.trade.entity; + +import java.math.BigDecimal; +import java.util.UUID; + +import com.sztzjy.trade.mapper.StuUserMapper; +import io.swagger.annotations.ApiModelProperty; + +import javax.annotation.Resource; + +/** + * 数字贸易营销-账户信息 + * + * @author whb + * stu_trade_account_info + */ +public class StuTradeAccountInfo { + @ApiModelProperty(notes = "ID") + private Integer id; + + @ApiModelProperty(notes = "账户名称") + private String accountName; + + @ApiModelProperty(notes = "账户余额") + private BigDecimal accountBalance; + + @ApiModelProperty(notes = "用户ID") + private String userId; + + @ApiModelProperty(notes = "预留字段1") + private String reservedOne; + + @ApiModelProperty(notes = "预留字段2") + private String reservedTwo; + + @ApiModelProperty(notes = "预留字段3") + private String reservedThree; + + @ApiModelProperty(notes = "预留字段4") + private String reservedFour; + + @ApiModelProperty(notes = "预留字段5") + private String reservedFive; + + @Resource + StuUserMapper stuUserMapper; + public StuTradeAccountInfo(String userId){ + Integer uuid= UUID.randomUUID().toString().replaceAll("-","").hashCode(); + uuid = uuid < 0 ? -uuid : uuid;//String.hashCode() 值会为空 + this.id=uuid; + this.accountBalance=new BigDecimal(20000000); + this.userId=userId; + + //查询用户名称 + StuUser stuUser = stuUserMapper.selectByPrimaryKey(userId); + this.accountName=stuUser.getName(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName == null ? null : accountName.trim(); + } + + public BigDecimal getAccountBalance() { + return accountBalance; + } + + public void setAccountBalance(BigDecimal accountBalance) { + this.accountBalance = accountBalance; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId == null ? null : userId.trim(); + } + + public String getReservedOne() { + return reservedOne; + } + + public void setReservedOne(String reservedOne) { + this.reservedOne = reservedOne == null ? null : reservedOne.trim(); + } + + public String getReservedTwo() { + return reservedTwo; + } + + public void setReservedTwo(String reservedTwo) { + this.reservedTwo = reservedTwo == null ? null : reservedTwo.trim(); + } + + public String getReservedThree() { + return reservedThree; + } + + public void setReservedThree(String reservedThree) { + this.reservedThree = reservedThree == null ? null : reservedThree.trim(); + } + + public String getReservedFour() { + return reservedFour; + } + + public void setReservedFour(String reservedFour) { + this.reservedFour = reservedFour == null ? null : reservedFour.trim(); + } + + public String getReservedFive() { + return reservedFive; + } + + public void setReservedFive(String reservedFive) { + this.reservedFive = reservedFive == null ? null : reservedFive.trim(); + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/trade/entity/StuTradeAccountInfoExample.java b/src/main/java/com/sztzjy/trade/entity/StuTradeAccountInfoExample.java new file mode 100644 index 0000000..8a16ef4 --- /dev/null +++ b/src/main/java/com/sztzjy/trade/entity/StuTradeAccountInfoExample.java @@ -0,0 +1,810 @@ +package com.sztzjy.trade.entity; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +public class StuTradeAccountInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public StuTradeAccountInfoExample() { + oredCriteria = new ArrayList<>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andAccountNameIsNull() { + addCriterion("account_name is null"); + return (Criteria) this; + } + + public Criteria andAccountNameIsNotNull() { + addCriterion("account_name is not null"); + return (Criteria) this; + } + + public Criteria andAccountNameEqualTo(String value) { + addCriterion("account_name =", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameNotEqualTo(String value) { + addCriterion("account_name <>", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameGreaterThan(String value) { + addCriterion("account_name >", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameGreaterThanOrEqualTo(String value) { + addCriterion("account_name >=", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameLessThan(String value) { + addCriterion("account_name <", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameLessThanOrEqualTo(String value) { + addCriterion("account_name <=", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameLike(String value) { + addCriterion("account_name like", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameNotLike(String value) { + addCriterion("account_name not like", value, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameIn(List values) { + addCriterion("account_name in", values, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameNotIn(List values) { + addCriterion("account_name not in", values, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameBetween(String value1, String value2) { + addCriterion("account_name between", value1, value2, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountNameNotBetween(String value1, String value2) { + addCriterion("account_name not between", value1, value2, "accountName"); + return (Criteria) this; + } + + public Criteria andAccountBalanceIsNull() { + addCriterion("account_balance is null"); + return (Criteria) this; + } + + public Criteria andAccountBalanceIsNotNull() { + addCriterion("account_balance is not null"); + return (Criteria) this; + } + + public Criteria andAccountBalanceEqualTo(BigDecimal value) { + addCriterion("account_balance =", value, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceNotEqualTo(BigDecimal value) { + addCriterion("account_balance <>", value, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceGreaterThan(BigDecimal value) { + addCriterion("account_balance >", value, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("account_balance >=", value, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceLessThan(BigDecimal value) { + addCriterion("account_balance <", value, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceLessThanOrEqualTo(BigDecimal value) { + addCriterion("account_balance <=", value, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceIn(List values) { + addCriterion("account_balance in", values, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceNotIn(List values) { + addCriterion("account_balance not in", values, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("account_balance between", value1, value2, "accountBalance"); + return (Criteria) this; + } + + public Criteria andAccountBalanceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("account_balance not between", value1, value2, "accountBalance"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(String value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(String value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(String value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(String value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(String value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(String value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLike(String value) { + addCriterion("user_id like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotLike(String value) { + addCriterion("user_id not like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(String value1, String value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(String value1, String value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andReservedOneIsNull() { + addCriterion("reserved_one is null"); + return (Criteria) this; + } + + public Criteria andReservedOneIsNotNull() { + addCriterion("reserved_one is not null"); + return (Criteria) this; + } + + public Criteria andReservedOneEqualTo(String value) { + addCriterion("reserved_one =", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneNotEqualTo(String value) { + addCriterion("reserved_one <>", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneGreaterThan(String value) { + addCriterion("reserved_one >", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneGreaterThanOrEqualTo(String value) { + addCriterion("reserved_one >=", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneLessThan(String value) { + addCriterion("reserved_one <", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneLessThanOrEqualTo(String value) { + addCriterion("reserved_one <=", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneLike(String value) { + addCriterion("reserved_one like", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneNotLike(String value) { + addCriterion("reserved_one not like", value, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneIn(List values) { + addCriterion("reserved_one in", values, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneNotIn(List values) { + addCriterion("reserved_one not in", values, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneBetween(String value1, String value2) { + addCriterion("reserved_one between", value1, value2, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedOneNotBetween(String value1, String value2) { + addCriterion("reserved_one not between", value1, value2, "reservedOne"); + return (Criteria) this; + } + + public Criteria andReservedTwoIsNull() { + addCriterion("reserved_two is null"); + return (Criteria) this; + } + + public Criteria andReservedTwoIsNotNull() { + addCriterion("reserved_two is not null"); + return (Criteria) this; + } + + public Criteria andReservedTwoEqualTo(String value) { + addCriterion("reserved_two =", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoNotEqualTo(String value) { + addCriterion("reserved_two <>", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoGreaterThan(String value) { + addCriterion("reserved_two >", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoGreaterThanOrEqualTo(String value) { + addCriterion("reserved_two >=", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoLessThan(String value) { + addCriterion("reserved_two <", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoLessThanOrEqualTo(String value) { + addCriterion("reserved_two <=", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoLike(String value) { + addCriterion("reserved_two like", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoNotLike(String value) { + addCriterion("reserved_two not like", value, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoIn(List values) { + addCriterion("reserved_two in", values, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoNotIn(List values) { + addCriterion("reserved_two not in", values, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoBetween(String value1, String value2) { + addCriterion("reserved_two between", value1, value2, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedTwoNotBetween(String value1, String value2) { + addCriterion("reserved_two not between", value1, value2, "reservedTwo"); + return (Criteria) this; + } + + public Criteria andReservedThreeIsNull() { + addCriterion("reserved_three is null"); + return (Criteria) this; + } + + public Criteria andReservedThreeIsNotNull() { + addCriterion("reserved_three is not null"); + return (Criteria) this; + } + + public Criteria andReservedThreeEqualTo(String value) { + addCriterion("reserved_three =", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeNotEqualTo(String value) { + addCriterion("reserved_three <>", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeGreaterThan(String value) { + addCriterion("reserved_three >", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeGreaterThanOrEqualTo(String value) { + addCriterion("reserved_three >=", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeLessThan(String value) { + addCriterion("reserved_three <", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeLessThanOrEqualTo(String value) { + addCriterion("reserved_three <=", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeLike(String value) { + addCriterion("reserved_three like", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeNotLike(String value) { + addCriterion("reserved_three not like", value, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeIn(List values) { + addCriterion("reserved_three in", values, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeNotIn(List values) { + addCriterion("reserved_three not in", values, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeBetween(String value1, String value2) { + addCriterion("reserved_three between", value1, value2, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedThreeNotBetween(String value1, String value2) { + addCriterion("reserved_three not between", value1, value2, "reservedThree"); + return (Criteria) this; + } + + public Criteria andReservedFourIsNull() { + addCriterion("reserved_four is null"); + return (Criteria) this; + } + + public Criteria andReservedFourIsNotNull() { + addCriterion("reserved_four is not null"); + return (Criteria) this; + } + + public Criteria andReservedFourEqualTo(String value) { + addCriterion("reserved_four =", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourNotEqualTo(String value) { + addCriterion("reserved_four <>", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourGreaterThan(String value) { + addCriterion("reserved_four >", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourGreaterThanOrEqualTo(String value) { + addCriterion("reserved_four >=", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourLessThan(String value) { + addCriterion("reserved_four <", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourLessThanOrEqualTo(String value) { + addCriterion("reserved_four <=", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourLike(String value) { + addCriterion("reserved_four like", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourNotLike(String value) { + addCriterion("reserved_four not like", value, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourIn(List values) { + addCriterion("reserved_four in", values, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourNotIn(List values) { + addCriterion("reserved_four not in", values, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourBetween(String value1, String value2) { + addCriterion("reserved_four between", value1, value2, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFourNotBetween(String value1, String value2) { + addCriterion("reserved_four not between", value1, value2, "reservedFour"); + return (Criteria) this; + } + + public Criteria andReservedFiveIsNull() { + addCriterion("reserved_five is null"); + return (Criteria) this; + } + + public Criteria andReservedFiveIsNotNull() { + addCriterion("reserved_five is not null"); + return (Criteria) this; + } + + public Criteria andReservedFiveEqualTo(String value) { + addCriterion("reserved_five =", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveNotEqualTo(String value) { + addCriterion("reserved_five <>", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveGreaterThan(String value) { + addCriterion("reserved_five >", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveGreaterThanOrEqualTo(String value) { + addCriterion("reserved_five >=", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveLessThan(String value) { + addCriterion("reserved_five <", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveLessThanOrEqualTo(String value) { + addCriterion("reserved_five <=", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveLike(String value) { + addCriterion("reserved_five like", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveNotLike(String value) { + addCriterion("reserved_five not like", value, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveIn(List values) { + addCriterion("reserved_five in", values, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveNotIn(List values) { + addCriterion("reserved_five not in", values, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveBetween(String value1, String value2) { + addCriterion("reserved_five between", value1, value2, "reservedFive"); + return (Criteria) this; + } + + public Criteria andReservedFiveNotBetween(String value1, String value2) { + addCriterion("reserved_five not between", value1, value2, "reservedFive"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/trade/entity/dto/StuSettlementDTO.java b/src/main/java/com/sztzjy/trade/entity/dto/StuSettlementDTO.java new file mode 100644 index 0000000..8567e44 --- /dev/null +++ b/src/main/java/com/sztzjy/trade/entity/dto/StuSettlementDTO.java @@ -0,0 +1,18 @@ +package com.sztzjy.trade.entity.dto; + +import com.sztzjy.trade.entity.StuShoppingCartInfo; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author tz + * @date 2024/10/28 16:30 + */ +@Data +public class StuSettlementDTO { + private List shoppingCartInfos; + private BigDecimal amount; + private String userId; +} diff --git a/src/main/java/com/sztzjy/trade/mapper/StuGoodsOrderInfoMapper.java b/src/main/java/com/sztzjy/trade/mapper/StuGoodsOrderInfoMapper.java index d1471c0..64d34e6 100644 --- a/src/main/java/com/sztzjy/trade/mapper/StuGoodsOrderInfoMapper.java +++ b/src/main/java/com/sztzjy/trade/mapper/StuGoodsOrderInfoMapper.java @@ -3,8 +3,10 @@ package com.sztzjy.trade.mapper; import com.sztzjy.trade.entity.StuGoodsOrderInfo; import com.sztzjy.trade.entity.StuGoodsOrderInfoExample; import java.util.List; -import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper public interface StuGoodsOrderInfoMapper { long countByExample(StuGoodsOrderInfoExample example); @@ -27,4 +29,8 @@ public interface StuGoodsOrderInfoMapper { int updateByPrimaryKeySelective(StuGoodsOrderInfo record); int updateByPrimaryKey(StuGoodsOrderInfo record); + + List selectMyOrderInfoList(@Param("userId")String userId, + @Param("orderType")String orderType, + @Param("name")String name); } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/trade/mapper/StuMapper.java b/src/main/java/com/sztzjy/trade/mapper/StuMapper.java deleted file mode 100644 index 8a8aa33..0000000 --- a/src/main/java/com/sztzjy/trade/mapper/StuMapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sztzjy.trade.mapper; - -import org.apache.ibatis.annotations.Mapper; - -/** - * @author tz - * @date 2024/8/16 15:46 - */ -@Mapper -public class StuMapper { - -} diff --git a/src/main/java/com/sztzjy/trade/mapper/StuShoppingCartInfoMapper.java b/src/main/java/com/sztzjy/trade/mapper/StuShoppingCartInfoMapper.java index 35458ce..08a3b98 100644 --- a/src/main/java/com/sztzjy/trade/mapper/StuShoppingCartInfoMapper.java +++ b/src/main/java/com/sztzjy/trade/mapper/StuShoppingCartInfoMapper.java @@ -3,8 +3,10 @@ package com.sztzjy.trade.mapper; import com.sztzjy.trade.entity.StuShoppingCartInfo; import com.sztzjy.trade.entity.StuShoppingCartInfoExample; import java.util.List; -import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper public interface StuShoppingCartInfoMapper { long countByExample(StuShoppingCartInfoExample example); @@ -33,6 +35,4 @@ public interface StuShoppingCartInfoMapper { int updateByPrimaryKeyWithBLOBs(StuShoppingCartInfo record); int updateByPrimaryKey(StuShoppingCartInfo record); - - } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/trade/mapper/StuTradeAccountInfoMapper.java b/src/main/java/com/sztzjy/trade/mapper/StuTradeAccountInfoMapper.java new file mode 100644 index 0000000..11efac1 --- /dev/null +++ b/src/main/java/com/sztzjy/trade/mapper/StuTradeAccountInfoMapper.java @@ -0,0 +1,32 @@ +package com.sztzjy.trade.mapper; + +import com.sztzjy.trade.entity.StuTradeAccountInfo; +import com.sztzjy.trade.entity.StuTradeAccountInfoExample; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface StuTradeAccountInfoMapper { + long countByExample(StuTradeAccountInfoExample example); + + int deleteByExample(StuTradeAccountInfoExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(StuTradeAccountInfo record); + + int insertSelective(StuTradeAccountInfo record); + + List selectByExample(StuTradeAccountInfoExample example); + + StuTradeAccountInfo selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") StuTradeAccountInfo record, @Param("example") StuTradeAccountInfoExample example); + + int updateByExample(@Param("record") StuTradeAccountInfo record, @Param("example") StuTradeAccountInfoExample example); + + int updateByPrimaryKeySelective(StuTradeAccountInfo record); + + int updateByPrimaryKey(StuTradeAccountInfo record); +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/trade/service/StuGoodsTradingCenterService.java b/src/main/java/com/sztzjy/trade/service/StuGoodsTradingCenterService.java index fc1a4cf..74d4c4f 100644 --- a/src/main/java/com/sztzjy/trade/service/StuGoodsTradingCenterService.java +++ b/src/main/java/com/sztzjy/trade/service/StuGoodsTradingCenterService.java @@ -1,7 +1,10 @@ package com.sztzjy.trade.service; import com.github.pagehelper.PageInfo; +import com.sztzjy.trade.entity.StuGoodsOrderInfo; import com.sztzjy.trade.entity.StuShoppingCartInfo; +import com.sztzjy.trade.entity.dto.StuSettlementDTO; +import org.springframework.security.core.parameters.P; import java.util.List; import com.sztzjy.trade.util.ResultEntity; @@ -14,6 +17,17 @@ import com.sztzjy.trade.util.ResultEntity; */ public interface StuGoodsTradingCenterService { PageInfo getShoppingCartInfo(String userId, Integer index, Integer size); + + Integer deleteShoppingCartInfo(Integer id); + + Integer attention(Integer id,Integer attention); + + String getBalance(String userId); + + void settlement(StuSettlementDTO stuSettlementDTO); + + PageInfo getMyOrderInfo(String userId,Integer index,Integer size, String orderType, String name); + ResultEntity getSmallAdPlacement(String userId); //所有商品查询 diff --git a/src/main/java/com/sztzjy/trade/service/impl/StuGoodsTradingCenterServiceImpl.java b/src/main/java/com/sztzjy/trade/service/impl/StuGoodsTradingCenterServiceImpl.java index b114109..f876b94 100644 --- a/src/main/java/com/sztzjy/trade/service/impl/StuGoodsTradingCenterServiceImpl.java +++ b/src/main/java/com/sztzjy/trade/service/impl/StuGoodsTradingCenterServiceImpl.java @@ -5,16 +5,29 @@ import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.dto.StuGoodsSalesManageDTO; import com.sztzjy.trade.mapper.*; import com.github.pagehelper.PageInfo; +import com.sztzjy.trade.config.exception.handler.ServiceException; +import com.sztzjy.trade.entity.*; +import com.sztzjy.trade.entity.dto.StuSettlementDTO; +import com.sztzjy.trade.mapper.*; import com.sztzjy.trade.service.StuGoodsTradingCenterService; +import com.sztzjy.trade.util.BigDecimalUtils; import com.sztzjy.trade.util.ResultEntity; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import com.sztzjy.trade.util.PageUtil; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import java.util.*; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.util.Date; +import java.util.List; +import java.util.Random; +import java.util.UUID; +import java.util.Random; import java.util.stream.Collectors; @@ -43,6 +56,14 @@ public class StuGoodsTradingCenterServiceImpl implements StuGoodsTradingCenterSe @Autowired private StuGoodsCommentInfoMapper stuGoodsCommentInfoMapper; + @Resource + StuTradeAccountInfoMapper accountInfoMapper; + @Resource + StuGoodsSalesManageMapper goodsSalesManageMapper; + @Resource + BigDecimalUtils bigDecimalUtils; + @Resource + StuGoodsOrderInfoMapper orderInfoMapper; //小广告位招租 @Override @@ -104,8 +125,8 @@ public class StuGoodsTradingCenterServiceImpl implements StuGoodsTradingCenterSe } @Override - public PageInfo getShoppingCartInfo(String userId, Integer index, Integer size) { - StuShoppingCartInfoExample cartInfoExample = new StuShoppingCartInfoExample(); + public PageInfo getShoppingCartInfo(String userId, Integer index, Integer size) { + StuShoppingCartInfoExample cartInfoExample=new StuShoppingCartInfoExample(); cartInfoExample.createCriteria().andUserIdEqualTo(userId); @@ -113,6 +134,118 @@ public class StuGoodsTradingCenterServiceImpl implements StuGoodsTradingCenterSe return PageUtil.pageHelper(stuShoppingCartInfos, index, size); } + @Override + public Integer deleteShoppingCartInfo(Integer id) { + return shoppingCartInfoMapper.deleteByPrimaryKey(id); + } + + @Override + public Integer attention(Integer id,Integer attention) { + StuShoppingCartInfo stuShoppingCartInfo = shoppingCartInfoMapper.selectByPrimaryKey(id); + stuShoppingCartInfo.setAttentionState(attention); + return shoppingCartInfoMapper.updateByPrimaryKey(stuShoppingCartInfo); + } + + @Override + public String getBalance(String userId) { + StuTradeAccountInfoExample accountInfoExample=new StuTradeAccountInfoExample(); + accountInfoExample.createCriteria().andUserIdEqualTo(userId); + List stuTradeAccountInfos = accountInfoMapper.selectByExample(accountInfoExample); + if(stuTradeAccountInfos.isEmpty()){ //设置默认值 + StuTradeAccountInfo stuTradeAccountInfo=new StuTradeAccountInfo(userId); + accountInfoMapper.insert(stuTradeAccountInfo); + stuTradeAccountInfos.add(stuTradeAccountInfo); + } + //取到余额 + BigDecimal accountBalance = stuTradeAccountInfos.get(0).getAccountBalance(); + //转为千分计位格式 + DecimalFormat formatter = new DecimalFormat("#,###.00"); + return formatter.format(accountBalance); + } + + @Override + public void settlement(StuSettlementDTO stuSettlementDTO) { + // TODO: 2024/10/28 1、查询账户余额,检验余额是否足够、 + StuTradeAccountInfoExample accountInfoExample=new StuTradeAccountInfoExample(); + accountInfoExample.createCriteria().andUserIdEqualTo(stuSettlementDTO.getUserId()); + List stuTradeAccountInfos = accountInfoMapper.selectByExample(accountInfoExample); + if(stuTradeAccountInfos.isEmpty()){ //设置默认值 + StuTradeAccountInfo stuTradeAccountInfo=new StuTradeAccountInfo(stuSettlementDTO.getUserId()); + accountInfoMapper.insert(stuTradeAccountInfo); + stuTradeAccountInfos.add(stuTradeAccountInfo); + } + //取到余额,去掉末尾的0比较精度 + BigDecimal accountBalance = stuTradeAccountInfos.get(0).getAccountBalance().stripTrailingZeros(); + BigDecimal bigDecimal = stuSettlementDTO.getAmount().stripTrailingZeros(); + + if(accountBalance.compareTo(bigDecimal)<0){ + throw new ServiceException(HttpStatus.ACCEPTED,"余额不足"); + } + + // TODO: 2024/10/28 2、检验商品上架信息和库存信息 + List shoppingCartInfos = stuSettlementDTO.getShoppingCartInfos(); + for (StuShoppingCartInfo stuShoppingCartInfo:shoppingCartInfos) { + //根据商品ID查询商品是否已下架 + StuGoodsInfo stuGoodsInfo = stuGoodsInfoMapper.selectByPrimaryKey(stuShoppingCartInfo.getGoodsId()); + if(stuGoodsInfo.getOnlineState()==0){ + throw new ServiceException(HttpStatus.ACCEPTED,stuGoodsInfo.getGoodsName()+"商品已下架,请重新选择结算商品"); + } + + //根据商品ID查询商品库存是否足够 + StuGoodsSalesManageExample salesManageExample=new StuGoodsSalesManageExample(); + salesManageExample.createCriteria().andGoodsIdEqualTo(stuShoppingCartInfo.getGoodsId()); + List stuGoodsSalesManages = goodsSalesManageMapper.selectByExample(salesManageExample); + if(stuGoodsSalesManages.get(0).getOnlineTotal() stuGoodsOrderInfos=orderInfoMapper.selectMyOrderInfoList(userId,orderType,name); + return PageUtil.pageHelper(stuGoodsOrderInfos,index,size); + } + //大广告招租 @Override diff --git a/src/main/resources/mappers/StuGoodsOrderInfoMapper.xml b/src/main/resources/mappers/StuGoodsOrderInfoMapper.xml index 554ced9..12dd5b1 100644 --- a/src/main/resources/mappers/StuGoodsOrderInfoMapper.xml +++ b/src/main/resources/mappers/StuGoodsOrderInfoMapper.xml @@ -211,7 +211,7 @@ - + update stu_goods_order_info @@ -335,4 +335,18 @@ user_id = #{userId,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mappers/StuGoodsSalesManageMapper.xml b/src/main/resources/mappers/StuGoodsSalesManageMapper.xml index afe71d4..23f56cb 100644 --- a/src/main/resources/mappers/StuGoodsSalesManageMapper.xml +++ b/src/main/resources/mappers/StuGoodsSalesManageMapper.xml @@ -7,7 +7,7 @@ - + @@ -122,7 +122,7 @@ online_time, state, user_id ) values (#{id,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER}, #{goodsName,jdbcType=VARCHAR}, - #{goodsType,jdbcType=VARCHAR}, #{goodsSubclass,jdbcType=VARCHAR}, #{onlineTotal,jdbcType=VARCHAR}, + #{goodsType,jdbcType=VARCHAR}, #{goodsSubclass,jdbcType=VARCHAR}, #{onlineTotal,jdbcType=INTEGER}, #{availableInventoryQuantity,jdbcType=INTEGER}, #{soldQuantity,jdbcType=VARCHAR}, #{salesVolume,jdbcType=VARCHAR}, #{grossMargin,jdbcType=VARCHAR}, #{numberOfComments,jdbcType=INTEGER}, #{numberOfLikes,jdbcType=INTEGER}, #{numberOfCollections,jdbcType=INTEGER}, #{numberOfShares,jdbcType=INTEGER}, @@ -201,7 +201,7 @@ #{goodsSubclass,jdbcType=VARCHAR}, - #{onlineTotal,jdbcType=VARCHAR}, + #{onlineTotal,jdbcType=INTEGER}, #{availableInventoryQuantity,jdbcType=INTEGER}, @@ -263,7 +263,7 @@ goods_subclass = #{record.goodsSubclass,jdbcType=VARCHAR}, - online_total = #{record.onlineTotal,jdbcType=VARCHAR}, + online_total = #{record.onlineTotal,jdbcType=INTEGER}, available_inventory_quantity = #{record.availableInventoryQuantity,jdbcType=INTEGER}, @@ -310,7 +310,7 @@ goods_name = #{record.goodsName,jdbcType=VARCHAR}, goods_type = #{record.goodsType,jdbcType=VARCHAR}, goods_subclass = #{record.goodsSubclass,jdbcType=VARCHAR}, - online_total = #{record.onlineTotal,jdbcType=VARCHAR}, + online_total = #{record.onlineTotal,jdbcType=INTEGER}, available_inventory_quantity = #{record.availableInventoryQuantity,jdbcType=INTEGER}, sold_quantity = #{record.soldQuantity,jdbcType=VARCHAR}, sales_volume = #{record.salesVolume,jdbcType=VARCHAR}, @@ -342,7 +342,7 @@ goods_subclass = #{goodsSubclass,jdbcType=VARCHAR}, - online_total = #{onlineTotal,jdbcType=VARCHAR}, + online_total = #{onlineTotal,jdbcType=INTEGER}, available_inventory_quantity = #{availableInventoryQuantity,jdbcType=INTEGER}, @@ -386,7 +386,7 @@ goods_name = #{goodsName,jdbcType=VARCHAR}, goods_type = #{goodsType,jdbcType=VARCHAR}, goods_subclass = #{goodsSubclass,jdbcType=VARCHAR}, - online_total = #{onlineTotal,jdbcType=VARCHAR}, + online_total = #{onlineTotal,jdbcType=INTEGER}, available_inventory_quantity = #{availableInventoryQuantity,jdbcType=INTEGER}, sold_quantity = #{soldQuantity,jdbcType=VARCHAR}, sales_volume = #{salesVolume,jdbcType=VARCHAR}, diff --git a/src/main/resources/mappers/StuShoppingCartInfoMapper.xml b/src/main/resources/mappers/StuShoppingCartInfoMapper.xml index ec41814..d37e40f 100644 --- a/src/main/resources/mappers/StuShoppingCartInfoMapper.xml +++ b/src/main/resources/mappers/StuShoppingCartInfoMapper.xml @@ -5,7 +5,9 @@ + + @@ -75,8 +77,8 @@ - id, goods_id, goods_name, goods_image, unit_price, number, subtotal, shop_name, attention_state, - user_id + id, goods_id, goods_name, goods_type, goods_image, goods_url, unit_price, number, + subtotal, shop_name, attention_state, user_id goods_specification @@ -131,13 +133,15 @@ insert into stu_shopping_cart_info (id, goods_id, goods_name, - goods_image, unit_price, number, - subtotal, shop_name, attention_state, - user_id, goods_specification) + goods_type, goods_image, goods_url, + unit_price, number, subtotal, + shop_name, attention_state, user_id, + goods_specification) values (#{id,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER}, #{goodsName,jdbcType=VARCHAR}, - #{goodsImage,jdbcType=VARCHAR}, #{unitPrice,jdbcType=DECIMAL}, #{number,jdbcType=INTEGER}, - #{subtotal,jdbcType=DECIMAL}, #{shopName,jdbcType=VARCHAR}, #{attentionState,jdbcType=INTEGER}, - #{userId,jdbcType=VARCHAR}, #{goodsSpecification,jdbcType=LONGVARCHAR}) + #{goodsType,jdbcType=VARCHAR}, #{goodsImage,jdbcType=VARCHAR}, #{goodsUrl,jdbcType=VARCHAR}, + #{unitPrice,jdbcType=DECIMAL}, #{number,jdbcType=INTEGER}, #{subtotal,jdbcType=DECIMAL}, + #{shopName,jdbcType=VARCHAR}, #{attentionState,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, + #{goodsSpecification,jdbcType=LONGVARCHAR}) insert into stu_shopping_cart_info @@ -151,9 +155,15 @@ goods_name, + + goods_type, + goods_image, + + goods_url, + unit_price, @@ -186,9 +196,15 @@ #{goodsName,jdbcType=VARCHAR}, + + #{goodsType,jdbcType=VARCHAR}, + #{goodsImage,jdbcType=VARCHAR}, + + #{goodsUrl,jdbcType=VARCHAR}, + #{unitPrice,jdbcType=DECIMAL}, @@ -230,9 +246,15 @@ goods_name = #{record.goodsName,jdbcType=VARCHAR}, + + goods_type = #{record.goodsType,jdbcType=VARCHAR}, + goods_image = #{record.goodsImage,jdbcType=VARCHAR}, + + goods_url = #{record.goodsUrl,jdbcType=VARCHAR}, + unit_price = #{record.unitPrice,jdbcType=DECIMAL}, @@ -264,7 +286,9 @@ set id = #{record.id,jdbcType=INTEGER}, goods_id = #{record.goodsId,jdbcType=INTEGER}, goods_name = #{record.goodsName,jdbcType=VARCHAR}, + goods_type = #{record.goodsType,jdbcType=VARCHAR}, goods_image = #{record.goodsImage,jdbcType=VARCHAR}, + goods_url = #{record.goodsUrl,jdbcType=VARCHAR}, unit_price = #{record.unitPrice,jdbcType=DECIMAL}, number = #{record.number,jdbcType=INTEGER}, subtotal = #{record.subtotal,jdbcType=DECIMAL}, @@ -281,7 +305,9 @@ set id = #{record.id,jdbcType=INTEGER}, goods_id = #{record.goodsId,jdbcType=INTEGER}, goods_name = #{record.goodsName,jdbcType=VARCHAR}, + goods_type = #{record.goodsType,jdbcType=VARCHAR}, goods_image = #{record.goodsImage,jdbcType=VARCHAR}, + goods_url = #{record.goodsUrl,jdbcType=VARCHAR}, unit_price = #{record.unitPrice,jdbcType=DECIMAL}, number = #{record.number,jdbcType=INTEGER}, subtotal = #{record.subtotal,jdbcType=DECIMAL}, @@ -301,9 +327,15 @@ goods_name = #{goodsName,jdbcType=VARCHAR}, + + goods_type = #{goodsType,jdbcType=VARCHAR}, + goods_image = #{goodsImage,jdbcType=VARCHAR}, + + goods_url = #{goodsUrl,jdbcType=VARCHAR}, + unit_price = #{unitPrice,jdbcType=DECIMAL}, @@ -332,7 +364,9 @@ update stu_shopping_cart_info set goods_id = #{goodsId,jdbcType=INTEGER}, goods_name = #{goodsName,jdbcType=VARCHAR}, + goods_type = #{goodsType,jdbcType=VARCHAR}, goods_image = #{goodsImage,jdbcType=VARCHAR}, + goods_url = #{goodsUrl,jdbcType=VARCHAR}, unit_price = #{unitPrice,jdbcType=DECIMAL}, number = #{number,jdbcType=INTEGER}, subtotal = #{subtotal,jdbcType=DECIMAL}, @@ -346,7 +380,9 @@ update stu_shopping_cart_info set goods_id = #{goodsId,jdbcType=INTEGER}, goods_name = #{goodsName,jdbcType=VARCHAR}, + goods_type = #{goodsType,jdbcType=VARCHAR}, goods_image = #{goodsImage,jdbcType=VARCHAR}, + goods_url = #{goodsUrl,jdbcType=VARCHAR}, unit_price = #{unitPrice,jdbcType=DECIMAL}, number = #{number,jdbcType=INTEGER}, subtotal = #{subtotal,jdbcType=DECIMAL}, diff --git a/src/main/resources/mappers/StuTradeAccountInfoMapper.xml b/src/main/resources/mappers/StuTradeAccountInfoMapper.xml new file mode 100644 index 0000000..24c3fa6 --- /dev/null +++ b/src/main/resources/mappers/StuTradeAccountInfoMapper.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, account_name, account_balance, user_id, reserved_one, reserved_two, reserved_three, + reserved_four, reserved_five + + + + + delete from stu_trade_account_info + where id = #{id,jdbcType=INTEGER} + + + delete from stu_trade_account_info + + + + + + insert into stu_trade_account_info (id, account_name, account_balance, + user_id, reserved_one, reserved_two, + reserved_three, reserved_four, reserved_five + ) + values (#{id,jdbcType=INTEGER}, #{accountName,jdbcType=VARCHAR}, #{accountBalance,jdbcType=DECIMAL}, + #{userId,jdbcType=VARCHAR}, #{reservedOne,jdbcType=VARCHAR}, #{reservedTwo,jdbcType=VARCHAR}, + #{reservedThree,jdbcType=VARCHAR}, #{reservedFour,jdbcType=VARCHAR}, #{reservedFive,jdbcType=VARCHAR} + ) + + + insert into stu_trade_account_info + + + id, + + + account_name, + + + account_balance, + + + user_id, + + + reserved_one, + + + reserved_two, + + + reserved_three, + + + reserved_four, + + + reserved_five, + + + + + #{id,jdbcType=INTEGER}, + + + #{accountName,jdbcType=VARCHAR}, + + + #{accountBalance,jdbcType=DECIMAL}, + + + #{userId,jdbcType=VARCHAR}, + + + #{reservedOne,jdbcType=VARCHAR}, + + + #{reservedTwo,jdbcType=VARCHAR}, + + + #{reservedThree,jdbcType=VARCHAR}, + + + #{reservedFour,jdbcType=VARCHAR}, + + + #{reservedFive,jdbcType=VARCHAR}, + + + + + + update stu_trade_account_info + + + id = #{record.id,jdbcType=INTEGER}, + + + account_name = #{record.accountName,jdbcType=VARCHAR}, + + + account_balance = #{record.accountBalance,jdbcType=DECIMAL}, + + + user_id = #{record.userId,jdbcType=VARCHAR}, + + + reserved_one = #{record.reservedOne,jdbcType=VARCHAR}, + + + reserved_two = #{record.reservedTwo,jdbcType=VARCHAR}, + + + reserved_three = #{record.reservedThree,jdbcType=VARCHAR}, + + + reserved_four = #{record.reservedFour,jdbcType=VARCHAR}, + + + reserved_five = #{record.reservedFive,jdbcType=VARCHAR}, + + + + + + + + update stu_trade_account_info + set id = #{record.id,jdbcType=INTEGER}, + account_name = #{record.accountName,jdbcType=VARCHAR}, + account_balance = #{record.accountBalance,jdbcType=DECIMAL}, + user_id = #{record.userId,jdbcType=VARCHAR}, + reserved_one = #{record.reservedOne,jdbcType=VARCHAR}, + reserved_two = #{record.reservedTwo,jdbcType=VARCHAR}, + reserved_three = #{record.reservedThree,jdbcType=VARCHAR}, + reserved_four = #{record.reservedFour,jdbcType=VARCHAR}, + reserved_five = #{record.reservedFive,jdbcType=VARCHAR} + + + + + + update stu_trade_account_info + + + account_name = #{accountName,jdbcType=VARCHAR}, + + + account_balance = #{accountBalance,jdbcType=DECIMAL}, + + + user_id = #{userId,jdbcType=VARCHAR}, + + + reserved_one = #{reservedOne,jdbcType=VARCHAR}, + + + reserved_two = #{reservedTwo,jdbcType=VARCHAR}, + + + reserved_three = #{reservedThree,jdbcType=VARCHAR}, + + + reserved_four = #{reservedFour,jdbcType=VARCHAR}, + + + reserved_five = #{reservedFive,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update stu_trade_account_info + set account_name = #{accountName,jdbcType=VARCHAR}, + account_balance = #{accountBalance,jdbcType=DECIMAL}, + user_id = #{userId,jdbcType=VARCHAR}, + reserved_one = #{reservedOne,jdbcType=VARCHAR}, + reserved_two = #{reservedTwo,jdbcType=VARCHAR}, + reserved_three = #{reservedThree,jdbcType=VARCHAR}, + reserved_four = #{reservedFour,jdbcType=VARCHAR}, + reserved_five = #{reservedFive,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file