品类库修改
This commit is contained in:
@ -13,4 +13,8 @@ public interface EvaluateTaskConstant {
|
||||
* Indicator_type
|
||||
*/
|
||||
public static final String INDICATOR_TYPE_ND = "Indicator_type";
|
||||
/**
|
||||
* 按指标查询1
|
||||
*/
|
||||
public static final Long INDICATOR_TYPE_ND_1 = 1L;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 品类库_品类库包含品类Controller
|
||||
*
|
||||
@ -55,4 +57,22 @@ public class CoscoCategoryLibraryContainController extends BaseController {
|
||||
public BaseResponse remove(@PathVariable String[] 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));
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao;
|
||||
|
||||
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.vo.CategoryContainListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -69,4 +69,17 @@ public interface CoscoCategoryLibraryContainMapper extends IBaseMapper<CoscoCate
|
||||
* @return
|
||||
*/
|
||||
List<String> selectLoctyList(List<String> deptIds);
|
||||
|
||||
/**
|
||||
* 查询树形列表结构
|
||||
* @param categoryLibraryId
|
||||
* @return
|
||||
*/
|
||||
List<CategoryContainListVo> selectTreeListByLibraryId(String categoryLibraryId);
|
||||
|
||||
/**
|
||||
* 修改锁定状态
|
||||
* @param co
|
||||
*/
|
||||
void updateLockType(CoscoCategoryLibraryContain co);
|
||||
}
|
||||
|
@ -4,9 +4,10 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao.CoscoCategoryLibraryContainMapper">
|
||||
|
||||
<resultMap type="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain" id="CoscoCategoryLibraryContainResult">
|
||||
<result property="categoryLibraryId" column="category_library_id"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
<resultMap type="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategoryLibraryContain"
|
||||
id="CoscoCategoryLibraryContainResult">
|
||||
<result property="categoryLibraryId" column="category_library_id"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCoscoCategoryLibraryContainVo">
|
||||
@ -14,7 +15,9 @@
|
||||
from cosco_category_library_contain
|
||||
</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"/>
|
||||
<where>
|
||||
<if test="categoryLibraryId != null">and category_library_id = #{categoryLibraryId}</if>
|
||||
@ -23,19 +26,20 @@
|
||||
|
||||
<select id="selectCoscoCategoryLibraryContainByCategoryLibraryId" parameterType="String"
|
||||
resultMap="CoscoCategoryLibraryContainResult">
|
||||
<include refid="selectCoscoCategoryLibraryContainVo"/>
|
||||
where category_library_id = #{categoryLibraryId}
|
||||
<include refid="selectCoscoCategoryLibraryContainVo"/>
|
||||
where category_library_id = #{categoryLibraryId}
|
||||
</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
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="categoryLibraryId != null">category_library_id,</if>
|
||||
<if test="categoryId != null">category_id,</if>
|
||||
<if test="categoryLibraryId != null">category_library_id,</if>
|
||||
<if test="categoryId != null">category_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="categoryLibraryId != null">#{categoryLibraryId},</if>
|
||||
<if test="categoryId != null">#{categoryId},</if>
|
||||
<if test="categoryLibraryId != null">#{categoryLibraryId},</if>
|
||||
<if test="categoryId != null">#{categoryId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="batchCoscoCategoryLibraryContain" parameterType="java.util.List">
|
||||
@ -46,18 +50,20 @@
|
||||
( #{item.categoryLibraryId}, #{item.categoryId})
|
||||
</foreach>
|
||||
</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
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="categoryId != null">category_id =
|
||||
#{categoryId},
|
||||
</if>
|
||||
<if test="categoryId != null">category_id =
|
||||
#{categoryId},
|
||||
</if>
|
||||
</trim>
|
||||
where category_library_id = #{categoryLibraryId}
|
||||
</update>
|
||||
|
||||
<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}
|
||||
</update>
|
||||
|
||||
@ -83,4 +89,23 @@
|
||||
</where>
|
||||
</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>
|
||||
|
@ -215,6 +215,7 @@
|
||||
"张三" AS createName,
|
||||
ccl.term_of_validity AS termOfValidity,
|
||||
ccl.approve_status AS approveStatus,
|
||||
ccl.last_update_time as approveTime,
|
||||
ccl.remark,
|
||||
CASE
|
||||
WHEN ccl.approve_status = 0 AND ccl.work_flow_id IS NULL THEN '未开始'
|
||||
@ -231,7 +232,7 @@
|
||||
LEFT JOIN
|
||||
cosco_category_library_contain cclc ON ccl.id = cclc.category_library_id
|
||||
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
|
||||
cosco_category_library_supplier ccls ON ccl.id = ccls.category_library_id
|
||||
LEFT JOIN
|
||||
@ -247,6 +248,7 @@
|
||||
</where>
|
||||
GROUP BY
|
||||
ccl.id
|
||||
order by ccl.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -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.CoscoCategoryLibraryContain;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.AddCategoryIdVos;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.CategoryContainListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -81,4 +82,18 @@ public interface ICoscoCategoryLibraryContainService extends IBaseService<Cosco
|
||||
* @return
|
||||
*/
|
||||
List<String> selectLoctyList();
|
||||
|
||||
/**
|
||||
* 树形结构查询
|
||||
* @param coscoCategoryLibraryContain
|
||||
* @return
|
||||
*/
|
||||
List<CategoryContainListVo> treeList(CoscoCategoryLibraryContain coscoCategoryLibraryContain);
|
||||
|
||||
/**
|
||||
* 修改锁定结构
|
||||
* @param coscoCategoryLibraryContain
|
||||
* @return
|
||||
*/
|
||||
int updateList(List<CoscoCategoryLibraryContain> coscoCategoryLibraryContain);
|
||||
}
|
||||
|
@ -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.service.*;
|
||||
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.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -137,4 +138,41 @@ public class CoscoCategoryLibraryContainServiceImpl extends BaseServiceImpl<Cosc
|
||||
deptIds.add("dep01");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ public class CoscoCategoryLibraryServiceImpl extends BaseServiceImpl<CoscoCatego
|
||||
public int insertCoscoCategoryLibrary(AddCoscoCategoryLibraryVo coscoCategoryLibrary) {
|
||||
coscoCategoryLibrary.setCreateTime(LocalDateTime.now());
|
||||
coscoCategoryLibrary.setCreateBy("1");
|
||||
coscoCategoryLibrary.setLastUpdateTime(LocalDateTime.now());
|
||||
coscoCategoryLibrary.setDelFlag(CoscoCategoryConstant.DELETE_FLAG_YES);
|
||||
coscoCategoryLibrary.setApplyDeptId("1");
|
||||
coscoCategoryLibrary.setId(PropertyUtils.getSnowflakeId());
|
||||
@ -104,7 +103,6 @@ public class CoscoCategoryLibraryServiceImpl extends BaseServiceImpl<CoscoCatego
|
||||
@Override
|
||||
public int updateCoscoCategoryLibrary(CoscoCategoryLibrary coscoCategoryLibrary) {
|
||||
coscoCategoryLibrary.setUpdateTime(LocalDateTime.now());
|
||||
coscoCategoryLibrary.setLastUpdateTime(LocalDateTime.now());
|
||||
return coscoCategoryLibraryMapper.updateCoscoCategoryLibrary(coscoCategoryLibrary);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -56,6 +56,10 @@ public class CoscoCategoryLibraryVo {
|
||||
* 供应商数量
|
||||
*/
|
||||
private Integer snumber;
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
private Date approveTime;
|
||||
/**
|
||||
* 审批结果
|
||||
*/
|
||||
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.EvaluateTaskConstant;
|
||||
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.common.MessageType;
|
||||
@ -119,8 +120,14 @@ public class CoscoEvaluateTaskServiceImpl implements ICoscoEvaluateTaskService {
|
||||
|
||||
List<UserNdTypeVo> userNdTypeVos1 = map.get(userId);
|
||||
vo.setType(userNdTypeVos1.get(0).getType());
|
||||
List<String> indicatorIds = userNdTypeVos1.stream().map(UserNdTypeVo::getNeId).collect(Collectors.toList());
|
||||
vo.setIndicatorIds(indicatorIds);
|
||||
|
||||
if(vo.getType()== EvaluateTaskConstant.INDICATOR_TYPE_ND_1){
|
||||
List<String> indicatorIds = userNdTypeVos1.stream().map(UserNdTypeVo::getNeId).collect(Collectors.toList());
|
||||
vo.setIndicatorIds(indicatorIds);
|
||||
}else{
|
||||
vo.setIndicatorIds(new ArrayList<>());
|
||||
}
|
||||
|
||||
vos.add(vo);
|
||||
});
|
||||
List<String> supplierIds = list.stream().map(TaskSupplierVo::getId).collect(Collectors.toList());
|
||||
|
Reference in New Issue
Block a user