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
**/
@PostMapping("isdisablecategory")
public Result isDisableCategory(@RequestBody IsDisableCategoryFormDTO formDTO) {
public Result isDisableCategory(@LoginUser TokenDto tokenDto, @RequestBody IsDisableCategoryFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IsDisableCategoryFormDTO.IsDisableCategory.class);
formDTO.setUserId(tokenDto.getUserId());
if(!ModuleConstants.ID_ENABLE.equals(formDTO.getType())&&!ModuleConstants.IS_DISABLE.equals(formDTO.getType())){
throw new RuntimeException("参数错误,操作类型值错误!");
}
@ -174,8 +175,9 @@ public class IssueProjectCategoryDictController {
* @Author sun
**/
@PostMapping("delcategory")
public Result delCategory(@RequestBody DelCategoryFormDTO formDTO) {
public Result delCategory(@LoginUser TokenDto tokenDto, @RequestBody DelCategoryFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, DelCategoryFormDTO.DelCategory.class);
formDTO.setUserId(tokenDto.getUserId());
issueProjectCategoryDictService.delCategory(formDTO);
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;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.IsDisableCategoryFormDTO;
import com.epmet.dto.form.IssueTagFormDTO;
import com.epmet.dto.result.IssueCategoryTagResultDTO;
import com.epmet.entity.IssueProjectTagDictEntity;
@ -102,4 +103,10 @@ public interface IssueProjectTagDictDao extends BaseDao<IssueProjectTagDictEntit
* @date 2020.12.13 14:23
*/
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.IssueProjectCategoryDictDao;
import com.epmet.dao.IssueProjectRelationDao;
import com.epmet.dao.IssueProjectTagDictDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -77,6 +78,8 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
private GovProjectOpenFeignClient govProjectOpenFeignClient;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private IssueProjectTagDictDao issueProjectTagDictDao;
@Override
public PageData<IssueProjectCategoryDictDTO> page(Map<String, Object> params) {
@ -243,25 +246,32 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
List<String> categoryList = new ArrayList<>();
//待修改的二级分类Id汇总
List<String> secondList = new ArrayList<>();
if("1".equals(dto.getCategoryType())){
if ("1".equals(dto.getCategoryType())) {
//2-1.查询子类信息
List<ProjectCategoryDictResultDTO> subList = baseDao.selectSubCustomerCategoryDict(formDTO.getCustomerId(),formDTO.getCategoryId());
secondList = subList.stream().map(sub->sub.getId()).collect(Collectors.toList());
List<ProjectCategoryDictResultDTO> subList = baseDao.selectSubCustomerCategoryDict(formDTO.getCustomerId(), formDTO.getCategoryId());
secondList = subList.stream().map(sub -> sub.getId()).collect(Collectors.toList());
categoryList.add(formDTO.getCategoryId());
}else {
} else {
secondList.add(formDTO.getCategoryId());
}
categoryList.addAll(secondList);
formDTO.setCategoryList(categoryList);
formDTO.setSecondCategorylist(secondList);
//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()));
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
}
}
/**
* @Description 分类删除
@ -281,7 +291,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
//2-1.判断议题有无使用
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());
}
//2-2.判断项目有无使用
@ -289,7 +299,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
if (!resultList.success()) {
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());
}

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

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

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

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

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

@ -136,4 +136,17 @@
</foreach>
</if>
</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>

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;
/**
* 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})
private String type;
/**
* 一类二类分类Id集合
*/
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
WHERE del_flag = '0'
AND customer_id = #{customerId}
<if test="level != null and '' != level and '1' == level ">
<if test="1 == level ">
AND category_pids = #{categoryId}
</if>
<if test="level != null and '' != level and '2' == level ">
<if test="2 == level ">
AND category_id = #{categoryId}
</if>
</select>

Loading…
Cancel
Save