Commit 0c40687a authored by 赵啸非's avatar 赵啸非

添加修改产品规划

parent 31627be4
......@@ -2,4 +2,6 @@
2023-9-11
-- ----------------------------
ALTER TABLE mortals_xhx_user ADD COLUMN `staffId` varchar(64) COMMENT '员工Id,关联用户员工表';
ALTER TABLE mortals_xhx_user ADD COLUMN `openId` varchar(64) COMMENT '微信openId';
ALTER TABLE mortals_xhx_user ADD COLUMN `serviceAprParams` varchar(1024) default '' COMMENT '事件服务接口请求参数';
ALTER TABLE mortals_xhx_user ADD COLUMN `customerId` bigint(20) COMMENT '客户ID';
......@@ -75,7 +75,7 @@
<el-table-column label="标签名称" prop="labelId">
<template slot-scope="scope">
<el-select v-model="scope.row.labelId+''" placeholder="请选择标签名称" >
<el-select v-model="scope.row.labelId" placeholder="请选择标签名称" >
<el-option
v-for="($label, $value) in dict.labels"
:key="$value"
......@@ -328,6 +328,14 @@
// 渲染前置处理
beforeRender(data) {
if(data.entity.companyLabelsList) {
data.entity.companyLabelsList.forEach(item => {
//如果相等做操作
item['labelId'] = item[ 'labelId']+ '';
})
this.companyLabelsList = data.entity.companyLabelsList;
}
if(data.entity.companyPatentsList) {
......
......@@ -57,7 +57,6 @@
return {
/** 子表列元素 */
columnSet:[
{label: "产品id", prop: "productId", formatter: this.formatter},
{label: "产品名称", prop: "productName"},
{label: "问题", prop: "question"},
{label: "常见问题回答", prop: "answer"},
......@@ -69,34 +68,20 @@
{type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
{label: "产品名称,名称唯一", prop: "productName"},
{label: "产品名称", prop: "productName"},
{label: "产品编码", prop: "productCode"},
{label: "产品分类", prop: "categoryIds",formatter: this.formatters},
{label: "产品slogan", prop: "productSlogan"},
{label: "所属企业", prop: "companyIds",formatter: this.formatters},
{label: "产品图标", prop: "productLogoPath"},
{label: "产品介绍", prop: "productIntroduction" , width: 120},
{label: "产品封面图片", prop: "productFacePath"},
{label: "发布时间", prop: "publishTime", formatter: this.formatterDate},
{label: "是否热门", prop: "hot",formatter: this.formatter},
{label: "热门", prop: "hot",formatter: this.formatter},
{label: "最近更新时间", prop: "updateTime", formatter: this.formatterDate},
{label: "创建用户", prop: "createUserId", formatter: this.formatter},
{label: "产品常见问题",
width: 120,
prop: "subColumns",
formatter: (row) => {
let widthsize = this.columnSet.reduce((pre, cur) => {
return pre + Number(cur.width);
}, 50);
return (
<el-popover placement="right" width={widthsize} trigger="click">
{this.renderTable(row.productQuestionList)}
<el-button type="text" slot="reference">详细</el-button>
</el-popover>
);
},
},
{
label: "操作",
width: 240,
......@@ -111,4 +96,4 @@
};
}
};
</script>
\ No newline at end of file
</script>
package com.mortals.xhx.module.company.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.company.model.vo.CompanyLabelsVo;
import lombok.Data;
/**
* 公司标注实体对象
*
......@@ -41,23 +46,25 @@ public class CompanyLabelsEntity extends CompanyLabelsVo {
* 备注
*/
private String remark;
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getLabelId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof CompanyLabelsEntity) {
CompanyLabelsEntity tmp = (CompanyLabelsEntity) obj;
if (this.getId() == tmp.getId()) {
if (this.getLabelId() == tmp.getLabelId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
public void initAttrValue() {
this.labelId = 0L;
this.labelName = "";
this.companyId = 0L;
......
......@@ -19,5 +19,10 @@ public class ProductVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
//所属公司
private String companyIds;
//所属企业
private String categoryIds;
}
\ No newline at end of file
package com.mortals.xhx.module.product.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.category.service.CategoryService;
import com.mortals.xhx.module.company.model.CompanyProductQuery;
import com.mortals.xhx.module.company.service.CompanyProductService;
import com.mortals.xhx.module.company.service.CompanyService;
import com.mortals.xhx.module.product.model.*;
import com.mortals.xhx.module.product.service.ProductCategoryService;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.product.dao.ProductDao;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import com.mortals.xhx.module.product.model.ProductQuestionEntity;
import com.mortals.xhx.module.product.model.ProductQuestionQuery;
import com.mortals.xhx.module.product.service.ProductQuestionService;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* ProductService
......@@ -27,12 +33,35 @@ import lombok.extern.slf4j.Slf4j;
public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, ProductEntity, Long> implements ProductService {
@Autowired
private ProductQuestionService productQuestionService;
@Autowired
private ProductCategoryService productCategoryService;
@Autowired
private CompanyProductService companyProductService;
@Autowired
private CategoryService categoryService;
@Autowired
private CompanyService companyService;
@Override
protected void findAfter(ProductEntity params, PageInfo pageInfo, Context context, List<ProductEntity> list) throws AppException {
list.forEach(item->{
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(item.getId())).stream().map(i -> i.getCategoryId().toString()).collect(Collectors.joining(","));
String companyIds = companyProductService.find(new CompanyProductQuery().productId(item.getId())).stream().map(i -> i.getProductId().toString()).collect(Collectors.joining(","));
item.setCompanyIds(companyIds);
item.setCategoryIds(categoryIds);
});
}
@Override
protected void saveAfter(ProductEntity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.getProductQuestionList())){
entity.getProductQuestionList().stream().peek(item->{
item.setProductId(entity.getId());
item.setProductName(entity.getProductName());
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
}).count();
......@@ -48,6 +77,7 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
productQuestionService.remove(productQuestionIds,context);
entity.getProductQuestionList().stream().peek(item ->{
item.setProductId(entity.getId());
item.setProductName(entity.getProductName());
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
item.setUpdateUserId(this.getContextUserId(context));
......
package com.mortals.xhx.module.product.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.category.model.CategoryQuery;
import com.mortals.xhx.module.category.service.CategoryService;
import com.mortals.xhx.module.company.model.CompanyQuery;
import com.mortals.xhx.module.company.service.CompanyService;
import com.mortals.xhx.module.product.service.ProductCategoryService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 产品
*
* @author zxfei
* @date 2023-09-18
*/
* 产品
*
* @author zxfei
* @date 2023-09-18
*/
@RestController
@RequestMapping("product")
public class ProductController extends BaseCRUDJsonBodyMappingController<ProductService,ProductEntity,Long> {
public class ProductController extends BaseCRUDJsonBodyMappingController<ProductService, ProductEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private ProductCategoryService productCategoryService;
@Autowired
private CategoryService categoryService;
@Autowired
private CompanyService companyService;
public ProductController(){
super.setModuleDesc( "产品");
public ProductController() {
super.setModuleDesc("产品");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "hot", paramService.getParamBySecondOrganize("Product","hot"));
this.addDict(model, "hot", YesNoEnum.getEnumMap());
this.addDict(model, "categoryId", categoryService.find(new CategoryQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName(), (o, n) -> n)));
this.addDict(model, "companyId", companyService.find(new CompanyQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getCompanyName(), (o, n) -> n)));
super.init(model, context);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment