Commit fdadd951 authored by “yiyousong”'s avatar “yiyousong”
parents e72ffb04 cb60dbcc
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</template> </template>
<!-- 类型 --> <!-- 类型 -->
<template slot="appType" slot-scope="text"> <template slot="appType" slot-scope="text">
{{ text.appType === 1 ? "应用程序" : "URL" }} {{ appType[text.appType] }}
</template> </template>
<!-- 上下架 --> <!-- 上下架 -->
<template slot="shelves" slot-scope="text"> <template slot="shelves" slot-scope="text">
...@@ -150,6 +150,13 @@ import { ...@@ -150,6 +150,13 @@ import {
import local from "@/utils/local"; import local from "@/utils/local";
import { mapMutations, mapGetters } from "vuex"; import { mapMutations, mapGetters } from "vuex";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
let appType = {
1: "应用程序",
2: "URL",
3: "微信小程序",
4: "天府通办",
5: "Router",
};
const columns = [ const columns = [
{ {
title: "序号", title: "序号",
...@@ -211,6 +218,7 @@ export default { ...@@ -211,6 +218,7 @@ export default {
return { return {
api: process.env.VUE_APP_API_BASE_URL + "/", api: process.env.VUE_APP_API_BASE_URL + "/",
columns, columns,
appType,
siteId: local.getLocal("siteId"), siteId: local.getLocal("siteId"),
tableData: [], // 表格数据 tableData: [], // 表格数据
loading: false, loading: false,
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</template> </template>
<!-- 类型 --> <!-- 类型 -->
<template slot="appType" slot-scope="text"> <template slot="appType" slot-scope="text">
{{ text.appType === 1 ? "应用程序" : "URL" }} {{ appType[text.appType] }}
</template> </template>
<!-- 上下架 --> <!-- 上下架 -->
<template slot="shelves" slot-scope="text"> <template slot="shelves" slot-scope="text">
...@@ -150,6 +150,13 @@ import { ...@@ -150,6 +150,13 @@ import {
import local from "@/utils/local"; import local from "@/utils/local";
import { mapMutations, mapGetters } from "vuex"; import { mapMutations, mapGetters } from "vuex";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
let appType = {
1: "应用程序",
2: "URL",
3: "微信小程序",
4: "天府通办",
5: "Router",
};
const columns = [ const columns = [
{ {
title: "序号", title: "序号",
...@@ -211,6 +218,7 @@ export default { ...@@ -211,6 +218,7 @@ export default {
return { return {
api: process.env.VUE_APP_API_BASE_URL + "/", api: process.env.VUE_APP_API_BASE_URL + "/",
columns, columns,
appType,
siteId: local.getLocal("siteId"), siteId: local.getLocal("siteId"),
tableData: [], // 表格数据 tableData: [], // 表格数据
loading: false, loading: false,
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<a-radio :value="2"> URL </a-radio> <a-radio :value="2"> URL </a-radio>
<a-radio :value="3" v-if="form.type != 1"> 微信小程序 </a-radio> <a-radio :value="3" v-if="form.type != 1"> 微信小程序 </a-radio>
<a-radio :value="4" v-if="form.type != 2"> 天府通办 </a-radio> <a-radio :value="4" v-if="form.type != 2"> 天府通办 </a-radio>
<a-radio :value="5"> Router </a-radio>
</a-radio-group> </a-radio-group>
</a-form-model-item> </a-form-model-item>
<a-form-model-item <a-form-model-item
...@@ -406,6 +407,7 @@ export default { ...@@ -406,6 +407,7 @@ export default {
// 改变类型 // 改变类型
changeAppType(e) { changeAppType(e) {
let val = e.target.value; let val = e.target.value;
this.$refs.form.clearValidate(["url", "filePath"]);
if (val == 1) { if (val == 1) {
this.form.url = ""; this.form.url = "";
} else { } else {
......
...@@ -235,6 +235,22 @@ ...@@ -235,6 +235,22 @@
<groupId>com.mortals.framework</groupId> <groupId>com.mortals.framework</groupId>
<artifactId>mortals-framework-annotation</artifactId> <artifactId>mortals-framework-annotation</artifactId>
</dependency> </dependency>
<!-- 达梦数据库驱动-->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>
<!-- Spring Boot Data Elasticsearch依赖 -->
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<version>2.7.18</version>
</dependency>
-->
</dependencies> </dependencies>
......
...@@ -24,7 +24,7 @@ import java.util.List; ...@@ -24,7 +24,7 @@ import java.util.List;
@Aspect @Aspect
@Slf4j @Slf4j
//@Component @Component
public class DataPermissionAspect { public class DataPermissionAspect {
@Autowired @Autowired
...@@ -57,7 +57,6 @@ public class DataPermissionAspect { ...@@ -57,7 +57,6 @@ public class DataPermissionAspect {
List<DimensionResourceRuleEntity> componentRules = dimensionResourceRuleService.getRoleComponentRule(loginUser.getId(), componentRoute); List<DimensionResourceRuleEntity> componentRules = dimensionResourceRuleService.getRoleComponentRule(loginUser.getId(), componentRoute);
if (!ObjectUtils.isEmpty(componentRules)) { if (!ObjectUtils.isEmpty(componentRules)) {
//在request添加属性 //在request添加属性
//todo 构建数据权限sql 并设置到request中。
String permissionSql = RuleQueryGenerator.getPermissionSql(componentRules, loginUser); String permissionSql = RuleQueryGenerator.getPermissionSql(componentRules, loginUser);
log.info("permissionSql:{}", permissionSql); log.info("permissionSql:{}", permissionSql);
......
//package com.mortals.xhx.base.framework.config;
//
//import org.apache.http.HttpHost;
//import org.elasticsearch.client.RestClient;
//import org.elasticsearch.client.RestHighLevelClient;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.elasticsearch.client.ClientConfiguration;
//import org.springframework.data.elasticsearch.client.RestClients;
//import org.springframework.data.elasticsearch.config.AbstractElasticsearchConfiguration;
//import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
//
//@Configuration
//public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
//
//
// @Value("${elasticSearch.url}")
// private String esUrl;
//
// /**
// * @return
// */
// @Override
// //localhost:9200 写在配置文件中就可以了
// public RestHighLevelClient elasticsearchClient() {
//
// final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
// .connectedTo(esUrl) //localhost:9200
// .build();
//
// return RestClients.create(clientConfiguration).rest();
//
// }
//
//
//}
//package com.mortals.xhx.busiz;
//import com.nowcoder.community.entity.DiscussPost;
//import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
//import org.springframework.stereotype.Repository;
//
///*
//ElasticsearchRepository<DiscussPost, Integer>
//DiscussPost:接口要处理的实体类
//Integer:实体类中的主键是什么类型
//ElasticsearchRepository:父接口,其中已经事先定义好了对es服务器访问的增删改查各种方法。Spring会给它自动做一个实现,我们直接去调就可以了。
// */
//@Repository
//public interface DiscussPostRepository extends ElasticsearchRepository<DiscussPost, Integer> {
//
//}
...@@ -9,14 +9,17 @@ import com.mortals.xhx.busiz.message.MessageService; ...@@ -9,14 +9,17 @@ import com.mortals.xhx.busiz.message.MessageService;
import com.mortals.xhx.busiz.req.MessageReq; import com.mortals.xhx.busiz.req.MessageReq;
import com.mortals.xhx.busiz.rsp.MessageResp; import com.mortals.xhx.busiz.rsp.MessageResp;
import com.mortals.xhx.common.utils.RSAUtils; import com.mortals.xhx.common.utils.RSAUtils;
import com.mortals.xhx.common.utils.SecurityUtils;
import com.mortals.xhx.common.utils.ServicePlatformInvoker; import com.mortals.xhx.common.utils.ServicePlatformInvoker;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.http.*;
import org.springframework.lang.NonNull; import org.springframework.lang.NonNull;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
...@@ -40,6 +43,8 @@ import java.util.List; ...@@ -40,6 +43,8 @@ import java.util.List;
public class MessageServiceImpl implements MessageService { public class MessageServiceImpl implements MessageService {
private RestTemplate restTemplate = new RestTemplate();
@Override @Override
public MessageReq decryptMessage(MessageReq req) { public MessageReq decryptMessage(MessageReq req) {
if ("RSA".equalsIgnoreCase(req.getAlgorithm())) { if ("RSA".equalsIgnoreCase(req.getAlgorithm())) {
...@@ -58,36 +63,11 @@ public class MessageServiceImpl implements MessageService { ...@@ -58,36 +63,11 @@ public class MessageServiceImpl implements MessageService {
throw new AppException(e); throw new AppException(e);
} }
/* SM4 sm4 = SmUtil.sm4(req.getPassword().getBytes());
String decryptContent = sm4.decryptStr(req.getContent());*/
/* SM4Utils sm4Utils = new SM4Utils();
sm4Utils.setHexString(false);
sm4Utils.setSecretKey(req.getPassword());
log.info("password:{},secretKey:{},keybytes:{}",req.getPassword(),sm4Utils.getSecretKey(),sm4Utils.getSecretKey().getBytes());
String decryptContent = sm4Utils.decryptData_ECB(req.getContent());*/
MessageReq messageReq = new MessageReq(); MessageReq messageReq = new MessageReq();
messageReq.setKey(req.getKey()); messageReq.setKey(req.getKey());
messageReq.setDecryptContent(decryptContent); messageReq.setDecryptContent(decryptContent);
return messageReq; return messageReq;
} else if ("SM2".equalsIgnoreCase(req.getAlgorithm())) { } else if ("SM2".equalsIgnoreCase(req.getAlgorithm())) {
/* SM2 sm2 = SmUtil.sm2();
byte[] sign = sm2.sign(req.getContent().getBytes(), req.getPassword().getBytes());
// SM2 sm2 = SmUtil.sm2(req.getPassword().getBytes());
// String decryptContent = sm4.decryptStr(req.getContent());
*//* SM4Utils sm4Utils = new SM4Utils();
sm4Utils.setHexString(false);
sm4Utils.setSecretKey(req.getPassword());
log.info("password:{},secretKey:{},keybytes:{}",req.getPassword(),sm4Utils.getSecretKey(),sm4Utils.getSecretKey().getBytes());
String decryptContent = sm4Utils.decryptData_ECB(req.getContent());*//*
MessageReq messageReq = new MessageReq();
messageReq.setKey(req.getKey());
messageReq.setDecryptContent(decryptContent);
return messageReq;*/
} }
return req; return req;
} }
...@@ -100,7 +80,7 @@ public class MessageServiceImpl implements MessageService { ...@@ -100,7 +80,7 @@ public class MessageServiceImpl implements MessageService {
messageReq.setKey(req.getPassword()); messageReq.setKey(req.getPassword());
messageReq.setDecryptContent(decryptContent); messageReq.setDecryptContent(decryptContent);
return messageReq; return messageReq;
} else if ("SM4".equalsIgnoreCase(req.getAlgorithm())) { }else if ("SM4".equalsIgnoreCase(req.getAlgorithm())) {
String decryptContent = null; String decryptContent = null;
try { try {
decryptContent = encryptSM4(req.getPassword(), req.getContent()); decryptContent = encryptSM4(req.getPassword(), req.getContent());
...@@ -110,6 +90,96 @@ public class MessageServiceImpl implements MessageService { ...@@ -110,6 +90,96 @@ public class MessageServiceImpl implements MessageService {
messageReq.setKey(req.getKey()); messageReq.setKey(req.getKey());
messageReq.setDecryptContent(decryptContent); messageReq.setDecryptContent(decryptContent);
return messageReq; return messageReq;
}else if ("SM4new".equalsIgnoreCase(req.getAlgorithm())) {
//加密数据 并请求 再解密数据
JSONObject jsonObject = JSON.parseObject(req.getContent());
JSONObject bizJson = jsonObject.getJSONObject("biz_content");
String access_key = jsonObject.getString("access_key");
String format = jsonObject.getString("format");
String request_id = jsonObject.getString("request_id");
String timestamp = jsonObject.getString("timestamp");
String version = jsonObject.getString("version");
JSONObject dataJson = bizJson.getJSONObject("data");
log.info("未加密的数据:{}", dataJson.toJSONString());
//针对datajson加密
String encryptContent = null;
try {
encryptContent = encryptSM4(req.getPassword(), dataJson.toJSONString());
log.info("加密后的数据:{}", encryptContent);
bizJson.put("data", encryptContent);
} catch (Exception e) {
throw new AppException(e + "数据sm4加密错误");
}
// 封装数据
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.set("access_key", access_key);
params.add("biz_content", bizJson.toJSONString());
params.add("format", format);
params.add("request_id", request_id);
params.add("timestamp", timestamp);
params.add("version", version);
// 获取签名字符串
List<String> signSourceParams = new ArrayList<>();
params.forEach((key, values) -> {
if (values != null && values.size() > 0) {
Object value = values.get(0);
if (value != null) {
String valueStr = value.toString();
if (!valueStr.isEmpty()) {
signSourceParams.add(String.format("%s=%s", key, valueStr));
}
}
}
});
Collections.sort(signSourceParams);
String sign = null;
try {
String paramStr = String.join("&", signSourceParams);
// String paramStr = "access_key=DYZWFWZX&biz_content={\"aaz001\":\"1701142468806\",\"appid\":\"uRsNCSjIRWaN\",\"data\":\"{\\\"aaz001\\\":\\\"1701049617366\\\",\\\"data\\\":\\\"K7JVkCiKcUyv3VcKx8WZXvY3E+P2pXMFE3QDkhiVhJDgmJWN+NMwoQhoVjBSmO9fWdO+4kG6iYYc8JEefgYn4g==\\\",\\\"serviceCode\\\":\\\"00500100101\\\",\\\"appid\\\":\\\"uRsNCSjIRWaN\\\"}\"}&format=json&request_id=2be36a654da24cc8bb20&timestamp=1701049618303&version=1.0";
log.info("paramStr==>" + paramStr);
byte[] paramStrBytes = paramStr.getBytes(StandardCharsets.UTF_8);
byte[] signBytes = null;
signBytes = ServicePlatformInvoker.SignUtils.sm2Sign(req.getPrivate_key(), paramStrBytes);
sign = Base64.getEncoder().encodeToString(signBytes);
} catch (Exception e) {
log.error("异常", e);
throw new AppException(e.getMessage() + ",签名错误");
}
params.add("sign", sign);
// 发送POST请求, 并获取响应
HttpHeaders headers = new HttpHeaders();
String responseContent;
try {
headers.set("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
ResponseEntity<String> responseEntity = restTemplate.exchange(req.getUrl(), HttpMethod.POST, new HttpEntity<>(params, headers), String.class);
responseContent = responseEntity.getBody();
} catch (Exception e) {
throw new RuntimeException("网络错误: " + e.getMessage());
}
JSONObject respJson = JSON.parseObject(responseContent);
String code = respJson.getString("code");
if (!"1".equals(code)) {
messageReq.setKey(req.getKey());
messageReq.setDecryptContent(respJson.toJSONString());
return messageReq;
}
JSONObject biz_data = respJson.getJSONObject("biz_data");
String data = biz_data.getString("data");
log.info("data==>{}", data);
String decryptContent = null;
try {
decryptContent = decryptSM4(req.getPassword(), data);
JSONObject jsonObject1 = JSONObject.parseObject(decryptContent);
biz_data.put("data", jsonObject1);
respJson.put("biz_data", biz_data);
} catch (Exception e) {
log.error("异常", e);
}
messageReq.setKey(req.getKey());
messageReq.setDecryptContent(respJson.toJSONString());
return messageReq;
} }
return messageReq; return messageReq;
} }
...@@ -119,7 +189,7 @@ public class MessageServiceImpl implements MessageService { ...@@ -119,7 +189,7 @@ public class MessageServiceImpl implements MessageService {
if (content == null) { if (content == null) {
return null; return null;
} }
Cipher cipher = Cipher.getInstance("SM4/ECB/PKCS7Padding", new BouncyCastleProvider()); Cipher cipher = SecurityUtils.getSM4Cipher(key);
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "SM4"), (AlgorithmParameters) null); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "SM4"), (AlgorithmParameters) null);
return Base64.getEncoder().encodeToString(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8))); return Base64.getEncoder().encodeToString(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
} }
...@@ -135,6 +205,18 @@ public class MessageServiceImpl implements MessageService { ...@@ -135,6 +205,18 @@ public class MessageServiceImpl implements MessageService {
return new String(cipher.doFinal(Base64.getDecoder().decode(encryptContent)), StandardCharsets.UTF_8); return new String(cipher.doFinal(Base64.getDecoder().decode(encryptContent)), StandardCharsets.UTF_8);
} }
public String decryptSM4(@NonNull String key, String encryptContent) throws Exception {
Assert.hasText(key, "密钥不能为空");
if (encryptContent == null) {
return null;
}
Cipher cipher = null;
cipher = Cipher.getInstance("SM4/ECB/PKCS7Padding", SecurityUtils.geBouncyCastleProvider());
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "SM4"), (AlgorithmParameters) null);
return new String(cipher.doFinal(Base64.getDecoder().decode(encryptContent)),StandardCharsets.UTF_8);
}
@Override @Override
public MessageResp signMessage(MessageReq req) { public MessageResp signMessage(MessageReq req) {
......
//package com.mortals.xhx.busiz.web;
//
//import com.alibaba.fastjson.JSONObject;
//import lombok.extern.slf4j.Slf4j;
//import org.elasticsearch.action.search.SearchRequest;
//import org.elasticsearch.action.search.SearchResponse;
//import org.elasticsearch.client.RequestOptions;
//import org.elasticsearch.client.RestHighLevelClient;
//
//import org.elasticsearch.index.query.QueryBuilders;
//import org.elasticsearch.search.SearchHit;
//import org.elasticsearch.search.builder.SearchSourceBuilder;
//import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
//import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
//import org.elasticsearch.search.sort.SortBuilders;
//import org.elasticsearch.search.sort.SortOrder;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.io.IOException;
//import java.util.LinkedList;
//
//@RestController
//@RequestMapping("elTest")
//@Slf4j
//public class ElasticsearchTestsController {
//
// @Qualifier("client")
// @Autowired
// private RestHighLevelClient restHighLevelClient;
//
// //判断某id的文档(数据库中的行)是否存在
// public void testExist(){
//
// }
//
// //一次保存一条数据
// public void testInsert() {
// //把id为241的DiscussPost的对象保存到discusspost索引(es的索引相当于数据库的表)
// }
//
//
// //不带高亮的查询
// public void noHighlightQuery() throws IOException {
// SearchRequest searchRequest = new SearchRequest("discusspost");//discusspost是索引名,就是表名
//
// //构建搜索条件
// SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder()
// //在discusspost索引的title和content字段中都查询“互联网寒冬”
// .query(QueryBuilders.multiMatchQuery("互联网寒冬", "title", "content"))
// // matchQuery是模糊查询,会对key进行分词:searchSourceBuilder.query(QueryBuilders.matchQuery(key,value));
// // termQuery是精准查询:searchSourceBuilder.query(QueryBuilders.termQuery(key,value));
// .sort(SortBuilders.fieldSort("type").order(SortOrder.DESC))
// .sort(SortBuilders.fieldSort("score").order(SortOrder.DESC))
// .sort(SortBuilders.fieldSort("createTime").order(SortOrder.DESC))
// //一个可选项,用于控制允许搜索的时间:searchSourceBuilder.timeout(new TimeValue(60, TimeUnit.SECONDS));
// .from(0)// 指定从哪条开始查询
// .size(10);// 需要查出的总记录条数
//
// searchRequest.source(searchSourceBuilder);
// SearchResponse searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
//
// System.out.println(JSONObject.toJSON(searchResponse));
//
///* List<DiscussPost> list = new LinkedList<>();
// for (SearchHit hit : searchResponse.getHits().getHits()) {
// DiscussPost discussPost = JSONObject.parseObject(hit.getSourceAsString(), DiscussPost.class);
// System.out.println(discussPost);
// list.add(discussPost);
// }*/
// }
//
//
// //带高亮的查询
// public void highlightQuery() throws Exception{
// SearchRequest searchRequest = new SearchRequest("discusspost");//discusspost是索引名,就是表名
//
// //高亮
// HighlightBuilder highlightBuilder = new HighlightBuilder();
// highlightBuilder.field("title");
// highlightBuilder.field("content");
// highlightBuilder.requireFieldMatch(false);
// highlightBuilder.preTags("<span style='color:red'>");
// highlightBuilder.postTags("</span>");
//
// //构建搜索条件
// SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder()
// .query(QueryBuilders.multiMatchQuery("互联网寒冬", "title", "content"))
// .sort(SortBuilders.fieldSort("type").order(SortOrder.DESC))
// .sort(SortBuilders.fieldSort("score").order(SortOrder.DESC))
// .sort(SortBuilders.fieldSort("createTime").order(SortOrder.DESC))
// .from(0)// 指定从哪条开始查询
// .size(10)// 需要查出的总记录条数
// .highlighter(highlightBuilder);//高亮
//
// searchRequest.source(searchSourceBuilder);
// SearchResponse searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
///*
// List<DiscussPost> list = new LinkedList<>();
// for (SearchHit hit : searchResponse.getHits().getHits()) {
// DiscussPost discussPost = JSONObject.parseObject(hit.getSourceAsString(), DiscussPost.class);
//
// // 处理高亮显示的结果
// HighlightField titleField = hit.getHighlightFields().get("title");
// if (titleField != null) {
// discussPost.setTitle(titleField.getFragments()[0].toString());
// }
// HighlightField contentField = hit.getHighlightFields().get("content");
// if (contentField != null) {
// discussPost.setContent(contentField.getFragments()[0].toString());
// }
// System.out.println(discussPost);
// list.add(discussPost);
// }*/
// }
//
//
//}
package com.mortals.xhx.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.AlgorithmParameters;
import java.security.NoSuchAlgorithmException;
/**
* 安全服务工具类
*
* @author zxfei
*/
@Slf4j
public class SecurityUtils {
private static Cipher SM4Cipher = null;
private static Cipher SM4DecryptCipher;
static {
try {
SM4DecryptCipher = Cipher.getInstance("SM4/ECB/PKCS7Padding", new BouncyCastleProvider());
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (NoSuchPaddingException e) {
throw new RuntimeException(e);
}
}
private static BouncyCastleProvider bouncyCastleProvider = new BouncyCastleProvider();
public static BouncyCastleProvider geBouncyCastleProvider() {
return bouncyCastleProvider;
}
public synchronized static Cipher getSM4Cipher(String key) {
try {
if (SM4Cipher == null) {
//创建实例之前可能会有一些准备性的耗时工作
Thread.sleep(300);
synchronized (SecurityUtils.class) {
if (SM4Cipher == null) {//二次检查
SM4Cipher = Cipher.getInstance("SM4/ECB/PKCS7Padding", new BouncyCastleProvider());
}
}
}
} catch (Exception e) {
log.error("SM4Cipher init error", e);
}
return SM4Cipher;
}
public synchronized static Cipher getSM4DecryptCipher(String key) {
try {
if (SM4DecryptCipher == null) {
//创建实例之前可能会有一些准备性的耗时工作
Thread.sleep(300);
synchronized (SecurityUtils.class) {
if (SM4DecryptCipher == null) {//二次检查
//SM4DecryptCipher = Cipher.getInstance("SM4/ECB/PKCS7Padding", new BouncyCastleProvider());
SM4DecryptCipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "SM4"), (AlgorithmParameters) null);
}
}
}
SM4DecryptCipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "SM4"), (AlgorithmParameters) null);
} catch (Exception e) {
log.error("SM4Cipher init error", e);
}
return SM4DecryptCipher;
}
/**
* 获取Authentication
*/
//public static Authentication getAuthentication() {
// return SecurityContextHolder.getContext().getAuthentication();
// }
/**
* 生成BCryptPasswordEncoder密码
*
* @param password 密码
* @return 加密字符串
*/
public static String encryptPassword(String password) {
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
return passwordEncoder.encode(password);
}
/**
* 判断密码是否相同
*
* @param rawPassword 真实密码
* @param encodedPassword 加密后字符
* @return 结果
*/
public static boolean matchesPassword(String rawPassword, String encodedPassword) {
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
return passwordEncoder.matches(rawPassword, encodedPassword);
}
/**
* 是否为管理员
*
* @param userId 用户ID
* @return 结果
*/
public static boolean isAdmin(Long userId) {
return userId != null && 1L == userId;
}
}
...@@ -28,8 +28,6 @@ import java.util.List; ...@@ -28,8 +28,6 @@ import java.util.List;
@Service("appInfoTempleteFieldService") @Service("appInfoTempleteFieldService")
public class AppInfoTempleteFieldServiceImpl extends AbstractCRUDServiceImpl<AppInfoTempleteFieldDao, AppInfoTempleteFieldEntity, Long> implements AppInfoTempleteFieldService { public class AppInfoTempleteFieldServiceImpl extends AbstractCRUDServiceImpl<AppInfoTempleteFieldDao, AppInfoTempleteFieldEntity, Long> implements AppInfoTempleteFieldService {
@Autowired
private AppService appService;
@Autowired @Autowired
private AppDatasetService appDatasetService; private AppDatasetService appDatasetService;
@Autowired @Autowired
...@@ -46,7 +44,7 @@ public class AppInfoTempleteFieldServiceImpl extends AbstractCRUDServiceImpl<App ...@@ -46,7 +44,7 @@ public class AppInfoTempleteFieldServiceImpl extends AbstractCRUDServiceImpl<App
AppDatasetQuery appDatasetQuery = new AppDatasetQuery(); AppDatasetQuery appDatasetQuery = new AppDatasetQuery();
appDatasetQuery.setAppId(entity.getAppId()); appDatasetQuery.setAppId(entity.getAppId());
List<AppDatasetEntity> appDatasetEntities = appDatasetService.find(appDatasetQuery, context); List<AppDatasetEntity> appDatasetEntities = appDatasetService.find(appDatasetQuery, context);
// 判断该数据集 是否已经存在 没存在 再添加 // 判断该数据集 是否已经存在 没存在 再添加
ArrayList<AppInfoFieldEntity> fieldSaveList = new ArrayList<>(); ArrayList<AppInfoFieldEntity> fieldSaveList = new ArrayList<>();
for (AppDatasetEntity appDatasetEntity : appDatasetEntities) { for (AppDatasetEntity appDatasetEntity : appDatasetEntities) {
...@@ -65,7 +63,6 @@ public class AppInfoTempleteFieldServiceImpl extends AbstractCRUDServiceImpl<App ...@@ -65,7 +63,6 @@ public class AppInfoTempleteFieldServiceImpl extends AbstractCRUDServiceImpl<App
fieldSaveList.add(fieldEntity); fieldSaveList.add(fieldEntity);
} }
} }
if (!ObjectUtils.isEmpty(fieldSaveList)) { if (!ObjectUtils.isEmpty(fieldSaveList)) {
appInfoFieldService.save(fieldSaveList, context); appInfoFieldService.save(fieldSaveList, context);
} }
......
...@@ -296,12 +296,9 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti ...@@ -296,12 +296,9 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti
public Rest<String> cloneAppBySameSite(AppEntity appEntity, Context context) { public Rest<String> cloneAppBySameSite(AppEntity appEntity, Context context) {
Long sourceAppId = appEntity.getSourceAppId(); Long sourceAppId = appEntity.getSourceAppId();
Long targetAppId = appEntity.getTargetAppId(); Long targetAppId = appEntity.getTargetAppId();
AppEntity sourceAppEntity = this.get(sourceAppId, context); AppEntity sourceAppEntity = this.get(sourceAppId, context);
AppEntity targetAppEntity = this.get(targetAppId, context); AppEntity targetAppEntity = this.get(targetAppId, context);
//删除应用的数据集 //删除应用的数据集
if (!ObjectUtils.isEmpty(appEntity.getTargetDelete()) && YesNoEnum.YES.getValue() == appEntity.getTargetDelete()) { if (!ObjectUtils.isEmpty(appEntity.getTargetDelete()) && YesNoEnum.YES.getValue() == appEntity.getTargetDelete()) {
Long[] delIds = targetAppEntity.getAppDatasetList().stream().map(i -> i.getId()).toArray(Long[]::new); Long[] delIds = targetAppEntity.getAppDatasetList().stream().map(i -> i.getId()).toArray(Long[]::new);
...@@ -394,9 +391,6 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti ...@@ -394,9 +391,6 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti
String originFilePath = appEntity.getFilePath(); String originFilePath = appEntity.getFilePath();
String filePath = entity.getFilePath(); String filePath = entity.getFilePath();
String fileName = entity.getFileName(); String fileName = entity.getFileName();
//entity.setFilePath(null);
//entity.setFileName(null);
//判断如果应用下架,通知自助服务终端 //判断如果应用下架,通知自助服务终端
if (entity.getShelves() == YesNoEnum.NO.getValue()) { if (entity.getShelves() == YesNoEnum.NO.getValue()) {
AppPdu appPdu = new AppPdu(); AppPdu appPdu = new AppPdu();
...@@ -445,40 +439,6 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti ...@@ -445,40 +439,6 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti
} }
/*
@Override
protected void updateAfter(AppEntity entity, Context context) throws AppException {
AppVersionQuery appVersionQuery = new AppVersionQuery();
appVersionQuery.setAppId(entity.getId());
List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("version", OrderCol.DESCENDING));
appVersionQuery.setOrderColList(orderColList);
List<AppVersionEntity> appVersionEntities = appVersionService.find(appVersionQuery, context);
//获取最大版本号
if (!ObjectUtils.isEmpty(appVersionEntities)) {
AppVersionEntity curAppVersionEntity = appVersionEntities.get(0);
// String versionNum = StrUtil.subAfter(curAppVersionEntity.getVersion(), Constant.VERSION_PREFIX, false);
Integer versionNum = curAppVersionEntity.getVersion();
Integer newVersionNum = ++versionNum;
AppVersionEntity appVersionEntity = new AppVersionEntity();
appVersionEntity.initAttrValue();
AppVersionEntity versionEntity = new AppVersionEntity();
versionEntity.initAttrValue();
versionEntity.setAppId(entity.getId());
versionEntity.setAppName(entity.getAppName());
versionEntity.setVersion(newVersionNum);
versionEntity.setNotes(entity.getNotes());
versionEntity.setFileName(entity.getFileName());
versionEntity.setFilePath(entity.getFilePath());
versionEntity.setDistributeFilePath(entity.getDistributeFilePath());
versionEntity.setCreateTime(new Date());
versionEntity.setCreateUserId(this.getContextUserId(context));
appVersionService.save(versionEntity, context);
}
super.updateAfter(entity, context);
}*/
@Override @Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException { protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
...@@ -506,7 +466,6 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti ...@@ -506,7 +466,6 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti
appInfoFieldService.remove(idList, context); appInfoFieldService.remove(idList, context);
} }
} }
super.removeAfter(ids, context, result); super.removeAfter(ids, context, result);
} }
......
...@@ -35,8 +35,6 @@ import static com.mortals.framework.ap.SysConstains.*; ...@@ -35,8 +35,6 @@ import static com.mortals.framework.ap.SysConstains.*;
@RequestMapping("app/category") @RequestMapping("app/category")
public class AppCategoryController extends BaseCRUDJsonBodyMappingController<AppCategoryService,AppCategoryEntity,Long> { public class AppCategoryController extends BaseCRUDJsonBodyMappingController<AppCategoryService,AppCategoryEntity,Long> {
@Autowired
private ParamService paramService;
public AppCategoryController(){ public AppCategoryController(){
super.setModuleDesc( "自助终端应用分类"); super.setModuleDesc( "自助终端应用分类");
......
...@@ -244,8 +244,6 @@ public class AppController extends BaseCRUDJsonBodyMappingController<AppService, ...@@ -244,8 +244,6 @@ public class AppController extends BaseCRUDJsonBodyMappingController<AppService,
public static void main(String[] args) { public static void main(String[] args) {
/* String homeUrl = "app/1/2"; /* String homeUrl = "app/1/2";
String domainUrl = "http://192.168.0.98:11078"; String domainUrl = "http://192.168.0.98:11078";
String s = UrlBuilder.of(domainUrl).addPath("app").addPath("1").addPath("2").toString(); String s = UrlBuilder.of(domainUrl).addPath("app").addPath("1").addPath("2").toString();
......
...@@ -119,8 +119,6 @@ public class AppDatasetController extends BaseCRUDJsonBodyMappingController<AppD ...@@ -119,8 +119,6 @@ public class AppDatasetController extends BaseCRUDJsonBodyMappingController<AppD
appDatasetQuery.setFieldCode(query.getFieldCode()); appDatasetQuery.setFieldCode(query.getFieldCode());
appDatasetQuery.setFieldName(query.getFieldName()); appDatasetQuery.setFieldName(query.getFieldName());
appDatasetQuery.setAppId(query.getAppId()); appDatasetQuery.setAppId(query.getAppId());
// String fieldValue = StrUtil.addPrefixIfNot(query.getFieldValue(), "%");
// fieldValue = StrUtil.addSuffixIfNot(fieldValue, "%");
appDatasetQuery.setFieldValue(query.getFieldValue()); appDatasetQuery.setFieldValue(query.getFieldValue());
PageInfo pageInfo = this.buildPageInfo(query); PageInfo pageInfo = this.buildPageInfo(query);
Result<AppInfoFieldEntity> customResult = this.service.findCustomList(appDatasetQuery, pageInfo, context); Result<AppInfoFieldEntity> customResult = this.service.findCustomList(appDatasetQuery, pageInfo, context);
......
...@@ -80,7 +80,6 @@ public class AppVersionController extends BaseCRUDJsonBodyMappingController<AppV ...@@ -80,7 +80,6 @@ public class AppVersionController extends BaseCRUDJsonBodyMappingController<AppV
List<OrderCol> orderColList = new ArrayList<>(); List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("version", OrderCol.DESCENDING)); orderColList.add(new OrderCol("version", OrderCol.DESCENDING));
query.setOrderColList(orderColList); query.setOrderColList(orderColList);
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
......
package com.mortals.xhx.module.area.service.impl; package com.mortals.xhx.module.area.service.impl;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.base.service.BaseAreaService;
import com.mortals.xhx.module.site.service.SiteService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.common.code.SatusEnum; import com.mortals.xhx.common.code.SatusEnum;
import com.mortals.xhx.module.area.dao.AreaDao; import com.mortals.xhx.module.area.dao.AreaDao;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.area.service.AreaService; import com.mortals.xhx.module.area.service.AreaService;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -195,12 +194,12 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -195,12 +194,12 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
@Override @Override
public List<AreaTreeSelect> getListByParentId(String parentId, Context context) { public List<AreaTreeSelect> getListByParentId(String parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) { if (ObjectUtils.isEmpty(parentId)) {
parentId = "0"; parentId = "%0%";
} }
//只做一层 //只做一层
List<AreaTreeSelect> collect = this.find(new AreaQuery().pid(parentId), context).stream().map(item -> new AreaTreeSelect(item) List<AreaTreeSelect> collect = this.find(new AreaQuery().pid(parentId), context).stream().map(item -> new AreaTreeSelect(item)
).collect(Collectors.toList()); ).collect(Collectors.toList());
if ("0".equals(parentId)) { if ("%0%".equals(parentId)) {
return collect; return collect;
} }
// AreaEntity areaEntity = this.selectOne(new AreaQuery().iid(parentId)); // AreaEntity areaEntity = this.selectOne(new AreaQuery().iid(parentId));
......
...@@ -34,7 +34,7 @@ public class BusinessMatterServiceImpl extends AbstractCRUDServiceImpl<BusinessM ...@@ -34,7 +34,7 @@ public class BusinessMatterServiceImpl extends AbstractCRUDServiceImpl<BusinessM
super.saveBefore(entity, context); super.saveBefore(entity, context);
int count = this.getDao().getCount(new BusinessMatterQuery().siteBusinessId(entity.getSiteBusinessId()).matterId(entity.getMatterId())); int count = this.getDao().getCount(new BusinessMatterQuery().siteBusinessId(entity.getSiteBusinessId()).matterId(entity.getMatterId()));
if(count>0){ if(count>0){
throw new AppException("当前业务事项已存在,不能新增"); throw new AppException("当前业务事项已存在,不能新增!");
} }
} }
......
...@@ -85,11 +85,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa ...@@ -85,11 +85,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
@Override @Override
protected void updateAfter(BusinessEntity entity, Context context) throws AppException { protected void updateAfter(BusinessEntity entity, Context context) throws AppException {
Runnable runnable = new Runnable() { Runnable runnable = new Runnable() {
/**
*
*/
@Override @Override
public void run() { public void run() {
//同步更新所有站点 //同步更新所有站点
...@@ -112,9 +108,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa ...@@ -112,9 +108,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
if( !ObjectUtils.isEmpty(windowBusinessEntityList)) { if( !ObjectUtils.isEmpty(windowBusinessEntityList)) {
windowBusinessService.update(windowBusinessEntityList, context); windowBusinessService.update(windowBusinessEntityList, context);
} }
} }
//通知第三方平台 //通知第三方平台
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api"); String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api");
phpUrl += "/inter/device/baseDataSave"; phpUrl += "/inter/device/baseDataSave";
...@@ -126,11 +120,9 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa ...@@ -126,11 +120,9 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
apiThirdPartyReq.setStatus(ThirdPartyStatusEnum.修改.getValue()); apiThirdPartyReq.setStatus(ThirdPartyStatusEnum.修改.getValue());
apiThirdPartyReq.setData(bussinessThirdPartyReq); apiThirdPartyReq.setData(bussinessThirdPartyReq);
messageService.sendThirdParty(phpUrl, JSON.toJSONString(apiThirdPartyReq)); messageService.sendThirdParty(phpUrl, JSON.toJSONString(apiThirdPartyReq));
} }
}; };
ThreadPool.getInstance().execute(runnable); ThreadPool.getInstance().execute(runnable);
super.updateAfter(entity, context); super.updateAfter(entity, context);
} }
...@@ -150,7 +142,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa ...@@ -150,7 +142,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
for (BusinessEntity child : childList) { for (BusinessEntity child : childList) {
if (!idSet.contains(child.getId())) { if (!idSet.contains(child.getId())) {
bool = true; bool = true;
break; continue;
} }
if (bool) { if (bool) {
throw new AppException("删除的父业务存在子业务,不能删除"); throw new AppException("删除的父业务存在子业务,不能删除");
...@@ -171,8 +163,6 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa ...@@ -171,8 +163,6 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
apiThirdPartyReq.setData(bussinessThirdPartyReq); apiThirdPartyReq.setData(bussinessThirdPartyReq);
messageService.sendThirdParty(phpUrl, JSON.toJSONString(apiThirdPartyReq)); messageService.sendThirdParty(phpUrl, JSON.toJSONString(apiThirdPartyReq));
} }
super.removeBefore(ids, context); super.removeBefore(ids, context);
} }
...@@ -233,8 +223,6 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa ...@@ -233,8 +223,6 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
private void updateOrSave(BusinessEntity item, Long siteId, Context context) { private void updateOrSave(BusinessEntity item, Long siteId, Context context) {
SiteBusinessEntity siteBusinessEntity = new SiteBusinessEntity(); SiteBusinessEntity siteBusinessEntity = new SiteBusinessEntity();
// BeanUtils.copyProperties(item, siteBusinessEntity, BeanUtil.getNullPropertyNames(item));
SiteEntity siteEntity = siteService.get(siteId); SiteEntity siteEntity = siteService.get(siteId);
if (ObjectUtils.isEmpty(siteEntity)) { if (ObjectUtils.isEmpty(siteEntity)) {
throw new AppException("未找到相应站点!"); throw new AppException("未找到相应站点!");
......
...@@ -280,15 +280,9 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -280,15 +280,9 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
if (!ObjectUtils.isEmpty(siteMatterEntityList)) { if (!ObjectUtils.isEmpty(siteMatterEntityList)) {
siteMatterService.update(siteMatterEntityList, context); siteMatterService.update(siteMatterEntityList, context);
} }
} }
}; };
ThreadPool.getInstance().execute(runnable); ThreadPool.getInstance().execute(runnable);
super.updateAfter(entity, context); super.updateAfter(entity, context);
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.device.web; package com.mortals.xhx.module.device.web;
import com.mortals.framework.annotation.SlideWindowLimit;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
...@@ -38,4 +40,13 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -38,4 +40,13 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
} }
/**
* @param query
* @return
*/
@Override
@SlideWindowLimit
public Rest<Object> list(DeviceEntity query) {
return super.list(query);
}
} }
\ No newline at end of file
...@@ -158,6 +158,7 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao, ...@@ -158,6 +158,7 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
} catch (Exception e) { } catch (Exception e) {
throw new AppException("密码转换异常!", e); throw new AppException("密码转换异常!", e);
} }
sysUser.setUpdateTime(new Date());
dao.update(sysUser); dao.update(sysUser);
this.putCache(loginName, sysUser); this.putCache(loginName, sysUser);
...@@ -218,7 +219,8 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao, ...@@ -218,7 +219,8 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
boolean bool = com.mortals.framework.util.FileUtil.write(filePath, FileUtil.readBytes(file), true, true); boolean bool = com.mortals.framework.util.FileUtil.write(filePath, FileUtil.readBytes(file), true, true);
if (bool) { if (bool) {
workmanEntity.setPhotoPath(newName); workmanEntity.setPhotoPath(newName);
workmanService.update(workmanEntity); workmanEntity.setUpdateTime(new Date());
workmanService.getDao().update(workmanEntity);
} }
} catch (IOException e) { } catch (IOException e) {
log.error("写入证照异常", e); log.error("写入证照异常", e);
...@@ -254,7 +256,7 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao, ...@@ -254,7 +256,7 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
entity.setId(workmanEntity.getId()); entity.setId(workmanEntity.getId());
entity.setDeleted(YesNoEnum.NO.getValue()); entity.setDeleted(YesNoEnum.NO.getValue());
entity.setUpdateUserId(this.getContextUserId(context)); entity.setUpdateUserId(this.getContextUserId(context));
entity.setCreateTime(new Date()); entity.setUpdateTime(new Date());
WorkmanEntity update = this.update(entity, context); WorkmanEntity update = this.update(entity, context);
if (update != null) { if (update != null) {
successNum++; successNum++;
......
...@@ -111,10 +111,10 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman ...@@ -111,10 +111,10 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
WorkmanEntity workmanEntity = this.service.doLogin(query.getLoginName(), query.getLoginPwd(), ip); WorkmanEntity workmanEntity = this.service.doLogin(query.getLoginName(), query.getLoginPwd(), ip);
workmanEntity.setLastLoginAddress(ip); workmanEntity.setLastLoginAddress(ip);
workmanEntity.setLastLoginTime(new Date()); workmanEntity.setLastLoginTime(new Date());
if(query.getWindowId()!=null) { if (query.getWindowId() != null) {
workmanEntity.setWindowId(query.getWindowId()); workmanEntity.setWindowId(query.getWindowId());
WindowEntity windowEntity = windowService.get(query.getWindowId()); WindowEntity windowEntity = windowService.get(query.getWindowId());
if(windowEntity!=null){ if (windowEntity != null) {
workmanEntity.setWindowName(windowEntity.getName()); workmanEntity.setWindowName(windowEntity.getName());
} }
} }
...@@ -141,7 +141,7 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman ...@@ -141,7 +141,7 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
try { try {
log.info("filePath:" + query.getFilePath()); log.info("filePath:" + query.getFilePath());
Rest<Void> rest = this.service.doImportPic(query.getFilePath()); this.service.doImportPic(query.getFilePath());
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
recordSysLog(request, getCurUser(), "解析工作人员图片成功!"); recordSysLog(request, getCurUser(), "解析工作人员图片成功!");
return ret.toJSONString(); return ret.toJSONString();
...@@ -170,7 +170,7 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman ...@@ -170,7 +170,7 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
} else { } else {
throw new AppException("账户密码修改失败!"); throw new AppException("账户密码修改失败!");
} }
recordSysLog(request, getCurUser(), "工作人员更新密码成功! workman:"+query.getLoginName());
} catch (Exception e) { } catch (Exception e) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE); ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e)); ret.put(KEY_RESULT_MSG, super.convertException(e));
...@@ -245,7 +245,7 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman ...@@ -245,7 +245,7 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
} }
if (!ObjectUtils.isEmpty(workmanEntity.getDeptName())) { if (!ObjectUtils.isEmpty(workmanEntity.getDeptName())) {
DeptEntity dept = deptService.selectOne(new DeptQuery().name(workmanEntity.getDeptName()).siteId(siteEntity.getId())); DeptEntity dept = deptService.selectOne(new DeptQuery().name(workmanEntity.getDeptName()).siteId(siteEntity.getId()));
if(!ObjectUtils.isEmpty(dept)){ if (!ObjectUtils.isEmpty(dept)) {
workmanEntity.setDeptId(dept.getId()); workmanEntity.setDeptId(dept.getId());
workmanEntity.setDeptName(dept.getName()); workmanEntity.setDeptName(dept.getName());
} }
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
<property name="showSql" value="false" /> <property name="showSql" value="false" />
</plugin> </plugin>
<!-- <plugin interceptor="com.mortals.framework.thirty.dm.DmTransInterceptor"> <plugin interceptor="com.mortals.framework.thirty.dm.DmTransInterceptor">
<property name="showSql" value="false" />
</plugin>--> </plugin>
</plugins> </plugins>
</configuration> </configuration>
\ No newline at end of file
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
a.shortName as shortName, a.shortName as shortName,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('domain') or colPickMode == 1 and data.containsKey('domain')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('domain') or colPickMode == 1 and data.containsKey('domain')))">
a.domain as domain, a.`domain` as `domain`,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))">
a.status as status, a.status as status,
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
a.shortName=#{data.shortName}, a.shortName=#{data.shortName},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('domain')) or (colPickMode==1 and !data.containsKey('domain'))"> <if test="(colPickMode==0 and data.containsKey('domain')) or (colPickMode==1 and !data.containsKey('domain'))">
a.domain=#{data.domain}, a.`domain`=#{data.domain},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))"> <if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))">
a.status=#{data.status}, a.status=#{data.status},
...@@ -602,14 +602,14 @@ ...@@ -602,14 +602,14 @@
<if test="conditionParamRef.containsKey('domain')"> <if test="conditionParamRef.containsKey('domain')">
<if test="conditionParamRef.domain != null and conditionParamRef.domain != ''"> <if test="conditionParamRef.domain != null and conditionParamRef.domain != ''">
${_conditionType_} a.domain like #{${_conditionParam_}.domain} ${_conditionType_} a.`domain` like #{${_conditionParam_}.domain}
</if> </if>
<if test="conditionParamRef.domain == null"> <if test="conditionParamRef.domain == null">
${_conditionType_} a.domain is null ${_conditionType_} a.`domain` is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('domainList')"> <if test="conditionParamRef.containsKey('domainList')">
${_conditionType_} a.domain in ${_conditionType_} a.`domain` in
<foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
...@@ -760,7 +760,7 @@ ...@@ -760,7 +760,7 @@
, ,
</if> </if>
<if test="orderCol.containsKey('domain')"> <if test="orderCol.containsKey('domain')">
a.domain a.`domain`
<if test='orderCol.domain != null and "DESC".equalsIgnoreCase(orderCol.domain)'>DESC</if> <if test='orderCol.domain != null and "DESC".equalsIgnoreCase(orderCol.domain)'>DESC</if>
, ,
</if> </if>
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
a.shortName, a.shortName,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('domain') or colPickMode == 1 and data.containsKey('domain')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('domain') or colPickMode == 1 and data.containsKey('domain')))">
a.domain, a.`domain`,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))">
a.status, a.status,
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
a.shortName=#{data.shortName}, a.shortName=#{data.shortName},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('domain')) or (colPickMode==1 and !data.containsKey('domain'))"> <if test="(colPickMode==0 and data.containsKey('domain')) or (colPickMode==1 and !data.containsKey('domain'))">
a.domain=#{data.domain}, a.`domain`=#{data.domain},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))"> <if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))">
a.status=#{data.status}, a.status=#{data.status},
...@@ -613,14 +613,14 @@ ...@@ -613,14 +613,14 @@
<if test="conditionParamRef.containsKey('domain')"> <if test="conditionParamRef.containsKey('domain')">
<if test="conditionParamRef.domain != null and conditionParamRef.domain != ''"> <if test="conditionParamRef.domain != null and conditionParamRef.domain != ''">
${_conditionType_} a.domain like #{${_conditionParam_}.domain} ${_conditionType_} a.`domain` like #{${_conditionParam_}.domain}
</if> </if>
<if test="conditionParamRef.domain == null"> <if test="conditionParamRef.domain == null">
${_conditionType_} a.domain is null ${_conditionType_} a.`domain` is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('domainList')"> <if test="conditionParamRef.containsKey('domainList')">
${_conditionType_} a.domain in ${_conditionType_} a.`domain` in
<foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
...@@ -771,7 +771,7 @@ ...@@ -771,7 +771,7 @@
, ,
</if> </if>
<if test="orderCol.containsKey('domain')"> <if test="orderCol.containsKey('domain')">
a.domain a.`domain`
<if test='orderCol.domain != null and "DESC".equalsIgnoreCase(orderCol.domain)'>DESC</if> <if test='orderCol.domain != null and "DESC".equalsIgnoreCase(orderCol.domain)'>DESC</if>
, ,
</if> </if>
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
a.shortName, a.shortName,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('domain') or colPickMode == 1 and data.containsKey('domain')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('domain') or colPickMode == 1 and data.containsKey('domain')))">
a.domain, a.`domain`,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('iid') or colPickMode == 1 and data.containsKey('iid')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('iid') or colPickMode == 1 and data.containsKey('iid')))">
a.iid, a.iid,
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
a.shortName=#{data.shortName}, a.shortName=#{data.shortName},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('domain')) or (colPickMode==1 and !data.containsKey('domain'))"> <if test="(colPickMode==0 and data.containsKey('domain')) or (colPickMode==1 and !data.containsKey('domain'))">
a.domain=#{data.domain}, a.`domain`=#{data.domain},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('iid')) or (colPickMode==1 and !data.containsKey('iid'))"> <if test="(colPickMode==0 and data.containsKey('iid')) or (colPickMode==1 and !data.containsKey('iid'))">
a.iid=#{data.iid}, a.iid=#{data.iid},
...@@ -437,14 +437,14 @@ ...@@ -437,14 +437,14 @@
<if test="conditionParamRef.containsKey('domain')"> <if test="conditionParamRef.containsKey('domain')">
<if test="conditionParamRef.domain != null and conditionParamRef.domain != ''"> <if test="conditionParamRef.domain != null and conditionParamRef.domain != ''">
${_conditionType_} a.domain like #{${_conditionParam_}.domain} ${_conditionType_} a.`domain` like #{${_conditionParam_}.domain}
</if> </if>
<if test="conditionParamRef.domain == null"> <if test="conditionParamRef.domain == null">
${_conditionType_} a.domain is null ${_conditionType_} a.`domain` is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('domainList')"> <if test="conditionParamRef.containsKey('domainList')">
${_conditionType_} a.domain in ${_conditionType_} a.`domain` in
<foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
...@@ -573,7 +573,7 @@ ...@@ -573,7 +573,7 @@
, ,
</if> </if>
<if test="orderCol.containsKey('domain')"> <if test="orderCol.containsKey('domain')">
a.domain a.`domain`
<if test='orderCol.domain != null and "DESC".equalsIgnoreCase(orderCol.domain)'>DESC</if> <if test='orderCol.domain != null and "DESC".equalsIgnoreCase(orderCol.domain)'>DESC</if>
, ,
</if> </if>
......
...@@ -183,6 +183,12 @@ ...@@ -183,6 +183,12 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- 达梦数据库驱动-->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<setting name="useColumnLabel" value="true" /> <setting name="useColumnLabel" value="true" />
<setting name="useGeneratedKeys" value="false" /> <setting name="useGeneratedKeys" value="false" />
<setting name="defaultExecutorType" value="REUSE" /> <setting name="defaultExecutorType" value="REUSE" />
</settings> </settings>
<plugins> <plugins>
<plugin interceptor="com.mortals.framework.thirty.mybatis.MortalsPagePlugin"> <plugin interceptor="com.mortals.framework.thirty.mybatis.MortalsPagePlugin">
...@@ -18,5 +19,8 @@ ...@@ -18,5 +19,8 @@
<property name="enableExecutorTime" value="true" /> <property name="enableExecutorTime" value="true" />
<property name="showSql" value="false" /> <property name="showSql" value="false" />
</plugin> </plugin>
<plugin interceptor="com.mortals.framework.thirty.dm.DmTransInterceptor">
<property name="showSql" value="false" />
</plugin>
</plugins> </plugins>
</configuration> </configuration>
\ No newline at end of file
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