Commit 5c52f91b authored by unset's avatar unset

修改支付信息

parent e3754e02
package com.upyuns.platform.rs.website.dto; package com.upyuns.platform.rs.website.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -11,7 +12,7 @@ import java.math.BigDecimal; ...@@ -11,7 +12,7 @@ import java.math.BigDecimal;
* @Date: 2020-12-12 17:09 * @Date: 2020-12-12 17:09
*/ */
@Data @Data
public class OrderInfoDto { public class OrderInfoDto extends PageParam {
//详情ID //详情ID
Integer detailId; Integer detailId;
......
...@@ -89,6 +89,9 @@ public class CommonInfo implements Serializable { ...@@ -89,6 +89,9 @@ public class CommonInfo implements Serializable {
@Column(name = "rank") @Column(name = "rank")
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer rank; private Integer rank;
/**
* 图标
*/
private String icon;
} }
...@@ -6,7 +6,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,7 +6,9 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.upyuns.platform.rs.website.dto.CartOrderDto; import com.upyuns.platform.rs.website.dto.CartOrderDto;
import com.upyuns.platform.rs.website.dto.OrderInfoDto; import com.upyuns.platform.rs.website.dto.OrderInfoDto;
import com.upyuns.platform.rs.website.entity.*; import com.upyuns.platform.rs.website.entity.*;
...@@ -74,14 +76,20 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping ...@@ -74,14 +76,20 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping
/** /**
* 获取用户所有购物车商品 * 获取用户所有购物车商品
* @param userId * @param orderInfoDto
* @return * @return
*/ */
public ObjectRestResponse getUserAllCart(Integer userId) { public ObjectRestResponse getUserAllCart(OrderInfoDto orderInfoDto) {
AppUserDTO appUserDTO = userFeign.userDetailByToken(request.getHeader("Authorization")).getData();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
Example example = new Example(ShoppingCartInfo.class); Example example = new Example(ShoppingCartInfo.class);
example.createCriteria().andEqualTo("userId", userId).andEqualTo("isDel", 0); example.createCriteria().andEqualTo("userId", appUserDTO.getUserid()).andEqualTo("isDel", 0);
example.orderBy("updTime").desc(); example.orderBy("updTime").desc();
return ObjectRestResponse.succ(mapper.selectByExample(example)); Query query = new Query(orderInfoDto);
PageDataVO<ShoppingCartInfo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectByExample(example));
return ObjectRestResponse.succ();
} }
/** /**
...@@ -107,23 +115,30 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping ...@@ -107,23 +115,30 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping
if (OrderTypeEnum.IMAGE_STORAGE.getType().equals(orderInfoDto.getType())) { if (OrderTypeEnum.IMAGE_STORAGE.getType().equals(orderInfoDto.getType())) {
ImageImgStorage imageImgStorage = imageImgStorageBiz.selectById(orderInfoDto.getDetailId()); ImageImgStorage imageImgStorage = imageImgStorageBiz.selectById(orderInfoDto.getDetailId());
if (imageImgStorage != null) { if (imageImgStorage != null) {
ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo(); ShoppingCartInfo old = selectByUser(appUserDTO.getUserid(), imageImgStorage.getId());
shoppingCartInfo.setDetailId(imageImgStorage.getId()); if (old != null) {
shoppingCartInfo.setDetailJson(JSONObject.toJSONString(imageImgStorage)); old.setNumber(old.getNumber() + orderInfoDto.getNumber());
shoppingCartInfo.setPrice(orderInfoDto.getPrice()); old.setTotalAmount(old.getPrice().multiply(new BigDecimal(old.getNumber())));
shoppingCartInfo.setFilePath(orderInfoDto.getFilePath()); updateSelectiveByIdRe(old);
shoppingCartInfo.setNumber(orderInfoDto.getNumber()); } else {
shoppingCartInfo.setItemPic(imageImgStorage.getCoverImg()); ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo();
shoppingCartInfo.setName(imageImgStorage.getName()); shoppingCartInfo.setDetailId(imageImgStorage.getId());
shoppingCartInfo.setTotalAmount(orderInfoDto.getPrice().multiply(new BigDecimal(orderInfoDto.getNumber()))); shoppingCartInfo.setDetailJson(JSONObject.toJSONString(imageImgStorage));
shoppingCartInfo.setType(orderInfoDto.getType()); shoppingCartInfo.setPrice(orderInfoDto.getPrice());
//添加用户信息 shoppingCartInfo.setFilePath(orderInfoDto.getFilePath());
shoppingCartInfo.setRealName(appUserDTO.getRealname()); shoppingCartInfo.setNumber(orderInfoDto.getNumber());
shoppingCartInfo.setNickname(appUserDTO.getNickname()); shoppingCartInfo.setItemPic(imageImgStorage.getCoverImg());
shoppingCartInfo.setHeadImg(appUserDTO.getHeadimgurl()); shoppingCartInfo.setName(imageImgStorage.getName());
shoppingCartInfo.setPhone(appUserDTO.getUsername()); shoppingCartInfo.setTotalAmount(orderInfoDto.getPrice().multiply(new BigDecimal(orderInfoDto.getNumber())));
shoppingCartInfo.setUserId(appUserDTO.getUserid()); shoppingCartInfo.setType(orderInfoDto.getType());
addUpdate(shoppingCartInfo); //添加用户信息
shoppingCartInfo.setRealName(appUserDTO.getRealname());
shoppingCartInfo.setNickname(appUserDTO.getNickname());
shoppingCartInfo.setHeadImg(appUserDTO.getHeadimgurl());
shoppingCartInfo.setPhone(appUserDTO.getUsername());
shoppingCartInfo.setUserId(appUserDTO.getUserid());
addUpdate(shoppingCartInfo);
}
} else { } else {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE)); return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE));
} }
...@@ -133,24 +148,30 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping ...@@ -133,24 +148,30 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping
if (OrderTypeEnum.INDUSTRY_INFO.getType().equals(orderInfoDto.getType())) { if (OrderTypeEnum.INDUSTRY_INFO.getType().equals(orderInfoDto.getType())) {
IndustryApplicationInfo industryApplicationInfo = industryApplicationInfoBiz.selectById(orderInfoDto.getDetailId()); IndustryApplicationInfo industryApplicationInfo = industryApplicationInfoBiz.selectById(orderInfoDto.getDetailId());
if (industryApplicationInfo != null) { if (industryApplicationInfo != null) {
ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo(); ShoppingCartInfo old = selectByUser(appUserDTO.getUserid(), industryApplicationInfo.getId());
shoppingCartInfo.setDetailId(industryApplicationInfo.getId()); if (old != null) {
shoppingCartInfo.setDetailJson(JSONObject.toJSONString(industryApplicationInfo)); old.setNumber(old.getNumber() + orderInfoDto.getNumber());
shoppingCartInfo.setPrice(orderInfoDto.getPrice()); old.setTotalAmount(old.getPrice().multiply(new BigDecimal(old.getNumber())));
shoppingCartInfo.setFilePath(orderInfoDto.getFilePath()); updateSelectiveByIdRe(old);
shoppingCartInfo.setNumber(orderInfoDto.getNumber()); } else {
shoppingCartInfo.setItemPic(industryApplicationInfo.getCoverImg()); ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo();
shoppingCartInfo.setName(industryApplicationInfo.getTitle()); shoppingCartInfo.setDetailId(industryApplicationInfo.getId());
shoppingCartInfo.setTotalAmount(orderInfoDto.getPrice().multiply(new BigDecimal(orderInfoDto.getNumber()))); shoppingCartInfo.setDetailJson(JSONObject.toJSONString(industryApplicationInfo));
shoppingCartInfo.setType(orderInfoDto.getType()); shoppingCartInfo.setPrice(orderInfoDto.getPrice());
//添加用户信息 shoppingCartInfo.setFilePath(orderInfoDto.getFilePath());
shoppingCartInfo.setRealName(appUserDTO.getRealname()); shoppingCartInfo.setNumber(orderInfoDto.getNumber());
shoppingCartInfo.setNickname(appUserDTO.getNickname()); shoppingCartInfo.setItemPic(industryApplicationInfo.getCoverImg());
shoppingCartInfo.setHeadImg(appUserDTO.getHeadimgurl()); shoppingCartInfo.setName(industryApplicationInfo.getTitle());
shoppingCartInfo.setPhone(appUserDTO.getUsername()); shoppingCartInfo.setTotalAmount(orderInfoDto.getPrice().multiply(new BigDecimal(orderInfoDto.getNumber())));
shoppingCartInfo.setUserId(appUserDTO.getUserid()); shoppingCartInfo.setType(orderInfoDto.getType());
addUpdate(shoppingCartInfo); //添加用户信息
shoppingCartInfo.setRealName(appUserDTO.getRealname());
shoppingCartInfo.setNickname(appUserDTO.getNickname());
shoppingCartInfo.setHeadImg(appUserDTO.getHeadimgurl());
shoppingCartInfo.setPhone(appUserDTO.getUsername());
shoppingCartInfo.setUserId(appUserDTO.getUserid());
addUpdate(shoppingCartInfo);
}
} else { } else {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE)); return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE));
} }
...@@ -159,6 +180,12 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping ...@@ -159,6 +180,12 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper,Shopping
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public ShoppingCartInfo selectByUser(Integer userId, Integer detailId) {
Example example = new Example(ShoppingCartInfo.class);
example.createCriteria().andEqualTo("detailId", detailId).andEqualTo("userId", userId);
return mapper.selectOneByExample(example);
}
/** /**
* 购物车转为订单 * 购物车转为订单
* @param cartOrderDto * @param cartOrderDto
......
package com.upyuns.platform.rs.website.controller.web; package com.upyuns.platform.rs.website.controller.web;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.upyuns.platform.rs.website.biz.ShoppingCartInfoBiz; import com.upyuns.platform.rs.website.biz.ShoppingCartInfoBiz;
import com.upyuns.platform.rs.website.dto.CartOrderDto;
import com.upyuns.platform.rs.website.dto.OrderInfoDto;
import com.upyuns.platform.rs.website.entity.ShoppingCartInfo; import com.upyuns.platform.rs.website.entity.ShoppingCartInfo;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("shoppingCartInfo/web") @RequestMapping("shoppingCartInfo/web")
public class ShoppingCartInfoWebController extends BaseController<ShoppingCartInfoBiz,ShoppingCartInfo> { public class ShoppingCartInfoWebController extends BaseController<ShoppingCartInfoBiz,ShoppingCartInfo> {
@PostMapping(value = "addUpdate")
public ObjectRestResponse addUpdate(@RequestBody OrderInfoDto orderInfoDto) {
return baseBiz.addShoppingCart(orderInfoDto);
}
@GetMapping(value = "getUserShoppingCart")
public ObjectRestResponse getUserShoppingCart(OrderInfoDto orderInfoDto) {
return baseBiz.getUserAllCart(orderInfoDto);
}
@PostMapping(value = "convertToOrderInfo")
public ObjectRestResponse convertToOrderInfo(CartOrderDto cartOrderDto) {
return baseBiz.convertShopCartToOrderInfo(cartOrderDto);
}
} }
\ No newline at end of file
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