项目十二:商品信息管理和销售管理修改

main
@t2652009480
parent 3b2b4bfa84
commit ad288711fa

@ -2,7 +2,7 @@ package com.sztzjy.trade.controller.stu;
import com.sztzjy.trade.annotation.AnonymousAccess; import com.sztzjy.trade.annotation.AnonymousAccess;
import com.sztzjy.trade.entity.StuGoodsCommentInfo; import com.sztzjy.trade.entity.StuGoodsCommentInfo;
import com.sztzjy.trade.entity.dto.StuGoodsInfoDTO; import com.sztzjy.trade.entity.dto.StuGoodsManageInfoDTO;
import com.sztzjy.trade.service.StuGoodsManageCenterService; import com.sztzjy.trade.service.StuGoodsManageCenterService;
import com.sztzjy.trade.util.ResultEntity; import com.sztzjy.trade.util.ResultEntity;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -51,7 +51,7 @@ public class StuGoodsManageCenterController {
@ApiOperation("保存") @ApiOperation("保存")
@PostMapping("/save") @PostMapping("/save")
@AnonymousAccess @AnonymousAccess
public ResultEntity save(@RequestBody StuGoodsInfoDTO stuGoodsInfoDTO, public ResultEntity save(@RequestBody StuGoodsManageInfoDTO stuGoodsInfoDTO,
@ApiParam("商品主图片")@RequestParam(required = false) MultipartFile file, @ApiParam("商品主图片")@RequestParam(required = false) MultipartFile file,
@ApiParam("轮播图集合")@RequestParam(required = false) List<MultipartFile> files){ @ApiParam("轮播图集合")@RequestParam(required = false) List<MultipartFile> files){
@ -66,7 +66,7 @@ public class StuGoodsManageCenterController {
@ApiOperation("新增") @ApiOperation("新增")
@PostMapping("/add") @PostMapping("/add")
@AnonymousAccess @AnonymousAccess
public ResultEntity add(@RequestBody StuGoodsInfoDTO stuGoodsInfoDTO, public ResultEntity add(@RequestBody StuGoodsManageInfoDTO stuGoodsInfoDTO,
@ApiParam("商品主图片") MultipartFile file, @ApiParam("商品主图片") MultipartFile file,
@ApiParam("轮播图集合")@RequestParam(required = false) List<MultipartFile> files){ @ApiParam("轮播图集合")@RequestParam(required = false) List<MultipartFile> files){
@ -81,7 +81,7 @@ public class StuGoodsManageCenterController {
@ApiOperation("编辑") @ApiOperation("编辑")
@PostMapping("/update") @PostMapping("/update")
@AnonymousAccess @AnonymousAccess
public ResultEntity update(@RequestBody StuGoodsInfoDTO stuGoodsInfoDTO, public ResultEntity update(@RequestBody StuGoodsManageInfoDTO stuGoodsInfoDTO,
@ApiParam("商品主图片") MultipartFile file, @ApiParam("商品主图片") MultipartFile file,
@ApiParam("轮播图集合")@RequestParam(required = false) List<MultipartFile> files){ @ApiParam("轮播图集合")@RequestParam(required = false) List<MultipartFile> files){

@ -12,7 +12,7 @@ import java.util.List;
* @date 2024/11/1 16:33 * @date 2024/11/1 16:33
*/ */
@Data @Data
public class StuGoodsInfoDTO { public class StuGoodsManageInfoDTO {
@ApiModelProperty(notes = "ID") @ApiModelProperty(notes = "ID")
private Integer id; private Integer id;

@ -3,7 +3,7 @@ package com.sztzjy.trade.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.entity.StuGoodSalesManage; import com.sztzjy.trade.entity.StuGoodSalesManage;
import com.sztzjy.trade.entity.StuGoodsInfo; import com.sztzjy.trade.entity.StuGoodsInfo;
import com.sztzjy.trade.entity.dto.StuGoodsInfoDTO; import com.sztzjy.trade.entity.dto.StuGoodsManageInfoDTO;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@ -17,11 +17,11 @@ public interface StuGoodsManageCenterService {
PageInfo<StuGoodSalesManage> getGoodsSalesManagementList(String userId, Integer index, Integer size); PageInfo<StuGoodSalesManage> getGoodsSalesManagementList(String userId, Integer index, Integer size);
Integer save(StuGoodsInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files); Integer save(StuGoodsManageInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files);
Integer add(StuGoodsInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files); Integer add(StuGoodsManageInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files);
Integer update(StuGoodsInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files); Integer update(StuGoodsManageInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files);
Integer remove(Integer id); Integer remove(Integer id);

@ -3,7 +3,7 @@ package com.sztzjy.trade.service.impl;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.config.exception.handler.ServiceException; import com.sztzjy.trade.config.exception.handler.ServiceException;
import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.*;
import com.sztzjy.trade.entity.dto.StuGoodsInfoDTO; import com.sztzjy.trade.entity.dto.StuGoodsManageInfoDTO;
import com.sztzjy.trade.mapper.StuGoodsInfoMapper; import com.sztzjy.trade.mapper.StuGoodsInfoMapper;
import com.sztzjy.trade.mapper.StuGoodsPromotionPricingMapper; import com.sztzjy.trade.mapper.StuGoodsPromotionPricingMapper;
import com.sztzjy.trade.mapper.StuGoodsSalesManageMapper; import com.sztzjy.trade.mapper.StuGoodsSalesManageMapper;
@ -58,7 +58,7 @@ public class StuGoodsManageCenterServiceImpl implements StuGoodsManageCenterServ
} }
@Override @Override
public Integer save(StuGoodsInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files) { public Integer save(StuGoodsManageInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files) {
//主图片上传 //主图片上传
String upload=""; String upload="";
@ -68,7 +68,7 @@ public class StuGoodsManageCenterServiceImpl implements StuGoodsManageCenterServ
stuGoodsInfoDTO.setGoodsMainImage(upload); stuGoodsInfoDTO.setGoodsMainImage(upload);
//轮播图批量上传 //轮播图批量上传
StuGoodsInfoDTO stuGoodsInfoDTO1=new StuGoodsInfoDTO(); StuGoodsManageInfoDTO stuGoodsInfoDTO1=new StuGoodsManageInfoDTO();
if(!files.isEmpty()){ if(!files.isEmpty()){
stuGoodsInfoDTO1 = insertBatch(stuGoodsInfoDTO, files); stuGoodsInfoDTO1 = insertBatch(stuGoodsInfoDTO, files);
} }
@ -134,13 +134,13 @@ public class StuGoodsManageCenterServiceImpl implements StuGoodsManageCenterServ
} }
@Override @Override
public Integer add(StuGoodsInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files) { public Integer add(StuGoodsManageInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files) {
//主图片上传 //主图片上传
String upload= fileUtil.upload(file); String upload= fileUtil.upload(file);
stuGoodsInfoDTO.setGoodsMainImage(upload); stuGoodsInfoDTO.setGoodsMainImage(upload);
//轮播图批量上传 //轮播图批量上传
StuGoodsInfoDTO stuGoodsInfoDTO1 = insertBatch(stuGoodsInfoDTO, files); StuGoodsManageInfoDTO stuGoodsInfoDTO1 = insertBatch(stuGoodsInfoDTO, files);
//关键词拼接 //关键词拼接
String join = String.join(",", stuGoodsInfoDTO1.getProductKeyword()); String join = String.join(",", stuGoodsInfoDTO1.getProductKeyword());
@ -200,13 +200,13 @@ public class StuGoodsManageCenterServiceImpl implements StuGoodsManageCenterServ
} }
@Override @Override
public Integer update(StuGoodsInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files) { public Integer update(StuGoodsManageInfoDTO stuGoodsInfoDTO, MultipartFile file, List<MultipartFile> files) {
//主图片上传 //主图片上传
String upload= fileUtil.upload(file); String upload= fileUtil.upload(file);
stuGoodsInfoDTO.setGoodsMainImage(upload); stuGoodsInfoDTO.setGoodsMainImage(upload);
//轮播图批量上传 //轮播图批量上传
StuGoodsInfoDTO stuGoodsInfoDTO1 = insertBatch(stuGoodsInfoDTO, files); StuGoodsManageInfoDTO stuGoodsInfoDTO1 = insertBatch(stuGoodsInfoDTO, files);
//关键词拼接 //关键词拼接
String join = String.join(",", stuGoodsInfoDTO1.getProductKeyword()); String join = String.join(",", stuGoodsInfoDTO1.getProductKeyword());
@ -300,7 +300,7 @@ public class StuGoodsManageCenterServiceImpl implements StuGoodsManageCenterServ
* @param stuGoodsInfoDTO * @param stuGoodsInfoDTO
* @param files * @param files
*/ */
private StuGoodsInfoDTO insertBatch(StuGoodsInfoDTO stuGoodsInfoDTO, List<MultipartFile> files) { private StuGoodsManageInfoDTO insertBatch(StuGoodsManageInfoDTO stuGoodsInfoDTO, List<MultipartFile> files) {
StringBuilder imageUpload = new StringBuilder(); StringBuilder imageUpload = new StringBuilder();
for (int i = 0; i < files.size(); i++) { for (int i = 0; i < files.size(); i++) {
String upload = fileUtil.upload(files.get(i)); String upload = fileUtil.upload(files.get(i));

@ -213,8 +213,7 @@ public class StuGoodsTradingCenterServiceImpl implements StuGoodsTradingCenterSe
} }
// TODO: 2024/10/28 3、生成订单信息并删除所结算商品在购物车中的信息,商品管理信息更新 // TODO: 2024/10/28 3、生成订单信息并删除所结算商品在购物车中的信息,商品管理信息更新
for (StuShoppingCartInfo stuShoppingCartInfo:shoppingCartInfos) { for (StuShoppingCartInfo stuShoppingCartInfo:shoppingCartInfos) {//生成订单信息
//生成订单信息
StuGoodsOrderInfo stuGoodsOrderInfo=new StuGoodsOrderInfo(); StuGoodsOrderInfo stuGoodsOrderInfo=new StuGoodsOrderInfo();
//赋值 //赋值
Integer uuid= UUID.randomUUID().toString().replaceAll("-","").hashCode(); Integer uuid= UUID.randomUUID().toString().replaceAll("-","").hashCode();

Loading…
Cancel
Save