diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/pom.xml b/esua-epdc/epdc-admin/epdc-admin-epmet/pom.xml new file mode 100644 index 00000000..55da4ac6 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/pom.xml @@ -0,0 +1,89 @@ + + + + esua-epdc + com.esua.epdc + 1.0.0 + + 4.0.0 + + epdc-admin-epmet + admin模块项目对接产品功能工具包 + + + + com.esua.epdc + epdc-admin-client + 1.0.0 + + + com.esua.epdc + epdc-commons-mybatis + 1.0.0 + + + org.springframework.boot + spring-boot-autoconfigure + compile + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + + + ${project.artifactId} + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + com.spotify + dockerfile-maven-plugin + + + + ${project.basedir}/src/main/java + + + + true + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + + + diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/db/sys_epmet_user_relation.sql b/esua-epdc/epdc-admin/epdc-admin-epmet/src/db/sys_epmet_user_relation.sql new file mode 100644 index 00000000..6b35d620 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/db/sys_epmet_user_relation.sql @@ -0,0 +1,17 @@ +CREATE TABLE `sys_epmet_user_relation` ( + `ID` varchar(32) NOT NULL COMMENT 'ID', + `SYS_USER_ID` bigint(20) NOT NULL COMMENT '项目端用户ID', + `STAFF_ID` varchar(100) NOT NULL COMMENT '产品端工作人员ID', + `STAFF_NAME` varchar(100) NOT NULL COMMENT '产品端工作人员姓名', + `MOBILE` varchar(50) NOT NULL COMMENT '产品端工作人员手机号', + `AGENCY_ID` varchar(100) NOT NULL COMMENT '产品端工作人员所属组织ID', + `AGENCY_ALL_NAME` varchar(300) NOT NULL COMMENT '产品端工作人员所属组织全路径名称', + `CUSTOMER_ID` varchar(100) NOT NULL COMMENT '产品端工作人员所属客户id', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识 0-否,1-是', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目产品工作人员关系表'; diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/feign/EpmetAnalysisFeignClient.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/feign/EpmetAnalysisFeignClient.java new file mode 100644 index 00000000..01a0b69c --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/feign/EpmetAnalysisFeignClient.java @@ -0,0 +1,31 @@ +package com.elink.esua.epdc.epmet.modules.feign; + +import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.admin.*; +import com.elink.esua.epdc.epmet.modules.feign.fallback.EpmetAnalysisFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * 数据分析模块调用 + * + * @Author:liuchuang + * @Date:2020/9/9 15:41 + */ +@FeignClient(name = ServiceConstant.EPDC_ANALYSIS_SERVER, fallback = EpmetAnalysisFeignClientFallback.class) +public interface EpmetAnalysisFeignClient { + + /** + * 根据手机号获取产品工作人员信息 + * + * @param formDto 入参 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 19:19 + */ + @GetMapping(value = "analysis/admin/getEpmetUserInfo", consumes = MediaType.APPLICATION_JSON_VALUE) + Result getEpmetUserInfoByMobile(SysEpmetUserFormDTO formDto); + +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/feign/fallback/EpmetAnalysisFeignClientFallback.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/feign/fallback/EpmetAnalysisFeignClientFallback.java new file mode 100644 index 00000000..9448221e --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/feign/fallback/EpmetAnalysisFeignClientFallback.java @@ -0,0 +1,22 @@ +package com.elink.esua.epdc.epmet.modules.feign.fallback; + +import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; +import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.admin.*; +import com.elink.esua.epdc.epmet.modules.feign.EpmetAnalysisFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Author:songyunpeg + * @Date:2020/9/9 15:42 + */ +@Component +public class EpmetAnalysisFeignClientFallback implements EpmetAnalysisFeignClient { + + + @Override + public Result getEpmetUserInfoByMobile(SysEpmetUserFormDTO formDto) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "getEpmetUserInfoByMobile",formDto); + } +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/controller/SysEpmetUserRelationController.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/controller/SysEpmetUserRelationController.java new file mode 100644 index 00000000..80cac07c --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/controller/SysEpmetUserRelationController.java @@ -0,0 +1,140 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.epmet.modules.userrelation.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.epmet.modules.userrelation.dto.SysEpmetUserRelationDTO; +import com.elink.esua.epdc.epmet.modules.userrelation.service.SysEpmetUserRelationService; +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 qu qu@elink-cn.com + * @since v1.0.0 2021-07-08 + */ +@RestController +@RequestMapping("sysepmetuserrelation") +public class SysEpmetUserRelationController { + + @Autowired + private SysEpmetUserRelationService sysEpmetUserRelationService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = sysEpmetUserRelationService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + SysEpmetUserRelationDTO data = sysEpmetUserRelationService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody SysEpmetUserRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + sysEpmetUserRelationService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody SysEpmetUserRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + sysEpmetUserRelationService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + sysEpmetUserRelationService.delete(ids); + return new Result(); + } + + /** + * 获取当前用户已绑定的产品工作人员信息 + * + * @param id 当前用户ID + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 16:39 + */ + @GetMapping("getepmetuser/{id}") + public Result getEpmetUser(@PathVariable("id") Long id) { + SysEpmetUserRelationDTO data = sysEpmetUserRelationService.getSysUserRelationEpmetInfo(id); + return new Result().ok(data); + } + + /** + * 根据手机号获取产品工作人员信息 + * + * @param mobile 当前用户手机号 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 16:42 + */ + @GetMapping("getstaffuser/{mobile}") + public Result getStaffUserFromEpmet(@PathVariable("mobile") String mobile) { + return sysEpmetUserRelationService.getStaffUserFromEpmet(mobile); + } + + /** + * 当前用户绑定产品工作人员信息 + * + * @param formDto 产品工作人员信息 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 16:47 + */ + @PostMapping("bindepmetuser") + public Result bindEpmetUser(@RequestBody SysEpmetUserRelationDTO formDto) { + return sysEpmetUserRelationService.bindSysUserWithEpmetUser(formDto); + } + + /** + * 解除当前用户已绑定的产品工作人员信息 + * + * @param formDto 产品工作人员信息 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 16:49 + */ + @PostMapping("unbindepmetuser") + public Result unbindEpmetUser(@RequestBody SysEpmetUserRelationDTO formDto) { + return sysEpmetUserRelationService.unbindSysUserWithEpmetUser(formDto); + } + +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/dao/SysEpmetUserRelationDao.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/dao/SysEpmetUserRelationDao.java new file mode 100644 index 00000000..75976251 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/dao/SysEpmetUserRelationDao.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.epmet.modules.userrelation.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.epmet.modules.userrelation.dto.SysEpmetUserRelationDTO; +import com.elink.esua.epdc.epmet.modules.userrelation.entity.SysEpmetUserRelationEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 项目产品工作人员关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-07-08 + */ +@Mapper +public interface SysEpmetUserRelationDao extends BaseDao { + + /** + * 获取当前用户已绑定的产品工作人员信息 + * + * @param id 当前用户ID + * @return com.elink.esua.epdc.epmet.modules.userrelation.entity.SysEpmetUserRelationEntity + * @author liuchuang + * @since 2021/7/8 17:04 + */ + SysEpmetUserRelationEntity selectSysUserRelationEpmetInfo(Long id); +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/dto/SysEpmetUserRelationDTO.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/dto/SysEpmetUserRelationDTO.java new file mode 100644 index 00000000..8b17c9e0 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/dto/SysEpmetUserRelationDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.epmet.modules.userrelation.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 项目产品工作人员关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-07-08 + */ +@Data +public class SysEpmetUserRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 项目端用户ID + */ + private Long sysUserId; + + /** + * 产品端工作人员ID + */ + private String staffId; + + /** + * 产品端工作人员姓名 + */ + private String staffName; + + /** + * 产品端工作人员手机号 + */ + private String mobile; + + /** + * 产品端工作人员所属组织ID + */ + private String agencyId; + + /** + * 产品端工作人员所属组织全路径名称 + */ + private String agencyAllName; + + /** + * 产品端工作人员所属客户id + */ + private String customerId; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/entity/SysEpmetUserRelationEntity.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/entity/SysEpmetUserRelationEntity.java new file mode 100644 index 00000000..1cc665db --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/entity/SysEpmetUserRelationEntity.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.epmet.modules.userrelation.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 项目产品工作人员关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-07-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_epmet_user_relation") +public class SysEpmetUserRelationEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 项目端用户ID + */ + private Long sysUserId; + + /** + * 产品端工作人员ID + */ + private String staffId; + + /** + * 产品端工作人员姓名 + */ + private String staffName; + + /** + * 产品端工作人员手机号 + */ + private String mobile; + + /** + * 产品端工作人员所属组织ID + */ + private String agencyId; + + /** + * 产品端工作人员所属组织全路径名称 + */ + private String agencyAllName; + + /** + * 产品端工作人员所属客户id + */ + private String customerId; + +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/service/SysEpmetUserRelationService.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/service/SysEpmetUserRelationService.java new file mode 100644 index 00000000..8329f743 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/service/SysEpmetUserRelationService.java @@ -0,0 +1,136 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.epmet.modules.userrelation.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.epmet.modules.userrelation.dto.SysEpmetUserRelationDTO; +import com.elink.esua.epdc.epmet.modules.userrelation.entity.SysEpmetUserRelationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目产品工作人员关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-07-08 + */ +public interface SysEpmetUserRelationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-07-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-07-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return SysEpmetUserRelationDTO + * @author generator + * @date 2021-07-08 + */ + SysEpmetUserRelationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-07-08 + */ + void save(SysEpmetUserRelationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-07-08 + */ + void update(SysEpmetUserRelationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-07-08 + */ + void delete(String[] ids); + + /** + * 获取当前用户已绑定的产品工作人员信息 + * + * @param id 当前用户ID + * @return com.elink.esua.epdc.epmet.modules.userrelation.dto.SysEpmetUserRelationDTO + * @author liuchuang + * @since 2021/7/8 17:02 + */ + SysEpmetUserRelationDTO getSysUserRelationEpmetInfo(Long id); + + /** + * 根据手机号获取产品工作人员信息 + * + * @param mobile 当前用户手机号 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 17:14 + */ + Result getStaffUserFromEpmet(String mobile); + + /** + * 当前用户绑定产品工作人员信息 + * + * @param formDto 产品工作人员信息 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 17:09 + */ + Result bindSysUserWithEpmetUser(SysEpmetUserRelationDTO formDto); + + /** + * 解除当前用户已绑定的产品工作人员信息 + * + * @param formDto 产品工作人员信息 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 17:12 + */ + Result unbindSysUserWithEpmetUser(SysEpmetUserRelationDTO formDto); +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/service/impl/SysEpmetUserRelationServiceImpl.java b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/service/impl/SysEpmetUserRelationServiceImpl.java new file mode 100644 index 00000000..d0962f9f --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/java/com/elink/esua/epdc/epmet/modules/userrelation/service/impl/SysEpmetUserRelationServiceImpl.java @@ -0,0 +1,136 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.epmet.modules.userrelation.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.admin.SysEpmetUserFormDTO; +import com.elink.esua.epdc.dto.admin.SysEpmetUserResultDTO; +import com.elink.esua.epdc.epmet.modules.feign.EpmetAnalysisFeignClient; +import com.elink.esua.epdc.epmet.modules.userrelation.dao.SysEpmetUserRelationDao; +import com.elink.esua.epdc.epmet.modules.userrelation.dto.SysEpmetUserRelationDTO; +import com.elink.esua.epdc.epmet.modules.userrelation.entity.SysEpmetUserRelationEntity; +import com.elink.esua.epdc.epmet.modules.userrelation.service.SysEpmetUserRelationService; +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 java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 项目产品工作人员关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-07-08 + */ +@Service +public class SysEpmetUserRelationServiceImpl extends BaseServiceImpl implements SysEpmetUserRelationService { + + @Autowired + private EpmetAnalysisFeignClient epmetAnalysisFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, SysEpmetUserRelationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, SysEpmetUserRelationDTO.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 SysEpmetUserRelationDTO get(String id) { + SysEpmetUserRelationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, SysEpmetUserRelationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(SysEpmetUserRelationDTO dto) { + SysEpmetUserRelationEntity entity = ConvertUtils.sourceToTarget(dto, SysEpmetUserRelationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(SysEpmetUserRelationDTO dto) { + SysEpmetUserRelationEntity entity = ConvertUtils.sourceToTarget(dto, SysEpmetUserRelationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public SysEpmetUserRelationDTO getSysUserRelationEpmetInfo(Long id) { + SysEpmetUserRelationEntity entity = baseDao.selectSysUserRelationEpmetInfo(id); + return ConvertUtils.sourceToTarget(entity, SysEpmetUserRelationDTO.class); + } + + @Override + public Result getStaffUserFromEpmet(String mobile) { + SysEpmetUserFormDTO formDto = new SysEpmetUserFormDTO(); + formDto.setMobile(mobile); + Result result = epmetAnalysisFeignClient.getEpmetUserInfoByMobile(formDto); + if (result.success()) { + SysEpmetUserRelationDTO data = ConvertUtils.sourceToTarget(result.getData(), SysEpmetUserRelationDTO.class); + return new Result().ok(data); + } + + return new Result().error(result.getMsg()); + } + + @Override + public Result bindSysUserWithEpmetUser(SysEpmetUserRelationDTO formDto) { + return null; + } + + @Override + public Result unbindSysUserWithEpmetUser(SysEpmetUserRelationDTO formDto) { + return null; + } + +} diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/application.yml b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/application.yml new file mode 100644 index 00000000..71d20d6a --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/application.yml @@ -0,0 +1,24 @@ +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.elink.esua.epdc.epmet.modules.*.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: UUID + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + #db-type: mysql + #刷新mapper 调试神器 + refresh-mapper: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/logback-spring.xml b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..361642d5 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/logback-spring.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/mapper/SysEpmetUserRelationDao.xml b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/mapper/SysEpmetUserRelationDao.xml new file mode 100644 index 00000000..a8c9c227 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-epmet/src/main/resources/mapper/SysEpmetUserRelationDao.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/esua-epdc/epdc-admin/epdc-admin-server/pom.xml b/esua-epdc/epdc-admin/epdc-admin-server/pom.xml index 9230ffca..7b80a8dc 100644 --- a/esua-epdc/epdc-admin/epdc-admin-server/pom.xml +++ b/esua-epdc/epdc-admin/epdc-admin-server/pom.xml @@ -13,6 +13,11 @@ jar + + com.esua.epdc + epdc-admin-epmet + 1.0.0 + com.esua.epdc epdc-admin-client diff --git a/esua-epdc/epdc-admin/pom.xml b/esua-epdc/epdc-admin/pom.xml index efcda291..558dfeff 100644 --- a/esua-epdc/epdc-admin/pom.xml +++ b/esua-epdc/epdc-admin/pom.xml @@ -16,6 +16,7 @@ epdc-admin-client epdc-admin-server + epdc-admin-epmet diff --git a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java index 91661331..dbdc86aa 100644 --- a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java +++ b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java @@ -89,7 +89,7 @@ public interface UserFeignClient { Result updateUserOpenId(@PathVariable("userId") Long userId); /** - * @Description 根据临时凭证获取用户信息 + * @Description 根据临时凭证获取用户信息 * @Author songyunpeng * @Date 2020/6/22 * @Param [scrip] diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/EpmetConstant.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/EpmetConstant.java index 31e1d361..836890c7 100644 --- a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/EpmetConstant.java +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/EpmetConstant.java @@ -227,6 +227,11 @@ public interface EpmetConstant { */ String EPMET_SCREEN_AGENCY_ADD_STREET_COMM = "/data/report/screen/agency/addstreetcomm"; + /** + * 查询工作人员基本信息 + */ + String EPMET_STAFF_INFO = "/data/aggregator/epmetuser/open-staffdetail"; + /** * 行政地区编码查询 - 平阴县 diff --git a/esua-epdc/epdc-gateway/pom.xml b/esua-epdc/epdc-gateway/pom.xml index 05c40e8a..98838fca 100644 --- a/esua-epdc/epdc-gateway/pom.xml +++ b/esua-epdc/epdc-gateway/pom.xml @@ -100,8 +100,9 @@ lb://epdc-auth-server - lb://epdc-admin-server - + http://127.0.0.1:9091 + + http://127.0.0.1:9092 lb://epdc-activiti-server diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/SysEpmetUserFormDTO.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/SysEpmetUserFormDTO.java new file mode 100644 index 00000000..c47d22a7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/SysEpmetUserFormDTO.java @@ -0,0 +1,21 @@ +package com.elink.esua.epdc.dto.admin; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author:liuchuang + * @Date:2021/7/8 19:08 + */ +@Data +public class SysEpmetUserFormDTO implements Serializable { + private static final long serialVersionUID = 6400768831973551059L; + + /** + * 工作人员手机号 + */ + @NotBlank(message = "手机号不能为空") + private String mobile; +} diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/SysEpmetUserResultDTO.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/SysEpmetUserResultDTO.java new file mode 100644 index 00000000..900a74e4 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/SysEpmetUserResultDTO.java @@ -0,0 +1,44 @@ +package com.elink.esua.epdc.dto.admin; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author:liuchuang + * @Date:2021/7/8 19:10 + */ +@Data +public class SysEpmetUserResultDTO implements Serializable { + private static final long serialVersionUID = 5008884147555281491L; + + /** + * 产品端工作人员ID + */ + private String staffId; + + /** + * 产品端工作人员姓名 + */ + private String staffName; + + /** + * 产品端工作人员手机号 + */ + private String mobile; + + /** + * 产品端工作人员所属组织ID + */ + private String agencyId; + + /** + * 产品端工作人员所属组织全路径名称 + */ + private String agencyAllName; + + /** + * 产品端工作人员所属客户id + */ + private String customerId; +} diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/pom.xml b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/pom.xml index e04d2c6a..df40ed07 100644 --- a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/pom.xml +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/pom.xml @@ -136,10 +136,10 @@ 47.105.119.155:8848 1da17390-6495-4e16-9ec6-0b8ece18a4a0 - http://epmet-dev.elinkservice.cn:48080/api - d2c011b14217425eb48e27cf6481716ae845cff14cc0429198a8348c76893023 - c1fe1becebf94b8aef724728690816a0 - eac9d3b8b10c328350b59ac4b1d64db5 + https://epmet-dev.elinkservice.cn/api + 0398b33f845c4768a102d2ab6ebdd00b5fec222e437540428f55d1df53e6be1e + d44a6daaea58be408bb74fe93714710f + f5ff0770f409981c73adda6ae35143ef diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/controller/AdminAnalysisController.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/controller/AdminAnalysisController.java index 6f6e2768..45a83ab6 100644 --- a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/controller/AdminAnalysisController.java +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/controller/AdminAnalysisController.java @@ -2,9 +2,7 @@ package com.elink.esua.epdc.modules.admin.controller; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; -import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO; -import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO; -import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO; +import com.elink.esua.epdc.dto.admin.*; import com.elink.esua.epdc.dto.epdc.DeptCodeOption; import com.elink.esua.epdc.modules.admin.service.AdminAnalysisService; import org.springframework.beans.factory.annotation.Autowired; @@ -50,4 +48,18 @@ public class AdminAnalysisController { return adminAnalysisService.addAreaCode(formDto); } + /** + * 根据手机号获取产品工作人员信息 + * + * @param formDto 入参 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 19:19 + */ + @GetMapping("getEpmetUserInfo") + public Result getEpmetUserInfoByMobile(@RequestBody SysEpmetUserFormDTO formDto){ + ValidatorUtils.validateEntity(formDto); + return adminAnalysisService.getEpmetUserInfoByMobile(formDto); + } + } diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/AdminAnalysisService.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/AdminAnalysisService.java index 3ff10493..1cac9dc3 100644 --- a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/AdminAnalysisService.java +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/AdminAnalysisService.java @@ -1,9 +1,7 @@ package com.elink.esua.epdc.modules.admin.service; import com.elink.esua.epdc.commons.tools.utils.Result; -import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO; -import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO; -import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO; +import com.elink.esua.epdc.dto.admin.*; import com.elink.esua.epdc.dto.epdc.DeptCodeOption; /** @@ -30,4 +28,14 @@ public interface AdminAnalysisService { * @since 2021/5/11 15:45 */ Result addAreaCode(DeptAddAreaCodeFormDTO formDto); + + /** + * 根据手机号获取产品工作人员信息 + * + * @param formDto 入参 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author liuchuang + * @since 2021/7/8 19:21 + */ + Result getEpmetUserInfoByMobile(SysEpmetUserFormDTO formDto); } diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/impl/AdminAnalysisServiceImpl.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/impl/AdminAnalysisServiceImpl.java index 7960056e..46d219f0 100644 --- a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/impl/AdminAnalysisServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/impl/AdminAnalysisServiceImpl.java @@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; import com.elink.esua.epdc.commons.tools.constant.EpmetConstant; import com.elink.esua.epdc.commons.tools.utils.Result; -import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO; -import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO; -import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO; -import com.elink.esua.epdc.dto.admin.DeptCodeTree; +import com.elink.esua.epdc.dto.admin.*; import com.elink.esua.epdc.dto.epdc.DeptCodeOption; import com.elink.esua.epdc.dto.issue.result.IssueResultDTO; import com.elink.esua.epdc.modules.admin.service.AdminAnalysisService; @@ -52,4 +49,10 @@ public class AdminAnalysisServiceImpl extends BaseServiceImpl getEpmetUserInfoByMobile(SysEpmetUserFormDTO formDto) { + String dataResult = epmetUtils.httpPost(EpmetConstant.EPMET_STAFF_INFO, JSONObject.toJSONString(formDto)); + return JSONObject.parseObject(dataResult, Result.class); + } + }