提交 70cf8533 作者: 余乾开

Merge branch 'develop'

......@@ -103,20 +103,11 @@ jobs:
git config user.name "Chuck"
git config user.email "Chuck@users.noreply.github.com"
git remote set-url origin "$GITLAB_URL"
git commit -am "Generated Image New Tag"
git commit -am "Update Image Tag"
git push origin develop
- name: Send Error Notification by WeChat
if: ${{ failure() }}
run: |
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=9be1b073-1760-442d-8e3d-faa0fd32ea16' -H 'Content-Type: application/json' -d '
{
"msgtype": "markdown",
"markdown": {
"content": "### GitHub构建并推送镜像失败 \n
> - 提交人: ${{github.actor}} \n
> - 提交信息: ${{github.event.head_commit.message}} \n
> - 提交到仓库: ${{github.repository}} \n
> - 提交到分支: ${{github.ref}} \n 请修复错误后重新提交...
"
}'
#- name: Commit files
# run: |
# git config --local user.email "Chuck@users.noreply.github.com"
# git config --local user.name "Chuck"
# git commit -am "Image Update"
......@@ -108,21 +108,11 @@ jobs:
git config user.name "Chuck"
git config user.email "Chuck@users.noreply.github.com"
git remote set-url origin "$GITLAB_URL"
git add .
git commit -m "Generated Image New Tag"
git commit -am "Update Image Tag"
git push origin master
- name: Send Error Notification by WeChat
if: ${{ failure() }}
run: |
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=9be1b073-1760-442d-8e3d-faa0fd32ea16' -H 'Content-Type: application/json' -d '
{
"msgtype": "markdown",
"markdown": {
"content": "### GitHub构建并推送镜像失败 \n
> - 提交人: ${{github.actor}} \n
> - 提交信息: ${{github.event.head_commit.message}} \n
> - 提交到仓库: ${{github.repository}} \n
> - 提交到分支: ${{github.ref}} \n 请修复错误后重新提交...
"
}'
#- name: Commit files
# run: |
# git config --local user.email "Chuck@users.noreply.github.com"
# git config --local user.name "Chuck"
# git commit -am "Image Update"
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newTag: 0617f51e1eeecaa013d138ccfee8d9a085e3c6e7
newTag: 757f0a2dc9e893e41007e7f05972b846146bb4f9
package com.mmc.pms.auth.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author small
* @Date 2023/7/4 10:55
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoDTO {
private static final long serialVersionUID = 3247519744829926132L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", example = "0")
private Integer companyType;
@ApiModelProperty(value = "单位名称", example = "科比特")
private String companyName;
@ApiModelProperty(value = "单位全称", example = "浙江科比特创新科技有限公司")
private String fullName;
@ApiModelProperty(value = "省份名称", example = "广东省")
private String province;
@ApiModelProperty(value = "城市名称", example = "深圳市")
private String city;
@ApiModelProperty(value = "县区名称", example = "南山区")
private String district;
@ApiModelProperty(value = "详细地址", example = "西丽街道万科云城国际创新谷6栋")
private String address;
@ApiModelProperty(value = "联系人", example = "lx")
private String companyUserName;
@ApiModelProperty(value = "联系电话", example = "13925255742")
private String phoneNum;
@ApiModelProperty(value = "备注")
private String remark;
}
package com.mmc.pms.auth.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/7/4 10:04
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoVO {
private static final long serialVersionUID = 3247519744829926132L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", example = "0")
private Integer companyType;
@ApiModelProperty(value = "单位名称", example = "科比特")
private String companyName;
@ApiModelProperty(value = "单位全称", example = "浙江科比特创新科技有限公司")
private String fullName;
@ApiModelProperty(value = "省份名称", example = "广东省")
private String province;
@ApiModelProperty(value = "城市名称", example = "深圳市")
private String city;
@ApiModelProperty(value = "县区名称", example = "南山区")
private String district;
@ApiModelProperty(value = "详细地址", example = "西丽街道万科云城国际创新谷6栋")
private String address;
@ApiModelProperty(value = "联系人", example = "lx")
private String companyUserName;
@ApiModelProperty(value = "联系电话", example = "13925255742")
private String phoneNum;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -26,5 +26,6 @@ public class LoginSuccessDTO implements Serializable {
private String phoneNum;
private String userName;
private String nickName;
private CompanyInfoVO companyInfoVO;
// private RoleInfoDTO roleInfo;
}
......@@ -381,10 +381,10 @@ public enum ResultEnum implements BaseErrorInfoInterface {
DIRECTORY_NAME_HAS_BEEN_EXIST("40168", "目录名称已存在"),
FAILED_TO_ADD_DATA("40169", "数据新增失败,请稍后重试"),
FAILED_TO_EDIT_DATA("40170", "数据修改失败,请稍后重试"),
SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "sku不存在或已删除,请刷新后重试!"),
PRODUCT_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "产品不存在或已删除,请刷新后重试!"),
SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40172", "规格不存在或已删除,请刷新后重试!"),
SKU_ALREADY_EXIST_IN_THIS_INDUSTRY("40173", "该所属行业下已经存在sku,请检查后重试!"),
SPEC_EXIST_UNDER_THE_SKU("40174", "该sku下有规格存在,无法删除!"),
SPEC_EXIST_UNDER_THE_SKU("40174", "该产品下有规格存在,无法删除!"),
SPEC_NOT_CONFIG_PRICE("40175", "存在规格没有配置价格,请联系客服获取报价!"),
SHOP_CAR_SIZE_MORE_2("40176", "行业购物车下单数量仅限一个"),
CONTRACT_TEMPLATE_NOT_EXIST_OR_DELETED("40177", "合同模板不存在或已删除!"),
......
......@@ -100,9 +100,11 @@ public class BackstageCategoriesController {
@GetMapping("queryRelevantBusiness")
public ResultBody queryRelevantBusiness(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryRelevantBusiness(id, type);
@ApiParam(value = "业务类型: 0、商城商品列表 1、租赁商品列表 2、服务列表 3、课程列表", required = true) @Min(value = 0)
@RequestParam(value = "type") Integer type,
@RequestParam Integer pageNo,
@RequestParam Integer pageSize) {
return ResultBody.success(categoriesService.queryRelevantBusiness(id, type,pageNo,pageSize));
}
@ApiOperation(value = "分类删除")
......
......@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
......@@ -27,15 +28,17 @@ import java.util.List;
@RestController
@RequestMapping("/goods")
@Api(tags = {"后台-商品管理-相关接口"})
public class BackstageGoodsManageController {
public class BackstageGoodsManageController extends BaseController {
@Resource private GoodsInfoService goodsInfoService;
@ApiOperation(value = "新增(租赁/销售)商品")
@PostMapping("addGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addGoods(
@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.addGoods(goodsAddVO);
@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO,
HttpServletRequest request) {
return goodsInfoService.addGoods(
goodsAddVO, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "修改(租赁/销售)商品")
......@@ -134,4 +137,12 @@ public class BackstageGoodsManageController {
@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListIndstGoodsSkuInfo(mallOrderGoodsInfoQO);
}
@ApiOperation(value = "商品列表-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchangeGoodsInfo")
public ResultBody exchangeGoodsInfo(@ApiParam(value = "第一个参数id", required = true) @RequestParam(value = "firstId") Integer firstId,
@ApiParam(value = "第二个参数id", required = true) @RequestParam(value = "secondId") Integer secondId) {
return goodsInfoService.exchangeGoodsInfo(firstId, secondId);
}
}
......@@ -15,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author LW
......@@ -27,7 +28,7 @@ import java.math.BigDecimal;
public class BackstageProductSpecController {
@Autowired private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku")
@ApiOperation(value = "新增产品")
@PostMapping("addProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addProductSku(
......@@ -35,14 +36,14 @@ public class BackstageProductSpecController {
return productSkuService.addProductSku(param);
}
@ApiOperation(value = "产品sku详情")
@ApiOperation(value = "产品详情")
@GetMapping("getProductSkuDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSkuDetail(id);
}
@ApiOperation(value = "编辑产品sku")
@ApiOperation(value = "编辑产品")
@PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku(
......@@ -57,7 +58,7 @@ public class BackstageProductSpecController {
return productSkuService.productDirectoryList();
}
@ApiOperation(value = "产品sku分页列表")
@ApiOperation(value = "产品分页列表")
@PostMapping("listPageProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) {
......@@ -101,14 +102,14 @@ public class BackstageProductSpecController {
@ApiOperation(value = "产品规格管理-价格配置")
@PostMapping("productSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody productSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
public ResultBody productSpecCPQ(@RequestBody List<ProductSpecCPQVO> productSpecCPQVO) {
return productSkuService.productSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "价格配置信息的修改")
@PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
public ResultBody updateProductSpecCPQ(@RequestBody List<ProductSpecCPQVO> productSpecCPQVO) {
return productSkuService.updateProductSpecCPQ(productSpecCPQVO);
}
......
......@@ -3,6 +3,7 @@ package com.mmc.pms.controller;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Others;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
......@@ -64,10 +65,11 @@ public class BackstageTaskServiceController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@GetMapping("queryWorkService")
public ResultBody<ServiceDTO> queryWorkService(
@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.queryById(id);
@ApiParam("作业服务id") @RequestParam(value = "id") Integer id,HttpServletRequest request) {
return backstageTaskService.queryById(id,request);
}
@ApiOperation(value = "查询服务管理列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("queryServiceManagerList")
......@@ -75,7 +77,7 @@ public class BackstageTaskServiceController extends BaseController {
@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return ResultBody.success(
backstageTaskService.queryServiceManagerList(
param, this.getUserLoginInfoFromRedis(request).getUserAccountId()));
param, this.getUserLoginInfoFromRedis(request).getUserAccountId(),this.getUserLoginInfoFromRedis(request).getCompanyInfoVO()));
}
@ApiOperation(value = "远程查询作业服务")
......@@ -93,4 +95,22 @@ public class BackstageTaskServiceController extends BaseController {
@ApiParam("分类id") @RequestBody List<Integer> categoriesId) {
return backstageTaskService.getWorkServiceCountByCategoriesId(categoriesId);
}
@ApiOperation(value = "查询作业服务数量——用于后台调用")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("queryWorkServiceCount")
public ResultBody queryWorkServiceCount(
@ApiParam("单位id") @RequestParam(value = "companyId") Integer companyId,HttpServletRequest request) {
return backstageTaskService.queryByIdCount(companyId);
}
@ApiOperation(value = "排序交换")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("exchange")
public ResultBody exchangeBannerInfo(@Validated(Others.class) @RequestBody List<ServiceVO> list) {
return backstageTaskService.exchange(list);
}
}
......@@ -43,4 +43,12 @@ public interface BackstageTaskServiceDao {
Integer batchUpAndDownWorkService(@Param("param") UpAndDownServiceVO param);
Integer getWorkServiceCountByCategoriesId(@Param("categoriesIds") List<Integer> categoriesIds);
Integer queryByIdCount(Integer companyId);
void exchange(ServiceDO serviceDO);
void exchangeSort(Integer id,Integer sort);
List<ServiceDO> queryWorkInfoByCategoryId(Integer pageNo , Integer pageSize,Integer id);
}
......@@ -68,8 +68,6 @@ public interface GoodsInfoDao {
List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids);
void insertMallProdSkuInfo(MallProdInfoDO mallProdSkuInfoDO);
void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO);
void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
......@@ -91,7 +89,7 @@ public interface GoodsInfoDao {
List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer pageNo,Integer pageSize,Integer id,int type);
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId);
......@@ -114,4 +112,8 @@ public interface GoodsInfoDao {
void updateMallProdSkuInfo(MallProdInfoDO mallProdInfoDO);
List<MallProdInfoDO> getAllMallProSkuInfo(Integer goodsInfoId);
int updateGoodsInfoSort(Integer id, Integer sort);
int countServiceByCategoryId(Integer id);
}
......@@ -11,37 +11,37 @@ import java.util.List;
*/
@Mapper
public interface MiniProgramProductMallDao {
GoodsInfoDO getGoodsInfoByGoodsId(Integer goodsId);
GoodsInfoDO getGoodsInfoByGoodsId(Integer goodsId);
List<GoodsImgDO> listGoodsInfoByGoodsId(Integer goodsId);
List<GoodsImgDO> listGoodsInfoByGoodsId(Integer goodsId);
GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsId);
GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsId);
List<GoodsQaDO> listGoodsQaInfoByGoodsId(Integer goodsId);
List<GoodsQaDO> listGoodsQaInfoByGoodsId(Integer goodsId);
List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsId);
List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsId);
List<MallProdInfoDO> getMallProdInfoByGoodsId(Integer goodsId);
List<MallProdInfoDO> getMallProdInfoByGoodsId(Integer goodsId);
List<MallProdSkuInfoSpecDO> listMallProdSkuInfoSpec(Integer goodsId);
List<MallProdSkuInfoSpecDO> listMallProdSkuInfoSpec(Integer goodsId);
List<ProductSpecDO> listProductSpecInfo(List<Integer> collect);
List<ProductSpecDO> listProductSpecInfo(List<Integer> collect);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer goodsInfoId);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer goodsInfoId);
List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId);
List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId);
int countListGoodsByQO(GoodsInfoQO param);
int countListGoodsByQO(GoodsInfoQO param);
List<GoodsInfoDO> listGoodsByQO(GoodsInfoQO param);
List<GoodsInfoDO> listGoodsByQO(GoodsInfoQO param);
List<GoodsTypeDO> listIndustryIdBySort();
List<GoodsTypeDO> listIndustryIdBySort();
List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId);
List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId);
List<InventorySpecDO> listInventorySpec(List<Integer> collect);
List<InventorySpecDO> listInventorySpec(List<Integer> collect);
ProductSpecDO getProductSpecDetail(Integer productSpecId);
ProductSpecDO getProductSpecDetail(Integer productSpecId);
ProductSkuDO getProductSkuDetail(Integer productSkuId);
ProductDO getProductSkuDetail(Integer productSkuId);
}
......@@ -26,17 +26,17 @@ public interface ProductDao {
int countSkuName(ProductSkuVO param);
int insertProductSku(ProductSkuDO productSkuDO);
int insertProductSku(ProductDO productDO);
int countSkuIsExist(Integer id);
int countProductIsExist(Integer id);
ProductSkuDO getProductSkuDetail(Integer id);
ProductDO getProductDetail(Integer id);
int updateProductSku(ProductSkuDO productSkuDO);
int updateProductSku(ProductDO productDO);
int countListPageProductSku(ProductSkuQO productSkuQO);
List<ProductSkuDO> listPageProductSku(ProductSkuQO productSkuQO);
List<ProductDO> listPageProductSku(ProductSkuQO productSkuQO);
int countSpecName(ProductSpecVO param);
......@@ -53,7 +53,7 @@ public interface ProductDao {
List<ProductSpecDO> listPageProductSpec(
@Param(value = "pageNo") Integer pageNo,
@Param(value = "pageSize") Integer pageSize,
@Param(value = "productSkuId") Integer productSkuId,
@Param(value = "productId") Integer productId,
@Param(value = "keyword") String keyword);
int batchInsertSpecPrice(List<ProductSpecPriceDO> list);
......@@ -68,7 +68,7 @@ public interface ProductDao {
List<ProductSpecDO> listProductSpec(Integer id);
List<ProductSkuDO> listProductSkuDO(List<Integer> productSkuId);
List<ProductDO> listProductSkuDO(List<Integer> productId);
List<InventorySpecDO> listInventorySpecInfo(List<Integer> industryProductInventoryIds);
......@@ -78,8 +78,6 @@ public interface ProductDao {
int countProductSpecByBrandId(Integer id);
int countSpecByProdSkuId(Integer id);
void removeProductSku(Integer id);
void removeProductSpec(Integer id);
......@@ -88,7 +86,7 @@ public interface ProductDao {
List<InventorySpecDO> listInventorySpec(Integer id);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
List<BigDecimal> feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
......@@ -103,7 +101,7 @@ public interface ProductDao {
ProductSpecPriceDTO feignGetUnitPrice(Integer id, Integer tagId);
List<ProductSpecDO> getProductSpecList(List<Integer> productSkuIds);
List<ProductSpecDO> getProductSpecList(List<Integer> productIds);
List<MallProdSkuInfoSpecDO> getProductSpecByIds(List<Integer> delProductSpecId);
......@@ -119,5 +117,10 @@ public interface ProductDao {
List<DirectoryDO> productDirectoryList();
List<ProductSpecPriceDO> listAllProductSpecPriceByType(@Param("prodSkuSpecIds") Set<Integer> prodSkuSpecIds);
List<ProductSpecPriceDO> listAllProductSpecPriceByType(
@Param("prodSkuSpecIds") Set<Integer> prodSkuSpecIds);
int countSpecByProdSkuId(Integer id);
BigDecimal getMarketplacePrice(PriceAcquisition priceAcquisition);
}
......@@ -37,12 +37,14 @@ public interface WebDeviceDao {
int countListWareInfoPage(
@Param("categoryIds") List<Integer> categoryIds,
@Param("userIds") List<Integer> userIds,
@Param("type") Integer type);
@Param("type") Integer type,
@Param("goodsName")String goodsName);
List<GoodsInfo> listWareInfoPage(
@Param("param") WareInfoQO param,
@Param("userIds") List<Integer> userIds,
@Param("type") Integer type);
@Param("type") Integer type,
@Param("goodsName")String goodsName);
WareInfoDO getWareInfoById(Integer id);
......
......@@ -55,12 +55,10 @@ public class MallIndustrySkuInfoDO implements Serializable {
return GoodsSpecDTO.builder()
.id(this.id)
.goodsSpecName(this.industrySkuSpecName)
.categoryId(this.categoriesId)
.chooseType(this.chooseType)
.skuUnitId(skuUnitId)
.unitName(this.unitName)
.skuId(this.industrySkuId)
.typeName(this.typeName)
.skuName(this.industrySkuName)
.must(must)
.build();
......
......@@ -21,7 +21,7 @@ public class MallProdInfoDO implements Serializable {
private static final long serialVersionUID = 3667714765929443857L;
private Integer id;
private Integer goodsInfoId;
private Integer prodSkuId;
private Integer productId;
private String prodSkuSpecName;
private Integer categoriesId;
private Integer chooseType;
......@@ -52,13 +52,11 @@ public class MallProdInfoDO implements Serializable {
public GoodsSpecDTO buildGoodsSpecDTO() {
return GoodsSpecDTO.builder()
.id(this.id)
.skuId(this.productId)
.goodsSpecName(this.prodSkuSpecName)
.categoryId(this.categoriesId)
.chooseType(this.chooseType)
.skuUnitId(skuUnitId)
.unitName(this.unitName)
.skuId(this.prodSkuId)
.typeName(this.typeName)
.must(must)
.skuName(this.productSkuName)
.brandInfoId(brandInfoId)
......
......@@ -17,52 +17,39 @@ import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class ProductSkuDO implements Serializable {
private static final long serialVersionUID = -2830786012593215477L;
private Integer id;
private String productName;
private Integer categoriesId;
private String model;
private Date createTime;
private Date updateTime;
private Integer brandInfoId;
private Integer deleted;
private Integer customize;
private Integer directoryId;
/**
* 辅助字段 begin
*/
private String categoryName;
private String directoryName;
private String brandName;
/**
* 辅助字段 end
*/
public ProductSkuDO(ProductSkuVO param) {
this.id = param.getId();
this.categoriesId = param.getCategoryId();
this.model = param.getModel();
this.productName = param.getProductName();
this.brandInfoId = param.getProductBrandId();
this.directoryId = param.getDirectoryId();
}
public ProductSkuDTO buildProductSkuDTO() {
return ProductSkuDTO.builder()
.id(this.id)
.productName(this.productName)
.model(this.model)
.productBrand(this.brandName)
.createTime(this.createTime)
.categoriesId(categoriesId)
.productBrandId(brandInfoId)
.directoryId(directoryId)
.categoryName(this.categoryName)
.directoryName(directoryName)
.build();
}
public class ProductDO implements Serializable {
private static final long serialVersionUID = -2830786012593215477L;
private Integer id;
private String productName;
private String model;
private Date createTime;
private Date updateTime;
private Integer brandInfoId;
private Integer deleted;
private Integer customize;
private Integer type;
/** 辅助字段 begin */
private String brandName;
/** 辅助字段 end */
public ProductDO(ProductSkuVO param) {
this.id = param.getId();
this.model = param.getModel();
this.productName = param.getProductName();
this.brandInfoId = param.getProductBrandId();
this.type = param.getType();
}
public ProductSkuDTO buildProductSkuDTO() {
return ProductSkuDTO.builder()
.id(this.id)
.productName(this.productName)
.model(this.model)
.productBrand(this.brandName)
.createTime(this.createTime)
.productBrandId(brandInfoId)
.type(this.type)
.build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.sale.dto.MallProductSpecDTO;
import com.mmc.pms.model.sale.dto.ProductSpecDTO;
import com.mmc.pms.model.sale.dto.ProductSpecVO;
import com.mmc.pms.model.sale.dto.MallProductSpecDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -19,46 +19,46 @@ import java.util.Date;
@AllArgsConstructor
@Accessors(chain = true)
public class ProductSpecDO implements Serializable {
private static final long serialVersionUID = -5476701567447257133L;
private Integer id;
private Integer productSkuId;
private String specName;
private String specImage;
private String partNo;
private String versionDesc;
private Date createTime;
private Date updateTime;
private Integer deleted;
private static final long serialVersionUID = -5476701567447257133L;
private Integer id;
private Integer productId;
private String specName;
private String specImage;
private String partNo;
private String versionDesc;
private Date createTime;
private Date updateTime;
private Integer deleted;
public ProductSpecDO(ProductSpecVO param) {
this.id = param.getId();
this.productSkuId = param.getProductSkuId();
this.specName = param.getSpecName();
this.specImage = param.getSpecImage();
this.partNo = param.getPartNo();
this.versionDesc = param.getVersionDesc();
}
public ProductSpecDO(ProductSpecVO param) {
this.id = param.getId();
this.productId = param.getProductSkuId();
this.specName = param.getSpecName();
this.specImage = param.getSpecImage();
this.partNo = param.getPartNo();
this.versionDesc = param.getVersionDesc();
}
public ProductSpecDTO buildProductSpecDTO() {
return ProductSpecDTO.builder()
.id(this.id)
.productSkuId(this.productSkuId)
.specName(this.specName)
.specImage(this.specImage)
.partNo(this.partNo)
.versionDesc(this.versionDesc)
.createTime(this.createTime)
.build();
}
public ProductSpecDTO buildProductSpecDTO() {
return ProductSpecDTO.builder()
.id(this.id)
.productSkuId(this.productId)
.specName(this.specName)
.specImage(this.specImage)
.partNo(this.partNo)
.versionDesc(this.versionDesc)
.createTime(this.createTime)
.build();
}
public MallProductSpecDTO buildMallProductSpecDTO() {
return MallProductSpecDTO.builder()
.productSpec(this.id)
.productSkuId(this.productSkuId)
.specName(this.specName)
.specImage(this.specImage)
.partNo(this.partNo)
.versionDesc(this.versionDesc)
.build();
}
public MallProductSpecDTO buildMallProductSpecDTO() {
return MallProductSpecDTO.builder()
.productSpec(this.id)
.productSkuId(this.productId)
.specName(this.specName)
.specImage(this.specImage)
.partNo(this.partNo)
.versionDesc(this.versionDesc)
.build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.vo.RelevanceServiceInfoVO;
import com.mmc.pms.model.group.Others;
import com.mmc.pms.model.work.vo.ServiceVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -7,6 +9,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
......@@ -61,6 +64,14 @@ public class ServiceDO implements Serializable {
@ApiModelProperty(value = "逻辑删除字段")
private Integer isDeleted;
@ApiModelProperty(value = "单位id")
private Integer companyId;
@ApiModelProperty(value = "顺序")
@NotNull(message = "sort不能为空", groups = { Others.class})
private Integer sort;
public ServiceDO(ServiceVO param, Integer accountId) {
this(param);
this.accountId = accountId;
......@@ -76,10 +87,9 @@ public class ServiceDO implements Serializable {
this.shareCard = param.getShareCard();
this.video = param.getVideo();
this.serviceIntroduction = param.getServiceIntroduction();
this.companyId=param.getCompanyId();
}
public ServiceDO(Integer id, Integer accountId) {
this.id = id;
this.accountId = accountId;
public RelevanceServiceInfoVO buildRelevanceServiceInfoVO(){
return RelevanceServiceInfoVO.builder().id(id).name(serviceName).shelf(displayState).videoUrl(video).build();
}
}
......@@ -17,4 +17,7 @@ import java.util.List;
public interface ImsAppApi {
@GetMapping("/release/curriculum/feignCurriculumInfoList")
List<CurriculumInfoVO> feignCurriculumInfoList(@RequestParam Integer categoriesId);
@GetMapping("/release/curriculum/feignCountCurriculumInfo")
int feignCountCurriculumInfo(@RequestParam Integer categoriesId);
}
......@@ -3,8 +3,11 @@ package com.mmc.pms.feign;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.CompanyInfoDTO;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import com.mmc.pms.model.qo.CompanyInfoQO;
import com.mmc.pms.model.qo.UserAccountQO;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections4.CollectionUtils;
......@@ -67,4 +70,17 @@ public interface UserAppApi {
*/
@PostMapping("/userapp/user-account/feignListAppUserAccount")
List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO, @RequestHeader("token") String token);
/**
* 获取单位数据
* @param id
* @param token
* @return
*/
@GetMapping("/userapp/company/getCompanyInfoById")
String getCompanyInfoById(@ApiParam(value = "单位", required = true) @RequestParam Integer id, @RequestHeader("token") String token);
@PostMapping("/userapp/company/listCompanyPageBack")
List<CompanyInfoVO> listCompanyPage(@ApiParam(value = "单位查询QO", required = true) @RequestBody CompanyInfoQO companyInfoQO, @RequestHeader("token") String token);
}
......@@ -18,4 +18,10 @@ public class ImsApiHystrix implements ImsAppApi {
log.error("熔断:feignCurriculumInfoList:{}", categoriesId);
return null;
}
@Override
public int feignCountCurriculumInfo(Integer categoriesId) {
log.error("熔断:feignCountCurriculumInfo:{}", categoriesId);
return 0;
}
}
package com.mmc.pms.feign.hystrix;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.CompanyInfoDTO;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.qo.CompanyInfoQO;
import com.mmc.pms.model.qo.UserAccountQO;
import lombok.extern.slf4j.Slf4j;
......@@ -37,4 +40,16 @@ public class UserAppApiHystrix implements UserAppApi {
log.error("熔断:feignListAppUserAccount:{}", userAccountQO);
return null;
}
@Override
public String getCompanyInfoById(Integer id, String token) {
log.error("熔断:feignListAppUserAccount:{}", id);
return null;
}
@Override
public List<CompanyInfoVO> listCompanyPage(CompanyInfoQO companyInfoQO, String token) {
log.error("熔断:feignListAppUserAccount:{}", companyInfoQO);
return null;
}
}
......@@ -71,4 +71,8 @@ public class CurriculumInfoVO implements Serializable {
@ApiModelProperty(value = "课程详情")
private String detailContent;
public RelevanceCurriculumVO buildRelevanceCurriculumVO(){
return RelevanceCurriculumVO.builder().id(id).curriculumUrl(surfaceUrl).curriculumName(curriculumName).build();
}
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.model.categories.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -15,6 +16,7 @@ import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class RelevanceCurriculumVO implements Serializable {
@ApiModelProperty(value = "id")
......@@ -22,7 +24,10 @@ public class RelevanceCurriculumVO implements Serializable {
@ApiModelProperty(value = "课程名称")
private String curriculumName;
// 课程图片
// 状态
@ApiModelProperty(value = "课程图片")
private String curriculumUrl;
@ApiModelProperty(value = "状态")
private String status;
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.model.categories.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -15,11 +16,10 @@ import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class RelevanceServiceInfoVO implements Serializable {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "服务编号")
private String number;
@ApiModelProperty(value = "服务名称")
private String name;
@ApiModelProperty(value = "视频")
......
package com.mmc.pms.model.group;
/**
* @Author small
* @Date 2023/7/5 16:55
* @Version 1.0
*/
public @interface Others {
}
......@@ -5,6 +5,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author 23214
*/
......@@ -12,9 +14,6 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public class PriceAcquisition {
@ApiModelProperty(value = "用户id")
private Integer userId;
@ApiModelProperty(value = "规格id")
private Integer specsId;
......@@ -22,6 +21,6 @@ public class PriceAcquisition {
private Integer day;
@ApiModelProperty(value = "渠道等级id")
private Integer channelLevelId;
private List<Integer> channelLevelId;
}
\ No newline at end of file
package com.mmc.pms.model.qo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Page;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/7/4 13:37
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoQO {
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
}
......@@ -13,30 +13,36 @@ import java.io.Serializable;
/**
* @Author LW
* @date 2022/9/26 11:13
* 概要:
*
* @date 2022/9/26 11:13 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProductSkuQO implements Serializable {
private static final long serialVersionUID = 7548828456935084794L;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品类型")
private Integer categoryId;
@ApiModelProperty(value = "产品目录")
private Integer directoryId;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
private static final long serialVersionUID = 7548828456935084794L;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "归属商品 0:商城商品 1:租赁商品")
private Integer type;
@ApiModelProperty(value = "页码", required = true)
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
......@@ -65,4 +65,10 @@ public class ServiceQO implements Serializable {
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
@ApiModelProperty(value = "部门id", required = true)
private Integer companyId;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", required = true)
private Integer companyType;
}
......@@ -23,6 +23,9 @@ public class WareInfoQO implements Serializable {
@ApiModelProperty(name = "districtId", value = "地域id", example = "440000")
private Integer provinceId;
@ApiModelProperty(name = "goodsName", value = "商品名称", example = "6")
private String goodsName;
@ApiModelProperty(name = "categoryId", value = "分类id")
private List<Integer> categoryId;
......
......@@ -27,12 +27,6 @@ public class GoodsSpecDTO implements Serializable {
@ApiModelProperty(value = "规格名称")
private String goodsSpecName;
@ApiModelProperty(value = "产品或行业类型")
private Integer categoryId;
@ApiModelProperty(value = "产品或行业类型名称")
private String typeName;
@ApiModelProperty(value = "产品或行业skuId")
private Integer skuId;
......
......@@ -18,38 +18,29 @@ import java.util.List;
@AllArgsConstructor
@Builder
public class ProductSkuDTO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品类型id")
private Integer categoriesId;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "产品类型名称")
private String categoryName;
@ApiModelProperty(value = "产品品牌")
private String productBrand;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "产品品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "产品品牌")
private String productBrand;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "产品品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "归属商品 0:商城商品 1:租赁商品")
private Integer type;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
@ApiModelProperty(value = "目录名称")
private String directoryName;
@ApiModelProperty(value = "产品规格信息对象")
private List<ProductSpecDTO> productSpecList;
@ApiModelProperty(value = "产品规格信息对象")
private List<ProductSpecDTO> productSpecList;
}
......@@ -17,26 +17,29 @@ import java.io.Serializable;
@NoArgsConstructor
@AllArgsConstructor
public class ProductSkuVO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
@NotNull(message = "修改时id不能为空", groups = {Update.class})
private Integer id;
@NotNull(message = "产品名称不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品名称")
private String productName;
@NotNull(message = "产品类型id不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品类型id")
private Integer categoryId;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
@NotNull(
message = "修改时id不能为空",
groups = {Update.class})
private Integer id;
@NotNull(
message = "产品名称不能为空",
groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品名称")
private String productName;
@NotNull(
message = "归属商品不能为空",
groups = {Create.class})
@ApiModelProperty(value = "归属商品")
private Integer type;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "品牌id")
private Integer productBrandId;
}
......@@ -25,7 +25,7 @@ public class ProductSpecVO implements Serializable {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "productSkuId")
@ApiModelProperty(value = "产品id")
@NotNull(message = "修改时productSkuId不能为空", groups = {Create.class})
private Integer productSkuId;
......
......@@ -28,9 +28,9 @@ public class GoodsProdSpecVO implements Serializable {
@ApiModelProperty(value = "产品类型id")
private Integer categoryId;
@ApiModelProperty(value = "产品:自定义时此字段可不用填写")
@ApiModelProperty(value = "产品:新增自定义时此字段可不用填写")
private Integer skuId;
@ApiModelProperty(value = "规格来源 0:获取 1:自定义")
private Integer flag;
......
......@@ -18,6 +18,4 @@ public class SpecPriceVO implements Serializable {
private Integer id;
private Integer cooperationTag;
private BigDecimal price;
private Integer productSpecId;
private Integer leaseTerm;
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.model.work.dto;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.group.Others;
import com.mmc.pms.model.work.vo.ServiceVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -9,6 +10,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
......@@ -73,6 +75,15 @@ public class ServiceDTO implements Serializable {
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "单位id")
private Integer companyId;
@ApiModelProperty(value = "单位名称")
private String companyName;
@ApiModelProperty(value = "顺序")
private Integer sort;
public ServiceDTO(ServiceVO param, Integer accountId) {
this.id = param.getId();
this.serviceName = param.getServiceName();
......@@ -116,6 +127,25 @@ public class ServiceDTO implements Serializable {
this.accountId = serviceDO.getAccountId();
this.createTime = serviceDO.getCreateTime();
this.updateTime = serviceDO.getUpdateTime();
this.companyId=serviceDO.getCompanyId();
this.sort=serviceDO.getSort();
}
public ServiceDTO(ServiceDO serviceDO,String companyName) {
this.id = serviceDO.getId();
this.serviceName = serviceDO.getServiceName();
this.applicationId = serviceDO.getApplicationId();
this.industryId = serviceDO.getIndustryId();
this.displayState = serviceDO.getDisplayState();
this.coverPlan = serviceDO.getCoverPlan();
this.shareCard = serviceDO.getShareCard();
this.video = serviceDO.getVideo();
this.serviceIntroduction = serviceDO.getServiceIntroduction();
this.accountId = serviceDO.getAccountId();
this.createTime = serviceDO.getCreateTime();
this.updateTime = serviceDO.getUpdateTime();
this.companyId=serviceDO.getCompanyId();
this.companyName=companyName;
}
}
......@@ -45,12 +45,18 @@ public class WorkServiceDTO implements Serializable {
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
@ApiModelProperty(value = "公司名称")
@ApiModelProperty(value = "部门名称")
private String companyName;
@ApiModelProperty(value = "部门id")
private Integer companyId;
@ApiModelProperty(value = "评论列表")
private List<InspComtDO> inspComtList;
@ApiModelProperty(value = "评论数量")
private Integer inspComtAmount;
@ApiModelProperty(value = "排序")
private Integer sort;
}
package com.mmc.pms.model.work.vo;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Others;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -28,7 +29,7 @@ public class ServiceVO implements Serializable {
@NotNull(
message = "修改服务id不能为空",
groups = {Update.class})
groups = {Update.class, Others.class})
private Integer id;
@ApiModelProperty(value = "服务名称", example = "服务名称")
......@@ -67,4 +68,11 @@ public class ServiceVO implements Serializable {
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
@ApiModelProperty(value = "单位id")
private Integer companyId;
@ApiModelProperty(value = "顺序")
@NotNull(message = "sort不能为空", groups = { Others.class})
private Integer sort;
}
package com.mmc.pms.service;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
......@@ -22,9 +23,9 @@ public interface BackstageTaskService {
ResultBody deleteByIds(List<Integer> ids);
ResultBody<ServiceDTO> queryById(Integer id);
ResultBody<ServiceDTO> queryById(Integer id,HttpServletRequest request);
PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId);
PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId, CompanyInfoVO companyInfoDTO);
PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request);
......@@ -33,4 +34,8 @@ public interface BackstageTaskService {
ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param);
Integer getWorkServiceCountByCategoriesId(List<Integer> ids);
ResultBody queryByIdCount(Integer id);
ResultBody exchange(List<ServiceVO> list);
}
......@@ -2,8 +2,6 @@ package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.DistrictDO;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
......@@ -11,7 +9,6 @@ import com.mmc.pms.model.sale.vo.QueryClassifyVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
......@@ -37,7 +34,7 @@ public interface CategoriesService {
ResultBody getClassifyDetails(Integer id);
ResultBody queryRelevantBusiness(Integer id, Integer type);
PageResult queryRelevantBusiness(Integer id, Integer type,Integer pageNo,Integer pageSize);
ResultBody deleteRelevantBusiness(Integer id);
......
......@@ -21,7 +21,7 @@ import java.util.List;
*/
public interface GoodsInfoService {
ResultBody addGoods(GoodsAddVO goodsAddVO);
ResultBody addGoods(GoodsAddVO goodsAddVO, Integer userAccountId);
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
......@@ -46,4 +46,6 @@ public interface GoodsInfoService {
ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
ResultBody batchRemoveWareInfo(List<Integer> ids);
ResultBody exchangeGoodsInfo(Integer firstId, Integer secondId);
}
package com.mmc.pms.service.Impl;
import com.mmc.pms.service.WebAndMiniProgramCategoryService;
import org.springframework.stereotype.Service;
/**
* @Author LW
* @date 2023/6/7 13:51
* 概要:
*/
@Service
public class WebAndMiniProgramCategoryServiceImpl implements WebAndMiniProgramCategoryService {
}
......@@ -34,11 +34,11 @@ public interface ProductSkuService {
ResultBody listPageProductSpec(
Integer pageNo, Integer pageSize, Integer productSkuId, String keyword);
ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody productSpecCPQ(List<ProductSpecCPQVO> productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO);
ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody updateProductSpecCPQ(List<ProductSpecCPQVO> productSpecCPQVO);
ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
......
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.mmc.pms.auth.dto.CompanyInfoDTO;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.DateConstant;
import com.mmc.pms.dao.BackstageTaskServiceDao;
......@@ -10,6 +15,7 @@ import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.qo.CompanyInfoQO;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.dto.WorkServiceDTO;
......@@ -25,6 +31,7 @@ import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
......@@ -54,7 +61,8 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
@Override
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
ServiceDO serviceDO = new ServiceDO(param, userAccountId);
backstageTaskServiceDao.insert(serviceDO);
Integer insert = backstageTaskServiceDao.insert(serviceDO);
backstageTaskServiceDao.exchangeSort(serviceDO.getId(),serviceDO.getId());
return ResultBody.success();
}
......@@ -74,9 +82,16 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
}
@Override
public ResultBody<ServiceDTO> queryById(Integer id) {
public ResultBody<ServiceDTO> queryById(Integer id, HttpServletRequest request) {
ServiceDO serviceDO = backstageTaskServiceDao.queryById(id);
ServiceDTO serviceDTO = new ServiceDTO(serviceDO);
String token =
userAppApi.getCompanyInfoById(serviceDO.getCompanyId(), request.getHeader("token"));
JSONObject jsonObject = JSONObject.parseObject(token);
CompanyInfoDTO companyInfoDTO =
JSON.parseObject(
String.valueOf((JSONObject) jsonObject.get("result")), CompanyInfoDTO.class);
String companyName = companyInfoDTO.getCompanyName();
ServiceDTO serviceDTO = new ServiceDTO(serviceDO, companyName);
Map<Integer, String> categoriesNameMap =
getCategoriesNameByIds(
Arrays.asList(serviceDTO.getApplicationId(), serviceDTO.getIndustryId()));
......@@ -107,7 +122,10 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
}
@Override
public PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId) {
public PageResult queryServiceManagerList(
ServiceQO param, Integer userAccountId, CompanyInfoVO companyInfoVO) {
param.setCompanyId(companyInfoVO.getId());
param.setCompanyType(companyInfoVO.getCompanyType());
int count = backstageTaskServiceDao.count(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
......@@ -140,6 +158,7 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
}
@Override
@Transactional
public PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request) {
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
......@@ -159,7 +178,7 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
List<ServiceDO> pageList =
backstageTaskServiceDao.queryPageByLimit(param, categoriesIds, userIds);
List<WorkServiceDTO> workServiceDTOList = getWorkServiceDTOS(pageList);
List<WorkServiceDTO> workServiceDTOList = getWorkServiceDTOS(pageList, request);
return PageResult.buildPage(pageNo, param.getPageSize(), count, workServiceDTOList);
}
......@@ -184,24 +203,53 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
return backstageTaskServiceDao.getWorkServiceCountByCategoriesId(ids);
}
private List<WorkServiceDTO> getWorkServiceDTOS(List<ServiceDO> pageList) {
// 用户暂时无关联公司数据,先用假数据展示
String companyName = "浙江科比特创新科技有限公司";
@Override
public ResultBody queryByIdCount(Integer companyId) {
return ResultBody.success(backstageTaskServiceDao.queryByIdCount(companyId));
}
@Transactional
@Override
public ResultBody exchange(List<ServiceVO> list) {
Integer sort = list.get(0).getSort();
ServiceDO serviceDO = new ServiceDO();
serviceDO.setId(list.get(0).getId());
serviceDO.setSort(list.get(1).getSort());
backstageTaskServiceDao.exchange(serviceDO);
ServiceDO serviceDO1 = new ServiceDO();
serviceDO1.setId(list.get(1).getId());
serviceDO1.setSort(sort);
backstageTaskServiceDao.exchange(serviceDO1);
return ResultBody.success();
}
private List<WorkServiceDTO> getWorkServiceDTOS(List<ServiceDO> pageList,HttpServletRequest request) {
List<CompanyInfoVO> companyInfoList = userAppApi.listCompanyPage(new CompanyInfoQO(1, 100000), request.getHeader("token"));
String companyName = "";
List<WorkServiceDTO> workServiceDTOList = new ArrayList<>();
for (ServiceDO item : pageList) {
for (CompanyInfoVO companyInfoVO : companyInfoList) {
if (item.getCompanyId().equals(companyInfoVO.getId())){
companyName=companyInfoVO.getCompanyName();
break;
}
}
List<InspComtDO> inspComtDOS = generateComments(item);
WorkServiceDTO workServiceDTO =
WorkServiceDTO.builder()
.id(item.getId())
.serviceName(item.getServiceName())
.companyName(companyName)
.coverPlan(item.getCoverPlan())
.serviceIntroduction(item.getServiceIntroduction())
.video(item.getVideo())
.shareCard(item.getShareCard())
.inspComtList(inspComtDOS)
.inspComtAmount(inspComtDOS.size())
.build();
WorkServiceDTO.builder()
.id(item.getId())
.serviceName(item.getServiceName())
.companyId(item.getCompanyId())
.companyName(companyName)
.sort(item.getSort())
.coverPlan(item.getCoverPlan())
.serviceIntroduction(item.getServiceIntroduction())
.video(item.getVideo())
.shareCard(item.getShareCard())
.inspComtList(inspComtDOS)
.inspComtAmount(inspComtDOS.size())
.build();
workServiceDTOList.add(workServiceDTO);
}
return workServiceDTOList;
......
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
......@@ -17,82 +17,78 @@ import java.util.stream.Collectors;
/**
* @Author LW
* @date 2023/3/14 13:27
* 概要:
*
* @date 2023/3/14 13:27 概要:
*/
@Service
public class BrandManageServiceImpl implements BrandManageService {
@Autowired
private BrandManageDao brandManageDao;
@Resource
private ProductDao productDao;
@Autowired private BrandManageDao brandManageDao;
@Resource private ProductDao productDao;
/**
* 添加品牌信息
*
* @param brandName 品牌名称
* @return {@link ResultBody}
*/
@Override
public ResultBody addBrandInfo(String brandName) {
// 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(null, brandName);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandManageDao.insertBrandInfo(brandInfoDO);
return ResultBody.success();
/**
* 添加品牌信息
*
* @param brandName 品牌名称
* @return {@link ResultBody}
*/
@Override
public ResultBody addBrandInfo(String brandName) {
// 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(null, brandName);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandManageDao.insertBrandInfo(brandInfoDO);
return ResultBody.success();
}
/**
* 品牌列表信息
*
* @return {@link ResultBody}
*/
@Override
public PageResult listBrandInfo(Integer pageNo, Integer pageSize) {
int count = brandManageDao.countBrandInfo();
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, 0);
}
int itemIndex = (pageNo - 1) * pageSize;
List<BrandInfoDO> brandInfo = brandManageDao.listBrandInfo(itemIndex, pageSize);
List<BrandInfoDTO> brandInfoList = brandInfo.stream()
.map(BrandInfoDO::buildBrandInfoDTO)
.collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, brandInfoList);
/**
* 品牌列表信息
*
* @return {@link ResultBody}
*/
@Override
public PageResult listBrandInfo(Integer pageNo, Integer pageSize) {
int count = brandManageDao.countBrandInfo();
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, 0);
}
int itemIndex = (pageNo - 1) * pageSize;
List<BrandInfoDO> brandInfo = brandManageDao.listBrandInfo(itemIndex, pageSize);
List<BrandInfoDTO> brandInfoList =
brandInfo.stream().map(BrandInfoDO::buildBrandInfoDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, brandInfoList);
}
/**
* 删除品牌信息
*
* @param id id
* @return {@link ResultBody}
*/
@Override
public ResultBody deleteBrandInfo(Integer id) {
// 判断该品牌是否绑定产品信息
int count = productDao.countProductSpecByBrandId(id);
if (count > 0) {
return ResultBody.error(ResultEnum.BRAND_DELETE_FAIL);
}
brandManageDao.removeBrandInfoById(id);
return ResultBody.success();
/**
* 删除品牌信息
*
* @param id id
* @return {@link ResultBody}
*/
@Override
public ResultBody deleteBrandInfo(Integer id) {
// 判断该品牌是否绑定产品信息
int count = productDao.countProductSpecByBrandId(id);
if (count > 0) {
return ResultBody.error(ResultEnum.BRAND_DELETE_FAIL);
}
brandManageDao.removeBrandInfoById(id);
return ResultBody.success();
}
@Override
public ResultBody editBrandInfo(Integer id, String brandName) {
// 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(id, brandName);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandInfoDO.setId(id);
brandManageDao.updateBrandInfo(brandInfoDO);
return ResultBody.success();
@Override
public ResultBody editBrandInfo(Integer id, String brandName) {
// 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(id, brandName);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandInfoDO.setId(id);
brandManageDao.updateBrandInfo(brandInfoDO);
return ResultBody.success();
}
}
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.BackstageTaskServiceDao;
import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.dao.DirectoryDao;
import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.GoodsInfo;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.feign.ImsAppApi;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.dto.CategoriesDTO;
......@@ -45,7 +47,8 @@ public class CategoriesServiceImpl implements CategoriesService {
@Resource private GoodsInfoDao goodsInfoDao;
@Autowired private DirectoryDao directoryDao;
@Autowired private BackstageTaskService backstageTaskService;
@Autowired private ImsAppApi appApi;
@Autowired private BackstageTaskServiceDao backstageTaskServiceDao;
@Autowired private ImsAppApi imsAppApi;
@Override
public ResultBody addOrEditDirectory(DirectoryInfoVO param) {
......@@ -191,23 +194,68 @@ public class CategoriesServiceImpl implements CategoriesService {
}
@Override
public ResultBody queryRelevantBusiness(Integer id, Integer type) {
public PageResult queryRelevantBusiness(Integer id, Integer type,Integer pageNo,Integer pageSize) {
RelevantBusinessVO relevantBusinessVO = new RelevantBusinessVO();
switch (type) {
case 0:
List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id);
if (CollectionUtils.isNotEmpty(goodsInfo)) {
int count = goodsInfoDao.countGoodsInfoByCategoryId(id);
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, count);
}
List<GoodsInfo> mallGoodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId((pageNo - 1) * pageSize, pageSize,id,0);
if (CollectionUtils.isNotEmpty(mallGoodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(
goodsInfo.stream()
mallGoodsInfo.stream()
.map(GoodsInfo::buildRelevanceGoodsInfoVO)
.collect(Collectors.toList()));
return ResultBody.success(relevantBusinessVO);
return PageResult.buildPage(pageNo,pageSize,count,relevantBusinessVO);
}
break;
case 1:
int countOne = goodsInfoDao.countGoodsInfoByCategoryId(id);
if (countOne == 0) {
return PageResult.buildPage(pageNo, pageSize, countOne);
}
List<GoodsInfo> leaseTermGoodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId((pageNo - 1) * pageSize, pageSize,id,1);
if (CollectionUtils.isNotEmpty(leaseTermGoodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(
leaseTermGoodsInfo.stream()
.map(GoodsInfo::buildRelevanceGoodsInfoVO)
.collect(Collectors.toList()));
return PageResult.buildPage(pageNo,pageSize,countOne,relevantBusinessVO);
}
break;
case 2:
int countTwo = goodsInfoDao.countServiceByCategoryId(id);
if (countTwo == 0) {
return PageResult.buildPage(pageNo, pageSize, countTwo);
}
List<ServiceDO> serviceList = backstageTaskServiceDao.queryWorkInfoByCategoryId((pageNo - 1) * pageSize,pageSize,id);
if (CollectionUtils.isNotEmpty(serviceList)) {
relevantBusinessVO.setRelevanceServiceInfoVOs(
serviceList.stream().map(ServiceDO :: buildRelevanceServiceInfoVO)
.collect(Collectors.toList()));
return PageResult.buildPage(pageNo,pageSize,countTwo,relevantBusinessVO);
}
break;
case 3 :
int countThree = imsAppApi.feignCountCurriculumInfo(id);
if (countThree == 0){
return PageResult.buildPage(pageNo, pageSize, countThree);
}
List<CurriculumInfoVO> curriculumList = imsAppApi.feignCurriculumInfoList(id);
if(CollectionUtils.isNotEmpty(curriculumList)){
relevantBusinessVO.setRelevanceCurriculumVOs(curriculumList
.stream().skip((pageNo - 1) * pageSize).limit(pageSize)
.map(CurriculumInfoVO::buildRelevanceCurriculumVO)
.collect(Collectors.toList()));
return PageResult.buildPage(pageNo, pageSize, countThree,relevantBusinessVO);
}
break;
default:
return ResultBody.error("输入类型有误!");
throw new RuntimeException("输入类型有误!");
}
return ResultBody.success();
return PageResult.buildPage(pageNo,pageSize,0);
}
@Override
......@@ -271,7 +319,7 @@ public class CategoriesServiceImpl implements CategoriesService {
if (taskCount > 0) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE);
}
List<CurriculumInfoVO> curriculumInfo = appApi.feignCurriculumInfoList(id);
List<CurriculumInfoVO> curriculumInfo = imsAppApi.feignCurriculumInfoList(id);
if (CollectionUtils.isNotEmpty(curriculumInfo)) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE);
}
......
package com.mmc.pms.service.Impl;
import com.alibaba.fastjson2.JSONObject;
package com.mmc.pms.service.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.GoodsInfoDao;
......@@ -22,15 +20,15 @@ import com.mmc.pms.util.TDateUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author 23214
* @description 针对表【goods_info(商品基本信息)】的数据库操作Service实现
* @description 针对表【goods_info(商品基本信息)】的数据库操作Service实现de
* @createDate 2023-05-27 14:08:45
*/
@Service
......@@ -46,7 +44,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody addGoods(GoodsAddVO goodsAddVO) {
public ResultBody addGoods(GoodsAddVO goodsAddVO, Integer userAccountId) {
// 判断商品名称是否存在
if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
......@@ -118,10 +116,10 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
MallProdInfoDO mallProdSkuInfoDO =
new MallProdInfoDO(goodsSpecVO)
.setProdSkuId(goodsSpecVO.getSkuId())
.setProductId(goodsSpecVO.getSkuId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息
goodsInfoDao.insertMallProdSkuInfo(mallProdSkuInfoDO);
productDao.insertMallProdSkuInfo(mallProdSkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
......@@ -140,7 +138,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
GoodsInfo goodsInfo, GoodsProdSpecVO goodsSpec, Integer id) {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setGoodsInfoId(goodsInfo.getId());
mallProdInfoDO.setProdSkuId(id);
mallProdInfoDO.setProductId(id);
mallProdInfoDO.setProdSkuSpecName(goodsSpec.getGoodsSpecName());
mallProdInfoDO.setCategoriesId(goodsSpec.getCategoryId());
mallProdInfoDO.setChooseType(goodsSpec.getChooseType());
......@@ -155,12 +153,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 遍历自定义规格信息
for (GoodsProdSpecVO productSpec : customGoodsSpecList) {
// 构建商品对应的sku信息
ProductSkuDO productSkuDO =
new ProductSkuDO()
.setCategoriesId(productSpec.getCategoryId())
.setProductName(productSpec.getProductName())
.setCustomize(1)
.setDirectoryId(goodsInfo.getDirectoryId());
ProductDO productSkuDO =
new ProductDO().setProductName(productSpec.getProductName()).setCustomize(1);
// 插入产品sku信息
productDao.insertProductSku(productSkuDO);
MallProdInfoDO mallProdInfoDO =
......@@ -173,7 +167,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
param -> {
ProductSpecDO productSpecDO =
new ProductSpecDO()
.setProductSkuId(productSkuDO.getId())
.setProductId(productSkuDO.getId())
.setVersionDesc("自定义")
.setSpecImage(param.getSpecImage())
.setSpecName(param.getSpecName())
......@@ -383,31 +377,35 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional(rollbackFor = Exception.class)
public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) {
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
// 1.1先获取用户输入的商品绑定sku的id集合
List<GoodsProdSpecVO> productSpec = goodsAddVO.getProductSpec();
// 获取不为空的产品规格
List<GoodsProdSpecVO> prod = productSpec.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
List<Integer> inputMallSkuIds =
prod.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList());
// 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds =
mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds);
}
// 1、普通的sku修改逻辑
List<GoodsProdSpecVO> specInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> !spec.getFlag().equals(1))
.collect(Collectors.toList());
goodsAddVO.getProductSpec().stream()
.filter(spec -> !spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(specInfo)) {
// 1.1先获取用户输入的商品绑定sku的id集合
List<GoodsProdSpecVO> updateGoodsSpec =
specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
List<Integer> inputMallSkuIds =
updateGoodsSpec.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList());
// 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds =
mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds);
}
specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
// 修改商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfoList =
updateGoodsSpec.stream()
......@@ -416,7 +414,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO
.setId(d.getId())
.setProdSkuId(d.getSkuId())
.setProductId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setProdSkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType())
......@@ -492,83 +490,71 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional(rollbackFor = Exception.class)
public void updateCustomize(GoodsInfo goodsInfo, List<GoodsProdSpecVO> zdySpecInfo, Integer id) {
// 先获取自定义的sku及规格(原来有的)
// 获取自定义产品及规格信息(获取带id的)
List<GoodsProdSpecVO> zdySpec =
zdySpecInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(zdySpec)) {
// 根据获取到的自定义sku及规格进行操作
List<MallProdInfoDO> zdySpecList =
zdySpec.stream()
.map(
d -> {
// 构建商品对应的sku信息
ProductSkuDO productSkuDO =
new ProductSkuDO()
.setId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setProductName(d.getProductName());
productDao.updateProductSku(productSkuDO);
return new MallProdInfoDO(d).setId(d.getId()).setProdSkuId(d.getSkuId());
})
.collect(Collectors.toList());
// 批量修改sku的信息
for (MallProdInfoDO mallProdInfoDO : zdySpecList) {
zdySpecInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(zdySpec)) {
for (GoodsProdSpecVO d : zdySpec) {
// 修改产品的规格基本信息
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO(d).setId(d.getId()).setProductId(d.getSkuId());
goodsInfoDao.updateMallProdSkuInfo(mallProdInfoDO);
}
// goodsInfoDao.batchUpdateMallProdSkuInfo(zdySpecList);
}
for (GoodsProdSpecVO goodsSpecVO : zdySpec) {
// 【1】获取输入的自定义规格信息// id不为空则修改
List<ProductSpecVO> customizeInfoList =
goodsSpecVO.getCustomizeInfo().stream()
.filter(d -> d.getId() != null)
.collect(Collectors.toList());
for (ProductSpecVO d : customizeInfoList) {
// ①修改价格配置
ProductSpecCPQVO productSpecCPQVO = d.getProductSpecCPQVO();
// 删除所有的随后在新增
productDao.removeProductSpecCPQ(productSpecCPQVO);
productSkuService.insertSpecPrice(productSpecCPQVO);
// ②在修改自定义的数据
productDao.updateProductSpec(new ProductSpecDO(d));
}
// 【2】删除多余的自定义规格
if (!CollectionUtils.isEmpty(goodsSpecVO.getDelProductSpecId())) {
// 批量查出spec的数据
List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList =
productDao.getProductSpecByIds(goodsSpecVO.getDelProductSpecId());
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) {
productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId());
// 构建商品对应的产品信息
ProductDO productSkuDO =
new ProductDO().setId(d.getSkuId()).setProductName(d.getProductName());
productDao.updateProductSku(productSkuDO);
List<ProductSpecVO> customizeInfoList =
d.getCustomizeInfo().stream()
.filter(e -> e.getId() != null)
.collect(Collectors.toList());
// 【2】删除多余的自定义规格
if (!CollectionUtils.isEmpty(d.getDelProductSpecId())) {
// 批量查出spec的数据
List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList =
productDao.getProductSpecByIds(d.getDelProductSpecId());
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) {
productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId());
}
goodsInfoDao.batchUpdateMallProdSpec(d.getDelProductSpecId());
}
for (ProductSpecVO e : customizeInfoList) {
// ①修改价格配置
ProductSpecCPQVO productSpecCPQVO = e.getProductSpecCPQVO();
// 删除所有的随后在新增
productDao.removeProductSpecCPQ(productSpecCPQVO);
productSkuService.insertSpecPrice(productSpecCPQVO);
ProductSpecDO productSpecDO = new ProductSpecDO(e);
productSpecDO.setId(productSpecCPQVO.getProductSpecId());
// ②在修改自定义的数据
productDao.updateProductSpec(productSpecDO);
}
// 【3】新增最新的自定义规格
List<ProductSpecVO> collect =
d.getCustomizeInfo().stream()
.filter(e -> e.getId() == null)
.collect(Collectors.toList());
for (ProductSpecVO param : collect) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
productDao.insertProductSpec(productSpecDO);
// 批量配置价格信息
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO);
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(productSpecDO.getId())
.setMallProdSkuInfoId(d.getId())
.setGoodsInfoId(id);
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
goodsInfoDao.batchUpdateMallProdSpec(goodsSpecVO.getDelProductSpecId());
}
// 【3】新增最新的自定义规格
List<ProductSpecVO> collect =
goodsSpecVO.getCustomizeInfo().stream()
.filter(d -> d.getId() == null)
.collect(Collectors.toList());
for (ProductSpecVO param : collect) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
productDao.insertProductSpec(productSpecDO);
// 批量配置价格信息
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO);
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(productSpecDO.getId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(id);
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
// 2.2 新增新的自定义规格信息
List<GoodsProdSpecVO> newZdySpec =
zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(newZdySpec)) {
productSkuSpecOperation(goodsInfo, newZdySpec);
}
......@@ -949,9 +935,11 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 查询商品信息
List<OrderGoodsProdDTO> orderGoodsProdDTOList =
productDao.listProdGoodsSkuInfo(mallOrderGoodsInfoQO);
//填充价格
List<ProductSpecPriceDO> allProductSpecPriceDOS = productDao.listAllProductSpecPriceByType(prodSkuSpecIds);
this.buildProductSpecPrice(orderGoodsProdDTOList, allProductSpecPriceDOS, mallOrderGoodsInfoQO.getCooperationTagIds());
// 填充价格
List<ProductSpecPriceDO> allProductSpecPriceDOS =
productDao.listAllProductSpecPriceByType(prodSkuSpecIds);
this.buildProductSpecPrice(
orderGoodsProdDTOList, allProductSpecPriceDOS, mallOrderGoodsInfoQO.getCooperationTagIds());
// 还需配置商品规格金额, 单个商品skuSpecAmount, 全部小sku金额
List<Integer> goodsIds =
orderGoodsProdDTOList.stream()
......@@ -983,19 +971,26 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
/**
* 填充产品规格价格
*
* @param orderGoodsProdDTOList
* @param allProductSpecPriceDOS
* @param cooperationTagIds
*/
private void buildProductSpecPrice(List<OrderGoodsProdDTO> orderGoodsProdDTOList, List<ProductSpecPriceDO> allProductSpecPriceDOS,
List<Integer> cooperationTagIds){
Map<Integer, List<ProductSpecPriceDO>> productSpecPriceMap = allProductSpecPriceDOS.stream()
private void buildProductSpecPrice(
List<OrderGoodsProdDTO> orderGoodsProdDTOList,
List<ProductSpecPriceDO> allProductSpecPriceDOS,
List<Integer> cooperationTagIds) {
Map<Integer, List<ProductSpecPriceDO>> productSpecPriceMap =
allProductSpecPriceDOS.stream()
.collect(Collectors.groupingBy(ProductSpecPriceDO::getProductSpecId));
for (OrderGoodsProdDTO orderGoodsProdDTO : orderGoodsProdDTOList) {
for (OrderGoodsProdDetailDTO prodDetailDTO : orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) {
List<ProductSpecPriceDO> specPriceDOS = productSpecPriceMap.get(prodDetailDTO.getProductSpecId());
for (OrderGoodsProdDetailDTO prodDetailDTO :
orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) {
List<ProductSpecPriceDO> specPriceDOS =
productSpecPriceMap.get(prodDetailDTO.getProductSpecId());
if (CollectionUtils.isNotEmpty(specPriceDOS)) {
List<ProductSpecPriceDO> tempSpecPrice = specPriceDOS.stream()
List<ProductSpecPriceDO> tempSpecPrice =
specPriceDOS.stream()
.filter(d -> cooperationTagIds.contains(d.getCooperationTag()))
.sorted(Comparator.comparing(ProductSpecPriceDO::getPrice))
.collect(Collectors.toList());
......@@ -1124,4 +1119,19 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
goodsInfoDao.removeWareInfo(ids);
return ResultBody.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody exchangeGoodsInfo(Integer firstId, Integer secondId) {
GoodsInfo firstGoodsInfoDO = goodsInfoDao.getGoodsSimpleInfo(firstId);
GoodsInfo secondGoodsInfoDO = goodsInfoDao.getGoodsSimpleInfo(secondId);
int updateCount1 = goodsInfoDao.updateGoodsInfoSort(firstId, secondGoodsInfoDO.getSort());
int updateCount2 = goodsInfoDao.updateGoodsInfoSort(secondId, firstGoodsInfoDO.getSort());
if (updateCount1 == updateCount2) {
return ResultBody.success();
} else {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("排序失败");
}
}
}
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
......@@ -6,13 +6,8 @@ import com.mmc.pms.dao.BrandManageDao;
import com.mmc.pms.dao.IndustrySpecDao;
import com.mmc.pms.dao.ProductDao;
import com.mmc.pms.entity.*;
import com.mmc.pms.model.sale.dto.ProductInventoryVO;
import com.mmc.pms.model.sale.dto.ProductSpecVO;
import com.mmc.pms.model.sale.dto.RemoveSkuDTO;
import com.mmc.pms.model.qo.IndustrySkuQO;
import com.mmc.pms.model.sale.dto.IndustrySpecCPQVO;
import com.mmc.pms.model.sale.dto.IndustrySpecDTO;
import com.mmc.pms.model.sale.dto.IndustrySpecPriceDTO;
import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.vo.GoodsProductSkuVO;
import com.mmc.pms.model.sale.vo.IndustrySkuVO;
import com.mmc.pms.model.sale.vo.IndustrySpecVO;
......@@ -31,428 +26,478 @@ import java.util.stream.Collectors;
/**
* @Author LW
* @date 2022/10/8 10:58
* 概要:
*
* @date 2022/10/8 10:58 概要:
*/
@Service
public class IndustrySpecServiceImpl implements IndustrySpecService {
@Autowired
IndustrySpecDao industrySpecDao;
@Autowired
ProductDao productDao;
@Autowired IndustrySpecDao industrySpecDao;
@Autowired ProductDao productDao;
@Autowired
private BrandManageDao brandManageDao;
@Autowired private BrandManageDao brandManageDao;
@Override
public ResultBody addIndustrySku(IndustrySkuVO param) {
// 获取名称判断此前是否已经存在
int count = industrySpecDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
IndustrySku industrySku = new IndustrySku(param);
// 新增产品sku
int status = industrySpecDao.insertIndustrySku(industrySku);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
return ResultBody.success();
@Override
public ResultBody addIndustrySku(IndustrySkuVO param) {
// 获取名称判断此前是否已经存在
int count = industrySpecDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
@Override
public ResultBody getIndustrySkuDetail(Integer id) {
// 判断此sku是否还存在
int count = industrySpecDao.countIndustrySkuById(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
IndustrySku IndustrySku = industrySpecDao.getIndustrySkuById(id);
return ResultBody.success(IndustrySku.buildIndustrySku());
IndustrySku industrySku = new IndustrySku(param);
// 新增产品sku
int status = industrySpecDao.insertIndustrySku(industrySku);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
return ResultBody.success();
}
@Override
public ResultBody editIndustrySku(IndustrySkuVO param) {
// 判断此sku是否还存在
int count = industrySpecDao.countIndustrySkuById(param.getId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 获取名称判断此前是否已经存在
int skuNameCount = industrySpecDao.countSkuName(param);
if (skuNameCount > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
IndustrySku IndustrySku = new IndustrySku(param);
// 新增产品sku
int status = industrySpecDao.updateIndustrySku(IndustrySku);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
return ResultBody.success();
@Override
public ResultBody getIndustrySkuDetail(Integer id) {
// 判断此sku是否还存在
int count = industrySpecDao.countIndustrySkuById(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.PRODUCT_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
IndustrySku IndustrySku = industrySpecDao.getIndustrySkuById(id);
return ResultBody.success(IndustrySku.buildIndustrySku());
}
@Override
public ResultBody listPageIndustrySku(IndustrySkuQO param) {
int count = industrySpecDao.countListPageIndustrySku(param);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<IndustrySku> industrySkuList = industrySpecDao.listPageIndustrySku(param);
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count,
industrySkuList.stream()
.map(IndustrySku::buildIndustrySkuDTO)
.collect(Collectors.toList())));
@Override
public ResultBody editIndustrySku(IndustrySkuVO param) {
// 判断此sku是否还存在
int count = industrySpecDao.countIndustrySkuById(param.getId());
if (count <= 0) {
return ResultBody.error(ResultEnum.PRODUCT_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 获取名称判断此前是否已经存在
int skuNameCount = industrySpecDao.countSkuName(param);
if (skuNameCount > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
IndustrySku IndustrySku = new IndustrySku(param);
// 新增产品sku
int status = industrySpecDao.updateIndustrySku(IndustrySku);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
return ResultBody.success();
}
/**
* 新增方案规格
*
* @param param
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody addIndustrySpec(IndustrySpecVO param) {
// 获取名称判断此前是否已经存在
int count = industrySpecDao.countSpecName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 新增规格表信息
IndustrySpecDO industrySpecDO = new IndustrySpecDO(param);
int status = industrySpecDao.insertIndustrySpec(industrySpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
// 新增规格绑定产品sku表信息
addInventorySpec(param, industrySpecDO);
return ResultBody.success();
@Override
public ResultBody listPageIndustrySku(IndustrySkuQO param) {
int count = industrySpecDao.countListPageIndustrySku(param);
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<IndustrySku> industrySkuList = industrySpecDao.listPageIndustrySku(param);
return ResultBody.success(
PageResult.buildPage(
pageNo,
param.getPageSize(),
count,
industrySkuList.stream()
.map(IndustrySku::buildIndustrySkuDTO)
.collect(Collectors.toList())));
}
private void addInventorySpec(IndustrySpecVO param, IndustrySpecDO industrySpecDO) {
for (ProductInventoryVO d : param.getProductInventoryList()) {
IndustryProductInventoryDO industryProductInventoryDO = new IndustryProductInventoryDO(d);
industryProductInventoryDO.setIndustrySpecId(industrySpecDO.getId());
industrySpecDao.insertIndustryProductInventory(industryProductInventoryDO);
// 新增清单绑定的产品规格信息
// 判断该sku是否指定产品规格 0:未指定 1:指定
if (d.getSelect().equals(0)) {
// 如果是表示不指定则要添加所有对sku下的所有产品规格
// 先查出该sku下的所有规格信息
List<ProductSpecDO> productSpecList = productDao.listProductSpec(d.getProductSku().getId());
// 批量插入
for (ProductSpecDO productSpecDO : productSpecList) {
InventorySpecDO inventorySpecDO = new InventorySpecDO();
inventorySpecDO.setIndustryProductInventoryId(industryProductInventoryDO.getId());
inventorySpecDO.setProductSpecId(productSpecDO.getId());
inventorySpecDO.setProductSkuId(productSpecDO.getProductSkuId());
industrySpecDao.insertInventorySpec(inventorySpecDO);
}
} else {
// 指定的直接拿指定的数据
for (ProductSpecVO productSpecVO : d.getProductSpecList()) {
InventorySpecDO inventorySpecDO = new InventorySpecDO();
inventorySpecDO.setIndustryProductInventoryId(industryProductInventoryDO.getId());
inventorySpecDO.setProductSpecId(productSpecVO.getId());
inventorySpecDO.setProductSkuId(productSpecVO.getProductSkuId());
industrySpecDao.insertInventorySpec(inventorySpecDO);
}
}
}
/**
* 新增方案规格
*
* @param param
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody addIndustrySpec(IndustrySpecVO param) {
// 获取名称判断此前是否已经存在
int count = industrySpecDao.countSpecName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 新增规格表信息
IndustrySpecDO industrySpecDO = new IndustrySpecDO(param);
int status = industrySpecDao.insertIndustrySpec(industrySpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
// 新增规格绑定产品sku表信息
addInventorySpec(param, industrySpecDO);
return ResultBody.success();
}
/**
* 获取行业规格信息
*
* @param industrySpecId
* @return
*/
@Override
public ResultBody getIndustrySpecDetail(Integer industrySpecId) {
// 查询当前行业规格是否存在
int count = industrySpecDao.countIndustrySpec(industrySpecId);
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
private void addInventorySpec(IndustrySpecVO param, IndustrySpecDO industrySpecDO) {
for (ProductInventoryVO d : param.getProductInventoryList()) {
IndustryProductInventoryDO industryProductInventoryDO = new IndustryProductInventoryDO(d);
industryProductInventoryDO.setIndustrySpecId(industrySpecDO.getId());
industrySpecDao.insertIndustryProductInventory(industryProductInventoryDO);
// 新增清单绑定的产品规格信息
// 判断该sku是否指定产品规格 0:未指定 1:指定
if (d.getSelect().equals(0)) {
// 如果是表示不指定则要添加所有对sku下的所有产品规格
// 先查出该sku下的所有规格信息
List<ProductSpecDO> productSpecList = productDao.listProductSpec(d.getProductSku().getId());
// 批量插入
for (ProductSpecDO productSpecDO : productSpecList) {
InventorySpecDO inventorySpecDO = new InventorySpecDO();
inventorySpecDO.setIndustryProductInventoryId(industryProductInventoryDO.getId());
inventorySpecDO.setProductSpecId(productSpecDO.getId());
inventorySpecDO.setProductSkuId(productSpecDO.getProductId());
industrySpecDao.insertInventorySpec(inventorySpecDO);
}
// 初始化行业规格DTO
IndustrySpecDTO industrySpecDTO;
// 获取行业规格的基本信息
IndustrySpecDO industrySpec = industrySpecDao.getIndustrySpecById(industrySpecId);
industrySpecDTO = industrySpec.buildIndustrySpecDTO();
// 获取这个规格下的产品sku信息
List<IndustryProductInventoryDO> industryProductInventory = industrySpecDao.getIndustryProductInventory(industrySpecId);
// 获取产品skuId
List<Integer> productSkuId = industryProductInventory.stream().map(IndustryProductInventoryDO::getProductSkuId).collect(Collectors.toList());
// 分别查出产品sku的详细信息
List<ProductSkuDO> productSkuList = productDao.listProductSkuDO(productSkuId);
// 查出产品sku对应的品牌的信息
Set<Integer> brandInfoIds = productSkuList.stream().map(ProductSkuDO::getBrandInfoId).collect(Collectors.toSet());
List<BrandInfoDO> brandInfoList = brandManageDao.listBrandInfoByIds(brandInfoIds);
// 拿到行业产品清单id的集合
List<Integer> industryProductInventoryIds = industryProductInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList());
// 再分别查出产品规格id
List<InventorySpecDO> inventorySpecList = productDao.listInventorySpecInfo(industryProductInventoryIds);
if (inventorySpecList.size() != 0) {
// 获取所有产品规格id
List<Integer> productSpecIds = inventorySpecList.stream().map(InventorySpecDO::getProductSpecId).collect(Collectors.toList());
// 根据这些规格id查询规格信息
List<ProductSpecDO> productSpecInfoList = productDao.listProductSpecInfo(productSpecIds);
// 构建产品规格信息
List<ProductSpecVO> productSpecList = productSpecInfoList.stream().map(d -> {
ProductSpecVO productSpecVO = new ProductSpecVO();
productSpecVO.setSpecImage(d.getSpecImage());
productSpecVO.setProductSkuId(d.getProductSkuId());
productSpecVO.setSpecName(d.getSpecName());
productSpecVO.setId(d.getId());
productSpecVO.setPartNo(d.getPartNo());
productSpecVO.setVersionDesc(d.getVersionDesc());
return productSpecVO;
}).collect(Collectors.toList());
// 根据产品skuId分组
Map<Integer, List<ProductSpecVO>> maps = productSpecList.stream().collect(Collectors.groupingBy(ProductSpecVO::getProductSkuId));
// 构建其余产品清单的信息
List<ProductInventoryVO> list = new ArrayList<>();
for (IndustryProductInventoryDO d : industryProductInventory) {
for (ProductSkuDO e : productSkuList) {
GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
goodsProductSkuVO.setId(d.getId());
goodsProductSkuVO.setCategoryName(e.getCategoryName());
goodsProductSkuVO.setProductName(e.getProductName());
for (BrandInfoDO b : brandInfoList) {
if (e.getBrandInfoId().equals(b.getId())) {
goodsProductSkuVO.setProductBrand(b.getBrandName());
break;
}
}
goodsProductSkuVO.setGoodsTypeId(e.getCategoriesId());
goodsProductSkuVO.setModel(e.getModel());
ProductInventoryVO productInventoryVO = new ProductInventoryVO();
productInventoryVO.setProductSku(goodsProductSkuVO);
if (d.getProductSkuId().equals(e.getId())) {
// 匹配分组之后id相等的数据构建到ProductInventoryVO对象中
List<ProductSpecVO> productSpecVOS = maps.get(e.getId());
productInventoryVO.setProductSpecList(productSpecVOS);
productInventoryVO.setSelect(d.getSelected());
productInventoryVO.setProductSkuId(d.getProductSkuId());
list.add(productInventoryVO);
}
}
}
// 组装产品清单
industrySpecDTO.setProductInventoryList(list);
} else {
// 指定的直接拿指定的数据
for (ProductSpecVO productSpecVO : d.getProductSpecList()) {
InventorySpecDO inventorySpecDO = new InventorySpecDO();
inventorySpecDO.setIndustryProductInventoryId(industryProductInventoryDO.getId());
inventorySpecDO.setProductSpecId(productSpecVO.getId());
inventorySpecDO.setProductSkuId(productSpecVO.getProductSkuId());
industrySpecDao.insertInventorySpec(inventorySpecDO);
}
return ResultBody.success(industrySpecDTO);
}
}
}
/**
* 编辑行业规格信息
*
* @param param
* @return
*/
@Override
public ResultBody editIndustrySpec(IndustrySpecVO param) {
int count = industrySpecDao.countIndustrySpec(param.getId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 获取名称判断此前是否已经存在
int countName = industrySpecDao.countSpecName(param);
if (countName > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 修改行业规格基本信息
IndustrySpecDO industrySpecDO = new IndustrySpecDO(param);
int status = industrySpecDao.updateIndustrySpec(industrySpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
// 先获取绑定的的产品skuId
List<IndustryProductInventoryDO> industryProductInventory = industrySpecDao.getIndustryProductInventory(param.getId());
List<Integer> industryProductInventoryIds = industryProductInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList());
// 批量删除原来绑定的产品规格信息
if (industryProductInventoryIds.size() != 0) {
industrySpecDao.batchDeleteInventorySpec(industryProductInventoryIds);
/**
* 获取行业规格信息
*
* @param industrySpecId
* @return
*/
@Override
public ResultBody getIndustrySpecDetail(Integer industrySpecId) {
// 查询当前行业规格是否存在
int count = industrySpecDao.countIndustrySpec(industrySpecId);
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 初始化行业规格DTO
IndustrySpecDTO industrySpecDTO;
// 获取行业规格的基本信息
IndustrySpecDO industrySpec = industrySpecDao.getIndustrySpecById(industrySpecId);
industrySpecDTO = industrySpec.buildIndustrySpecDTO();
// 获取这个规格下的产品sku信息
List<IndustryProductInventoryDO> industryProductInventory =
industrySpecDao.getIndustryProductInventory(industrySpecId);
// 获取产品skuId
List<Integer> productSkuId =
industryProductInventory.stream()
.map(IndustryProductInventoryDO::getProductSkuId)
.collect(Collectors.toList());
// 分别查出产品sku的详细信息
List<ProductDO> productSkuList = productDao.listProductSkuDO(productSkuId);
// 查出产品sku对应的品牌的信息
Set<Integer> brandInfoIds =
productSkuList.stream().map(ProductDO::getBrandInfoId).collect(Collectors.toSet());
List<BrandInfoDO> brandInfoList = brandManageDao.listBrandInfoByIds(brandInfoIds);
// 拿到行业产品清单id的集合
List<Integer> industryProductInventoryIds =
industryProductInventory.stream()
.map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList());
// 再分别查出产品规格id
List<InventorySpecDO> inventorySpecList =
productDao.listInventorySpecInfo(industryProductInventoryIds);
if (inventorySpecList.size() != 0) {
// 获取所有产品规格id
List<Integer> productSpecIds =
inventorySpecList.stream()
.map(InventorySpecDO::getProductSpecId)
.collect(Collectors.toList());
// 根据这些规格id查询规格信息
List<ProductSpecDO> productSpecInfoList = productDao.listProductSpecInfo(productSpecIds);
// 构建产品规格信息
List<ProductSpecVO> productSpecList =
productSpecInfoList.stream()
.map(
d -> {
ProductSpecVO productSpecVO = new ProductSpecVO();
productSpecVO.setSpecImage(d.getSpecImage());
productSpecVO.setProductSkuId(d.getProductId());
productSpecVO.setSpecName(d.getSpecName());
productSpecVO.setId(d.getId());
productSpecVO.setPartNo(d.getPartNo());
productSpecVO.setVersionDesc(d.getVersionDesc());
return productSpecVO;
})
.collect(Collectors.toList());
// 根据产品skuId分组
Map<Integer, List<ProductSpecVO>> maps =
productSpecList.stream().collect(Collectors.groupingBy(ProductSpecVO::getProductSkuId));
// 构建其余产品清单的信息
List<ProductInventoryVO> list = new ArrayList<>();
for (IndustryProductInventoryDO d : industryProductInventory) {
for (ProductDO e : productSkuList) {
GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
goodsProductSkuVO.setId(d.getId());
goodsProductSkuVO.setProductName(e.getProductName());
for (BrandInfoDO b : brandInfoList) {
if (e.getBrandInfoId().equals(b.getId())) {
goodsProductSkuVO.setProductBrand(b.getBrandName());
break;
}
}
goodsProductSkuVO.setModel(e.getModel());
ProductInventoryVO productInventoryVO = new ProductInventoryVO();
productInventoryVO.setProductSku(goodsProductSkuVO);
if (d.getProductSkuId().equals(e.getId())) {
// 匹配分组之后id相等的数据构建到ProductInventoryVO对象中
List<ProductSpecVO> productSpecVOS = maps.get(e.getId());
productInventoryVO.setProductSpecList(productSpecVOS);
productInventoryVO.setSelect(d.getSelected());
productInventoryVO.setProductSkuId(d.getProductSkuId());
list.add(productInventoryVO);
}
}
// 批量删除绑定的产品sku信息
industrySpecDao.deleteIndustryProductInventory(param.getId());
// 新增规格绑定产品sku表信息
addInventorySpec(param, industrySpecDO);
return ResultBody.success();
}
// 组装产品清单
industrySpecDTO.setProductInventoryList(list);
}
return ResultBody.success(industrySpecDTO);
}
/**
* 编辑行业规格信息
*
* @param param
* @return
*/
@Override
public ResultBody editIndustrySpec(IndustrySpecVO param) {
int count = industrySpecDao.countIndustrySpec(param.getId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 获取名称判断此前是否已经存在
int countName = industrySpecDao.countSpecName(param);
if (countName > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 修改行业规格基本信息
IndustrySpecDO industrySpecDO = new IndustrySpecDO(param);
int status = industrySpecDao.updateIndustrySpec(industrySpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
// 先获取绑定的的产品skuId
List<IndustryProductInventoryDO> industryProductInventory =
industrySpecDao.getIndustryProductInventory(param.getId());
List<Integer> industryProductInventoryIds =
industryProductInventory.stream()
.map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList());
// 批量删除原来绑定的产品规格信息
if (industryProductInventoryIds.size() != 0) {
industrySpecDao.batchDeleteInventorySpec(industryProductInventoryIds);
}
// 批量删除绑定的产品sku信息
industrySpecDao.deleteIndustryProductInventory(param.getId());
// 新增规格绑定产品sku表信息
addInventorySpec(param, industrySpecDO);
return ResultBody.success();
}
/**
* 列表页面行业规范
*
* @param pageNo 页面没有
* @param pageSize 页面大小
* @param industrySkuId 行业sku id
* @param keyword 关键字
* @return {@link ResultBody}
*/
@Override
public ResultBody listPageIndustrySpec(Integer pageNo, Integer pageSize, Integer industrySkuId, String keyword) {
int count = industrySpecDao.countListPageIndustrySpec(industrySkuId, keyword);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
}
List<IndustrySpecDO> industrySpecList = industrySpecDao.listPageIndustrySpec((pageNo - 1) * pageSize, pageSize, industrySkuId, keyword);
List<Integer> specIds = industrySpecList.stream().map(IndustrySpecDO::getId).collect(Collectors.toList());
// 根据规格id批量查询价格信息
List<IndustrySpecPriceDO> industrySpecPrice = industrySpecDao.getIndustrySpecPriceList(specIds);
Map<Integer, List<IndustrySpecPriceDO>> priceMap = industrySpecPrice.stream().collect(Collectors.groupingBy(IndustrySpecPriceDO::getIndustrySpecId));
List<IndustrySpecDTO> list = industrySpecList.stream().map(d -> {
IndustrySpecDTO industrySpecDTO = d.buildIndustrySpecDTO();
if (!CollectionUtils.isEmpty(priceMap.get(d.getId()))) {
industrySpecDTO.setPriceList(priceMap.get(d.getId()).stream().map(IndustrySpecPriceDO::buildIndustrySpecPriceDTO).collect(Collectors.toList()));
}
return industrySpecDTO;
}).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
/**
* 列表页面行业规范
*
* @param pageNo 页面没有
* @param pageSize 页面大小
* @param industrySkuId 行业sku id
* @param keyword 关键字
* @return {@link ResultBody}
*/
@Override
public ResultBody listPageIndustrySpec(
Integer pageNo, Integer pageSize, Integer industrySkuId, String keyword) {
int count = industrySpecDao.countListPageIndustrySpec(industrySkuId, keyword);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
}
List<IndustrySpecDO> industrySpecList =
industrySpecDao.listPageIndustrySpec(
(pageNo - 1) * pageSize, pageSize, industrySkuId, keyword);
List<Integer> specIds =
industrySpecList.stream().map(IndustrySpecDO::getId).collect(Collectors.toList());
// 根据规格id批量查询价格信息
List<IndustrySpecPriceDO> industrySpecPrice = industrySpecDao.getIndustrySpecPriceList(specIds);
Map<Integer, List<IndustrySpecPriceDO>> priceMap =
industrySpecPrice.stream()
.collect(Collectors.groupingBy(IndustrySpecPriceDO::getIndustrySpecId));
List<IndustrySpecDTO> list =
industrySpecList.stream()
.map(
d -> {
IndustrySpecDTO industrySpecDTO = d.buildIndustrySpecDTO();
if (!CollectionUtils.isEmpty(priceMap.get(d.getId()))) {
industrySpecDTO.setPriceList(
priceMap.get(d.getId()).stream()
.map(IndustrySpecPriceDO::buildIndustrySpecPriceDTO)
.collect(Collectors.toList()));
}
return industrySpecDTO;
})
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
}
/**
* 行业规格价格配置
*
* @param industrySpecCPQQ
* @return
*/
@Override
public ResultBody industrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ) {
// 判断该规格是否存在
int count = industrySpecDao.countIndustrySpec(industrySpecCPQQ.getIndustrySpecId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 批量插入规格价格
insertSpecPrice(industrySpecCPQQ);
return ResultBody.success();
/**
* 行业规格价格配置
*
* @param industrySpecCPQQ
* @return
*/
@Override
public ResultBody industrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ) {
// 判断该规格是否存在
int count = industrySpecDao.countIndustrySpec(industrySpecCPQQ.getIndustrySpecId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 批量插入规格价格
insertSpecPrice(industrySpecCPQQ);
return ResultBody.success();
}
private List<IndustrySpecPriceDO> getIndustrySpecPriceDOS(IndustrySpecCPQVO industrySpecCPQQ) {
// 批量插入规格价格
return industrySpecCPQQ.getSpecPrice().stream().map(d -> {
IndustrySpecPriceDO industrySpecPriceDO = new IndustrySpecPriceDO();
industrySpecPriceDO.setCooperationTag(d.getCooperationTag());
industrySpecPriceDO.setType(industrySpecCPQQ.getType());
industrySpecPriceDO.setPrice(d.getPrice());
if (industrySpecCPQQ.getType().equals(1)) {
private List<IndustrySpecPriceDO> getIndustrySpecPriceDOS(IndustrySpecCPQVO industrySpecCPQQ) {
// 批量插入规格价格
return industrySpecCPQQ.getSpecPrice().stream()
.map(
d -> {
IndustrySpecPriceDO industrySpecPriceDO = new IndustrySpecPriceDO();
industrySpecPriceDO.setCooperationTag(d.getCooperationTag());
industrySpecPriceDO.setType(industrySpecCPQQ.getType());
industrySpecPriceDO.setPrice(d.getPrice());
if (industrySpecCPQQ.getType().equals(1)) {
industrySpecPriceDO.setLeaseTerm(industrySpecCPQQ.getLeaseTerm());
}
industrySpecPriceDO.setIndustrySpecId(industrySpecCPQQ.getIndustrySpecId());
return industrySpecPriceDO;
}).collect(Collectors.toList());
}
}
industrySpecPriceDO.setIndustrySpecId(industrySpecCPQQ.getIndustrySpecId());
return industrySpecPriceDO;
})
.collect(Collectors.toList());
}
/**
* 行业规格价格配置修改
*
* @param industrySpecCPQQ
* @return
*/
@Override
public ResultBody updateIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ) {
// 先删除原来该规格下的所有价格配置信息
industrySpecDao.removeIndustrySpecCPQ(industrySpecCPQQ);
// 批量插入规格价格
insertSpecPrice(industrySpecCPQQ);
return ResultBody.success();
}
/**
* 行业规格价格配置修改
*
* @param industrySpecCPQQ
* @return
*/
@Override
public ResultBody updateIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ) {
// 先删除原来该规格下的所有价格配置信息
industrySpecDao.removeIndustrySpecCPQ(industrySpecCPQQ);
// 批量插入规格价格
insertSpecPrice(industrySpecCPQQ);
return ResultBody.success();
}
public ResultBody insertSpecPrice(IndustrySpecCPQVO industrySpecCPQQ) {
List<IndustrySpecPriceDO> list = getIndustrySpecPriceDOS(industrySpecCPQQ);
// 批量插入规格价格
if (industrySpecCPQQ.getType().equals(0)) {
int status = industrySpecDao.batchInsertSpecPrice(list);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
// 批量插入租赁价格
industrySpecDao.batchInsertLeaseSpecPrice(list);
}
return ResultBody.success();
public ResultBody insertSpecPrice(IndustrySpecCPQVO industrySpecCPQQ) {
List<IndustrySpecPriceDO> list = getIndustrySpecPriceDOS(industrySpecCPQQ);
// 批量插入规格价格
if (industrySpecCPQQ.getType().equals(0)) {
int status = industrySpecDao.batchInsertSpecPrice(list);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
// 批量插入租赁价格
industrySpecDao.batchInsertLeaseSpecPrice(list);
}
return ResultBody.success();
}
/**
* 获取配置价格信息
*
* @param industrySpecCPQQ 行业规范
* @return {@link ResultBody}
*/
@Override
public ResultBody getIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ) {
if (industrySpecCPQQ.getType().equals(1) && industrySpecCPQQ.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
List<IndustrySpecPriceDO> industrySpecPriceList = industrySpecDao.getIndustrySpecCPQ(industrySpecCPQQ);
List<IndustrySpecPriceDTO> list = industrySpecPriceList.stream()
.map(IndustrySpecPriceDO::buildIndustrySpecPriceDTO).collect(Collectors.toList());
return ResultBody.success(list);
/**
* 获取配置价格信息
*
* @param industrySpecCPQQ 行业规范
* @return {@link ResultBody}
*/
@Override
public ResultBody getIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ) {
if (industrySpecCPQQ.getType().equals(1) && industrySpecCPQQ.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
List<IndustrySpecPriceDO> industrySpecPriceList =
industrySpecDao.getIndustrySpecCPQ(industrySpecCPQQ);
List<IndustrySpecPriceDTO> list =
industrySpecPriceList.stream()
.map(IndustrySpecPriceDO::buildIndustrySpecPriceDTO)
.collect(Collectors.toList());
return ResultBody.success(list);
}
@Override
public ResultBody removeIndustrySku(Integer id) {
// 查询该sku下是否有行业规格存在
int specCount = industrySpecDao.countIndustrySpecBySkuId(id);
if (specCount <= 0) {
// 删除
industrySpecDao.removeIndustrySku(id);
return ResultBody.success();
} else {
return ResultBody.error(ResultEnum.SPEC_EXIST_UNDER_THE_SKU);
}
@Override
public ResultBody removeIndustrySku(Integer id) {
// 查询该sku下是否有行业规格存在
int specCount = industrySpecDao.countIndustrySpecBySkuId(id);
if (specCount <= 0) {
// 删除
industrySpecDao.removeIndustrySku(id);
return ResultBody.success();
} else {
return ResultBody.error(ResultEnum.SPEC_EXIST_UNDER_THE_SKU);
}
}
/**
* 删除行业规格
*
* @param id id
* @return {@link ResultBody}
*/
@Override
public ResultBody removeIndustrySpec(Integer id) {
// 判断该规格是否存在
int count = industrySpecDao.countIndustrySpec(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 获取该规格下绑定的商品的信息
RemoveSkuDTO removeSkuDTO = new RemoveSkuDTO();
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList = industrySpecDao.listMallIndustrySpec(id);
if (mallIndustrySkuInfoSpecList.size() != 0) {
List<String> goodsName = new ArrayList<>();
mallIndustrySkuInfoSpecList.forEach(d -> goodsName.add(d.getGoodsName()));
removeSkuDTO.setGoodsName(goodsName);
return ResultBody.success(removeSkuDTO);
} else {
// 根据规格id获取规格清单绑定的信息
List<IndustryProductInventoryDO> industryProductInventory = industrySpecDao.getIndustryProductInventory(id);
if (industryProductInventory.size() != 0) {
// 删除行业绑定的清单
industrySpecDao.removeIndustryProductInventory(industryProductInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList()));
List<Integer> ids = industryProductInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList());
List<InventorySpecDO> inventorySpecList = industrySpecDao.listInventorySpec(ids);
// 删除
industrySpecDao.removeInventorySpec(inventorySpecList.stream().map(InventorySpecDO::getId).collect(Collectors.toList()));
}
industrySpecDao.removeIndustrySpec(id);
return ResultBody.success();
}
/**
* 删除行业规格
*
* @param id id
* @return {@link ResultBody}
*/
@Override
public ResultBody removeIndustrySpec(Integer id) {
// 判断该规格是否存在
int count = industrySpecDao.countIndustrySpec(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 获取该规格下绑定的商品的信息
RemoveSkuDTO removeSkuDTO = new RemoveSkuDTO();
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList =
industrySpecDao.listMallIndustrySpec(id);
if (mallIndustrySkuInfoSpecList.size() != 0) {
List<String> goodsName = new ArrayList<>();
mallIndustrySkuInfoSpecList.forEach(d -> goodsName.add(d.getGoodsName()));
removeSkuDTO.setGoodsName(goodsName);
return ResultBody.success(removeSkuDTO);
} else {
// 根据规格id获取规格清单绑定的信息
List<IndustryProductInventoryDO> industryProductInventory =
industrySpecDao.getIndustryProductInventory(id);
if (industryProductInventory.size() != 0) {
// 删除行业绑定的清单
industrySpecDao.removeIndustryProductInventory(
industryProductInventory.stream()
.map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList()));
List<Integer> ids =
industryProductInventory.stream()
.map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList());
List<InventorySpecDO> inventorySpecList = industrySpecDao.listInventorySpec(ids);
// 删除
industrySpecDao.removeInventorySpec(
inventorySpecList.stream().map(InventorySpecDO::getId).collect(Collectors.toList()));
}
industrySpecDao.removeIndustrySpec(id);
return ResultBody.success();
}
//
// @Override
// public List<IndustrySpecPriceDTO> listAppGoodsPriceByTagId(Integer goodsInfoId, Integer tagInfoId) {
// List<IndustrySpecPriceDO> industrySpecPriceDOS = industrySpecDao.listAppGoodsPriceByTagId(goodsInfoId, tagInfoId);
// if (CollectionUtils.isEmpty(industrySpecPriceDOS)) {
// return null;
// }
// List<IndustrySpecPriceDTO> collect = industrySpecPriceDOS.stream().map(IndustrySpecPriceDO::buildIndustrySpecPriceDTO).collect(Collectors.toList());
// return collect;
// }
}
//
// @Override
// public List<IndustrySpecPriceDTO> listAppGoodsPriceByTagId(Integer goodsInfoId, Integer
// tagInfoId) {
// List<IndustrySpecPriceDO> industrySpecPriceDOS =
// industrySpecDao.listAppGoodsPriceByTagId(goodsInfoId, tagInfoId);
// if (CollectionUtils.isEmpty(industrySpecPriceDOS)) {
// return null;
// }
// List<IndustrySpecPriceDTO> collect =
// industrySpecPriceDOS.stream().map(IndustrySpecPriceDO::buildIndustrySpecPriceDTO).collect(Collectors.toList());
// return collect;
// }
}
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.mmc.pms.dao.InspComtDao;
import com.mmc.pms.entity.InspComtDO;
......@@ -10,9 +9,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 评论表 服务实现类
* </p>
*
* @author Pika
* @since 2023-06-09
......@@ -20,11 +17,10 @@ import java.util.List;
@Service
public class InspComtServiceImpl implements InspComtService {
@Autowired
private InspComtDao inspComtDao;
@Autowired private InspComtDao inspComtDao;
@Override
public List<InspComtDO> randomGetInspComtList(Integer size) {
return inspComtDao.randomGetInspComtList(size);
}
@Override
public List<InspComtDO> randomGetInspComtList(Integer size) {
return inspComtDao.randomGetInspComtList(size);
}
}
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
......@@ -100,12 +100,10 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
GoodsSpecDTO goodsSpecDTO = new GoodsSpecDTO();
goodsSpecDTO
.setId(d.getId())
.setSkuId(d.getProdSkuId())
.setSkuId(d.getProductId())
.setGoodsSpecName(d.getProdSkuSpecName())
.setSkuName(d.getProductSkuName())
.setBrandInfoId(d.getBrandInfoId())
.setCategoryId(d.getCategoriesId())
.setTypeName(d.getTypeName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setUnitName(d.getUnitName())
......@@ -190,7 +188,7 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
return productSpecVO;
})
.collect(Collectors.toList());
ProductSkuDO productSkuDetail =
ProductDO productSkuDetail =
goodsInfoDao.getProductSkuDetail(industryProductInventoryDO.getProductSkuId());
GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
BeanUtils.copyProperties(productSkuDetail, goodsProductSkuVO);
......
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
......@@ -14,6 +14,7 @@ import com.mmc.pms.service.ProductSkuService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
......@@ -37,7 +38,7 @@ public class ProductServiceImpl implements ProductSkuService {
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
ProductDO productSkuDO = new ProductDO(param);
productSkuDO.setCustomize(0);
// 新增产品sku
int status = productDao.insertProductSku(productSkuDO);
......@@ -50,11 +51,11 @@ public class ProductServiceImpl implements ProductSkuService {
@Override
public ResultBody getProductSkuDetail(Integer id) {
// 校验此sku是否还存在或已删除
int count = productDao.countSkuIsExist(id);
int count = productDao.countProductIsExist(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
return ResultBody.error(ResultEnum.PRODUCT_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSkuDO productSkuDO = productDao.getProductSkuDetail(id);
ProductDO productSkuDO = productDao.getProductDetail(id);
return ResultBody.success(productSkuDO.buildProductSkuDTO());
}
......@@ -65,7 +66,7 @@ public class ProductServiceImpl implements ProductSkuService {
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
ProductDO productSkuDO = new ProductDO(param);
int status = productDao.updateProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
......@@ -82,14 +83,14 @@ public class ProductServiceImpl implements ProductSkuService {
}
Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<ProductDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<Integer> productSkuIds =
productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
productSkuList.stream().map(ProductDO::getId).collect(Collectors.toList());
List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds);
Map<Integer, List<ProductSpecDO>> productSpecMap =
productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductId));
List<ProductSkuDTO> list =
productSkuList.stream().map(ProductSkuDO::buildProductSkuDTO).collect(Collectors.toList());
productSkuList.stream().map(ProductDO::buildProductSkuDTO).collect(Collectors.toList());
list.stream()
.peek(
d -> {
......@@ -176,14 +177,21 @@ public class ProductServiceImpl implements ProductSkuService {
}
@Override
public ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 判断该规格是否存在
int count = productDao.countSpecIsExist(productSpecCPQVO.getProductSpecId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
@Transactional(rollbackFor = Exception.class)
public ResultBody productSpecCPQ(List<ProductSpecCPQVO> productSpecCPQVO) {
for (ProductSpecCPQVO d : productSpecCPQVO) {
// 判断该规格是否存在
int count = productDao.countSpecIsExist(d.getProductSpecId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
if (d.getType().equals(1) && d.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
// 插入规格销售或租赁价格
insertSpecPrice(d);
}
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
return ResultBody.success();
}
@Override
......@@ -206,19 +214,21 @@ public class ProductServiceImpl implements ProductSkuService {
}
@Override
public ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 先删除原来该规格下的所有价格配置信息
productDao.removeProductSpecCPQ(productSpecCPQVO);
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
@Transactional(rollbackFor = Exception.class)
public ResultBody updateProductSpecCPQ(List<ProductSpecCPQVO> params) {
for (ProductSpecCPQVO productSpecCPQVO : params) {
// 先删除原来该规格下的所有价格配置信息
productDao.removeProductSpecCPQ(productSpecCPQVO);
// 调用批量插入规格销售或租赁价格
this.productSpecCPQ(params);
}
return ResultBody.success();
}
@NotNull
@Transactional(rollbackFor = Exception.class)
public ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) {
List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO);
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
// 批量插入规格销售价格
if (productSpecCPQVO.getType().equals(0)) {
productDao.batchInsertSpecPrice(list);
......@@ -231,9 +241,6 @@ public class ProductServiceImpl implements ProductSkuService {
@Override
public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
List<ProductSpecPriceDO> productSpecPriceList =
productDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list =
......@@ -306,20 +313,48 @@ public class ProductServiceImpl implements ProductSkuService {
@Override
public BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition) {
Map<Integer, Integer> dayMap = new HashMap<>();
dayMap.put(0, 7);
dayMap.put(8, 15);
dayMap.put(16, 30);
dayMap.put(31, Integer.MAX_VALUE);
Integer dayRange =
dayMap.entrySet().stream()
.filter(entry -> priceAcquisition.getDay() <= entry.getKey())
.findFirst()
.map(Map.Entry::getValue)
.orElseThrow(() -> new RuntimeException("租赁期限错误错误!"));
List<Integer> channelLevelId = priceAcquisition.getChannelLevelId();
if (channelLevelId == null){
return new BigDecimal(0);
}
// 设置时间区间
int dayRange = getDayRange(priceAcquisition.getDay());
priceAcquisition.setDay(dayRange);
return productDao.feignGetUnitPriceByTag(priceAcquisition);
// 获取市场价
BigDecimal marketplacePrice = productDao.getMarketplacePrice(priceAcquisition);
if (marketplacePrice == null) {
return new BigDecimal(0);
}
// 获取渠道价格
List<BigDecimal> price = productDao.feignGetUnitPriceByTag(priceAcquisition);
if (price.size()==0) {
return marketplacePrice;
}else {
List<BigDecimal> sortedPrice = price.stream()
.sorted(Comparator.naturalOrder())
.collect(Collectors.toList());
BigDecimal bigDecimal = sortedPrice.get(0);
if (bigDecimal.compareTo(marketplacePrice) < 0){
return bigDecimal;
}else if (bigDecimal.compareTo(marketplacePrice) > 0){
return marketplacePrice;
}else {
return marketplacePrice;
}
}
}
public int getDayRange(int day) {
if (between(day, 0 ,7)) return 0;
if (between(day, 8, 15)) return 1;
if (between(day, 16,30)) return 2;
if (day > 30) return 3;
throw new RuntimeException("租期有误!");
}
private boolean between(int num, int start, int end){
return num >= start && num <= end;
}
@Override
......
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.common.ResultBody;
......@@ -179,14 +179,14 @@ public class WebDeviceServiceImpl implements WebDeviceService {
userIds = Collections.singletonList(-1);
}
}
int count = webDeviceDao.countListWareInfoPage(param.getCategoryId(), userIds, param.getType());
int count = webDeviceDao.countListWareInfoPage(param.getCategoryId(), userIds, param.getType(),param.getGoodsName());
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfo> list = webDeviceDao.listWareInfoPage(param, userIds, param.getType());
List<GoodsInfo> list = webDeviceDao.listWareInfoPage(param, userIds, param.getType(),param.getGoodsName());
List<LeaseGoodsInfoDTO> pageList =
list.stream().map(GoodsInfo::buildLeaseGoodsInfoDTO).collect(Collectors.toList());
if (StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))) {
......
package com.mmc.pms.service.Impl;
package com.mmc.pms.service.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.dao.WebProductMallDao;
......@@ -8,7 +8,6 @@ import com.mmc.pms.entity.ProductCategory;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebProductMallService;
......
......@@ -7,8 +7,7 @@ spring:
password: MMC@2022&MYSQL
redis:
database: 1
host: r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
password: MMC@2022&REDIS
host: 127.0.0.1
port: 6379
#连接池
lettuce:
......
......@@ -63,13 +63,6 @@
insert into mall_industry_sku_info_spec(mall_industry_sku_info_id, industry_spec_id, goods_info_id)
values (#{mallIndustrySkuInfoId}, #{industrySpecId}, #{goodsInfoId})
</insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" useGeneratedKeys="true"
keyProperty="id">
insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag})
</insert>
<insert id="insertMallProdSkuInfoSpec">
insert into mall_prod_info_spec (goods_info_id, mall_prod_info_id, product_spec_id)
values (#{goodsInfoId}, #{mallProdSkuInfoId}, #{productSpecId})
......@@ -79,6 +72,7 @@
update goods_info
set goods_name = #{goodsName},
eco_label = #{ecoLabel},
directory_id = #{directoryId},
category_by_one = #{categoryByOne},
category_by_two = #{categoryByTwo},
shelf_status = #{shelfStatus}
......@@ -114,7 +108,7 @@
<foreach collection="list" item="d" separator=";" index="index">
update mall_prod_info
<set>
product_id = #{d.prodSkuId},
product_id = #{d.productId},
categories_id = #{d.categoriesId},
prod_spec_name = #{d.prodSkuSpecName},
choose_type = #{d.chooseType},
......@@ -163,7 +157,7 @@
</update>
<update id="updateMallProdSkuInfo">
update mall_prod_info
set product_id = #{prodSkuId},
set product_id = #{productId},
categories_id = #{categoriesId},
prod_spec_name = #{prodSkuSpecName},
choose_type = #{chooseType},
......@@ -171,6 +165,9 @@
is_must = #{must}
where id = #{id}
</update>
<update id="updateGoodsInfoSort">
update goods_info set sort = #{sort} where id = #{id}
</update>
<delete id="deleteGoodsServiceByGoodsId">
delete
from goods_service
......@@ -208,25 +205,21 @@
<select id="getMallProSkuInfo" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mi.id,
mi.goods_info_id,
mi.product_id prodSkuId,
mi.product_id productId,
mi.prod_spec_name prodSkuSpecName,
mi.categories_id categoriesId,
mi.choose_type chooseType,
mi.sku_unit_id skuUnitId,
mi.is_must must,
mi.flag flag,
mi.create_time createTime,
c.name typeName,
su.id skuUnitId,
su.unit_name unitName,
ps.product_name productSkuName
FROM mall_prod_info mi
INNER JOIN categories c ON c.id = mi.categories_id
INNER JOIN sku_unit su ON mi.sku_unit_id = su.id
INNER JOIN product ps ON ps.id = mi.product_id
WHERE mi.goods_info_id = #{id}
AND mi.is_deleted = 0
and flag = 0
</select>
<select id="getMallIndustrySkuInfo" resultType="com.mmc.pms.entity.MallIndustrySkuInfoDO">
SELECT mi.id,
......@@ -256,6 +249,7 @@
gi.category_by_two,
gi.shelf_status,
gi.create_time,
gi.sort,
gv.id goodsVideoId,
gv.video_url videoUrl
FROM goods_info gi
......@@ -466,7 +460,8 @@
FROM goods_info gi
INNER JOIN goods_img im ON gi.id = im.goods_info_id
AND im.img_type = 0
WHERE gi.category_by_one = #{id}
WHERE gi.category_by_one = #{id} and gi.goods_type = #{type} and gi.is_deleted = 0
limit #{pageNo},#{pageSize}
</select>
<resultMap id="resultMallProdSkuInfoSpecMap" type="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
<id property="id" column="id"/>
......@@ -576,7 +571,7 @@
</if>
</where>
ORDER BY
gi.shelf_status DESC , gi.create_time asc
gi.shelf_status DESC , gi.sort DESC
limit #{pageNo},#{pageSize}
</select>
......@@ -601,24 +596,24 @@
<select id="getAllMallProSkuInfo" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mi.id,
mi.goods_info_id,
mi.product_id prodSkuId,
mi.product_id productId,
mi.prod_spec_name prodSkuSpecName,
mi.categories_id categoriesId,
mi.choose_type chooseType,
mi.sku_unit_id skuUnitId,
mi.is_must must,
mi.flag flag,
mi.create_time createTime,
c.name typeName,
su.id skuUnitId,
su.unit_name unitName,
ps.product_name productSkuName
FROM mall_prod_info mi
INNER JOIN categories c ON c.id = mi.categories_id
INNER JOIN sku_unit su ON mi.sku_unit_id = su.id
INNER JOIN product ps ON ps.id = mi.product_id
WHERE mi.goods_info_id = #{id}
WHERE mi.goods_info_id = #{goodsInfoId}
AND mi.is_deleted = 0
ORDER BY mi.create_time asc
</select>
<select id="countServiceByCategoryId" resultType="java.lang.Integer">
select count(*) from service where (application_id = #{id} or industry_id = #{id})
</select>
</mapper>
......@@ -346,7 +346,7 @@
where id = #{id}
</select>
<select id="getProductSkuDetail" resultType="com.mmc.pms.entity.ProductSkuDO">
<select id="getProductSkuDetail" resultType="com.mmc.pms.entity.ProductDO">
SELECT ps.id,
ps.product_name productName,
ps.model,
......
......@@ -3,15 +3,15 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.ProductDao">
<insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductSkuDO"
<insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductDO"
useGeneratedKeys="true" keyProperty="id">
insert into product (product_name, categories_id, model, brand_info_id, directory_id, customize)
values (#{productName}, #{categoriesId}, #{model}, #{brandInfoId}, #{directoryId}, #{customize})
insert into product (product_name, model, brand_info_id, customize,`type`)
values (#{productName}, #{model}, #{brandInfoId}, #{customize},#{type})
</insert>
<insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true"
parameterType="com.mmc.pms.entity.ProductSpecDO">
insert into product_spec (product_id, spec_name, spec_image, part_no, version_desc)
values (#{productSkuId}, #{specName}, #{specImage}, #{partNo}, #{versionDesc})
values (#{productId}, #{specName}, #{specImage}, #{partNo}, #{versionDesc})
</insert>
<insert id="batchInsertSpecPrice" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.pms.entity.ProductSpecPriceDO">
......@@ -30,15 +30,14 @@
</insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO"
keyProperty="id" useGeneratedKeys="true">
insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, choose_type,
sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
values (#{goodsInfoId}, #{productId}, #{prodSkuSpecName}, #{chooseType}, #{skuUnitId}, #{must},
#{flag})
</insert>
<update id="updateProductSku">
update product
set product_name = #{productName},
categories_id = #{categoriesId},
model = #{model},
brand_info_id = #{brandInfoId}
where id = #{id}
......@@ -49,7 +48,7 @@
spec_image = #{specImage},
part_no = #{partNo},
version_desc = #{versionDesc},
product_id = #{productSkuId}
product_id = #{productId}
where id = #{id}
</update>
<update id="removeProductSku">
......@@ -82,23 +81,20 @@
and id <![CDATA[<>]]> #{id}
</if>
</select>
<select id="countSkuIsExist" resultType="java.lang.Integer">
<select id="countProductIsExist" resultType="java.lang.Integer">
select count(*)
from product
where id = #{id}
and is_deleted = 0
</select>
<select id="getProductSkuDetail" resultType="com.mmc.pms.entity.ProductSkuDO">
<select id="getProductDetail" resultType="com.mmc.pms.entity.ProductDO">
SELECT ps.id,
ps.product_name,
ps.model,
ps.type,
ps.create_time,
c.`name` categoryName,
d.directory_name directoryName,
bi.brand_name brandName
bi.brand_name brandName
FROM product ps
INNER JOIN categories c ON ps.categories_id = c.id
INNER JOIN `directory` d ON ps.directory_id = d.id
LEFT JOIN brand_info bi ON ps.brand_info_id = bi.id
WHERE ps.id = #{id}
</select>
......@@ -110,30 +106,22 @@
<if test="productName != null and productName !=''">
and product_name like CONCAT ('%',#{productName},'%')
</if>
<if test="categoryId != null">
and categories_id = #{categoryId}
</if>
<if test="directoryId != null">
and directory_id = #{directoryId}
<if test="type != null">
and (`type` = #{type} or `type` is null)
</if>
</where>
</select>
<select id="listPageProductSku" resultType="com.mmc.pms.entity.ProductSkuDO">
<select id="listPageProductSku" resultType="com.mmc.pms.entity.ProductDO">
SELECT
ps.id,
ps.product_name,
ps.model,
ps.create_time,
ps.brand_info_id,
ps.categories_id,
ps.directory_id,
c.`name` categoryName,
d.directory_name directoryName,
ps.type,
bi.brand_name brandName
FROM
product ps
INNER JOIN categories c ON ps.categories_id = c.id
INNER JOIN `directory` d ON ps.directory_id = d.id
LEFT JOIN brand_info bi ON ps.brand_info_id = bi.id
<where>
ps.is_deleted = 0
......@@ -141,11 +129,8 @@
<if test="productName != null and productName != ''">
and ps.product_name like CONCAT ('%',#{productName},'%')
</if>
<if test="categoryId != null">
and ps.categories_id = #{categoryId}
</if>
<if test="directoryId != null">
and ps.directory_id = #{directoryId}
<if test="type != null">
and (`type` = #{type} or `type` is null)
</if>
</where>
order by ps.create_time desc
......@@ -166,7 +151,7 @@
</select>
<select id="getProductSpecDetail" resultType="com.mmc.pms.entity.ProductSpecDO">
select id,
product_id productSkuId,
product_id productId,
spec_name specName,
spec_image specImage,
part_no partNo,
......@@ -188,7 +173,7 @@
</select>
<select id="listPageProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO">
select id,
product_id productSkuId,
product_id productId,
spec_name specName,
spec_image specImage,
part_no partNo,
......@@ -197,7 +182,7 @@
from product_spec
<where>
is_deleted = 0
and product_id = #{productSkuId}
and product_id = #{productId}
<if test="keyword != null and keyword != ''">
and spec_name like CONCAT('%',#{keyword},'%')
</if>
......@@ -213,17 +198,13 @@
create_time createTime,
lease_term
from product_spec_price
<where>
where
product_spec_id = #{productSpecId}
and `type` =#{type}
<if test="leaseTerm != null">
and lease_term = #{leaseTerm}
</if>
</where>
</select>
<select id="listProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO">
select id,
product_id productSkuId,
product_id productId,
spec_name,
spec_image,
part_no,
......@@ -231,9 +212,9 @@
create_time
from product_spec
where is_deleted = 0
and product_id = #{productSkuId}
and product_id = #{productId}
</select>
<select id="listProductSkuDO" resultType="com.mmc.pms.entity.ProductSkuDO">
<select id="listProductSkuDO" resultType="com.mmc.pms.entity.ProductDO">
SELECT ps.id,
ps.product_name productName,
ps.model,
......@@ -256,7 +237,7 @@
id,
industry_product_inventory_id industryProductInventoryId,
product_spec_id productSpecId,
product_id productSkuId
product_id productId
FROM
inventory_spec
WHERE
......@@ -269,7 +250,7 @@
<select id="listProductSpecInfo" resultType="com.mmc.pms.entity.ProductSpecDO">
SELECT
id,
product_id productSkuId,
product_id productId,
spec_name specName,
spec_image specImage,
part_no partNo,
......@@ -288,7 +269,7 @@
where brand_info_id = #{id}
and is_deleted = 0
</select>
<select id="countSpecByProdSkuId" resultType="java.lang.Integer">
<select id="countSpecByproductId" resultType="java.lang.Integer">
select count(*)
from product_spec
where product_id = #{id}
......@@ -333,14 +314,6 @@
AND mp.is_deleted = 0
AND gi.is_deleted = 0
</select>
<select id="feignGetUnitPriceByTag" resultType="java.math.BigDecimal">
select price
from product_spec_price
where product_spec_id = #{specsId}
and cooperation_tag = #{channelLevelId}
and `type` = 1
and lease_term = #{day}
</select>
<select id="listProdSpecInfo" resultType="com.mmc.pms.entity.MallGoodsSpecInfoDO">
SELECT
gi.id, gi.directory_id, mpsip.id as mallSkuInfoSpecId, mpsip.is_deleted as sku_spec_deleted, ps.spec_name,
......@@ -384,7 +357,7 @@
<select id="getProductSpecList" resultType="com.mmc.pms.entity.ProductSpecDO">
SELECT
id,
product_id productSkuId,
product_id productId,
spec_name specName,
spec_image specImage,
part_no partNo,
......@@ -452,7 +425,7 @@
gi.is_deleted,
mpsi.id as mall_prod_info_id,
mpsi.is_deleted as sku_info_deleted,
gt.name as goods_type_name,psk.id, psk.product_name,psk.model,psk.brand_info_id,
psk.id, psk.product_name,psk.model,psk.brand_info_id,
mpsis.id as mall_prod_info_spec_id,
mpsis.is_deleted as sku_spec_deleted,
psc.id as product_spec_id,psc.spec_name,psc.spec_image as prod_sku_spec_image,psc.part_no,psc.version_desc,
......@@ -466,7 +439,6 @@
INNER JOIN product_spec psc ON mpsis.product_spec_id = psc.id
INNER JOIN product psk ON psk.id = psc.product_id
INNER JOIN goods_img gimg ON gi.id = gimg.goods_info_id and gimg.img_type = 0
INNER JOIN categories gt ON psk.categories_id = gt.id
LEFT JOIN sku_unit su ON su.id = mpsi.sku_unit_id
left join brand_info bi on bi.id = psk.brand_info_id
<where>
......@@ -535,4 +507,34 @@
#{d}
</foreach>)
</select>
<select id="countSpecByProdSkuId" resultType="java.lang.Integer">
select count(*)
from product_spec
where product_id = #{id}
and is_deleted = 0
</select>
<select id="getMarketplacePrice" resultType="java.math.BigDecimal">
select product_spec_id productSpecId,
cooperation_tag cooperationTag,
price,
lease_term
from product_spec_price
where `type` = 1
and lease_term = #{day}
and cooperation_tag = 0
and product_spec_id = #{specsId}
</select>
<select id="feignGetUnitPriceByTag" resultType="java.math.BigDecimal">
select price
from product_spec_price
<where>
product_spec_id = #{specsId}
and `type` = 1
and lease_term = #{day}
<foreach collection="channelLevelId" index="index" separator="," open="and cooperation_tag in(" close=")" item="d">
#{d}
</foreach>
</where>
</select>
</mapper>
......@@ -169,6 +169,9 @@
#{user}
</foreach>
</if>
<if test="goodsName != null and goodsName != ''">
and gi.goods_name like CONCAT('%',#{goodsName},'%')
</if>
</where>
</select>
......@@ -193,8 +196,11 @@
#{user}
</foreach>
</if>
<if test="goodsName != null and goodsName != ''">
and gi.goods_name like CONCAT('%',#{goodsName},'%')
</if>
</where>
order by gi.create_time asc
order by gi.sort desc
limit #{param.pageNo},#{param.pageSize}
</select>
<select id="getWareInfoById" resultMap="wareInfoResultMap" parameterType="java.lang.Integer">
......
......@@ -18,6 +18,8 @@
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
<result property="accountId" column="account_id" jdbcType="INTEGER"/>
<result property="companyId" column="company_id" jdbcType="INTEGER"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
</resultMap>
<!--查询所有-->
......@@ -51,8 +53,9 @@
service_introduction,
create_time,
update_time,
account_id
from service
account_id,
company_id
from service
where id = #{id}
and is_deleted = 0
</select>
......@@ -61,7 +64,7 @@
<select id="queryAllByLimit" resultMap="ServiceMap" parameterType="com.mmc.pms.model.qo.ServiceQO">
select
id, service_name, application_id, industry_id, display_state, cover_plan, share_card, video,
service_introduction, create_time, update_time, account_id
service_introduction, create_time, update_time, account_id,company_id,sort
from service
<where>
is_deleted = 0
......@@ -77,8 +80,11 @@
<if test="displayState != null">
and display_state = #{displayState}
</if>
<if test="companyType==1 and companyId!=null">
and company_id = #{companyId}
</if>
</where>
order by create_time desc
order by sort desc
limit #{pageNo}, #{pageSize}
</select>
......@@ -100,15 +106,18 @@
<if test="displayState != null">
and display_state = #{displayState}
</if>
<if test="companyType==1 and companyId!=null">
and company_id = #{companyId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.mmc.pms.entity.ServiceDO">
insert into service(service_name, application_id, industry_id, display_state, cover_plan, share_card, video,
service_introduction, account_id)
service_introduction, account_id,company_id)
values (#{serviceName}, #{applicationId}, #{industryId}, #{displayState}, #{coverPlan}, #{shareCard},
#{video}, #{serviceIntroduction}, #{accountId})
#{video}, #{serviceIntroduction}, #{accountId},#{companyId})
</insert>
<!--通过主键修改数据-->
......@@ -148,6 +157,9 @@
<if test="accountId != null">
account_id = #{accountId},
</if>
<if test="companyId != null">
company_id = #{companyId},
</if>
</set>
where id = #{id}
</update>
......@@ -200,7 +212,7 @@
<select id="queryPageByLimit" resultType="com.mmc.pms.entity.ServiceDO">
select
id, service_name, application_id, industry_id, display_state, cover_plan, share_card, video,
service_introduction, create_time, update_time, account_id
service_introduction, create_time, update_time, account_id,company_id,sort
from service
<where>
is_deleted = 0 and display_state = 0
......@@ -232,9 +244,10 @@
and display_state = #{param.displayState}
</if>
</where>
order by create_time desc
order by sort desc
limit #{param.pageNo}, #{param.pageSize}
</select>
<select id="QueryWorkServiceListById" resultType="com.mmc.pms.model.work.dto.ServiceDTO">
select id,
service_name,
......@@ -283,4 +296,35 @@
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<select id="queryByIdCount" resultType="java.lang.Integer">
select count(1) from service where company_id=#{companyId} and is_deleted=0
</select>
<select id="queryWorkInfoByCategoryId" resultType="com.mmc.pms.entity.ServiceDO">
select id,service_name,display_state,video
from service
where (application_id = #{id} or industry_id = #{id})
limit #{pageNo},#{pageSize}
</select>
<update id="exchange" parameterType="com.mmc.pms.entity.ServiceDO">
update service
<set>
<if test=" sort != null ">
sort = #{sort}
</if>
</set>
where id = #{id}
</update>
<update id="exchangeSort" parameterType="com.mmc.pms.entity.ServiceDO">
update service
<set>
<if test=" sort != null ">
sort = #{sort}
</if>
</set>
where id = #{id}
</update>
</mapper>
......@@ -17,4 +17,4 @@ data-filter:
- /pms/backstage/work/feignQueryWorkServiceListById
- /pms/webDevice/getSecondDistrictInfo
- /pms/webDevice/ad
- /pms/actuator/health/readiness
\ No newline at end of file
- /pms/actuator/health/readiness
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论