|
@@ -66,19 +66,29 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
@Autowired
|
|
@Autowired
|
|
private PermissionService permissionService;
|
|
private PermissionService permissionService;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询产品类别
|
|
|
|
+ * @param queryRequest
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public Object queryMessage(QueryRequest queryRequest) throws Exception {
|
|
public Object queryMessage(QueryRequest queryRequest) throws Exception {
|
|
List<String> sqls = formatQueryService.reSqls(queryRequest,"productCategory");
|
|
List<String> sqls = formatQueryService.reSqls(queryRequest,"productCategory");
|
|
//根据sql查询产品类别信息
|
|
//根据sql查询产品类别信息
|
|
List<ProductCategoryVO> productCategoryVOS = productCategoryMapper.getProductCategory(sqls.get(0),sqls.get(1),sqls.get(2));
|
|
List<ProductCategoryVO> productCategoryVOS = productCategoryMapper.getProductCategory(sqls.get(0),sqls.get(1),sqls.get(2));
|
|
|
|
+ //遍历查询出来的产品类别
|
|
productCategoryVOS.forEach(item -> {
|
|
productCategoryVOS.forEach(item -> {
|
|
|
|
+ //根据showType到产品类别与可见人员关联表中查询可见人员
|
|
Integer showType = item.getShowType();
|
|
Integer showType = item.getShowType();
|
|
- LambdaQueryWrapper<AssoProductCategoryPerson> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
- queryWrapper.eq(AssoProductCategoryPerson::getProductCategoryId, item.getId());
|
|
|
|
- queryWrapper.eq(AssoProductCategoryPerson::getRole,showType);
|
|
|
|
- List<AssoProductCategoryPerson> assoProductCategoryPeople = assoProductCategoryPersonService.list(queryWrapper);
|
|
|
|
- List<Integer> showPersonIds = assoProductCategoryPeople.stream().map(AssoProductCategoryPerson::getPersonId).collect(Collectors.toList());
|
|
|
|
- item.setShowPersonIds(showPersonIds);
|
|
|
|
|
|
+ if(showType == 2 && showType == 3){
|
|
|
|
+ LambdaQueryWrapper<AssoProductCategoryPerson> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(AssoProductCategoryPerson::getProductCategoryId, item.getId());
|
|
|
|
+ queryWrapper.eq(AssoProductCategoryPerson::getRole,showType);
|
|
|
|
+ List<AssoProductCategoryPerson> assoProductCategoryPeople = assoProductCategoryPersonService.list(queryWrapper);
|
|
|
|
+ List<String> showPersonIds = assoProductCategoryPeople.stream().map(AssoProductCategoryPerson::getPersonId).collect(Collectors.toList());
|
|
|
|
+ item.setShowPersonIds(showPersonIds);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
//查询总数
|
|
//查询总数
|
|
Long total = productCategoryMapper.getProductCategoryCount(sqls.get(0));
|
|
Long total = productCategoryMapper.getProductCategoryCount(sqls.get(0));
|
|
@@ -122,21 +132,21 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
//产品类别入表
|
|
//产品类别入表
|
|
ProductCategory productCategory = new ProductCategory();
|
|
ProductCategory productCategory = new ProductCategory();
|
|
BeanUtils.copyProperties(productCategoryDTO, productCategory);
|
|
BeanUtils.copyProperties(productCategoryDTO, productCategory);
|
|
- productCategory.setCreateId(personnelVO.getId());
|
|
|
|
|
|
+ productCategory.setCreateId("1");
|
|
productCategory.setTenant(personnelVO.getTenantId());
|
|
productCategory.setTenant(personnelVO.getTenantId());
|
|
productCategory.insert();
|
|
productCategory.insert();
|
|
//判断可见类型:
|
|
//判断可见类型:
|
|
Integer showType = productCategoryDTO.getShowType();
|
|
Integer showType = productCategoryDTO.getShowType();
|
|
if(showType != 0 && showType != 1){
|
|
if(showType != 0 && showType != 1){
|
|
- List<Integer> showPersonIds = productCategoryDTO.getShowPersonIds();
|
|
|
|
|
|
+ List<String> showPersonIds = productCategoryDTO.getShowPersonIds();
|
|
//0所有人可见,1本人可见
|
|
//0所有人可见,1本人可见
|
|
if(showPersonIds !=null && showPersonIds.size() != 0){
|
|
if(showPersonIds !=null && showPersonIds.size() != 0){
|
|
List<AssoProductCategoryPerson> assoProductCategoryPeople = new ArrayList<>();
|
|
List<AssoProductCategoryPerson> assoProductCategoryPeople = new ArrayList<>();
|
|
- for (Integer showPersonId : showPersonIds) {
|
|
|
|
|
|
+ for (String showPersonId : showPersonIds) {
|
|
AssoProductCategoryPerson assoProductCategoryPerson = new AssoProductCategoryPerson();
|
|
AssoProductCategoryPerson assoProductCategoryPerson = new AssoProductCategoryPerson();
|
|
assoProductCategoryPerson.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryPerson.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryPerson.setPersonId(showPersonId);
|
|
assoProductCategoryPerson.setPersonId(showPersonId);
|
|
- assoProductCategoryPerson.setCreateId(personnelVO.getId());
|
|
|
|
|
|
+ assoProductCategoryPerson.setCreateId(personnelVO.getGuid());
|
|
//2仅选定人可见
|
|
//2仅选定人可见
|
|
if (showType == 2) {
|
|
if (showType == 2) {
|
|
assoProductCategoryPerson.setRole(1);
|
|
assoProductCategoryPerson.setRole(1);
|
|
@@ -162,7 +172,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
AssoProductCategoryFile assoProductCategoryFile = new AssoProductCategoryFile();
|
|
AssoProductCategoryFile assoProductCategoryFile = new AssoProductCategoryFile();
|
|
assoProductCategoryFile.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryFile.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryFile.setFileGuid(item);
|
|
assoProductCategoryFile.setFileGuid(item);
|
|
- assoProductCategoryFile.setCreateId(personnelVO.getId());
|
|
|
|
|
|
+ assoProductCategoryFile.setCreateId(personnelVO.getGuid());
|
|
assoProductCategoryFiles.add(assoProductCategoryFile);
|
|
assoProductCategoryFiles.add(assoProductCategoryFile);
|
|
}
|
|
}
|
|
if (assoProductCategoryFiles != null && assoProductCategoryFiles.size() != 0) {
|
|
if (assoProductCategoryFiles != null && assoProductCategoryFiles.size() != 0) {
|
|
@@ -267,7 +277,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
AssoProductCategoryFile assoProductCategoryFile = new AssoProductCategoryFile();
|
|
AssoProductCategoryFile assoProductCategoryFile = new AssoProductCategoryFile();
|
|
assoProductCategoryFile.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryFile.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryFile.setFileGuid(item);
|
|
assoProductCategoryFile.setFileGuid(item);
|
|
- assoProductCategoryFile.setCreateId(personnelVO.getId());
|
|
|
|
|
|
+ assoProductCategoryFile.setCreateId(personnelVO.getGuid());
|
|
assoProductCategoryFiles.add(assoProductCategoryFile);
|
|
assoProductCategoryFiles.add(assoProductCategoryFile);
|
|
}
|
|
}
|
|
if (assoProductCategoryFiles != null && assoProductCategoryFiles.size() != 0) {
|
|
if (assoProductCategoryFiles != null && assoProductCategoryFiles.size() != 0) {
|
|
@@ -285,8 +295,13 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 装载产品类别
|
|
|
|
+ * @param productCategoryVOS
|
|
|
|
+ * @throws IOException
|
|
|
|
+ */
|
|
private void loadProductCategory(List<ProductCategoryVO> productCategoryVOS) throws IOException {
|
|
private void loadProductCategory(List<ProductCategoryVO> productCategoryVOS) throws IOException {
|
|
- List<Integer> createIds = new ArrayList<>();
|
|
|
|
|
|
+ List<String> createIds = new ArrayList<>();
|
|
List<Integer> ids = new ArrayList<>();
|
|
List<Integer> ids = new ArrayList<>();
|
|
productCategoryVOS.forEach(
|
|
productCategoryVOS.forEach(
|
|
item -> {
|
|
item -> {
|
|
@@ -329,7 +344,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
//装载信息
|
|
//装载信息
|
|
for (ProductCategoryVO productCategoryVO:productCategoryVOS) {
|
|
for (ProductCategoryVO productCategoryVO:productCategoryVOS) {
|
|
//装载人员信息
|
|
//装载人员信息
|
|
- Personnel personnel = personnels.stream().filter(item -> item.getId().equals(productCategoryVO.getCreateId())).findFirst().orElse(null);
|
|
|
|
|
|
+ Personnel personnel = personnels.stream().filter(item -> item.getGuid().equals(productCategoryVO.getCreateId())).findFirst().orElse(null);
|
|
if(personnel != null){
|
|
if(personnel != null){
|
|
productCategoryVO.setCreateName(personnel.getPersonnelName());
|
|
productCategoryVO.setCreateName(personnel.getPersonnelName());
|
|
}
|
|
}
|