品类库修改

This commit is contained in:
YY
2025-06-25 13:48:42 +08:00
parent b3e08a05d3
commit fab33d1fbc
11 changed files with 168 additions and 22 deletions

View File

@ -13,4 +13,8 @@ public interface EvaluateTaskConstant {
* Indicator_type * Indicator_type
*/ */
public static final String INDICATOR_TYPE_ND = "Indicator_type"; public static final String INDICATOR_TYPE_ND = "Indicator_type";
/**
* 按指标查询1
*/
public static final Long INDICATOR_TYPE_ND_1 = 1L;
} }

View File

@ -8,6 +8,8 @@ import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 品类库_品类库包含品类Controller * 品类库_品类库包含品类Controller
* *
@ -55,4 +57,22 @@ public class CoscoCategoryLibraryContainController extends BaseController {
public BaseResponse remove(@PathVariable String[] categoryLibraryIds) { public BaseResponse remove(@PathVariable String[] categoryLibraryIds) {
return BaseResponse.success(coscoCategoryLibraryContainService.deleteCoscoCategoryLibraryContainByCategoryLibraryIds(categoryLibraryIds)); return BaseResponse.success(coscoCategoryLibraryContainService.deleteCoscoCategoryLibraryContainByCategoryLibraryIds(categoryLibraryIds));
} }
/**
* 获取树形结构信息
* @param coscoCategoryLibraryContain
* @return
*/
@GetMapping("/treeList")
public BaseResponse treeList(CoscoCategoryLibraryContain coscoCategoryLibraryContain) {
return BaseResponse.success(coscoCategoryLibraryContainService.treeList(coscoCategoryLibraryContain));
}
/**
* 修改品类库锁定状态
*/
@PutMapping("/lock")
public BaseResponse lock(@RequestBody List<CoscoCategoryLibraryContain> coscoCategoryLibraryContain) {
return BaseResponse.success(coscoCategoryLibraryContainService.updateList(coscoCategoryLibraryContain));
}
} }

View File

@ -1,8 +1,8 @@
package com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao; package com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao;
import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper; import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.CategoryContainListVo;
import java.util.List; import java.util.List;
@ -69,4 +69,17 @@ public interface CoscoCategoryLibraryContainMapper extends IBaseMapper<CoscoCate
* @return * @return
*/ */
List<String> selectLoctyList(List<String> deptIds); List<String> selectLoctyList(List<String> deptIds);
/**
* 查询树形列表结构
* @param categoryLibraryId
* @return
*/
List<CategoryContainListVo> selectTreeListByLibraryId(String categoryLibraryId);
/**
* 修改锁定状态
* @param co
*/
void updateLockType(CoscoCategoryLibraryContain co);
} }

View File

@ -4,7 +4,8 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao.CoscoCategoryLibraryContainMapper"> <mapper namespace="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao.CoscoCategoryLibraryContainMapper">
<resultMap type="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain" id="CoscoCategoryLibraryContainResult"> <resultMap type="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain"
id="CoscoCategoryLibraryContainResult">
<result property="categoryLibraryId" column="category_library_id"/> <result property="categoryLibraryId" column="category_library_id"/>
<result property="categoryId" column="category_id"/> <result property="categoryId" column="category_id"/>
</resultMap> </resultMap>
@ -14,7 +15,9 @@
from cosco_category_library_contain from cosco_category_library_contain
</sql> </sql>
<select id="selectCoscoCategoryLibraryContainList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain" resultMap="CoscoCategoryLibraryContainResult"> <select id="selectCoscoCategoryLibraryContainList"
parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain"
resultMap="CoscoCategoryLibraryContainResult">
<include refid="selectCoscoCategoryLibraryContainVo"/> <include refid="selectCoscoCategoryLibraryContainVo"/>
<where> <where>
<if test="categoryLibraryId != null">and category_library_id = #{categoryLibraryId}</if> <if test="categoryLibraryId != null">and category_library_id = #{categoryLibraryId}</if>
@ -27,7 +30,8 @@
where category_library_id = #{categoryLibraryId} where category_library_id = #{categoryLibraryId}
</select> </select>
<insert id="insertCoscoCategoryLibraryContain" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain"> <insert id="insertCoscoCategoryLibraryContain"
parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain">
insert into cosco_category_library_contain insert into cosco_category_library_contain
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="categoryLibraryId != null">category_library_id,</if> <if test="categoryLibraryId != null">category_library_id,</if>
@ -46,7 +50,8 @@
( #{item.categoryLibraryId}, #{item.categoryId}) ( #{item.categoryLibraryId}, #{item.categoryId})
</foreach> </foreach>
</insert> </insert>
<update id="updateCoscoCategoryLibraryContain" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain"> <update id="updateCoscoCategoryLibraryContain"
parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain">
update cosco_category_library_contain update cosco_category_library_contain
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="categoryId != null">category_id = <if test="categoryId != null">category_id =
@ -57,7 +62,8 @@
</update> </update>
<update id="deleteCoscoCategoryLibraryContainByCategoryLibraryId" parameterType="String"> <update id="deleteCoscoCategoryLibraryContainByCategoryLibraryId" parameterType="String">
update cosco_category_library_contain set del_flag = 2 update cosco_category_library_contain
set del_flag = 2
where category_library_id = #{categoryLibraryId} where category_library_id = #{categoryLibraryId}
</update> </update>
@ -83,4 +89,23 @@
</where> </where>
</select> </select>
<select id="selectTreeListByLibraryId" parameterType="string"
resultType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.CategoryContainListVo">
select cclc.category_library_id categoryLibraryId,
cclc.category_id categoryId,
cclc.lock_type lockType,
cc.parent_id parentId,
cc.category_name categoryName
from cosco_category_library_contain cclc
join cosco_category cc on cclc.category_id = cc.id
where cclc.category_library_id = #{categoryLibraryId}
</select>
<update id="updateLockType" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain">
update cosco_category_library_contain
set lock_type = #{lockType}
where category_library_id = #{categoryLibraryId}
and category_id = #{categoryId}
</update>
</mapper> </mapper>

View File

@ -215,6 +215,7 @@
"张三" AS createName, "张三" AS createName,
ccl.term_of_validity AS termOfValidity, ccl.term_of_validity AS termOfValidity,
ccl.approve_status AS approveStatus, ccl.approve_status AS approveStatus,
ccl.last_update_time as approveTime,
ccl.remark, ccl.remark,
CASE CASE
WHEN ccl.approve_status = 0 AND ccl.work_flow_id IS NULL THEN '未开始' WHEN ccl.approve_status = 0 AND ccl.work_flow_id IS NULL THEN '未开始'
@ -231,7 +232,7 @@
LEFT JOIN LEFT JOIN
cosco_category_library_contain cclc ON ccl.id = cclc.category_library_id cosco_category_library_contain cclc ON ccl.id = cclc.category_library_id
LEFT JOIN LEFT JOIN
cosco_category cc ON cc.id = cclc.category_id cosco_category cc ON cc.id = cclc.category_id and cc.type=1
LEFT JOIN LEFT JOIN
cosco_category_library_supplier ccls ON ccl.id = ccls.category_library_id cosco_category_library_supplier ccls ON ccl.id = ccls.category_library_id
LEFT JOIN LEFT JOIN
@ -247,6 +248,7 @@
</where> </where>
GROUP BY GROUP BY
ccl.id ccl.id
order by ccl.create_time DESC
</select> </select>

View File

@ -4,6 +4,7 @@ import com.chinaunicom.mall.ebtp.common.base.service.IBaseService;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibrary; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibrary;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.AddCategoryIdVos; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.AddCategoryIdVos;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.CategoryContainListVo;
import java.util.List; import java.util.List;
@ -81,4 +82,18 @@ public interface ICoscoCategoryLibraryContainService extends IBaseService<Cosco
* @return * @return
*/ */
List<String> selectLoctyList(); List<String> selectLoctyList();
/**
* 树形结构查询
* @param coscoCategoryLibraryContain
* @return
*/
List<CategoryContainListVo> treeList(CoscoCategoryLibraryContain coscoCategoryLibraryContain);
/**
* 修改锁定结构
* @param coscoCategoryLibraryContain
* @return
*/
int updateList(List<CoscoCategoryLibraryContain> coscoCategoryLibraryContain);
} }

View File

@ -8,6 +8,7 @@ import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao.CoscoCategoryLibrary
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.*; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.*;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.AddCategoryIdVos; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.AddCategoryIdVos;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.CategoryContainListVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -137,4 +138,41 @@ public class CoscoCategoryLibraryContainServiceImpl extends BaseServiceImpl<Cosc
deptIds.add("dep01"); deptIds.add("dep01");
return coscoCategoryLibraryContainMapper.selectLoctyList(deptIds); return coscoCategoryLibraryContainMapper.selectLoctyList(deptIds);
} }
@Override
public List<CategoryContainListVo> treeList(CoscoCategoryLibraryContain coscoCategoryLibraryContain) {
List<CategoryContainListVo> list =coscoCategoryLibraryContainMapper.selectTreeListByLibraryId(coscoCategoryLibraryContain.getCategoryLibraryId());
// 从根节点 parentId == "0" 开始递归构建树
return buildTree("0", list);
}
@Override
public int updateList(List<CoscoCategoryLibraryContain> coscoCategoryLibraryContain) {
coscoCategoryLibraryContain.forEach(co->{
coscoCategoryLibraryContainMapper.updateLockType(co);
});
return 0;
}
/**
* 递归构建树形结构
*
* @param parentId 父节点ID
* @param allList 所有节点列表
* @return 当前 parentId 下的子树列表
*/
private List<CategoryContainListVo> buildTree(String parentId, List<CategoryContainListVo> allList) {
List<CategoryContainListVo> children = new ArrayList<>();
for (CategoryContainListVo item : allList) {
if (parentId.equals(item.getParentId())) {
// 递归查找子节点
List<CategoryContainListVo> childList = buildTree(item.getCategoryId(), allList);
item.setCategoryList(childList);
children.add(item);
}
}
return children;
}
} }

View File

@ -74,7 +74,6 @@ public class CoscoCategoryLibraryServiceImpl extends BaseServiceImpl<CoscoCatego
public int insertCoscoCategoryLibrary(AddCoscoCategoryLibraryVo coscoCategoryLibrary) { public int insertCoscoCategoryLibrary(AddCoscoCategoryLibraryVo coscoCategoryLibrary) {
coscoCategoryLibrary.setCreateTime(LocalDateTime.now()); coscoCategoryLibrary.setCreateTime(LocalDateTime.now());
coscoCategoryLibrary.setCreateBy("1"); coscoCategoryLibrary.setCreateBy("1");
coscoCategoryLibrary.setLastUpdateTime(LocalDateTime.now());
coscoCategoryLibrary.setDelFlag(CoscoCategoryConstant.DELETE_FLAG_YES); coscoCategoryLibrary.setDelFlag(CoscoCategoryConstant.DELETE_FLAG_YES);
coscoCategoryLibrary.setApplyDeptId("1"); coscoCategoryLibrary.setApplyDeptId("1");
coscoCategoryLibrary.setId(PropertyUtils.getSnowflakeId()); coscoCategoryLibrary.setId(PropertyUtils.getSnowflakeId());
@ -104,7 +103,6 @@ public class CoscoCategoryLibraryServiceImpl extends BaseServiceImpl<CoscoCatego
@Override @Override
public int updateCoscoCategoryLibrary(CoscoCategoryLibrary coscoCategoryLibrary) { public int updateCoscoCategoryLibrary(CoscoCategoryLibrary coscoCategoryLibrary) {
coscoCategoryLibrary.setUpdateTime(LocalDateTime.now()); coscoCategoryLibrary.setUpdateTime(LocalDateTime.now());
coscoCategoryLibrary.setLastUpdateTime(LocalDateTime.now());
return coscoCategoryLibraryMapper.updateCoscoCategoryLibrary(coscoCategoryLibrary); return coscoCategoryLibraryMapper.updateCoscoCategoryLibrary(coscoCategoryLibrary);
} }

View File

@ -0,0 +1,20 @@
package com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo;
import lombok.Data;
import java.util.List;
@Data
public class CategoryContainListVo {
private String categoryLibraryId;
private String categoryId;
private String parentId;
private String categoryName;
private String lockType;
private List<CategoryContainListVo> categoryList;
}

View File

@ -56,6 +56,10 @@ public class CoscoCategoryLibraryVo {
* 供应商数量 * 供应商数量
*/ */
private Integer snumber; private Integer snumber;
/**
* 审批时间
*/
private Date approveTime;
/** /**
* 审批结果 * 审批结果
*/ */

View File

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils; import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.CoscoCategoryConstant; import com.chinaunicom.zyhy.ebtp.supplier.base.constant.CoscoCategoryConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.EvaluateTaskConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.service.impl.UserService; import com.chinaunicom.zyhy.ebtp.supplier.base.service.impl.UserService;
import com.chinaunicom.zyhy.ebtp.supplier.base.vo.UserVo; import com.chinaunicom.zyhy.ebtp.supplier.base.vo.UserVo;
import com.chinaunicom.zyhy.ebtp.supplier.common.MessageType; import com.chinaunicom.zyhy.ebtp.supplier.common.MessageType;
@ -119,8 +120,14 @@ public class CoscoEvaluateTaskServiceImpl implements ICoscoEvaluateTaskService {
List<UserNdTypeVo> userNdTypeVos1 = map.get(userId); List<UserNdTypeVo> userNdTypeVos1 = map.get(userId);
vo.setType(userNdTypeVos1.get(0).getType()); vo.setType(userNdTypeVos1.get(0).getType());
if(vo.getType()== EvaluateTaskConstant.INDICATOR_TYPE_ND_1){
List<String> indicatorIds = userNdTypeVos1.stream().map(UserNdTypeVo::getNeId).collect(Collectors.toList()); List<String> indicatorIds = userNdTypeVos1.stream().map(UserNdTypeVo::getNeId).collect(Collectors.toList());
vo.setIndicatorIds(indicatorIds); vo.setIndicatorIds(indicatorIds);
}else{
vo.setIndicatorIds(new ArrayList<>());
}
vos.add(vo); vos.add(vo);
}); });
List<String> supplierIds = list.stream().map(TaskSupplierVo::getId).collect(Collectors.toList()); List<String> supplierIds = list.stream().map(TaskSupplierVo::getId).collect(Collectors.toList());