Commit d8b472f4 authored by fangxinjiang's avatar fangxinjiang

新增小工具服务

parent fb79858f
apiVersion: apps/v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Deployment # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
name: yifu-check # 资源的名字,在同一个namespace中必须唯一
namespace: qas-mvp # 部署在哪个namespace中
spec: # 资源规范字段
selector: # 选择器
matchLabels: # 匹配标签
app: yifu-check
replicas: 1 # 声明副本数目
#revisionHistoryLimit: 3 # 保留历史版本
#strategy: # 策略
# rollingUpdate: # 滚动更新
# maxSurge: 30% # 最大额外可以存在的副本数,可以为百分比,也可以为整数
# maxUnavailable: 30% # 示在更新过程中能够进入不可用状态的 Pod 的最大值,可以为百分比,也可以为整数
# type: RollingUpdate # 滚动更新策略
template: # 模版
metadata: # 模版
labels: # 设定资源的标签
app: yifu-check
annotations:
dapr.io/enabled: "true" #设定此参数为 true 注入Dapr sidecar到pod
dapr.io/app-id: "yifu-check" #应用程序唯一 ID。 用于服务发现、状态封装 和 发布/订阅 消费者ID
dapr.io/app-port: "5022" #这个参数告诉Dapr你的应用程序正在监听哪个端口。
#dapr.io/log-level: "debug" #为 Dapr sidecar设置日志级别。 允许的值是debug,info,warn,error。 默认是 info
#dapr.io/log-as-json: "false" #将此参数设置为true以JSON格式输出日志。 默认值为 false.
#dapr.io/config: file #告诉 Dapr 要使用哪个配置 CRD
dapr.io/app-protocol: "http" #告诉 Dapr 你的应用程序正在使用哪种协议。 有效选项是 http and grpc。 Default is http
#dapr.io/app-max-concurrency: "20" #限制应用程序的并发量。 有效的数值是大于 0
#dapr.io/app-ssl: "false" #告诉Dapr通过不安全的SSL连接调用应用程序。 同时适用于HTTP和gRPC。 Traffic between your app and the Dapr sidecar is encrypted with a certificate issued by a non-trusted certificate authority, which is considered insecure. 默认值为 false.
dapr.io/metrics-port: "9090" #设置 sidecar 度量服务器的端口。 默认值为 9090
#dapr.io/sidecar-cpu-limit: 2 #Dapr sidecar可以使用的最大CPU数量。 默认情况下未设置
#dapr.io/sidecar-memory-limit: "800Mi" #Dapr sidecar可以使用的最大内存量。默认情况下未设置 请参阅 https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/ 的有效值。
#dapr.io/sidecar-cpu-request: 1 #Dapr sidecar要求的 CPU 数量
#dapr.io/sidecar-memory-request #Dapr sidecar 请求的内存数量
#dapr.io/http-max-request-size: "8MB" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/sidecar-listen-addresses: "0.0.0.0"
# 更多dapr配置请参考 https://www.bookstack.cn/read/dapr-1.5-zh/cc77b74e2cc2f4d4.md
spec: # 资源规范字段
nodeSelector: # node 选择器
node-type: worker # node标签
containers: # 容器
- name: yifu-check # 容器的名字
image: hub.yifucenter.com:5500/qas-mvp/yifu-check-biz:1.0.0 # 容器镜像地址
imagePullPolicy: Always # 每次Pod启动拉取镜像策略,三个选择 Always、Never、IfNotPresent
# Always,每次都检查;Never,每次都不检查(不管本地是否有);IfNotPresent,如果本地有就不检查,如果没有就拉取(手动测试时,
# 已经打好镜像存在docker容器中时,使用存在不检查级别,
# 默认为每次都检查,然后会进行拉取新镜像,因镜像仓库不存在,导致部署失败)
ports:
- containerPort: 5022 # 容器端口
env: # 启动环境配置信息 active and timeZone set
- name: SPRING_PROFILES_ACTIVE
value: test
- name: TZ
value: Asia/Shanghai
resources: #资源配置限制
limits: # 最大使用
memory: "2048Mi"
#cpu: 300m # CPU,1核心 = 1000m
requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
#cpu: 100m
memory: "500Mi"
#livenessProbe: # pod 内部健康检查的设置
# httpGet: # 通过httpget检查健康,返回200-399之间,则认为容器正常
# path: /healthCheck # URI地址
# port: 8080 # 端口
# scheme: HTTP # 协议
# # host: 127.0.0.1 # 主机地址
# initialDelaySeconds: 30 # 表明第一次检测在容器启动后多长时间后开始
# timeoutSeconds: 5 # 检测的超时时间
# periodSeconds: 30 # 检查间隔时间
# successThreshold: 1 # 成功门槛
# failureThreshold: 5 # 失败门槛,连接失败5次,pod杀掉,重启一个新的pod
# readinessProbe: # Pod 准备服务健康检查设置
# httpGet:
# path: /healthCheck
# port: 8080
# scheme: HTTP
# initialDelaySeconds: 30
# timeoutSeconds: 5
# periodSeconds: 10
# successThreshold: 1
# failureThreshold: 5
#也可以用这种方法
#exec: 执行命令的方法进行监测,如果其退出码不为0,则认为容器正常
# command:
# - cat
# - /tmp/health
#也可以用这种方法
#tcpSocket: # 通过tcpSocket检查健康
# port: number
#ports:
# - name: http # 名称
# containerPort: 8080 # 容器开发对外的端口
# protocol: TCP # 协议
imagePullSecrets: # 镜像仓库拉取密钥
- name: login
#affinity: # 亲和性调试
# nodeAffinity: # 节点亲和力
# requiredDuringSchedulingIgnoredDuringExecution: # pod 必须部署到满足条件的节点上
# nodeSelectorTerms: # 节点满足任何一个条件就可以
# - matchExpressions: # 有多个选项,则只有同时满足这些逻辑选项的节点才能运行 pod
# - key: beta.kubernetes.io/arch
# operator: In
# values:
# - amd64
\ No newline at end of file
apiVersion: v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Service # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
labels: # 设定资源的标签
app: yifu-check # 资源的名字,在同一个namespace中必须唯一
name: yifu-check # 资源的名字,在同一个namespace中必须唯一
namespace: qas-mvp # 部署在哪个namespace中
spec: # 资源规范字段
ports:
- port: 5022 # service 端口
protocol: TCP # 协议
targetPort: 5022 # 容器暴露的端口
name: http-check # 端口名称
- port: 3500 # service 端口
protocol: TCP # 协议
targetPort: 3500 # 容器暴露的端口
name: http-check-dapr
selector: # 选择器
app: yifu-check # 资源名称
type: ClusterIP # ClusterIP 类型
\ No newline at end of file
......@@ -42,5 +42,13 @@
<groupId>com.pig4cloud.excel</groupId>
<artifactId>excel-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependencies>
</project>
package com.yifu.cloud.plus.v1.check.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
/**
* 实名校验限定调用API的条数表
*
* @author hgw
* @date 2022-6-10 11:07:37
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_check_api_num")
@Schema(description = "实名校验限定调用API的条数表")
public class TCheckApiNum extends Model<TCheckApiNum> {
private static final long serialVersionUID = 1L;
/**
* 创建月
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 当月已调用API总条数,初始默认0条
*/
@NotNull(message = "当月已调用API总条数不能为空")
@Schema(description = "当月已调用API总条数")
private Integer apiNum;
/**
* 当月允许调用API总条数,初始默认每月10000条
*/
@NotNull(message = "当月允许调用API总条数不能为空")
@Schema(description = "当月允许调用API总条数")
private Integer canApiNum;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}
package com.yifu.cloud.plus.v1.check.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-5-10 17:41:27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_check_id_card")
@Schema(description = "身份证实名校验自留库")
public class TCheckIdCard extends Model<TCheckIdCard> {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空")
@Length(max = 20, message = "姓名不能超过20个字符")
@Schema(description = "姓名")
private String name;
/**
* 身份证
*/
@Length(max = 18, message = "身份证不能超过18个字符")
@Schema(description = "身份证")
private String idCard;
/**
* 是否正确:1正确。0错误。
*/
@NotNull(message = "是否正确:1正确。0错误。不能为空")
@Schema(description = "是否正确:1正确。0错误。")
private Integer isTrue;
/**
* 原因
*/
@Length(max = 50, message = "原因不能超过50个字符")
@Schema(description = "原因")
private String reason;
/**
* 类型0:初始导入数据;1调用api保存的数据
*/
@NotNull(message = "类型不能为空")
@Schema(description = "类型0:初始导入数据;1调用api保存的数据")
private Integer type;
/**
* 创建人
*/
@Length(max = 32, message = "创建人不能超过32个字符")
@Schema(description = "创建人")
private String createUser;
/**
* 创建时间
*/
@Schema(description = "创建时间")
@NotNull(message = "创建时间不能为空")
private LocalDateTime createTime;
}
package com.yifu.cloud.plus.v1.check.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* 实名校验导入锁定表(锁定后不可导入,除非清理掉数据)
*
* @author hgw
* @date 2022-6-10 11:07:15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_check_lock")
@Schema(description = "实名校验导入锁定表(锁定后不可导入,除非清理掉数据)")
public class TCheckLock extends Model<TCheckLock> {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 创建人
*/
@NotBlank(message = "创建人不能为空")
@Length(max = 32, message = "创建人不能超过32个字符")
@Schema(description = "创建人")
private String createUser;
/**
* 创建人姓名
*/
@Length(max = 50, message = "创建人姓名不能超过50个字符")
@Schema(description = "创建人姓名")
private String createUserName;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 校验月
*/
@Length(max = 6, message = "校验月不能超过6个字符")
@Schema(description = "校验月")
private String createMonth;
/**
* 导入总条数
*/
@NotNull(message = "导入总条数不能为空")
@Schema(description = "导入总条数")
private Integer importNum;
/**
* 调用API总条数
*/
@NotNull(message = "调用API总条数不能为空")
@Schema(description = "调用API总条数")
private Integer apiNum;
/**
* 删除标志:0未删除;1已删除(1代表已完成导入或删除,释放了锁)
*/
@NotNull(message = "删除标志:0未删除;1已删除(1代表已完成导入或删除,释放了锁)不能为空")
@Schema(description = "删除标志:0未删除;1已删除(1代表已完成导入或删除,释放了锁)")
private Integer deleteFlag;
}
package com.yifu.cloud.plus.v1.check.utils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import org.springframework.beans.factory.annotation.Value;
import java.util.HashMap;
import java.util.Map;
/**
* @author hgw2
* @description 测试身份证
* @date 2022/5/7
*/
public class CheckIdCard {
@Value("${canCheck}")
private static boolean canCheck;
private static final String APP_ID_ID_CARD = "oi0mucL4";
private static final String APP_KEY_ID_CARD = "s4lW5JRA";
private static final String API_URL_ID_CARD = "https://api.253.com/open/idcard/id-card-auth";
private static JsonParser jsonParser = new JsonParser();
public static void checkIdCard(TCheckIdCard checkIdCard) {
if (canCheck) {
// 1.调用身份信息校验api
extracted(checkIdCard);
} else {
checkIdCard.setIsTrue(0);
checkIdCard.setReason("nacos中checks.yaml的配置canCheck未开启!");
}
}
// 核心调用
private static void extracted(TCheckIdCard checkIdCard) {
final JsonObject jsonObject = CheckIdCard.invokeIdCard(checkIdCard.getName(), checkIdCard.getIdCard());
// 2.处理返回结果
if (jsonObject != null) {
//响应code码。200000:成功,其他失败
String code = jsonObject.get("code").getAsString();
if ("200000".equals(code) && jsonObject.get("data") != null) {
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
// 校验状态码 200000:成功,其他失败
String resultStr = jsonObject.get("data").getAsJsonObject().get("result").getAsString();
if ("01".equals(resultStr)) {
checkIdCard.setIsTrue(1);
checkIdCard.setReason("正确");
} else {
checkIdCard.setIsTrue(0);
String remark = jsonObject.get("data").getAsJsonObject().get("remark").getAsString();
checkIdCard.setReason("调用身份信息校验失败,resultStr:" + resultStr + ",msg:" + remark);
}
} else {
// 记录错误日志,正式项目中请换成log打印
checkIdCard.setIsTrue(0);
checkIdCard.setReason("调用身份信息校验失败,code:" + code + ",msg:" + jsonObject.get("message").getAsString());
}
} else {
checkIdCard.setIsTrue(0);
checkIdCard.setReason("接口无返回数据");
}
}
private static JsonObject invokeIdCard(String name, String idNum) {
Map<String, String> params = new HashMap<>();
params.put("appId", APP_ID_ID_CARD);
params.put("appKey", APP_KEY_ID_CARD);
params.put("name", name);
params.put("idNum", idNum);
String result = HttpUtils.post(API_URL_ID_CARD, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
}
}
package com.yifu.cloud.plus.v1.check.utils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.nio.charset.Charset;
import java.util.Map;
/**
* @author hgw2
* @description 发送
* @date 2022/5/7
*/
public class HttpUtils {
private static final int REQUEST_TIMEOUT = 3 * 1000; // 设置请求超时10秒钟
private static final int CONNECT_TIMEOUT = 5 * 1000; // 连接超时时间
private static final int SO_TIMEOUT = 10 * 1000; // 数据传输超时
private static final String ENCODING = "UTF-8";
// 务必单例
private static CloseableHttpClient client;
static {
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(CONNECT_TIMEOUT)
.setConnectionRequestTimeout(REQUEST_TIMEOUT)
.setSocketTimeout(SO_TIMEOUT)
.build();
client = HttpClients.custom().setDefaultRequestConfig(requestConfig).setMaxConnTotal(50).build();
}
public static String get(String url, Map<String, String> paramsMap) {
return send(RequestBuilder.get(url), paramsMap);
}
public static String post(String url, Map<String, String> paramsMap) {
return send(RequestBuilder.post(url), paramsMap);
}
public static String send(RequestBuilder requestBuilder, Map<String, String> paramsMap) {
requestBuilder.setCharset(Charset.forName(ENCODING));
String responseText = "";
if (paramsMap != null) {
for (Map.Entry<String, String> param : paramsMap.entrySet()) {
requestBuilder.addParameter(param.getKey(), param.getValue());
}
CloseableHttpResponse response = null;
try {
response = client.execute(requestBuilder.build());
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
HttpEntity entity = response.getEntity();
if (entity != null) {
responseText = EntityUtils.toString(entity, ENCODING);
}
}
} catch (Exception e) {
e.printStackTrace();//正式项目中请改为log打印
} finally {
try {
response.close();
} catch (Exception e) {
e.printStackTrace();//正式项目中请改为log打印
}
}
}
return responseText;
}
}
FROM moxm/java:1.8-full
RUN mkdir -p /consumer
RUN mkdir -p /yifu-check-biz
WORKDIR consumer
WORKDIR yifu-check-biz
ARG JAR_FILE=target/consumer-biz.jar
ARG JAR_FILE=target/yifu-check-biz.jar
COPY ${JAR_FILE} app.jar
......
package com.yifu.cloud.plus.v1.consumer;
package com.yifu.cloud.plus.v1.check;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.EnableYifuResourceServer;
import org.springframework.boot.SpringApplication;
......@@ -11,10 +11,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*/
@EnableYifuResourceServer
@SpringBootApplication
public class ConsumerApplication {
public class CheckApplication {
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
SpringApplication.run(CheckApplication.class, args);
}
}
package com.yifu.cloud.plus.v1.check.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.service.TCheckIdCardService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
@RestController
@AllArgsConstructor
@RequestMapping("/tcheckidcard")
@Tag(name = "身份证实名校验自留库")
public class TCheckIdCardController {
private final TCheckIdCardService tCheckIdCardService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tCheckIdCard 身份证实名校验自留库
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TCheckIdCard>> getTCheckIdCardPage(Page<TCheckIdCard> page, TCheckIdCard tCheckIdCard) {
return new R<>(tCheckIdCardService.getTCheckIdCardPage(page, tCheckIdCard));
}
@Operation(description = "获取所有list")
@GetMapping("/getAllList")
public R<List<TCheckIdCard>> getAllList(TCheckIdCard tCheckIdCard) {
return new R<>(tCheckIdCardService.getAllList(tCheckIdCard));
}
/**
* @param
* @Description: 获取身份证库
* @Author: hgw
* @Date: 2022/5/11 17:44
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.Map < java.lang.String, com.yifu.cloud.v1.checks.api.entity.TCheckIdCard>>
**/
@Inner
@Operation(description = "获取身份证库")
@PostMapping("/inner/getAllChecksInfo")
public R<Map<String, TCheckIdCard>> getAllChecksInfo() {
return new R<>(new HashMap<>());
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation(description = "id查询")
@GetMapping("/{id}")
public R<TCheckIdCard> getById(@PathVariable("id") String id) {
return new R<>(tCheckIdCardService.getById(id));
}
/**
* 新增记录
*
* @param tCheckIdCard
* @return R
*/
@Operation(description = "新增(checks:tcheckidcard_add)")
@PostMapping
@PreAuthorize("@pms.hasPermission('checks:tcheckidcard_add')")
public R<Boolean> save(@Valid @RequestBody TCheckIdCard tCheckIdCard) {
return new R<>(tCheckIdCardService.save(tCheckIdCard));
}
/**
* 修改记录
*
* @param tCheckIdCard
* @return R
*/
@Operation(description = "修改(checks:tcheckidcard_edit)")
@SysLog("修改身份证实名校验自留库")
@PutMapping
@PreAuthorize("@pms.hasPermission('checks:tcheckidcard_edit')")
public R<Boolean> update(@RequestBody TCheckIdCard tCheckIdCard) {
return new R(tCheckIdCardService.updateById(tCheckIdCard));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation(description = "删除(checks:tcheckidcard_del)")
@SysLog("删除身份证实名校验自留库")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('checks:tcheckidcard_del')")
public R<Boolean> removeById(@PathVariable String id) {
return new R<>(tCheckIdCardService.removeById(id));
}
/**
* @param checkList
* @Description: 校验姓名身份证
* @Author: hgw
* @Date: 2022-5-12 15:18:53
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation(description = "校验姓名身份证")
@SysLog("校验姓名身份证")
@PostMapping("/checkIdCard")
public R<List<TCheckIdCard>> checkIdCard(@RequestBody List<TCheckIdCard> checkList) {
return tCheckIdCardService.checkIdCard(checkList);
}
}
package com.yifu.cloud.plus.v1.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.check.entity.TCheckApiNum;
import org.apache.ibatis.annotations.Mapper;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
@Mapper
public interface TCheckApiNumMapper extends BaseMapper<TCheckApiNum> {
}
package com.yifu.cloud.plus.v1.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
@Mapper
public interface TCheckIdCardMapper extends BaseMapper<TCheckIdCard> {
/**
* 身份证实名校验自留库简单分页查询
*
* @param tCheckIdCard 身份证实名校验自留库
* @return
*/
IPage<TCheckIdCard> getTCheckIdCardPage(Page<TCheckIdCard> page, @Param("tCheckIdCard") TCheckIdCard tCheckIdCard);
/**
* @param
* @Description: 所有数据
* @Author: hgw
* @Date: 2022/5/12 15:28
* @return: java.util.List<com.yifu.cloud.v1.checks.api.entity.TCheckIdCard>
**/
List<TCheckIdCard> getAllList(@Param("tCheckIdCard") TCheckIdCard tCheckIdCard);
}
package com.yifu.cloud.plus.v1.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.check.entity.TCheckLock;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
@Mapper
public interface TCheckLockMapper extends BaseMapper<TCheckLock> {
/**
* @Description: 所有数据
* @Author: hgw
* @Date: 2022-6-10 11:15:00
* @return: java.util.List<com.yifu.cloud.v1.checks.api.entity.TCheckLock>
**/
List<TCheckLock> getAllList();
}
package com.yifu.cloud.plus.v1.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.check.entity.TCheckApiNum;
/**
* 校验锁
* @author hgw
* @date 2022-01-13 15:08:05
*/
public interface TCheckApiNumService extends IService<TCheckApiNum> {
}
package com.yifu.cloud.plus.v1.check.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
import java.util.Map;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
public interface TCheckIdCardService extends IService<TCheckIdCard> {
/**
* 身份证实名校验自留库简单分页查询
*
* @param tCheckIdCard 身份证实名校验自留库
* @return
*/
IPage<TCheckIdCard> getTCheckIdCardPage(Page<TCheckIdCard> page, TCheckIdCard tCheckIdCard);
/**
* @param
* @Description: 获取所有list
* @Author: hgw
* @Date: 2022/5/12 15:29
* @return: java.util.List<com.yifu.cloud.v1.checks.api.entity.TCheckIdCard>
**/
List<TCheckIdCard> getAllList(TCheckIdCard tCheckIdCard);
Map<String, TCheckIdCard> getAllMap(TCheckIdCard tCheckIdCard);
/**
* @param checkList
* @Description: 校验
* @Author: hgw
* @Date: 2022/5/12 15:20
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
R<List<TCheckIdCard>> checkIdCard(List<TCheckIdCard> checkList);
}
package com.yifu.cloud.plus.v1.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.check.entity.TCheckLock;
import java.util.List;
/**
* 校验锁
*
* @author hgw
* @date 2022-01-13 15:08:05
*/
public interface TCheckLockService extends IService<TCheckLock> {
/**
* 查询全部
*/
List<TCheckLock> getAllList();
}
package com.yifu.cloud.plus.v1.check.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckApiNum;
import com.yifu.cloud.plus.v1.check.mapper.TCheckApiNumMapper;
import com.yifu.cloud.plus.v1.check.service.TCheckApiNumService;
import org.springframework.stereotype.Service;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
@Service
public class TCheckApiNumServiceImpl extends ServiceImpl<TCheckApiNumMapper, TCheckApiNum> implements TCheckApiNumService {
@Override
public boolean save(TCheckApiNum entity) {
return super.save(entity);
}
}
package com.yifu.cloud.plus.v1.check.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckLock;
import com.yifu.cloud.plus.v1.check.mapper.TCheckLockMapper;
import com.yifu.cloud.plus.v1.check.service.TCheckLockService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
@Service
public class TCheckLockServiceImpl extends ServiceImpl<TCheckLockMapper, TCheckLock> implements TCheckLockService {
@Override
public List<TCheckLock> getAllList() {
return baseMapper.getAllList();
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.consumer.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.consumer.entity.Consumer;
import com.yifu.cloud.plus.v1.consumer.service.ConsumerService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
/**
* consumer表
*
* @author fxj
* @date 2022-05-13 23:28:12
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/consumer" )
@Tag(name = "consumer表管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ConsumerController {
private final ConsumerService consumerService;
/**
* 分页查询
* @param page 分页对象
* @param consumer consumer表
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('consumer_consumer_get')" )
public R getConsumerPage(Page page, Consumer consumer) {
return R.ok(consumerService.page(page, Wrappers.query(consumer)));
}
/**
* 通过id查询consumer表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('consumer_consumer_get')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(consumerService.getById(id));
}
/**
* 新增consumer表
* @param consumer consumer表
* @return R
*/
@Operation(summary = "新增consumer表", description = "新增consumer表")
@SysLog("新增consumer表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('consumer_consumer_add')" )
public R save(@RequestBody Consumer consumer) {
return R.ok(consumerService.saveTestSeata(consumer));
}
/**
* 修改consumer表
* @param consumer consumer表
* @return R
*/
@Operation(summary = "修改consumer表", description = "修改consumer表")
@SysLog("修改consumer表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('consumer_consumer_edit')" )
public R updateById(@RequestBody Consumer consumer) {
return R.ok(consumerService.updateById(consumer));
}
/**
* 通过id删除consumer表
* @param id id
* @return R
*/
@Operation(summary = "通过id删除consumer表", description = "通过id删除consumer表")
@SysLog("通过id删除consumer表" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('consumer_consumer_del')" )
public R removeById(@PathVariable Long id) {
return R.ok(consumerService.removeById(id));
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.consumer.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* consumer表
*
* @author fxj
* @date 2022-05-13 23:28:12
*/
@Data
@TableName("consumer")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "consumer表")
public class Consumer extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description ="主键")
private Long id;
/**
* 用户名
*/
@Schema(description ="用户名")
private String username;
/**
* 昵称
*/
@Schema(description ="昵称")
private String nicename;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.consumer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.consumer.entity.Consumer;
import org.apache.ibatis.annotations.Mapper;
/**
* consumer表
*
* @author fxj
* @date 2022-05-13 23:28:12
*/
@Mapper
public interface ConsumerMapper extends BaseMapper<Consumer> {
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.consumer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.consumer.entity.Consumer;
/**
* consumer表
*
* @author fxj
* @date 2022-05-13 23:28:12
*/
public interface ConsumerService extends IService<Consumer> {
Boolean saveTestSeata(Consumer consumer);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.consumer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.consumer.entity.Consumer;
import com.yifu.cloud.plus.v1.consumer.mapper.ConsumerMapper;
import com.yifu.cloud.plus.v1.consumer.service.ConsumerService;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprProviderProperties;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* consumer表
*
* @author fxj
* @date 2022-05-13 23:28:12
*/
@EnableConfigurationProperties(DaprProviderProperties.class)
@RequiredArgsConstructor
@Service
public class ConsumerServiceImpl extends ServiceImpl<ConsumerMapper, Consumer> implements ConsumerService {
private final DaprProviderProperties daprProperties;
@SneakyThrows
@GlobalTransactional // 分布式seata事务
@Transactional
@Override
public Boolean saveTestSeata(Consumer consumer) {
/*Provider provider = new Provider();
provider.setNicename(consumer.getNicename());
provider.setUsername(consumer.getUsername());
provider.setCreateBy(consumer.getCreateBy());
provider.setCreateTime(consumer.getCreateTime());
provider.setUpdateBy(consumer.getUpdateBy());
provider.setUpdateTime(consumer.getUpdateTime());
R result = HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(), "/provider", provider, Provider.class,null);
baseMapper.insert(consumer);*/
return true;
}
}
......@@ -23,6 +23,12 @@ security:
resource:
loadBalanced: true
token-info-uri: http://yifu-auth/oauth/check_token
# 直接放行URL
ignore:
urls:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
# mybaits-plus配置
mybatis-plus:
......@@ -36,11 +42,7 @@ mybatis-plus:
logic-not-delete-value: 0
configuration:
map-underscore-to-camel-case: true
# 直接放行URL
ignore:
urls:
- /v2/api-docs
- /actuator/**
spring:
application:
name: @artifactId@
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.consumer.mapper.ConsumerMapper">
<resultMap id="consumerMap" type="com.yifu.cloud.plus.v1.consumer.entity.Consumer">
<id property="id" column="id"/>
<result property="username" column="username"/>
<result property="nicename" column="nicename"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
</resultMap>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.v1.checks.mapper.TCheckApiNumMapper">
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.check.mapper.TCheckIdCardMapper">
<resultMap id="tCheckIdCardMap" type="com.yifu.cloud.plus.v1.check.entity.TCheckIdCard">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="idCard" column="id_card"/>
<result property="isTrue" column="is_true"/>
<result property="reason" column="reason"/>
<result property="type" column="type"/>
<result property="createUser" column="CREATE_USER"/>
<result property="createTime" column="CREATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.name,
a.id_card,
a.is_true,
a.reason,
a.type,
a.CREATE_USER,
a.CREATE_TIME
</sql>
<sql id="tCheckIdCard_where">
<if test="tCheckIdCard != null">
<if test="tCheckIdCard.id != null and tCheckIdCard.id.trim() != ''">
AND a.id = #{tCheckIdCard.id}
</if>
<if test="tCheckIdCard.name != null and tCheckIdCard.name.trim() != ''">
AND a.name = #{tCheckIdCard.name}
</if>
<if test="tCheckIdCard.idCard != null and tCheckIdCard.idCard.trim() != ''">
AND a.id_card = #{tCheckIdCard.idCard}
</if>
<if test="tCheckIdCard.isTrue != null">
AND a.is_true = #{tCheckIdCard.isTrue}
</if>
</if>
</sql>
<!--tCheckIdCard简单分页查询-->
<select id="getTCheckIdCardPage" resultMap="tCheckIdCardMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_check_id_card a
<where>
1=1
<include refid="tCheckIdCard_where"/>
</where>
</select>
<!--获取所有数据-->
<select id="getAllList" resultMap="tCheckIdCardMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_check_id_card a
<where>
1=1
<include refid="tCheckIdCard_where"/>
</where>
order by a.CREATE_TIME desc
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.check.mapper.TCheckLockMapper">
<resultMap id="tCheckIdCardMap" type="com.yifu.cloud.plus.v1.check.entity.TCheckLock">
<id property="id" column="id"/>
<result property="createUser" column="CREATE_USER"/>
<result property="createUserName" column="CREATE_USER_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="createMonth" column="CREATE_MONTH"/>
<result property="importNum" column="IMPORT_NUM"/>
<result property="apiNum" column="API_NUM"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
</resultMap>
<sql id="Base_Column_List">
ID,
CREATE_USER,
CREATE_USER_NAME,
CREATE_TIME,
CREATE_MONTH,
IMPORT_NUM,
API_NUM,
DELETE_FLAG
</sql>
<!--获取所有数据-->
<select id="getAllList" resultMap="tCheckIdCardMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_check_lock a
where a.DELETE_FLAG = 0
</select>
</mapper>
......@@ -66,6 +66,12 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
......@@ -127,8 +127,16 @@ public interface CommonConstants {
* 下划线
* hgw 2022-6-9 17:36:35
*/
String DOWN_LINE = "_";
//空字符串
String DOWN_LINE_STRING = "_";
/**
* 空字符串
* hgw 2022-6-9 17:36:35
*/
String EMPTY_STRING ="";
/**
* 数字int 1
* @author fxj
*/
int ONE_INT = 1;
}
......@@ -2,6 +2,11 @@ package com.yifu.cloud.plus.v1.yifu.common.core.util;
import lombok.extern.slf4j.Slf4j;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.util.regex.Pattern.compile;
/**
* @author: FANG
......@@ -41,4 +46,12 @@ public class Common {
}
return false;
}
// 金额验证
public static boolean isNumber(String str) {
// 判断小数点后2位的数字的正则表达式
Pattern pattern = compile("^((-?[1-9]{1}\\d*)|(-?[0]{1}))(\\.(\\d){0,2})?$");
Matcher match = pattern.matcher(str);
return match.matches() != false;
}
}
/**
* Copyright © 2017yifu. All rights reserved.
*
* @Title: MonthObject.java
* @Prject: worfuplus
* @Package: com.worfu.web.bo
* @Description: TODO
* @author: Administrator
* @date: 2017年8月22日 上午9:51:33
* @version: V1.0
*/
/**
* @Title: MonthObject.java
* @Package com.worfu.web.bo
* @Description: TODO(用一句话描述该文件做什么)
* @author fang
* @date 2017年8月22日
* @version V1.0
*/
package com.yifu.cloud.plus.v1.yifu.common.core.util.sms;
/**
*
* @author: fang 前台繳納月份实体
* @createDate: 2017年8月22日 上午9:51:33
*/
/**
* @ClassName: MonthObject
* @Description: TODO(这里用一句话描述这个类的作用)
* @author fang
* @date 2017年8月22日
*
*/
public class MonthObject {
private String month;
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
}
\ No newline at end of file
......@@ -173,7 +173,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
List<SysDataAuthMenuRel> menuSettleList = sysDataAuthVO.getMenuSettleList();
List<SysDataAuthMenuRel> menuDeptList = sysDataAuthVO.getMenuDeptList();
// 存储sql的map,用作缓存 键:linkId + CommonConstants.DOWN_LINE + menu.getMenuId()
// 存储sql的map,用作缓存 键:linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId()
Map<String, String> authSqlMap = new HashMap<>();
StringBuilder sql = new StringBuilder();
String mapSql;
......@@ -196,7 +196,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
sql.append(" or dept.dept_id = #deptId ");
}
for (SysDataAuthMenuRel menu : menuDeptList) {
authSqlMap.put(linkId + CommonConstants.DOWN_LINE + menu.getMenuId(), sql.toString());
authSqlMap.put(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId(), sql.toString());
menu.setSysDataAuthId(mainId);
menu.setType(3);
}
......@@ -208,13 +208,13 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
nowSql = " or a.create_by = #create_by ";
sysDataAuth.setIsCreateAuth(1);
for (SysDataAuthMenuRel menu : menuCreateList) {
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE + menu.getMenuId());
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId());
if (!Common.isEmpty(mapSql)) {
nowMapSql = new StringBuilder(nowSql).append(mapSql);
} else {
nowMapSql = new StringBuilder(nowSql);
}
authSqlMap.put(linkId + CommonConstants.DOWN_LINE + menu.getMenuId(), nowMapSql.toString());
authSqlMap.put(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId(), nowMapSql.toString());
menu.setType(1);
menu.setSysDataAuthId(mainId);
}
......@@ -226,13 +226,13 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
nowSql = " or a.settleDomainId in ('0'#settleDomainId) ";
sysDataAuth.setIsSettleAuth(1);
for (SysDataAuthMenuRel menu : menuSettleList) {
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE + menu.getMenuId());
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId());
if (!Common.isEmpty(mapSql)) {
nowMapSql = new StringBuilder(nowSql).append(mapSql);
} else {
nowMapSql = new StringBuilder(nowSql);
}
authSqlMap.put(linkId + CommonConstants.DOWN_LINE + menu.getMenuId(), nowMapSql.toString());
authSqlMap.put(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId(), nowMapSql.toString());
menu.setType(2);
menu.setSysDataAuthId(mainId);
}
......@@ -250,13 +250,13 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
sqls.setSysDataAuthId(mainId);
diySqlService.save(sqls);
for (SysDiySqlMenuRel menuSql : menuSqlList) {
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE + menuSql.getMenuId());
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE_STRING + menuSql.getMenuId());
if (!Common.isEmpty(mapSql)) {
nowMapSql = new StringBuilder(nowSql).append(mapSql);
} else {
nowMapSql = new StringBuilder(nowSql);
}
authSqlMap.put(linkId + CommonConstants.DOWN_LINE + menuSql.getMenuId(), nowMapSql.toString());
authSqlMap.put(linkId + CommonConstants.DOWN_LINE_STRING + menuSql.getMenuId(), nowMapSql.toString());
menuSql.setSysDataAuthId(mainId);
menuSql.setSysDiySqlId(sqls.getId());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment