Browse Source

接口自测问题修改

dev_shibei_match
sunyuchao 5 years ago
parent
commit
abbba792a9
  1. 6
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java
  2. 7
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java
  3. 26
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java
  4. 4
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml
  5. 19
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml
  6. 13
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml
  7. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DelCategoryFormDTO.java
  8. 13
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IsDisableCategoryFormDTO.java
  9. 4
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml

6
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java

@ -158,8 +158,9 @@ public class IssueProjectCategoryDictController {
* @Author sun * @Author sun
**/ **/
@PostMapping("isdisablecategory") @PostMapping("isdisablecategory")
public Result isDisableCategory(@RequestBody IsDisableCategoryFormDTO formDTO) { public Result isDisableCategory(@LoginUser TokenDto tokenDto, @RequestBody IsDisableCategoryFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IsDisableCategoryFormDTO.IsDisableCategory.class); ValidatorUtils.validateEntity(formDTO, IsDisableCategoryFormDTO.IsDisableCategory.class);
formDTO.setUserId(tokenDto.getUserId());
if(!ModuleConstants.ID_ENABLE.equals(formDTO.getType())&&!ModuleConstants.IS_DISABLE.equals(formDTO.getType())){ if(!ModuleConstants.ID_ENABLE.equals(formDTO.getType())&&!ModuleConstants.IS_DISABLE.equals(formDTO.getType())){
throw new RuntimeException("参数错误,操作类型值错误!"); throw new RuntimeException("参数错误,操作类型值错误!");
} }
@ -174,8 +175,9 @@ public class IssueProjectCategoryDictController {
* @Author sun * @Author sun
**/ **/
@PostMapping("delcategory") @PostMapping("delcategory")
public Result delCategory(@RequestBody DelCategoryFormDTO formDTO) { public Result delCategory(@LoginUser TokenDto tokenDto, @RequestBody DelCategoryFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, DelCategoryFormDTO.DelCategory.class); ValidatorUtils.validateEntity(formDTO, DelCategoryFormDTO.DelCategory.class);
formDTO.setUserId(tokenDto.getUserId());
issueProjectCategoryDictService.delCategory(formDTO); issueProjectCategoryDictService.delCategory(formDTO);
return new Result(); return new Result();
} }

7
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java

@ -18,6 +18,7 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.IsDisableCategoryFormDTO;
import com.epmet.dto.form.IssueTagFormDTO; import com.epmet.dto.form.IssueTagFormDTO;
import com.epmet.dto.result.IssueCategoryTagResultDTO; import com.epmet.dto.result.IssueCategoryTagResultDTO;
import com.epmet.entity.IssueProjectTagDictEntity; import com.epmet.entity.IssueProjectTagDictEntity;
@ -102,4 +103,10 @@ public interface IssueProjectTagDictDao extends BaseDao<IssueProjectTagDictEntit
* @date 2020.12.13 14:23 * @date 2020.12.13 14:23
*/ */
List<IssueProjectTagDictEntity> selectTagsByCustomerIdAndTagIds(@Param("customerId") String customerId,@Param("tagIds")List<String> tagIds); List<IssueProjectTagDictEntity> selectTagsByCustomerIdAndTagIds(@Param("customerId") String customerId,@Param("tagIds")List<String> tagIds);
/**
* 批量修改标签的启用禁用状态
* @author sun
*/
int updateCustomerTag(IsDisableCategoryFormDTO formDTO);
} }

26
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java

@ -30,6 +30,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IssueCategoryDao; import com.epmet.dao.IssueCategoryDao;
import com.epmet.dao.IssueProjectCategoryDictDao; import com.epmet.dao.IssueProjectCategoryDictDao;
import com.epmet.dao.IssueProjectRelationDao; import com.epmet.dao.IssueProjectRelationDao;
import com.epmet.dao.IssueProjectTagDictDao;
import com.epmet.dto.*; import com.epmet.dto.*;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
@ -77,6 +78,8 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
private GovProjectOpenFeignClient govProjectOpenFeignClient; private GovProjectOpenFeignClient govProjectOpenFeignClient;
@Autowired @Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient; private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private IssueProjectTagDictDao issueProjectTagDictDao;
@Override @Override
public PageData<IssueProjectCategoryDictDTO> page(Map<String, Object> params) { public PageData<IssueProjectCategoryDictDTO> page(Map<String, Object> params) {
@ -243,25 +246,32 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
List<String> categoryList = new ArrayList<>(); List<String> categoryList = new ArrayList<>();
//待修改的二级分类Id汇总 //待修改的二级分类Id汇总
List<String> secondList = new ArrayList<>(); List<String> secondList = new ArrayList<>();
if("1".equals(dto.getCategoryType())){ if ("1".equals(dto.getCategoryType())) {
//2-1.查询子类信息 //2-1.查询子类信息
List<ProjectCategoryDictResultDTO> subList = baseDao.selectSubCustomerCategoryDict(formDTO.getCustomerId(),formDTO.getCategoryId()); List<ProjectCategoryDictResultDTO> subList = baseDao.selectSubCustomerCategoryDict(formDTO.getCustomerId(), formDTO.getCategoryId());
secondList = subList.stream().map(sub->sub.getId()).collect(Collectors.toList()); secondList = subList.stream().map(sub -> sub.getId()).collect(Collectors.toList());
categoryList.add(formDTO.getCategoryId()); categoryList.add(formDTO.getCategoryId());
}else { } else {
secondList.add(formDTO.getCategoryId()); secondList.add(formDTO.getCategoryId());
} }
categoryList.addAll(secondList); categoryList.addAll(secondList);
formDTO.setCategoryList(categoryList); formDTO.setCategoryList(categoryList);
formDTO.setSecondCategorylist(secondList);
//3.修改标签、分类表数据状态 //3.修改标签、分类表数据状态
if(baseDao.updateCustomerCategory(formDTO)<NumConstant.ONE){ //修改分类数据
if (baseDao.updateCustomerCategory(formDTO) < NumConstant.ONE) {
logger.error(String.format("修改分类信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); logger.error(String.format("修改分类信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId()));
throw new RuntimeException("分类信息修改失败!"); throw new RuntimeException("分类信息修改失败!");
} }
//修改吧二级分类下默认的标签数据
if (issueProjectTagDictDao.updateCustomerTag(formDTO) < NumConstant.ONE) {
logger.error(String.format("修改标签信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId()));
throw new RuntimeException("分类、标签信息修改失败!");
}
//4.修改缓存中标签状态 todo //4.修改缓存中标签状态 todo
}
}
/** /**
* @Description 分类删除 * @Description 分类删除
@ -281,7 +291,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
//2-1.判断议题有无使用 //2-1.判断议题有无使用
List<IssueCategoryDTO> issueList = issueCategoryDao.selectIssueList(formDTO); List<IssueCategoryDTO> issueList = issueCategoryDao.selectIssueList(formDTO);
//已使用,不允许删除 //已使用,不允许删除
if (null != issueList || issueList.size() > NumConstant.ZERO) { if (null != issueList && issueList.size() > NumConstant.ZERO) {
throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg()); throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg());
} }
//2-2.判断项目有无使用 //2-2.判断项目有无使用
@ -289,7 +299,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
if (!resultList.success()) { if (!resultList.success()) {
throw new RenException(resultList.getCode(), resultList.getMsg()); throw new RenException(resultList.getCode(), resultList.getMsg());
} }
if (null != resultList.getData() || resultList.getData().size() > NumConstant.ZERO) { if (null != resultList.getData() && resultList.getData().size() > NumConstant.ZERO) {
throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg()); throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg());
} }

4
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml

@ -63,10 +63,10 @@
FROM issue_category FROM issue_category
WHERE del_flag = '0' WHERE del_flag = '0'
AND customer_id = #{customerId} AND customer_id = #{customerId}
<if test="level != null and '' != level and '1' == level "> <if test="1 == level ">
AND category_pids = #{categoryId} AND category_pids = #{categoryId}
</if> </if>
<if test="level != null and '' != level and '2' == level "> <if test="2 == level ">
AND category_id = #{categoryId} AND category_id = #{categoryId}
</if> </if>
</select> </select>

19
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml

@ -135,25 +135,29 @@
WHERE WHERE
del_flag = '0' del_flag = '0'
AND customer_id = #{customerId} AND customer_id = #{customerId}
AND pid = #{categoryId} AND pid = #{pid}
</select> </select>
<update id="delCategory"> <update id="delCategory">
UPDATE issue_project_category_dict UPDATE issue_project_category_dict
SET del_flag = '1' SET del_flag = '1',
updated_by = #{userId},
updated_time = NOW()
WHERE WHERE
customer_id = #{customerId} customer_id = #{customerId}
<if test="level != null and '' != level and '1' == level "> <if test="1 == level ">
AND id = #{categoryId} AND id = #{categoryId} OR pid = #{categoryId}
</if> </if>
<if test="level != null and '' != level and '2' == level "> <if test="2 == level ">
AND pid = #{categoryId} AND id = #{categoryId}
</if> </if>
</update> </update>
<update id="updateCustomerCategory"> <update id="updateCustomerCategory">
UPDATE issue_project_category_dict UPDATE issue_project_category_dict
SET is_disable = #{type} SET is_disable = #{type},
updated_by = #{userId},
updated_time = NOW()
WHERE WHERE
customer_id = #{customerId} customer_id = #{customerId}
<foreach item="ids" collection="categoryList" separator="OR" open="AND (" close=")" index=""> <foreach item="ids" collection="categoryList" separator="OR" open="AND (" close=")" index="">
@ -161,6 +165,7 @@
</foreach> </foreach>
</update> </update>
<select id="getMaxCategoryCode" resultType="Integer"> <select id="getMaxCategoryCode" resultType="Integer">
SELECT SELECT
IFNULL( MAX(CATEGORY_CODE), 0) IFNULL( MAX(CATEGORY_CODE), 0)

13
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

@ -136,4 +136,17 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<update id="updateCustomerTag">
UPDATE issue_project_tag_dict
SET is_disable = #{type},
updated_by = #{userId},
updated_time = NOW()
WHERE
customer_id = #{customerId}
<foreach item="ids" collection="secondCategorylist" separator="OR" open="AND (" close=")" index="">
category_id = #{ids}
</foreach>
</update>
</mapper> </mapper>

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DelCategoryFormDTO.java

@ -31,5 +31,10 @@ public class DelCategoryFormDTO implements Serializable {
*/ */
private String level; private String level;
/**
* token中用户
*/
private String userId;
} }

13
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IsDisableCategoryFormDTO.java

@ -31,6 +31,19 @@ public class IsDisableCategoryFormDTO implements Serializable {
@NotBlank(message = "是否启用类型不能为空",groups = {IsDisableCategory.class}) @NotBlank(message = "是否启用类型不能为空",groups = {IsDisableCategory.class})
private String type; private String type;
/**
* 一类二类分类Id集合
*/
private List<String> categoryList; private List<String> categoryList;
/**
* 二类分类Id集合
*/
private List<String> secondCategorylist;
/**
* token中用户
*/
private String userId;
} }

4
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml

@ -19,10 +19,10 @@
FROM project_category FROM project_category
WHERE del_flag = '0' WHERE del_flag = '0'
AND customer_id = #{customerId} AND customer_id = #{customerId}
<if test="level != null and '' != level and '1' == level "> <if test="1 == level ">
AND category_pids = #{categoryId} AND category_pids = #{categoryId}
</if> </if>
<if test="level != null and '' != level and '2' == level "> <if test="2 == level ">
AND category_id = #{categoryId} AND category_id = #{categoryId}
</if> </if>
</select> </select>

Loading…
Cancel
Save