82 changed files with 2329 additions and 202 deletions
@ -0,0 +1,40 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 根据客户Id staffId查询人员在客户下的角色列表-接口返参 |
|||
* @Author sun |
|||
*/ |
|||
@Data |
|||
public class StaffRoleListResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -2049883620062097446L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
* */ |
|||
private String customerId; |
|||
/** |
|||
* 员工Id |
|||
* */ |
|||
private String staffId; |
|||
/** |
|||
* 员工姓名 |
|||
* */ |
|||
private String staffName; |
|||
/** |
|||
* 角色Id |
|||
* */ |
|||
private String roleId; |
|||
/** |
|||
* 角色Key |
|||
* */ |
|||
private String roleKey; |
|||
/** |
|||
* 角色名称 |
|||
* */ |
|||
private String roleName; |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.epmet.dataaggre.dto.govorg.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 专题设置-组织网格切换树结构-接口返参 |
|||
* @author sun |
|||
*/ |
|||
@Data |
|||
public class StaffAgencyGridListResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
//机关组织Id
|
|||
private String agencyId = ""; |
|||
//机关组织名称
|
|||
private String agencyName = ""; |
|||
//机关组织名称
|
|||
private Boolean isOpt = true; |
|||
//网格:grid;社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province
|
|||
private String orgLevel = ""; |
|||
//当前组织id的上级id,如果当前是跟组织返回0
|
|||
private String pid = ""; |
|||
//当前组织id的所有上级id,如果当前是跟组织返回0
|
|||
private String pids = ""; |
|||
//当前机关的下属网格列表
|
|||
private List<StaffAgencyGridListResultDTO.GridResultDTO> gridList = new ArrayList<>(); |
|||
//当前组织的所有下级组织信息(递归)
|
|||
private List<StaffAgencyGridListResultDTO> subAgencyGridList = new ArrayList<>(); |
|||
|
|||
@Data |
|||
public static class GridResultDTO{ |
|||
//机关组织Id
|
|||
private String gridId = ""; |
|||
//机关组织名称
|
|||
private String gridName = ""; |
|||
//网格:grid;社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province
|
|||
private String orgLevel = ""; |
|||
//当前网格所属的组织id
|
|||
private String pid = ""; |
|||
//当前网格所有上级
|
|||
private String pids = ""; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,120 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 专题表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-15 |
|||
*/ |
|||
@Data |
|||
public class SpecialSubjectDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键(专题id) |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 标签id |
|||
*/ |
|||
private String tagId; |
|||
|
|||
/** |
|||
* 新增此专题的用户id |
|||
*/ |
|||
private String addUserId; |
|||
|
|||
/** |
|||
* 新增此专题时用户所在的组织id或者网格id |
|||
*/ |
|||
private String addOrgId; |
|||
|
|||
/** |
|||
* 网格:grid;社区级:community, |
|||
乡(镇、街道)级:street, |
|||
区县级: district, |
|||
市级: city |
|||
省级:province |
|||
*/ |
|||
private String orgLevel; |
|||
|
|||
/** |
|||
* 新增此专题用户所属的组织id |
|||
*/ |
|||
private String addUserAgencyId; |
|||
|
|||
/** |
|||
* 删除标识 0未删除;1已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 标签名 |
|||
*/ |
|||
private String tagName; |
|||
|
|||
/** |
|||
* 扩展属性:标签颜色 |
|||
*/ |
|||
private String tagColor; |
|||
|
|||
/** |
|||
* 删除人id |
|||
*/ |
|||
private String delStaffId; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 【专题管理】添加专题 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/7/15 14:24 |
|||
*/ |
|||
@Data |
|||
public class AddSpecialSubjectFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -4469613386814496224L; |
|||
|
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
/** |
|||
* 当前所在网格或者组织id |
|||
*/ |
|||
@NotBlank(message = "orgId不能为空", groups = AddUserInternalGroup.class) |
|||
private String orgId; |
|||
|
|||
@NotBlank(message = "pid不能为空", groups = AddUserInternalGroup.class) |
|||
private String pid; |
|||
/** |
|||
* orgId的所有上级id |
|||
*/ |
|||
@NotBlank(message = "pids不能为空", groups = AddUserInternalGroup.class) |
|||
private String pids; |
|||
|
|||
/** |
|||
* 网格:grid;社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province |
|||
*/ |
|||
@NotBlank(message = "orgLevel不能为空", groups = AddUserInternalGroup.class) |
|||
private String orgLevel; |
|||
|
|||
/** |
|||
* 所选的标签id |
|||
*/ |
|||
@NotBlank(message = "tagId不能为空", groups = AddUserInternalGroup.class) |
|||
private String tagId; |
|||
|
|||
// 以下属性从token中获取
|
|||
/** |
|||
* 从TokenDto中获取当前用户id |
|||
*/ |
|||
@NotBlank(message = "从token中获取userId为空", groups = AddUserInternalGroup.class) |
|||
private String addUserId; |
|||
|
|||
@NotBlank(message = "从token中获取客户id为空", groups = AddUserInternalGroup.class) |
|||
private String customerId; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 【专题管理】删除专题 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/7/15 20:50 |
|||
*/ |
|||
@Data |
|||
public class DelSpecialSubjectFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -2305529822756834522L; |
|||
|
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
/** |
|||
* 专题id |
|||
*/ |
|||
@NotBlank(message = "specialSubjectId不能为空", groups = AddUserInternalGroup.class) |
|||
private String specialSubjectId; |
|||
|
|||
/** |
|||
* 当前所在网格或者组织id |
|||
*/ |
|||
@NotBlank(message = "orgId不能为空", groups = AddUserInternalGroup.class) |
|||
private String orgId; |
|||
|
|||
// 以下属性从token中获取
|
|||
/** |
|||
* 从TokenDto中获取当前用户id |
|||
*/ |
|||
@NotBlank(message = "从token中获取userId为空", groups = AddUserInternalGroup.class) |
|||
private String userId; |
|||
@NotBlank(message = "从token中获取客户id为空", groups = AddUserInternalGroup.class) |
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/7/16 10:14 |
|||
*/ |
|||
@Data |
|||
public class HotSubjectTagFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -5526800827207175876L; |
|||
public interface HotSubjectTagGroup {} |
|||
private String customerId; |
|||
@NotBlank(message = "orgId不能为空", groups = HotSubjectTagGroup.class) |
|||
private String orgId; |
|||
@NotBlank(message = "pids不能为空", groups = HotSubjectTagGroup.class) |
|||
private String pids; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/7/16 9:41 |
|||
*/ |
|||
@Data |
|||
public class PreviewFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -3764759458780976123L; |
|||
private List<String> tagIdList; |
|||
private Integer pageSize; |
|||
private Integer pageNo; |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 【专题管理】已有专题列表 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/7/15 21:09 |
|||
*/ |
|||
@Data |
|||
public class QuerySpecialSubFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -436139256753489157L; |
|||
|
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
/** |
|||
* 当前所在网格或者组织id |
|||
*/ |
|||
@NotBlank(message = "orgId不能为空", groups = AddUserInternalGroup.class) |
|||
private String orgId; |
|||
|
|||
/** |
|||
* orgId的所有上级id |
|||
*/ |
|||
@NotBlank(message = "pids不能为空", groups = AddUserInternalGroup.class) |
|||
private String pids; |
|||
|
|||
/** |
|||
* 当前登录用户userId, |
|||
*/ |
|||
private String userId; |
|||
/** |
|||
* 当前登录用户客户id |
|||
*/ |
|||
private String customerId; |
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/7/15 2:05 下午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class SubjectArticleListFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7657974985102791998L; |
|||
|
|||
public interface SubjectArticleListForm extends CustomerClientShowGroup{}; |
|||
|
|||
@NotBlank(message = "网格ID不能为空",groups = SubjectArticleListForm.class) |
|||
private String gridId; |
|||
|
|||
@NotBlank(message = "标签ID不能为空",groups = SubjectArticleListForm.class) |
|||
private String tagId; |
|||
|
|||
@NotNull(message = "pageSize不能为空",groups = SubjectArticleListForm.class) |
|||
private Integer pageSize; |
|||
|
|||
@NotNull(message = "pageNo不能为空",groups = SubjectArticleListForm.class) |
|||
private Integer pageNo; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/7/15 4:34 下午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class SubjectListFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 6397877545890473794L; |
|||
|
|||
public interface SubjectListForm extends CustomerClientShowGroup{} |
|||
|
|||
@NotBlank(message = "网格ID不能为空",groups = SubjectListForm.class) |
|||
private String gridId; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 【专题管理】添加专题 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/7/15 17:46 |
|||
*/ |
|||
@Data |
|||
public class AddSpecialSubjectResultDTO implements Serializable { |
|||
/** |
|||
* 刚添加成功的专题id |
|||
* */ |
|||
private String specialSubjectId; |
|||
|
|||
public AddSpecialSubjectResultDTO(String id) { |
|||
this.specialSubjectId=id; |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/7/16 14:26 |
|||
*/ |
|||
@Data |
|||
public class PreviewResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 4801322472642418941L; |
|||
private String specialSubjectId; |
|||
private String tagName; |
|||
private List<ArticleListResultDTO> articleList; |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/7/15 2:11 下午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class SubjectArticleListResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 2580894348808140034L; |
|||
|
|||
/** |
|||
* 文章标题 |
|||
*/ |
|||
private String articleTitle; |
|||
|
|||
/** |
|||
* 文章内容 |
|||
*/ |
|||
private String articleContent; |
|||
|
|||
/** |
|||
* 文章ID |
|||
*/ |
|||
private String articleId; |
|||
|
|||
/** |
|||
* 发布者姓名 |
|||
*/ |
|||
private String publisherName; |
|||
|
|||
/** |
|||
* 发布时间 |
|||
*/ |
|||
private String publishDate; |
|||
|
|||
/** |
|||
* 标签名字集合 |
|||
*/ |
|||
private String tagNames; |
|||
|
|||
/** |
|||
* 文章封面 |
|||
*/ |
|||
private String articleCoverImg; |
|||
|
|||
public SubjectArticleListResultDTO() { |
|||
this.articleTitle = ""; |
|||
this.articleContent = ""; |
|||
this.articleId = ""; |
|||
this.publisherName = ""; |
|||
this.publishDate = ""; |
|||
this.tagNames = ""; |
|||
this.articleCoverImg = ""; |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/7/15 4:46 下午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class SubjectListResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -7761847964768693672L; |
|||
|
|||
/** |
|||
* 标签ID |
|||
*/ |
|||
private String tagId; |
|||
|
|||
/** |
|||
* 专题名字 |
|||
*/ |
|||
private String tagName; |
|||
|
|||
/** |
|||
* 标签颜色 |
|||
*/ |
|||
private String tagColor; |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 【专题管理】已有专题列表 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/7/15 21:14 |
|||
*/ |
|||
@Data |
|||
public class WorkSpecialSubjectResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 8147664815754574860L; |
|||
/** |
|||
* 标签id |
|||
*/ |
|||
private String tagId; |
|||
|
|||
/** |
|||
* 标签名称 |
|||
*/ |
|||
private String tagName; |
|||
|
|||
/** |
|||
* 标签颜色 |
|||
*/ |
|||
private String tagColor; |
|||
|
|||
/** |
|||
* true代表可以删除。false不可删除,隐藏减号 |
|||
*/ |
|||
private Boolean canDel; |
|||
|
|||
/** |
|||
* 专题id |
|||
*/ |
|||
private String specialSubjectId; |
|||
|
|||
private String addOrgId; |
|||
private String orgLevel; |
|||
|
|||
/** |
|||
* 创建时间-前端无用 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 创建人-前端无用 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 新增此专题用户所属的组织id |
|||
* mean:当前人是谁? |
|||
* -前端无用 |
|||
*/ |
|||
private String addUserAgencyId; |
|||
} |
@ -0,0 +1,128 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.annotation.RequirePermission; |
|||
import com.epmet.commons.tools.enums.RequirePermissionEnum; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.AddSpecialSubjectResultDTO; |
|||
import com.epmet.dto.result.PreviewResultDTO; |
|||
import com.epmet.dto.result.TagInfoResultDTO; |
|||
import com.epmet.dto.result.WorkSpecialSubjectResultDTO; |
|||
import com.epmet.service.SpecialSubjectService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 专题表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-15 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("specialsubject") |
|||
public class SpecialSubjectController { |
|||
|
|||
@Autowired |
|||
private SpecialSubjectService specialSubjectService; |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @author yinzuomei |
|||
* @description 添加专题 |
|||
* @Date 2021/7/15 15:31 |
|||
**/ |
|||
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_SPECIAL_PROJECT_ADD) |
|||
@PostMapping("add") |
|||
public Result<AddSpecialSubjectResultDTO> addSpecialSubject(@LoginUser TokenDto tokenDto, @RequestBody AddSpecialSubjectFormDTO formDTO) { |
|||
formDTO.setAddUserId(tokenDto.getUserId()); |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
ValidatorUtils.validateEntity(formDTO, AddSpecialSubjectFormDTO.AddUserInternalGroup.class); |
|||
return new Result<AddSpecialSubjectResultDTO>().ok(specialSubjectService.addSpecialSubject(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @param |
|||
* @author yinzuomei |
|||
* @description 【专题管理】删除专题 |
|||
* @Date 2021/7/15 20:49 |
|||
**/ |
|||
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_SPECIAL_PROJECT_DEL) |
|||
@PostMapping("del") |
|||
public Result delSpecialSubject(@LoginUser TokenDto tokenDto, @RequestBody DelSpecialSubjectFormDTO formDTO){ |
|||
formDTO.setUserId(tokenDto.getUserId()); |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
specialSubjectService.delSpecialSubject(formDTO); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.WorkSpecialSubjectResultDTO>> |
|||
* @param formDTO |
|||
* @author yinzuomei |
|||
* @description 【专题管理】已有专题列表 |
|||
* @Date 2021/7/15 21:17 |
|||
**/ |
|||
@PostMapping("existedlist") |
|||
public Result<List<WorkSpecialSubjectResultDTO>> queryExistedList(@LoginUser TokenDto tokenDto, @RequestBody QuerySpecialSubFormDTO formDTO) { |
|||
formDTO.setUserId(tokenDto.getUserId()); |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
ValidatorUtils.validateEntity(formDTO, QuerySpecialSubFormDTO.AddUserInternalGroup.class); |
|||
return new Result<List<WorkSpecialSubjectResultDTO>>().ok(specialSubjectService.queryExistedList(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* 热门标签列表 |
|||
* @author zhaoqifeng |
|||
* @date 2021/7/15 15:36 |
|||
* @param tokenDto |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.TagInfoResultDTO>> |
|||
*/ |
|||
@PostMapping("hot-subject-taglist") |
|||
public Result<List<TagInfoResultDTO>> hotSubjectTagList(@LoginUser TokenDto tokenDto, @RequestBody HotSubjectTagFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO, HotSubjectTagFormDTO.HotSubjectTagGroup.class); |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
return new Result<List<TagInfoResultDTO>>().ok(specialSubjectService.hotSubjectTagList(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* 效果预览 |
|||
* @author zhaoqifeng |
|||
* @date 2021/7/16 15:54 |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.PreviewResultDTO>> |
|||
*/ |
|||
@PostMapping("preview") |
|||
public Result<List<PreviewResultDTO>> preview(@RequestBody PreviewFormDTO formDTO) { |
|||
return new Result<List<PreviewResultDTO>>().ok(specialSubjectService.preview(formDTO)); |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.SpecialSubjectDTO; |
|||
import com.epmet.entity.SpecialSubjectEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 专题表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-15 |
|||
*/ |
|||
@Mapper |
|||
public interface SpecialSubjectDao extends BaseDao<SpecialSubjectEntity> { |
|||
|
|||
int delSpecialSubject(@Param("id") String id, @Param("userId") String userId); |
|||
|
|||
List<SpecialSubjectDTO> queryExistedList(@Param("orgId") String orgId,@Param("notList")List<String> notList); |
|||
|
|||
SpecialSubjectDTO getInfo(@Param("tagId") String tagId); |
|||
|
|||
} |
@ -0,0 +1,89 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 专题表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-15 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("special_subject") |
|||
public class SpecialSubjectEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 标签id |
|||
*/ |
|||
private String tagId; |
|||
|
|||
/** |
|||
* 新增此专题的用户id |
|||
*/ |
|||
private String addUserId; |
|||
|
|||
/** |
|||
* 新增此专题时用户所在的组织id或者网格id |
|||
* mean:给谁添加的??? |
|||
*/ |
|||
private String addOrgId; |
|||
|
|||
/** |
|||
* ADD_ORG_ID的上级id |
|||
*/ |
|||
private String addOrgPid; |
|||
|
|||
/** |
|||
* 用户所在的组织或者网格的所有上级 |
|||
*/ |
|||
private String addOrgPids; |
|||
|
|||
/** |
|||
* 网格:grid;社区级:community, |
|||
乡(镇、街道)级:street, |
|||
区县级: district, |
|||
市级: city |
|||
省级:province |
|||
*/ |
|||
private String orgLevel; |
|||
|
|||
/** |
|||
* 新增此专题用户所属的组织id |
|||
* mean:当前人是谁? |
|||
*/ |
|||
private String addUserAgencyId; |
|||
|
|||
/** |
|||
* 删除人id |
|||
*/ |
|||
private String delStaffId; |
|||
|
|||
} |
@ -0,0 +1,148 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.SpecialSubjectDTO; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.PreviewResultDTO; |
|||
import com.epmet.dto.result.TagInfoResultDTO; |
|||
import com.epmet.dto.result.AddSpecialSubjectResultDTO; |
|||
import com.epmet.dto.result.WorkSpecialSubjectResultDTO; |
|||
import com.epmet.entity.SpecialSubjectEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 专题表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-15 |
|||
*/ |
|||
public interface SpecialSubjectService extends BaseService<SpecialSubjectEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<SpecialSubjectDTO> |
|||
* @author generator |
|||
* @date 2021-07-15 |
|||
*/ |
|||
PageData<SpecialSubjectDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<SpecialSubjectDTO> |
|||
* @author generator |
|||
* @date 2021-07-15 |
|||
*/ |
|||
List<SpecialSubjectDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return SpecialSubjectDTO |
|||
* @author generator |
|||
* @date 2021-07-15 |
|||
*/ |
|||
SpecialSubjectDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-07-15 |
|||
*/ |
|||
void save(SpecialSubjectDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-07-15 |
|||
*/ |
|||
void update(SpecialSubjectDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-07-15 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 热门标签列表 |
|||
* @author zhaoqifeng |
|||
* @date 2021/7/15 15:35 |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.TagInfoResultDTO> |
|||
*/ |
|||
List<TagInfoResultDTO> hotSubjectTagList(HotSubjectTagFormDTO formDTO); |
|||
|
|||
/** |
|||
* 添加专题 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2021-07-15 |
|||
*/ |
|||
AddSpecialSubjectResultDTO addSpecialSubject(AddSpecialSubjectFormDTO formDTO); |
|||
|
|||
/** |
|||
* 【专题管理】删除专题 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2021-07-15 |
|||
*/ |
|||
void delSpecialSubject(DelSpecialSubjectFormDTO formDTO); |
|||
|
|||
/** |
|||
* 【专题管理】已有专题列表 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2021-07-15 |
|||
*/ |
|||
List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO); |
|||
|
|||
/** |
|||
* 效果预览 |
|||
* @author zhaoqifeng |
|||
* @date 2021/7/16 14:28 |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.PreviewResultDTO> |
|||
*/ |
|||
List<PreviewResultDTO> preview(PreviewFormDTO formDTO); |
|||
} |
@ -0,0 +1,306 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.SpecialSubjectDao; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.dto.SpecialSubjectDTO; |
|||
import com.epmet.dto.TagCustomerDTO; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.*; |
|||
import com.epmet.entity.SpecialSubjectEntity; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.redis.TagRedis; |
|||
import com.epmet.service.ArticleService; |
|||
import com.epmet.service.SpecialSubjectService; |
|||
import com.epmet.service.TagCustomerService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
import java.util.stream.Stream; |
|||
|
|||
/** |
|||
* 专题表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-15 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao, SpecialSubjectEntity> implements SpecialSubjectService { |
|||
@Autowired |
|||
private TagCustomerService tagCustomerService; |
|||
@Resource |
|||
private TagRedis tagRedis; |
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
@Resource |
|||
private ArticleService articleService; |
|||
|
|||
@Override |
|||
public PageData<SpecialSubjectDTO> page(Map<String, Object> params) { |
|||
IPage<SpecialSubjectEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, SpecialSubjectDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<SpecialSubjectDTO> list(Map<String, Object> params) { |
|||
List<SpecialSubjectEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, SpecialSubjectDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<SpecialSubjectEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<SpecialSubjectEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public SpecialSubjectDTO get(String id) { |
|||
SpecialSubjectEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, SpecialSubjectDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(SpecialSubjectDTO dto) { |
|||
SpecialSubjectEntity entity = ConvertUtils.sourceToTarget(dto, SpecialSubjectEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(SpecialSubjectDTO dto) { |
|||
SpecialSubjectEntity entity = ConvertUtils.sourceToTarget(dto, SpecialSubjectEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 添加专题 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2021-07-15 |
|||
*/ |
|||
@Override |
|||
public AddSpecialSubjectResultDTO addSpecialSubject(AddSpecialSubjectFormDTO formDTO) { |
|||
// 1、标签是否存在
|
|||
TagCustomerDTO tagCustomerDTO=tagCustomerService.get(formDTO.getTagId()); |
|||
if(null==tagCustomerDTO){ |
|||
throw new RenException(EpmetErrorCode.TAG_NOT_EXIST.getCode(), EpmetErrorCode.TAG_NOT_EXIST.getMsg()); |
|||
} |
|||
//2、校验当前组织是否添加过此专题
|
|||
QuerySpecialSubFormDTO querySpecialSubFormDTO=ConvertUtils.sourceToTarget(formDTO,QuerySpecialSubFormDTO.class); |
|||
querySpecialSubFormDTO.setUserId(formDTO.getAddUserId()); |
|||
List<WorkSpecialSubjectResultDTO> havedList=this.queryExistedList(querySpecialSubFormDTO); |
|||
List<String> haveTagIds=havedList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList()); |
|||
haveTagIds.forEach(tagId->{ |
|||
if(tagId.equals(formDTO.getTagId())){ |
|||
throw new RenException(EpmetErrorCode.EXISTED_SPECIAL_PROJECT.getCode(), EpmetErrorCode.EXISTED_SPECIAL_PROJECT.getMsg()); |
|||
} |
|||
}); |
|||
// 3、保存
|
|||
SpecialSubjectEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, SpecialSubjectEntity.class); |
|||
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(formDTO.getAddUserId()); |
|||
if(result.success()&&null!=result.getData()){ |
|||
insertEntity.setAddUserAgencyId(result.getData().getId()); |
|||
} |
|||
insertEntity.setAddOrgId(formDTO.getOrgId()); |
|||
insertEntity.setAddOrgPid(formDTO.getPid()); |
|||
insertEntity.setAddOrgPids(formDTO.getPids()); |
|||
baseDao.insert(insertEntity); |
|||
return new AddSpecialSubjectResultDTO(insertEntity.getId()); |
|||
} |
|||
|
|||
/** |
|||
* 【专题管理】删除专题 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2021-07-15 |
|||
*/ |
|||
@Override |
|||
public void delSpecialSubject(DelSpecialSubjectFormDTO formDTO) { |
|||
SpecialSubjectEntity original = baseDao.selectById(formDTO.getSpecialSubjectId()); |
|||
if (null != original) { |
|||
if (!original.getAddOrgId().equals(formDTO.getOrgId())) { |
|||
log.warn("当前专题id=" + original.getId() + ";是属于orgId=" + original.getAddOrgId() + ";当前用户正处在orgId=" + formDTO.getOrgId()+";所以无权删除"); |
|||
throw new RenException(EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getCode(), EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getMsg()); |
|||
} |
|||
baseDao.delSpecialSubject(formDTO.getSpecialSubjectId(), formDTO.getUserId()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 【专题管理】已有专题列表 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2021-07-15 |
|||
*/ |
|||
@Override |
|||
public List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO) { |
|||
Result<CustomerAgencyDTO> staffResult = govOrgOpenFeignClient.getAgencyByStaff(formDTO.getUserId()); |
|||
if (!staffResult.success() && null == staffResult.getData()) { |
|||
throw new RenException("查询当前工作人员信息异常"); |
|||
} |
|||
List<WorkSpecialSubjectResultDTO> resultDTOList = new ArrayList<>(); |
|||
List<String> notList = new ArrayList<>(); |
|||
//当前组织或者网格自己建立的
|
|||
List<WorkSpecialSubjectResultDTO> currentOrgList = new ArrayList<>(); |
|||
List<SpecialSubjectDTO> currentOrgCreatedList = baseDao.queryExistedList(formDTO.getOrgId(), notList); |
|||
currentOrgCreatedList.forEach(dto -> { |
|||
WorkSpecialSubjectResultDTO result = ConvertUtils.sourceToTarget(dto,WorkSpecialSubjectResultDTO.class); |
|||
result.setSpecialSubjectId(dto.getId()); |
|||
//1、如果当前专题是给当前所在组织(or网格)添加的;
|
|||
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
|
|||
// A组织添加到G1网格的专题,只有A组织下的工作人员,切换到G1时,才可以删除。
|
|||
if(dto.getAddUserAgencyId().equals(staffResult.getData().getId()) |
|||
&& dto.getAddOrgId().equals(formDTO.getOrgId())){ |
|||
result.setCanDel(true); |
|||
}else{ |
|||
result.setCanDel(false); |
|||
} |
|||
currentOrgList.add(result); |
|||
}); |
|||
if (CollectionUtils.isNotEmpty(currentOrgList)) { |
|||
notList = currentOrgList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList()); |
|||
} |
|||
if (!NumConstant.ZERO_STR.equals(formDTO.getPids())) { |
|||
List<String> pidList = Arrays.asList(formDTO.getPids().split(StrConstant.COLON)); |
|||
for (String pid : pidList) { |
|||
if(CollectionUtils.isNotEmpty(resultDTOList)){ |
|||
List<String> parentAddList=resultDTOList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList()); |
|||
notList.addAll(parentAddList); |
|||
} |
|||
//优先展示自己的,所以要排除掉自己的,自上向下查,优先展示上层领导们给我建立的专题
|
|||
List<SpecialSubjectDTO> list = baseDao.queryExistedList(pid, notList); |
|||
list.forEach(dto -> { |
|||
WorkSpecialSubjectResultDTO result = ConvertUtils.sourceToTarget(dto,WorkSpecialSubjectResultDTO.class); |
|||
result.setSpecialSubjectId(dto.getId()); |
|||
//1、如果当前专题是给当前所在组织(or网格)添加的;
|
|||
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
|
|||
if (dto.getAddUserAgencyId().equals(staffResult.getData().getId()) |
|||
&& dto.getAddOrgId().equals(formDTO.getOrgId())) { |
|||
result.setCanDel(true); |
|||
} else { |
|||
result.setCanDel(false); |
|||
} |
|||
resultDTOList.add(result); |
|||
}); |
|||
} |
|||
} |
|||
//自己建立的在最后面
|
|||
if (CollectionUtils.isNotEmpty(currentOrgList)) { |
|||
resultDTOList.addAll(currentOrgList); |
|||
} |
|||
return resultDTOList; |
|||
} |
|||
|
|||
/** |
|||
* 热门标签列表 |
|||
* |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.TagInfoResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/7/15 15:35 |
|||
*/ |
|||
@Override |
|||
public List<TagInfoResultDTO> hotSubjectTagList(HotSubjectTagFormDTO formDTO) { |
|||
|
|||
List<TagInfoResultDTO> list = tagRedis.zRevRange(formDTO.getCustomerId()); |
|||
List<String> orgIds = Stream.of(formDTO.getPids().split(StrConstant.COLON)).collect(Collectors.toList()); |
|||
orgIds.add(formDTO.getOrgId()); |
|||
LambdaQueryWrapper<SpecialSubjectEntity> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(SpecialSubjectEntity :: getCustomerId, formDTO.getCustomerId()); |
|||
wrapper.eq(SpecialSubjectEntity :: getDelFlag, NumConstant.ZERO_STR); |
|||
wrapper.in(SpecialSubjectEntity :: getAddOrgId, orgIds); |
|||
//查询出当前组织或网格已有的专题,
|
|||
List<SpecialSubjectEntity> specialSubjectList = baseDao.selectList(wrapper); |
|||
if (CollectionUtils.isNotEmpty(specialSubjectList)) { |
|||
List<String> tags = specialSubjectList.stream().map(SpecialSubjectEntity :: getTagId).distinct().collect(Collectors.toList()); |
|||
// 排除
|
|||
list = list.stream().filter(item -> !tags.contains(item.getTagId())).collect(Collectors.toList()); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
/** |
|||
* 效果预览 |
|||
* |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.PreviewResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/7/16 14:28 |
|||
*/ |
|||
@Override |
|||
public List<PreviewResultDTO> preview(PreviewFormDTO formDTO) { |
|||
List<PreviewResultDTO> result = new ArrayList<>(); |
|||
if (CollectionUtils.isNotEmpty(formDTO.getTagIdList())) { |
|||
formDTO.getTagIdList().forEach(tagId -> { |
|||
PreviewResultDTO previewResultDTO = new PreviewResultDTO(); |
|||
previewResultDTO.setArticleList(articleService.getArticleListByTag(tagId, (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(), |
|||
formDTO.getPageSize())); |
|||
result.add(previewResultDTO); |
|||
}); |
|||
} |
|||
return result; |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.epmet.utils; |
|||
|
|||
import java.util.Random; |
|||
|
|||
/** |
|||
* desc:标签颜色工具类 |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2021/7/19 10:39 上午 |
|||
* @version: 1.0 |
|||
*/ |
|||
public class TagColorUtils { |
|||
private static final String[] tagColorArr = {"#E3271C","#FB7900","#FFC100","#0089FF","#17B886"}; |
|||
|
|||
/** |
|||
* desc: 随机获取标签颜色 |
|||
* |
|||
* @param |
|||
* @return java.lang.String |
|||
* @author LiuJanJun |
|||
* @date 2021/7/19 2:38 下午 |
|||
*/ |
|||
public static String getRandomColor(){ |
|||
int size = tagColorArr.length; |
|||
int index = new Random().nextInt(size); |
|||
return tagColorArr[index]; |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
CREATE TABLE `special_subject` ( |
|||
`ID` varchar(64) NOT NULL COMMENT '主键(专题id)', |
|||
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', |
|||
`TAG_ID` varchar(64) NOT NULL COMMENT '标签id', |
|||
`ADD_USER_ID` varchar(64) NOT NULL COMMENT '新增此专题的用户id', |
|||
`ADD_ORG_ID` varchar(64) NOT NULL COMMENT '新增此专题时用户所在的组织id或者网格id', |
|||
`ADD_ORG_PID` varchar(64) NOT NULL COMMENT 'ADD_ORG_ID的上级id', |
|||
`ADD_ORG_PIDS` varchar(255) NOT NULL COMMENT '用户所在的组织或者网格的所有上级', |
|||
`ORG_LEVEL` varchar(10) NOT NULL COMMENT '网格:grid;社区级:community,\r\n乡(镇、街道)级:street,\r\n区县级: district,\r\n市级: city\r\n省级:province', |
|||
`ADD_USER_AGENCY_ID` varchar(64) NOT NULL COMMENT '新增此专题用户所属的组织id', |
|||
`DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', |
|||
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', |
|||
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', |
|||
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间', |
|||
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', |
|||
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', |
|||
PRIMARY KEY (`ID`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='专题表'; |
@ -0,0 +1,37 @@ |
|||
#添加标签颜色字段 |
|||
ALTER TABLE `epmet_gov_voice`.`tag_default` |
|||
ADD COLUMN `TAG_COLOR` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '标签颜色' AFTER `TAG_NAME`, |
|||
DROP PRIMARY KEY, |
|||
ADD PRIMARY KEY (`ID`) USING BTREE; |
|||
ALTER TABLE `epmet_gov_voice`.`tag_customer` |
|||
ADD COLUMN `TAG_COLOR` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '标签颜色' AFTER `TAG_NAME`, |
|||
DROP PRIMARY KEY, |
|||
ADD PRIMARY KEY (`ID`) USING BTREE; |
|||
#给默认标签添加颜色 |
|||
update tag_default set tag_color='#E3271C' where id='6dd39a3dab9011ea8c52c03fd56f7847'; |
|||
update tag_default set tag_color='#FB7900' where id='6dd55595ab9011ea8c52c03fd56f7847'; |
|||
update tag_default set tag_color='#FFC100' where id='6dd6c2eeab9011ea8c52c03fd56f7847'; |
|||
update tag_default set tag_color='#0089FF' where id='6dd804d1ab9011ea8c52c03fd56f7847'; |
|||
update tag_default set tag_color='#17B886' where id='6dda6acaab9011ea8c52c03fd56f7847'; |
|||
|
|||
#给已有的客户默认标签 添加统一的颜色 |
|||
update tag_customer set tag_color='#E3271C' where TAG_NAME='发现榜样'; |
|||
update tag_customer set tag_color='#FB7900' where TAG_NAME='党建动态'; |
|||
update tag_customer set tag_color='#FFC100' where TAG_NAME='通知公告'; |
|||
update tag_customer set tag_color='#0089FF' where TAG_NAME='生活服务'; |
|||
update tag_customer set tag_color='#17B886' where TAG_NAME='党建要闻'; |
|||
|
|||
#手动去执行 |
|||
#获取有哪些客户的标签需要赋值颜色 |
|||
# SELECT CUSTOMER_ID ,COUNT(ID) c FROM tag_customer where tag_color IS NULL GROUP BY CUSTOMER_ID; |
|||
#按照时间顺序 依次更新5个颜色 |
|||
# update tag_customer set tag_color='#E3271C' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1; |
|||
# update tag_customer set tag_color='#FB7900' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1; |
|||
# update tag_customer set tag_color='#FFC100' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1; |
|||
# update tag_customer set tag_color='#0089FF' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1; |
|||
# update tag_customer set tag_color='#17B886' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1; |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1 @@ |
|||
alter table special_subject add COLUMN DEL_STAFF_ID VARCHAR(64) COMMENT '删除人id' AFTER ADD_USER_AGENCY_ID; |
@ -0,0 +1,42 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.SpecialSubjectDao"> |
|||
|
|||
<update id="delSpecialSubject" parameterType="map"> |
|||
update special_subject set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=Now(),DEL_STAFF_ID=#{userId} |
|||
where id=#{id} |
|||
</update> |
|||
|
|||
<select id="queryExistedList" parameterType="map" resultType="com.epmet.dto.SpecialSubjectDTO"> |
|||
SELECT |
|||
ss.*, |
|||
tc.TAG_NAME AS tagName, |
|||
tc.TAG_COLOR as tagColor |
|||
FROM |
|||
special_subject ss |
|||
INNER JOIN tag_customer tc ON ( ss.CUSTOMER_ID = tc.CUSTOMER_ID AND ss.TAG_ID = tc.id ) |
|||
WHERE |
|||
ss.DEL_FLAG = '0' |
|||
AND tc.DEL_FLAG = '0' |
|||
AND ss.ADD_ORG_ID = #{orgId} |
|||
<if test="null != notList and notList.size()>0"> |
|||
and ss.tag_id not in |
|||
<foreach item="tagId" collection="notList" open="(" separator="," close=")"> |
|||
#{tagId} |
|||
</foreach> |
|||
</if> |
|||
order by ss.CREATED_TIME desc |
|||
</select> |
|||
<select id="getInfo" resultType="com.epmet.dto.SpecialSubjectDTO"> |
|||
SELECT |
|||
ss.id, |
|||
TAG_NAME |
|||
FROM |
|||
special_subject ss |
|||
INNER JOIN tag_customer ts ON ss.tag_id = ts.id |
|||
WHERE |
|||
ss.del_flag = '0' |
|||
AND ss.tag_id = #{tagId} |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue