diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index 86b39b69c8..28e9fae188 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://118.190.150.119:43306/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://192.168.1.140:3306/epmet_gov_voice?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: root #oracle配置 diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index b0f7737940..4cd073f977 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -197,6 +197,11 @@ + + com.tencentcloudapi + tencentcloud-sdk-java + 3.1.322 + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java index a0d1520e43..a245051765 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java @@ -1,5 +1,7 @@ package com.epmet.commons.tools.enums; +import org.apache.commons.lang3.StringUtils; + public enum PartyOrgTypeEnum { PROVINCIAL("0", "省委"), @@ -34,4 +36,17 @@ public enum PartyOrgTypeEnum { public void setName(String name) { this.name = name; } + + public static PartyOrgTypeEnum getEnumByCode(String code) { + if (StringUtils.isBlank(code)) { + return null; + } + for (PartyOrgTypeEnum en : PartyOrgTypeEnum.values()) { + if (en.getCode().equals(code)) { + return en; + } + } + + return null; + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java new file mode 100644 index 0000000000..34647de7ec --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java @@ -0,0 +1,49 @@ +package com.epmet.commons.tools.utils.net; + +import com.tencentcloudapi.ccc.v20200210.CccClient; +import com.tencentcloudapi.ccc.v20200210.models.CreateSDKLoginTokenRequest; +import com.tencentcloudapi.ccc.v20200210.models.CreateSDKLoginTokenResponse; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; +import com.tencentcloudapi.common.profile.ClientProfile; +import com.tencentcloudapi.common.profile.HttpProfile; +import lombok.extern.slf4j.Slf4j; + + +@Slf4j +public class TCCCClientUtils { + + private static String SDKAPPID = "1400801042"; + + private static String USERID = "286388969@qq.com"; + + private static String SECRETID = "AKIDynW4oQr6ED0a2dIn6EC3wgFlDVjrqIbg"; + + private static String SECRETKEY = "ymRuDJI8mCRUUPFvQqCPQME0c2MbfaM2"; + + public static String getToken() { + try { + Credential cred = new Credential(SECRETID, SECRETKEY); + // 实例化一个http选项,可选的,没有特殊需求可以跳过 + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("ccc.ap-shanghai.tencentcloudapi.com"); + // 实例化一个client选项,可选的,没有特殊需求可以跳过 + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + // 实例化要请求产品的client对象,clientProfile是可选的 + CccClient client = new CccClient(cred, "", clientProfile); + // 实例化一个请求对象,每个接口都会对应一个request对象 + CreateSDKLoginTokenRequest req = new CreateSDKLoginTokenRequest(); + req.setSdkAppId(1400801042L); + req.setSeatUserId("286388969@qq.com"); + // 返回的resp是一个CreateSDKLoginTokenResponse的实例,与请求对象对应 + CreateSDKLoginTokenResponse resp = client.CreateSDKLoginToken(req); + // 输出json格式的字符串回包 + System.out.println(CreateSDKLoginTokenResponse.toJsonString(resp)); + return CreateSDKLoginTokenResponse.toJsonString(resp); + } catch (TencentCloudSDKException e) { + log.error(e.toString()); + return e.toString(); + } + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java new file mode 100644 index 0000000000..18c2baba6e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java @@ -0,0 +1,24 @@ +package com.epmet.controller.tccc; + +import com.epmet.commons.tools.utils.net.TCCCClientUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@RestController +@RequestMapping("tccc") +public class TCCCAuthController { + + @RequestMapping("getTcccAuth") + public String getTcccAuth() { + try { + String tcccAuth = TCCCClientUtils.getToken(); + System.out.println(tcccAuth); + return tcccAuth; + } catch (Exception e) { + log.error(e.toString()); + return e.toString(); + } + } +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/CategoryDictDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/CategoryDictDTO.java new file mode 100644 index 0000000000..bbbce73e60 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/CategoryDictDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Data +public class CategoryDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 分类栏目名称 + */ + private String categoryName; + + /** + * 父栏目ID + */ + private String pid; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java index 568943b537..207fb75bcc 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java @@ -31,6 +31,9 @@ public class AddOrSaveDraftFormDTO implements Serializable { @Length(max = 50, message = "标题最长为50个字") private String title; + @NotBlank(message = "栏目分类不能为空",groups = {AddArticleForm.class}) + private String category; + /** * 发布范围IDs */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java index 6d4b81cc2a..fb472b3096 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java @@ -42,6 +42,11 @@ public class DraftAttrFromDTO implements Serializable { @NotBlank(message = "草稿ID不能为空") private String draftId; + /** + * 栏目 + */ + private String category; + /** * 封面图片地址 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java index 09c6818ac2..717930c62e 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java @@ -43,6 +43,11 @@ public class DraftContentFromDTO implements Serializable { */ private String draftId; + /** + * 栏目 + */ + private String category; + /** * 文章标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java index b575bf90c6..860e0fd6e6 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java @@ -28,6 +28,9 @@ public class UpdateArticleFormDTO { @NotBlank(message = "articleId不能为空", groups = {AddUserInternalGroup.class}) private String articleId; + @NotBlank(message = "栏目不能为空", groups = {AddUserInternalGroup.class}) + private String category; + @NotBlank(message = "文章标题不能为空", groups = {AddUserShowGroup.class}) @Length(max = 50, message = "文章标题最长为50个字") private String title; diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java index e3f62d12d5..f3c5e77a86 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java @@ -19,6 +19,10 @@ public class DraftListResultDTO implements Serializable { * 文章ID */ private String draftId; + /** + * 栏目 + */ + private String category; /** * 文章标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java index 2f14da3dc6..814d1e797c 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java @@ -19,6 +19,11 @@ public class DraftPcListResultDTO implements Serializable { * 文章草稿ID */ private String draftId; + + /** + * 栏目 + */ + private String category; /** * 组织Id */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java index 5ca995d10e..9e30604875 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java @@ -21,7 +21,10 @@ public class GovArticleDetailResultDTO implements Serializable { * 文章id */ private String articleId; - + /** + * 栏目 + */ + private String category; /** * 标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java index e277f6cd7a..c7e86d113f 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java @@ -19,6 +19,11 @@ public class OfflineListResultDTO implements Serializable { * 文章ID */ private String articleId; + + /** + * 栏目 + */ + private String category; /** * 文章标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java index e73acb6294..78ff5fe7f9 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java @@ -21,6 +21,11 @@ public class PublishedListResultDTO implements Serializable { * 文章ID */ private String articleId; + + /** + * 分类 + */ + private String category; /** * 组织Id */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java new file mode 100644 index 0000000000..40d67f975f --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java @@ -0,0 +1,72 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CategoryDictDTO; +import com.epmet.service.CategoryDictService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@RestController +@RequestMapping("categoryDict") +public class CategoryDictController { + + @Autowired + private CategoryDictService categoryDictService; + + @RequestMapping("list") + public Result> list(@RequestParam Integer pageNo, @RequestParam Integer pageSize){ + List list = categoryDictService.list(pageNo, pageSize); + return new Result>().ok(list); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + CategoryDictDTO data = categoryDictService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody CategoryDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + categoryDictService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody CategoryDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + categoryDictService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + categoryDictService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java index 6cf5a28000..39e70e953e 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java @@ -68,7 +68,7 @@ public class DraftController { } @PostMapping("draftlist") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_LIST) + // @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_LIST) public Result> draftList(@LoginUser TokenDto tokenDto, @RequestBody DraftListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(draftService.draftList(tokenDto, formDTO).getList()); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/CategoryDictDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/CategoryDictDao.java new file mode 100644 index 0000000000..6797882a8a --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/CategoryDictDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CategoryDictEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Mapper +public interface CategoryDictDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java index 87a4c76078..828bc985a6 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java @@ -42,6 +42,15 @@ public class ArticleEntity extends BaseEpmetEntity { */ private String customerId; + /** + * @description: 分类 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/12 4:39 PM + */ + private String category; + /** * 草稿ID */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/CategoryDictEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/CategoryDictEntity.java new file mode 100644 index 0000000000..e6cd84571c --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/CategoryDictEntity.java @@ -0,0 +1,44 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("category_dict") +public class CategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 分类栏目名称 + */ + private String categoryName; + + /** + * 父栏目ID + */ + private String pid; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java index 1c93cfc7cf..354ea0e01a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java @@ -47,6 +47,15 @@ public class DraftEntity extends BaseEpmetEntity { */ private String title; + /** + * @description: 分类 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/12 2:09 PM + */ + private String category; + /** * 标题审核状态 */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java new file mode 100644 index 0000000000..b070fd1c34 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java @@ -0,0 +1,88 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CategoryDictDTO; +import com.epmet.entity.CategoryDictEntity; + +import java.util.List; +import java.util.Map; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +public interface CategoryDictService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2023-04-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2023-04-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CategoryDictDTO + * @author generator + * @date 2023-04-11 + */ + CategoryDictDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2023-04-11 + */ + void save(CategoryDictDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2023-04-11 + */ + void update(CategoryDictDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2023-04-11 + */ + void delete(String[] ids); + + /** + * @description: 列表 + * @param pageNo: + * @param pageSize: + * @return java.util.List + * @author: WangXianZhang + * @date: 2023/4/11 7:06 PM + */ + List list(Integer pageNo, Integer pageSize); +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index f51705afdd..49c9350819 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -187,6 +187,7 @@ public class ArticleServiceImpl extends BaseServiceImpl draftContentList = null; if (StringUtils.isNotBlank(fromDTO.getDraftId())) { draftEntity = this.checkDraftStatus(fromDTO.getDraftId()); + draftEntity.setCategory(fromDTO.getCategory()); draftEntity.setTitle(StringUtils.isBlank(fromDTO.getTitle()) ? "" : fromDTO.getTitle()); buildPreviewContent(fromDTO, draftEntity); draftDao.updateById(draftEntity); @@ -212,6 +213,7 @@ public class ArticleServiceImpl extends BaseServiceImpl publishRangeEntityList = buildDraftPublishRange(draftEntity, tokenDto, fromDTO); - - + // 栏目 + draftEntity.setCategory(fromDTO.getCategory()); executeSaveDraftAttr(draftEntity, coverEntity, publishRangeEntityList); return true; } @@ -933,6 +935,7 @@ public class ArticleServiceImpl extends BaseServiceImpl DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); article.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); article.setPublisherId(formDTO.getPublisher()); @@ -1617,6 +1621,7 @@ public class ArticleServiceImpl extends BaseServiceImpl DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); draft.setPublisherId(StringUtils.isBlank(formDTO.getPublisher()) ? "" : formDTO.getPublisher()); draft.setPublishDate(StringUtils.isBlank(formDTO.getPublishDate()) ? null : DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); @@ -1841,6 +1846,7 @@ public class ArticleServiceImpl extends BaseServiceImpl DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); articleEntity.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); articleEntity.setPublisherId(formDTO.getPublisher()); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java new file mode 100644 index 0000000000..e48f6fd893 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java @@ -0,0 +1,149 @@ +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.distributedlock.DistributedLock; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.dao.CategoryDictDao; +import com.epmet.dto.CategoryDictDTO; +import com.epmet.entity.CategoryDictEntity; +import com.epmet.service.CategoryDictService; +import org.apache.commons.lang3.StringUtils; +import org.redisson.api.RLock; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Service +public class CategoryDictServiceImpl extends BaseServiceImpl implements CategoryDictService { + + @Autowired + private DistributedLock distributedLock; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CategoryDictDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CategoryDictDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CategoryDictDTO get(String id) { + CategoryDictEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CategoryDictDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CategoryDictDTO dto) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + // 重名检查,客户下不能重名 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CategoryDictEntity::getCustomerId, customerId); + query.eq(CategoryDictEntity::getCategoryName, dto.getCategoryName()); + + // 加锁 + RLock lock = distributedLock.getLock("voice:categorydict"); + try { + if (baseDao.selectCount(query) > 0) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "栏目名称已存在"); + } + + dto.setCustomerId(customerId); + CategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, CategoryDictEntity.class); + insert(entity); + + } catch (EpmetException ee) { + throw ee; + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【文章】新增文章栏目失败:" + ExceptionUtils.getErrorStackTrace(e)); + } finally { + // 解锁 + lock.unlock(); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CategoryDictDTO dto) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + // 重名检查,客户下不能重名 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CategoryDictEntity::getCustomerId, customerId); + query.eq(CategoryDictEntity::getCategoryName, dto.getCategoryName()); + + RLock lock = distributedLock.getLock("voice:categorydict"); + try { + CategoryDictEntity inDb = null; + // 能查询到一条数据,并且该条数据的ID不是当前修改的这条数据的ID,说明已存在同名的其他标签,该名字已被其他标签占用 + if ((inDb = baseDao.selectOne(query)) != null + && !inDb.getId().equals(dto.getId())) { + + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "栏目名称已存在"); + } + + dto.setCustomerId(customerId); + CategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, CategoryDictEntity.class); + updateById(entity); + + } catch (EpmetException ee) { + throw ee; + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【文章】新增文章栏目失败:" + ExceptionUtils.getErrorStackTrace(e)); + } finally { + // 解锁 + lock.unlock(); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List list(Integer pageNo, Integer pageSize) { + List list = baseDao.selectList(null); + return ConvertUtils.sourceToTarget(list, CategoryDictDTO.class); + } +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml index 04b8d0d712..19daac0379 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml @@ -7,6 +7,7 @@ SELECT id AS ARTICLE_ID, TITLE, + CATEGORY AS "category", PUBLISHER_NAME, PUBLISH_DATE, ( SELECT count( 1 ) FROM article_visit_record avr WHERE avr.DEL_FLAG = '0' AND avr.ARTICLE_ID =#{articleId}) AS VISIT_RECORD_COUNT, @@ -51,6 +52,7 @@ + select t.TYPE_KEY actTypeKey + , t.TYPE_NAME name + , count(*) as value + from ic_party_act a + inner join ic_party_act_type_dict t on (a.ACT_TYPE = t.TYPE_KEY and t.DEL_FLAG = 0) + where a.DEL_FLAG = 0 + and a.CUSTOMER_ID = #{customerId} + and a.ORG_ID_PATH like CONCAT(#{orgIdPath}, '%') + group by t.TYPE_KEY + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml index 410a074121..0f096e641d 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml @@ -249,4 +249,48 @@ ORDER BY org_pids ASC + + + + + + + + + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml index a9d4f8c583..b33c53a9d0 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml @@ -35,8 +35,9 @@ + - SELECT * FROM (