+ * 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.epmet.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 客户表 appId表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-27
+ */
+@Data
+public class CustomerAppDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ private String id;
+
+ /**
+ * 客户Id
+ */
+ private String customerId;
+
+ /**
+ * 小程序的appId
+ */
+ private String appId;
+
+ /**
+ * resi,work
+ */
+ private String client;
+
+ /**
+ * app的secret
+ */
+ private String secret;
+
+ /**
+ * 0:停用,1:启用
+ */
+ private Integer enableFlag;
+
+ /**
+ * 删除标识: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/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java
new file mode 100644
index 0000000000..bed538b63b
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java
@@ -0,0 +1,42 @@
+/**
+ * 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.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+
+/**
+ * 客户表 appId表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-27
+ */
+@Data
+public class CustomerAppSecretFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 小程序的appId
+ */
+ @NotBlank(message = "小程序Id不能为空")
+ private String appId;
+}
\ No newline at end of file
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
index 5b220aa698..71cc77831d 100644
--- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
@@ -1,13 +1,16 @@
package com.epmet.feign;
+import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerAppDTO;
import com.epmet.dto.CustomerDTO;
-import org.springframework.cloud.openfeign.FeignClient;
-
-import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.dto.form.CustomerAppSecretFormDTO;
import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
+import java.util.List;
+
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
*
@@ -23,4 +26,19 @@ public interface OperCrmOpenFeignClient {
*/
@PostMapping("/oper/crm/customer/getcostomerInfo")
Result getCustomerInfo(CustomerDTO dto);
+
+ /**
+ * 获取客户appId信息
+ * @param dto
+ * @return
+ */
+ @PostMapping("/oper/crm/customerapp/getsecretbyappid")
+ Result getSecretByAppId(CustomerAppSecretFormDTO dto);
+
+ /**
+ * 获取所有已配置的app信息
+ * @return
+ */
+ @PostMapping("/oper/crm/customerapp/getconfigallapp")
+ Result getConfigAllApp();
}
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
index 39594aa4fe..81b74a4f7c 100644
--- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
@@ -3,10 +3,14 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerAppDTO;
import com.epmet.dto.CustomerDTO;
+import com.epmet.dto.form.CustomerAppSecretFormDTO;
import com.epmet.feign.OperCrmOpenFeignClient;
import org.springframework.stereotype.Component;
+import java.util.List;
+
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
*
@@ -19,4 +23,20 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient {
public Result getCustomerInfo(CustomerDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto);
}
+
+ /**
+ * 获取客户appId信息
+ *
+ * @param dto
+ * @return
+ */
+ @Override
+ public Result getSecretByAppId(CustomerAppSecretFormDTO dto) {
+ return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getSecretByAppId", dto);
+ }
+
+ @Override
+ public Result> getConfigAllApp() {
+ return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getConfigAllApp", null);
+ }
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java
new file mode 100644
index 0000000000..90bdfd56c4
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java
@@ -0,0 +1,88 @@
+/**
+ * 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.epmet.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.dto.CustomerAppDTO;
+import com.epmet.dto.form.CustomerAppSecretFormDTO;
+import com.epmet.service.CustomerAppIdService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 客户表 app表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-27
+ */
+@RestController
+@RequestMapping("customerapp")
+public class CustomerAppController {
+
+ @Autowired
+ private CustomerAppIdService customerAppIdService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = customerAppIdService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ CustomerAppDTO data = customerAppIdService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody CustomerAppDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ customerAppIdService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody CustomerAppDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ customerAppIdService.update(dto);
+ return new Result();
+ }
+ @PostMapping("getsecretbyappid")
+ public Result getSecretByAppId(@RequestBody CustomerAppSecretFormDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, DefaultGroup.class);
+ return new Result().ok(customerAppIdService.selectSecretByAppId(dto.getAppId()));
+ }
+ @PostMapping("getconfigallapp")
+ public Result> getConfigAllApp(){
+ return new Result>().ok(customerAppIdService.list(null));
+ }
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java
new file mode 100644
index 0000000000..b69ea9fe11
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java
@@ -0,0 +1,35 @@
+/**
+ * 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.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.CustomerAppEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 客户表 appId表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-27
+ */
+@Mapper
+public interface CustomerAppDao extends BaseDao {
+
+ String selectSecretByAppId(@Param("appId") String appId);
+}
\ No newline at end of file
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java
new file mode 100644
index 0000000000..89d62c233d
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java
@@ -0,0 +1,63 @@
+/**
+ * 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.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 客户表 appId表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-27
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("customer_app")
+public class CustomerAppEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 客户Id
+ */
+ private String customerId;
+
+ /**
+ * 小程序的appId
+ */
+ private String appId;
+
+ /**
+ * resi,work
+ */
+ private String client;
+
+ /**
+ * app的secret
+ */
+ private String secret;
+
+ /**
+ * 0:停用,1:启用
+ */
+ private Integer enableFlag;
+
+}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java
new file mode 100644
index 0000000000..3da3da447d
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java
@@ -0,0 +1,92 @@
+/**
+ * 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.
+ *
+ * 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.epmet.service.impl;
+
+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.page.PageData;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.dao.CustomerAppDao;
+import com.epmet.dto.CustomerAppDTO;
+import com.epmet.entity.CustomerAppEntity;
+import com.epmet.service.CustomerAppIdService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户表 appId表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-27
+ */
+@Service
+public class CustomerAppIdServiceImpl extends BaseServiceImpl implements CustomerAppIdService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, CustomerAppDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, CustomerAppDTO.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 CustomerAppDTO get(String id) {
+ CustomerAppEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, CustomerAppDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(CustomerAppDTO dto) {
+ CustomerAppEntity entity = ConvertUtils.sourceToTarget(dto, CustomerAppEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(CustomerAppDTO dto) {
+ CustomerAppEntity entity = ConvertUtils.sourceToTarget(dto, CustomerAppEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ public String selectSecretByAppId(String appId) {
+ return baseDao.selectSecretByAppId(appId);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml
new file mode 100644
index 0000000000..599ef18c59
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file