diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java
index 83bb1167f..836458ed2 100644
--- a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java
+++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java
@@ -84,4 +84,9 @@ public interface ServiceConstant {
* 积分模块
*/
String EPDC_POINTS_SERVER = "epdc-points-server";
+
+ /**
+ * 开放接口模块
+ */
+ String EPDC_API_SERVER = "epdc-api-server";
}
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/ApiApplication.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/ApiApplication.java
index 96d647692..326c93a90 100644
--- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/ApiApplication.java
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/ApiApplication.java
@@ -8,6 +8,8 @@
package com.elink.esua.epdc;
+import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
+import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@@ -22,6 +24,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
+@NacosPropertySource(dataId = ServiceConstant.EPDC_API_SERVER, autoRefreshed = true)
public class ApiApplication {
public static void main(String[] args) {
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiScanSwitchController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiScanSwitchController.java
new file mode 100644
index 000000000..5f9443486
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiScanSwitchController.java
@@ -0,0 +1,100 @@
+/**
+ * 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.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+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.DefaultGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
+import com.elink.esua.epdc.dto.ScanSwitchDTO;
+import com.elink.esua.epdc.dto.form.EpdcAppScanVersionNumDTO;
+import com.elink.esua.epdc.dto.result.EpdcAppScanFlagDTO;
+import com.elink.esua.epdc.service.ScanSwitchService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+
+/**
+ * 扫码开关
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-10
+ */
+@RestController
+@RequestMapping("ma")
+public class ApiScanSwitchController {
+
+ @Autowired
+ private ScanSwitchService scanSwitchService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = scanSwitchService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ ScanSwitchDTO data = scanSwitchService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody ScanSwitchDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ scanSwitchService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody ScanSwitchDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ scanSwitchService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ scanSwitchService.delete(ids);
+ return new Result();
+ }
+
+
+ /***
+ * 前端接口开关
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @author qushutong
+ * @date 2019/10/10 11:58
+ */
+ @GetMapping("scanSwitch")
+ public Result get(EpdcAppScanVersionNumDTO scanVersionNumDTO){
+ //效验数据
+ ValidatorUtils.validateEntity(scanVersionNumDTO);
+ EpdcAppScanFlagDTO data = scanSwitchService.getOneScanInfo(scanVersionNumDTO);
+ return new Result().ok(data);
+ }
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/dao/ScanSwitchDao.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/dao/ScanSwitchDao.java
new file mode 100644
index 000000000..c73d1dbf3
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/dao/ScanSwitchDao.java
@@ -0,0 +1,44 @@
+/**
+ * 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.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.form.EpdcAppScanVersionNumDTO;
+import com.elink.esua.epdc.dto.result.EpdcAppScanFlagDTO;
+import com.elink.esua.epdc.entity.ScanSwitchEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 扫码开关
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-10
+ */
+@Mapper
+public interface ScanSwitchDao extends BaseDao {
+
+ /***
+ * 前端获取开关
+ * @param
+ * @return com.elink.esua.epdc.dto.form.EpdcAppScanVersionNumDTO
+ * @author qushutong
+ * @date 2019/10/10 12:01
+ */
+ EpdcAppScanFlagDTO selectOneOfScanInfo(EpdcAppScanVersionNumDTO scanVersionNumDTO);
+
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ScanSwitchService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ScanSwitchService.java
new file mode 100644
index 000000000..327a31b87
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ScanSwitchService.java
@@ -0,0 +1,107 @@
+/**
+ * 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.service;
+
+import com.elink.esua.epdc.commons.mybatis.service.BaseService;
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.dto.ScanSwitchDTO;
+import com.elink.esua.epdc.dto.form.EpdcAppScanVersionNumDTO;
+import com.elink.esua.epdc.dto.result.EpdcAppScanFlagDTO;
+import com.elink.esua.epdc.entity.ScanSwitchEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 扫码开关
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-10
+ */
+public interface ScanSwitchService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2019-10-10
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2019-10-10
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return ScanSwitchDTO
+ * @author generator
+ * @date 2019-10-10
+ */
+ ScanSwitchDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2019-10-10
+ */
+ void save(ScanSwitchDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2019-10-10
+ */
+ void update(ScanSwitchDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2019-10-10
+ */
+ void delete(String[] ids);
+
+
+ /***
+ * 前端获取开关
+ * @param
+ * @return com.elink.esua.epdc.dto.form.EpdcAppScanVersionNumDTO
+ * @author qushutong
+ * @date 2019/10/10 12:01
+ */
+ EpdcAppScanFlagDTO getOneScanInfo(EpdcAppScanVersionNumDTO scanVersionNumDTO);
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ScanSwitchServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ScanSwitchServiceImpl.java
new file mode 100644
index 000000000..b7787f550
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ScanSwitchServiceImpl.java
@@ -0,0 +1,109 @@
+/**
+ * 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.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.constant.FieldConstant;
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.dao.ScanSwitchDao;
+import com.elink.esua.epdc.dto.ScanSwitchDTO;
+import com.elink.esua.epdc.dto.form.EpdcAppScanVersionNumDTO;
+import com.elink.esua.epdc.dto.result.EpdcAppScanFlagDTO;
+import com.elink.esua.epdc.entity.ScanSwitchEntity;
+import com.elink.esua.epdc.service.ScanSwitchService;
+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 2019-10-10
+ */
+@Service
+public class ScanSwitchServiceImpl extends BaseServiceImpl implements ScanSwitchService {
+
+ @Autowired
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, ScanSwitchDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, ScanSwitchDTO.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 ScanSwitchDTO get(String id) {
+ ScanSwitchEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, ScanSwitchDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(ScanSwitchDTO dto) {
+ ScanSwitchEntity entity = ConvertUtils.sourceToTarget(dto, ScanSwitchEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(ScanSwitchDTO dto) {
+ ScanSwitchEntity entity = ConvertUtils.sourceToTarget(dto, ScanSwitchEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ @Override
+ public EpdcAppScanFlagDTO getOneScanInfo(EpdcAppScanVersionNumDTO scanVersionNumDTO) {
+ return baseDao.selectOneOfScanInfo(scanVersionNumDTO);
+ }
+
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/UserApplication.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/UserApplication.java
index 851d91f25..e2e855ab6 100644
--- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/UserApplication.java
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/UserApplication.java
@@ -1,13 +1,15 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
- *
+ *
* https://www.renren.io
- *
+ *
* 版权所有,侵权必究!
*/
package com.elink.esua.epdc;
+import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
+import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@@ -22,6 +24,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
+@NacosPropertySource(dataId = ServiceConstant.EPDC_USER_SERVER, autoRefreshed = true)
public class UserApplication {
public static void main(String[] args) {