Commit 3524c930 authored by tianbo's avatar tianbo

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 7e531288 e6700975
......@@ -84,8 +84,15 @@ public class ControllerAop {
String[] url = new String[] { "/api/user/save/curCompany", "/jcs/command/lookHtmlText",
"/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/elevator/getElevatorInfo",
"/openapi/bizToken/applyToken"
//+ ",/tzs/reg-unit-info/management-unit/tree","/tzs/flc-unit-info/region/tree", "/tzs/reg-unit-info/unit-type/list"
};
,"/tzs/flc-unit-info/region/tree"
// ,"/tzs/reg-unit-info/management-unit/tree",
//"/tzs/reg-unit-info/unit-type/list"
+ "/tzs/reg-unit-info/management-unit/tree","/tzs/flc-unit-info/region/tree", "/tzs/reg-unit-info/unit-type/list"
,"/tzs/reg-unit-info/"+"^[A-Za-z0-9]+$"+"/check","/tzs/flc-unit-info/hasExistPhone","/tzs/flc-unit-info/sendTelCode"
};
// if (request.getRequestURI().contains("/tzs/reg-unit-info") || request.getRequestURI().contains("/tzs/flc-unit-info")) {
// return;
// }
// 获取请求路径
for (String uri : url) {
if (request.getRequestURI().indexOf(uri) != -1) {
......
......@@ -116,7 +116,6 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
data.setCount(num);
}
return list;
}
@Override
public List<DataDictionary> getByType(String type) {
......
......@@ -14,7 +14,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
@FeignClient(name = "TZS-tym", path = "/tzs", configuration =
@FeignClient(name = "TZS", path = "/tzs", configuration =
{MultipartSupportConfig.class})
public interface TzsServiceFeignClient {
......
<?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.yeejoin.amos.api.openapi.face.orm.dao.EquipmentMapper">
<!-- <select id="page"
resultType="com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentModel">
SELECT
supervise.sequence_nbr,
registration.use_org_code AS useRegistrationNumber,
use1.use_unit_name AS useUnit,
registration.equ_list AS equipmentType,
registration.equ_category AS equipmentCategory,
registration.equ_define AS equipmentVariety,
registration.product_name AS equipmentName,
registration.equ_code AS equipmentCode,
registration.sequence_code AS equipmentNumber,
use1.use_inner_code AS internalNumber,
registration.organization_name AS registrationOrgan,
NULL AS registrationDate,
CONCAT(use1.province,use1.city,use1.county,use1.street,use1.address)AS useUnitAddress,
use1.use_unit_credit_code AS useUnitCode,
use1.area_code AS useUnitAreaCode,
use1.equ_state AS regStatus,
use1.use_state_change_date AS useStatusUpdate,
use1.changes AS changeStatus,
use1.use_state_change_date AS changeUpdate,
use1.use_date AS useDate,
design.design_unit_name AS designUnitName,
maintenance.me_unit_name AS manUnitName,
(SELECT construct.usc_unit_name FROM tz_jg_construction_info construct WHERE construct.sequence_code = supervise.sequence_code ORDER BY construct.sync_date DESC LIMIT 1) AS builderUnitName,
NULL AS JDUnitName,
NULL AS XSUnitName,
produce.produce_unit_name AS CQUnitName,
produce.produce_unit_credit_code AS CQUnitCode,
supervise.sync_date AS recordDate
FROM tz_jg_supervise_info supervise
LEFT JOIN
tz_jg_use_info use1 ON use1.sequence_code =
supervise.sequence_code
LEFT JOIN tz_jg_maintenance_info maintenance ON
maintenance.sequence_code
= supervise.sequence_code
LEFT JOIN
tz_jg_registration_info registration ON
registration.sequence_code =
supervise.sequence_code
LEFT JOIN tz_jg_other_info other ON
other.sequence_code =
supervise.sequence_code
LEFT JOIN
tz_jg_produce_info produce ON produce.sequence_code =
supervise.sequence_code
LEFT JOIN
tz_jg_design_info design ON design.sequence_code =
supervise.sequence_code
<where>
<if
test="startTime !=null and endTime !=null">
supervise.sync_date BETWEEN #{startTime} AND #{endTime}
OR use1.sync_date BETWEEN #{startTime} AND #{endTime}
OR maintenance.sync_date BETWEEN #{startTime} AND #{endTime}
OR registration.sync_date BETWEEN #{startTime} AND #{endTime}
OR other.sync_date BETWEEN #{startTime} AND #{endTime}
OR produce.sync_date BETWEEN #{startTime} AND #{endTime}
OR design.sync_date BETWEEN #{startTime} AND #{endTime}
OR (SELECT construct.sync_date FROM tz_jg_construction_info construct WHERE construct.sequence_code = supervise.sequence_code ORDER BY construct.sync_date DESC LIMIT 1) BETWEEN #{startTime} AND #{endTime}
</if>
</where>
</select> -->
<select id="page"
resultType="com.yeejoin.amos.api.openapi.face.model.EquipmentModel">
SELECT
*
FROM
tm_equipment_info
<where>
<if
test="startTime !=null and endTime !=null">
record_date BETWEEN #{startTime} AND #{endTime}
</if>
</where>
</select>
</mapper>
package com.yeejoin.precontrol.common.utils;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
/**
*
* <pre>
* DES加密解密工具
* 加密:DesUtils.encode("admin","1,2,3");
* 解密:DesUtils.decode("012C2C9BA925FAF8045B2FD9B02A2664","1,2,3");
* </pre>
*
* @author amos
* @version $Id: DesUtil.java, v 0.1 2018年10月13日 下午3:56:27 amos Exp $
*/
public class DesUtil {
private static DesCore desCore = new DesCore();
/**
* DES加密(secretKey代表3个key,用逗号分隔)
*/
public static String encode(String data, String secretKey) {
if (StringUtils.isBlank(data)){
return "";
}
String[] ks = StringUtils.split(secretKey, ",");
if (ks.length >= 3){
return desCore.strEnc(data, ks[0], ks[1], ks[2]);
}
return desCore.strEnc(data, secretKey, "", "");
}
/**
* DES解密(secretKey代表3个key,用逗号分隔)
*/
public static String decode(String data, String secretKey) {
if (StringUtils.isBlank(data)){
return "";
}
String[] ks = StringUtils.split(secretKey, ",");
if (ks.length >= 3){
return desCore.strDec(data, ks[0], ks[1], ks[2]);
}
return desCore.strDec(data, secretKey, "", "");
}
/**
*
* <pre>
* DES加密/解密
* @Copyright Copyright (c) 2006
* </pre>
*
* @author amos
* @version $Id: DesUtil.java, v 0.1 2018年10月13日 下午3:56:59 amos Exp $
*/
@SuppressWarnings({"rawtypes","unused","unchecked"})
static class DesCore {
/*
* encrypt the string to string made up of hex return the encrypted string
*/
public String strEnc(String data, String firstKey, String secondKey, String thirdKey) {
int leng = data.length();
String encData = "";
List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
int firstLength = 0, secondLength = 0, thirdLength = 0;
if (firstKey != null && firstKey != "") {
firstKeyBt = getKeyBytes(firstKey);
firstLength = firstKeyBt.size();
}
if (secondKey != null && secondKey != "") {
secondKeyBt = getKeyBytes(secondKey);
secondLength = secondKeyBt.size();
}
if (thirdKey != null && thirdKey != "") {
thirdKeyBt = getKeyBytes(thirdKey);
thirdLength = thirdKeyBt.size();
}
if (leng > 0) {
if (leng < 4) {
int[] bt = strToBt(data);
int[] encByte = null;
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
int[] tempBt;
int x, y, z;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt;
int x, y;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "") {
int[] tempBt;
int x = 0;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
encByte = tempBt;
}
}
}
encData = bt64ToHex(encByte);
} else {
int iterator = (leng / 4);
int remainder = leng % 4;
int i = 0;
for (i = 0; i < iterator; i++) {
String tempData = data.substring(i * 4 + 0, i * 4 + 4);
int[] tempByte = strToBt(tempData);
int[] encByte = null;
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
int[] tempBt;
int x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt;
int x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "") {
int[] tempBt;
int x;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
encByte = tempBt;
}
}
}
encData += bt64ToHex(encByte);
}
if (remainder > 0) {
String remainderData = data.substring(iterator * 4 + 0, leng);
int[] tempByte = strToBt(remainderData);
int[] encByte = null;
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
int[] tempBt;
int x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt;
int x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, (int[]) secondKeyBt.get(y));
}
encByte = tempBt;
} else {
if (firstKey != null && firstKey != "") {
int[] tempBt;
int x;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, (int[]) firstKeyBt.get(x));
}
encByte = tempBt;
}
}
}
encData += bt64ToHex(encByte);
}
}
}
return encData;
}
/*
* decrypt the encrypted string to the original string
*
* return the original string
*/
public String strDec(String data, String firstKey, String secondKey, String thirdKey) {
int leng = data.length();
String decStr = "";
List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
int firstLength = 0, secondLength = 0, thirdLength = 0;
if (firstKey != null && firstKey != "") {
firstKeyBt = getKeyBytes(firstKey);
firstLength = firstKeyBt.size();
}
if (secondKey != null && secondKey != "") {
secondKeyBt = getKeyBytes(secondKey);
secondLength = secondKeyBt.size();
}
if (thirdKey != null && thirdKey != "") {
thirdKeyBt = getKeyBytes(thirdKey);
thirdLength = thirdKeyBt.size();
}
int iterator = leng / 16;
int i = 0;
for (i = 0; i < iterator; i++) {
String tempData = data.substring(i * 16 + 0, i * 16 + 16);
String strByte = hexToBt64(tempData);
int[] intByte = new int[64];
int j = 0;
for (j = 0; j < 64; j++) {
intByte[j] = Integer.parseInt(strByte.substring(j, j + 1));
}
int[] decByte = null;
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
int[] tempBt;
int x, y, z;
tempBt = intByte;
for (x = thirdLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) thirdKeyBt.get(x));
}
for (y = secondLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(y));
}
for (z = firstLength - 1; z >= 0; z--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(z));
}
decByte = tempBt;
} else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
int[] tempBt;
int x, y, z;
tempBt = intByte;
for (x = secondLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) secondKeyBt.get(x));
}
for (y = firstLength - 1; y >= 0; y--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(y));
}
decByte = tempBt;
} else {
if (firstKey != null && firstKey != "") {
int[] tempBt;
int x, y, z;
tempBt = intByte;
for (x = firstLength - 1; x >= 0; x--) {
tempBt = dec(tempBt, (int[]) firstKeyBt.get(x));
}
decByte = tempBt;
}
}
}
decStr += byteToString(decByte);
}
return decStr;
}
/*
* chang the string into the bit array
*
* return bit array(it's length % 64 = 0)
*/
public List getKeyBytes(String key) {
List keyBytes = new ArrayList();
int leng = key.length();
int iterator = (leng / 4);
int remainder = leng % 4;
int i = 0;
for (i = 0; i < iterator; i++) {
keyBytes.add(i, strToBt(key.substring(i * 4 + 0, i * 4 + 4)));
}
if (remainder > 0) {
// keyBytes[i] = strToBt(key.substring(i*4+0,leng));
keyBytes.add(i, strToBt(key.substring(i * 4 + 0, leng)));
}
return keyBytes;
}
/*
* chang the string(it's length <= 4) into the bit array
*
* return bit array(it's length = 64)
*/
public int[] strToBt(String str) {
int leng = str.length();
int[] bt = new int[64];
if (leng < 4) {
int i = 0, j = 0, p = 0, q = 0;
for (i = 0; i < leng; i++) {
int k = str.charAt(i);
for (j = 0; j < 16; j++) {
int pow = 1, m = 0;
for (m = 15; m > j; m--) {
pow *= 2;
}
// bt.set(16*i+j,""+(k/pow)%2));
bt[16 * i + j] = (k / pow) % 2;
}
}
for (p = leng; p < 4; p++) {
int k = 0;
for (q = 0; q < 16; q++) {
int pow = 1, m = 0;
for (m = 15; m > q; m--) {
pow *= 2;
}
// bt[16*p+q]=parseInt(k/pow)%2;
// bt.add(16*p+q,""+((k/pow)%2));
bt[16 * p + q] = (k / pow) % 2;
}
}
} else {
for (int i = 0; i < 4; i++) {
int k = str.charAt(i);
for (int j = 0; j < 16; j++) {
int pow = 1;
for (int m = 15; m > j; m--) {
pow *= 2;
}
// bt[16*i+j]=parseInt(k/pow)%2;
// bt.add(16*i+j,""+((k/pow)%2));
bt[16 * i + j] = (k / pow) % 2;
}
}
}
return bt;
}
/*
* chang the bit(it's length = 4) into the hex
*
* return hex
*/
public String bt4ToHex(String binary) {
String hex = "";
if (binary.equalsIgnoreCase("0000")) {
hex = "0";
} else if (binary.equalsIgnoreCase("0001")) {
hex = "1";
} else if (binary.equalsIgnoreCase("0010")) {
hex = "2";
} else if (binary.equalsIgnoreCase("0011")) {
hex = "3";
} else if (binary.equalsIgnoreCase("0100")) {
hex = "4";
} else if (binary.equalsIgnoreCase("0101")) {
hex = "5";
} else if (binary.equalsIgnoreCase("0110")) {
hex = "6";
} else if (binary.equalsIgnoreCase("0111")) {
hex = "7";
} else if (binary.equalsIgnoreCase("1000")) {
hex = "8";
} else if (binary.equalsIgnoreCase("1001")) {
hex = "9";
} else if (binary.equalsIgnoreCase("1010")) {
hex = "A";
} else if (binary.equalsIgnoreCase("1011")) {
hex = "B";
} else if (binary.equalsIgnoreCase("1100")) {
hex = "C";
} else if (binary.equalsIgnoreCase("1101")) {
hex = "D";
} else if (binary.equalsIgnoreCase("1110")) {
hex = "E";
} else if (binary.equalsIgnoreCase("1111")) {
hex = "F";
}
return hex;
}
/*
* chang the hex into the bit(it's length = 4)
*
* return the bit(it's length = 4)
*/
public String hexToBt4(String hex) {
String binary = "";
if (hex.equalsIgnoreCase("0")) {
binary = "0000";
} else if (hex.equalsIgnoreCase("1")) {
binary = "0001";
}
if (hex.equalsIgnoreCase("2")) {
binary = "0010";
}
if (hex.equalsIgnoreCase("3")) {
binary = "0011";
}
if (hex.equalsIgnoreCase("4")) {
binary = "0100";
}
if (hex.equalsIgnoreCase("5")) {
binary = "0101";
}
if (hex.equalsIgnoreCase("6")) {
binary = "0110";
}
if (hex.equalsIgnoreCase("7")) {
binary = "0111";
}
if (hex.equalsIgnoreCase("8")) {
binary = "1000";
}
if (hex.equalsIgnoreCase("9")) {
binary = "1001";
}
if (hex.equalsIgnoreCase("A")) {
binary = "1010";
}
if (hex.equalsIgnoreCase("B")) {
binary = "1011";
}
if (hex.equalsIgnoreCase("C")) {
binary = "1100";
}
if (hex.equalsIgnoreCase("D")) {
binary = "1101";
}
if (hex.equalsIgnoreCase("E")) {
binary = "1110";
}
if (hex.equalsIgnoreCase("F")) {
binary = "1111";
}
return binary;
}
/*
* chang the bit(it's length = 64) into the string
*
* return string
*/
public String byteToString(int[] byteData) {
String str = "";
for (int i = 0; i < 4; i++) {
int count = 0;
for (int j = 0; j < 16; j++) {
int pow = 1;
for (int m = 15; m > j; m--) {
pow *= 2;
}
count += byteData[16 * i + j] * pow;
}
if (count != 0) {
str += "" + (char) (count);
}
}
return str;
}
public String bt64ToHex(int[] byteData) {
String hex = "";
for (int i = 0; i < 16; i++) {
String bt = "";
for (int j = 0; j < 4; j++) {
bt += byteData[i * 4 + j];
}
hex += bt4ToHex(bt);
}
return hex;
}
public String hexToBt64(String hex) {
String binary = "";
for (int i = 0; i < 16; i++) {
binary += hexToBt4(hex.substring(i, i + 1));
}
return binary;
}
/*
* the 64 bit des core arithmetic
*/
public int[] enc(int[] dataByte, int[] keyByte) {
int[][] keys = generateKeys(keyByte);
int[] ipByte = initPermute(dataByte);
int[] ipLeft = new int[32];
int[] ipRight = new int[32];
int[] tempLeft = new int[32];
int i = 0, j = 0, k = 0, m = 0, n = 0;
for (k = 0; k < 32; k++) {
ipLeft[k] = ipByte[k];
ipRight[k] = ipByte[32 + k];
}
for (i = 0; i < 16; i++) {
for (j = 0; j < 32; j++) {
tempLeft[j] = ipLeft[j];
ipLeft[j] = ipRight[j];
}
int[] key = new int[48];
for (m = 0; m < 48; m++) {
key[m] = keys[i][m];
}
int[] tempRight = xor(pPermute(sBoxPermute(xor(expandPermute(ipRight), key))), tempLeft);
for (n = 0; n < 32; n++) {
ipRight[n] = tempRight[n];
}
}
int[] finalData = new int[64];
for (i = 0; i < 32; i++) {
finalData[i] = ipRight[i];
finalData[32 + i] = ipLeft[i];
}
return finallyPermute(finalData);
}
public int[] dec(int[] dataByte, int[] keyByte) {
int[][] keys = generateKeys(keyByte);
int[] ipByte = initPermute(dataByte);
int[] ipLeft = new int[32];
int[] ipRight = new int[32];
int[] tempLeft = new int[32];
int i = 0, j = 0, k = 0, m = 0, n = 0;
for (k = 0; k < 32; k++) {
ipLeft[k] = ipByte[k];
ipRight[k] = ipByte[32 + k];
}
for (i = 15; i >= 0; i--) {
for (j = 0; j < 32; j++) {
tempLeft[j] = ipLeft[j];
ipLeft[j] = ipRight[j];
}
int[] key = new int[48];
for (m = 0; m < 48; m++) {
key[m] = keys[i][m];
}
int[] tempRight = xor(pPermute(sBoxPermute(xor(expandPermute(ipRight), key))), tempLeft);
for (n = 0; n < 32; n++) {
ipRight[n] = tempRight[n];
}
}
int[] finalData = new int[64];
for (i = 0; i < 32; i++) {
finalData[i] = ipRight[i];
finalData[32 + i] = ipLeft[i];
}
return finallyPermute(finalData);
}
public int[] initPermute(int[] originalData) {
int[] ipByte = new int[64];
int i = 0, m = 1, n = 0, j, k;
for (i = 0, m = 1, n = 0; i < 4; i++, m += 2, n += 2) {
for (j = 7, k = 0; j >= 0; j--, k++) {
ipByte[i * 8 + k] = originalData[j * 8 + m];
ipByte[i * 8 + k + 32] = originalData[j * 8 + n];
}
}
return ipByte;
}
public int[] expandPermute(int[] rightData) {
int[] epByte = new int[48];
int i, j;
for (i = 0; i < 8; i++) {
if (i == 0) {
epByte[i * 6 + 0] = rightData[31];
} else {
epByte[i * 6 + 0] = rightData[i * 4 - 1];
}
epByte[i * 6 + 1] = rightData[i * 4 + 0];
epByte[i * 6 + 2] = rightData[i * 4 + 1];
epByte[i * 6 + 3] = rightData[i * 4 + 2];
epByte[i * 6 + 4] = rightData[i * 4 + 3];
if (i == 7) {
epByte[i * 6 + 5] = rightData[0];
} else {
epByte[i * 6 + 5] = rightData[i * 4 + 4];
}
}
return epByte;
}
public int[] xor(int[] byteOne, int[] byteTwo) {
// var xorByte = new Array(byteOne.length);
// for(int i = 0;i < byteOne.length; i ++){
// xorByte[i] = byteOne[i] ^ byteTwo[i];
// }
// return xorByte;
int[] xorByte = new int[byteOne.length];
for (int i = 0; i < byteOne.length; i++) {
xorByte[i] = byteOne[i] ^ byteTwo[i];
}
return xorByte;
}
public int[] sBoxPermute(int[] expandByte) {
// var sBoxByte = new Array(32);
int[] sBoxByte = new int[32];
String binary = "";
int[][] s1 = { { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }, { 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8 },
{ 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0 }, { 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 } };
/* Table - s2 */
int[][] s2 = { { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 }, { 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5 },
{ 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15 }, { 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 } };
/* Table - s3 */
int[][] s3 = { { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 }, { 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1 },
{ 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7 }, { 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 } };
/* Table - s4 */
int[][] s4 = { { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 }, { 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9 },
{ 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4 }, { 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 } };
/* Table - s5 */
int[][] s5 = { { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 }, { 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 },
{ 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 }, { 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 } };
/* Table - s6 */
int[][] s6 = { { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 }, { 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8 },
{ 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6 }, { 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 } };
/* Table - s7 */
int[][] s7 = { { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 }, { 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6 },
{ 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2 }, { 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 } };
/* Table - s8 */
int[][] s8 = { { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 }, { 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2 },
{ 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8 }, { 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 } };
for (int m = 0; m < 8; m++) {
int i = 0, j = 0;
i = expandByte[m * 6 + 0] * 2 + expandByte[m * 6 + 5];
j = expandByte[m * 6 + 1] * 2 * 2 * 2 + expandByte[m * 6 + 2] * 2 * 2 + expandByte[m * 6 + 3] * 2 + expandByte[m * 6 + 4];
switch (m) {
case 0:
binary = getBoxBinary(s1[i][j]);
break;
case 1:
binary = getBoxBinary(s2[i][j]);
break;
case 2:
binary = getBoxBinary(s3[i][j]);
break;
case 3:
binary = getBoxBinary(s4[i][j]);
break;
case 4:
binary = getBoxBinary(s5[i][j]);
break;
case 5:
binary = getBoxBinary(s6[i][j]);
break;
case 6:
binary = getBoxBinary(s7[i][j]);
break;
case 7:
binary = getBoxBinary(s8[i][j]);
break;
}
sBoxByte[m * 4 + 0] = Integer.parseInt(binary.substring(0, 1));
sBoxByte[m * 4 + 1] = Integer.parseInt(binary.substring(1, 2));
sBoxByte[m * 4 + 2] = Integer.parseInt(binary.substring(2, 3));
sBoxByte[m * 4 + 3] = Integer.parseInt(binary.substring(3, 4));
}
return sBoxByte;
}
public int[] pPermute(int[] sBoxByte) {
int[] pBoxPermute = new int[32];
pBoxPermute[0] = sBoxByte[15];
pBoxPermute[1] = sBoxByte[6];
pBoxPermute[2] = sBoxByte[19];
pBoxPermute[3] = sBoxByte[20];
pBoxPermute[4] = sBoxByte[28];
pBoxPermute[5] = sBoxByte[11];
pBoxPermute[6] = sBoxByte[27];
pBoxPermute[7] = sBoxByte[16];
pBoxPermute[8] = sBoxByte[0];
pBoxPermute[9] = sBoxByte[14];
pBoxPermute[10] = sBoxByte[22];
pBoxPermute[11] = sBoxByte[25];
pBoxPermute[12] = sBoxByte[4];
pBoxPermute[13] = sBoxByte[17];
pBoxPermute[14] = sBoxByte[30];
pBoxPermute[15] = sBoxByte[9];
pBoxPermute[16] = sBoxByte[1];
pBoxPermute[17] = sBoxByte[7];
pBoxPermute[18] = sBoxByte[23];
pBoxPermute[19] = sBoxByte[13];
pBoxPermute[20] = sBoxByte[31];
pBoxPermute[21] = sBoxByte[26];
pBoxPermute[22] = sBoxByte[2];
pBoxPermute[23] = sBoxByte[8];
pBoxPermute[24] = sBoxByte[18];
pBoxPermute[25] = sBoxByte[12];
pBoxPermute[26] = sBoxByte[29];
pBoxPermute[27] = sBoxByte[5];
pBoxPermute[28] = sBoxByte[21];
pBoxPermute[29] = sBoxByte[10];
pBoxPermute[30] = sBoxByte[3];
pBoxPermute[31] = sBoxByte[24];
return pBoxPermute;
}
public int[] finallyPermute(int[] endByte) {
int[] fpByte = new int[64];
fpByte[0] = endByte[39];
fpByte[1] = endByte[7];
fpByte[2] = endByte[47];
fpByte[3] = endByte[15];
fpByte[4] = endByte[55];
fpByte[5] = endByte[23];
fpByte[6] = endByte[63];
fpByte[7] = endByte[31];
fpByte[8] = endByte[38];
fpByte[9] = endByte[6];
fpByte[10] = endByte[46];
fpByte[11] = endByte[14];
fpByte[12] = endByte[54];
fpByte[13] = endByte[22];
fpByte[14] = endByte[62];
fpByte[15] = endByte[30];
fpByte[16] = endByte[37];
fpByte[17] = endByte[5];
fpByte[18] = endByte[45];
fpByte[19] = endByte[13];
fpByte[20] = endByte[53];
fpByte[21] = endByte[21];
fpByte[22] = endByte[61];
fpByte[23] = endByte[29];
fpByte[24] = endByte[36];
fpByte[25] = endByte[4];
fpByte[26] = endByte[44];
fpByte[27] = endByte[12];
fpByte[28] = endByte[52];
fpByte[29] = endByte[20];
fpByte[30] = endByte[60];
fpByte[31] = endByte[28];
fpByte[32] = endByte[35];
fpByte[33] = endByte[3];
fpByte[34] = endByte[43];
fpByte[35] = endByte[11];
fpByte[36] = endByte[51];
fpByte[37] = endByte[19];
fpByte[38] = endByte[59];
fpByte[39] = endByte[27];
fpByte[40] = endByte[34];
fpByte[41] = endByte[2];
fpByte[42] = endByte[42];
fpByte[43] = endByte[10];
fpByte[44] = endByte[50];
fpByte[45] = endByte[18];
fpByte[46] = endByte[58];
fpByte[47] = endByte[26];
fpByte[48] = endByte[33];
fpByte[49] = endByte[1];
fpByte[50] = endByte[41];
fpByte[51] = endByte[9];
fpByte[52] = endByte[49];
fpByte[53] = endByte[17];
fpByte[54] = endByte[57];
fpByte[55] = endByte[25];
fpByte[56] = endByte[32];
fpByte[57] = endByte[0];
fpByte[58] = endByte[40];
fpByte[59] = endByte[8];
fpByte[60] = endByte[48];
fpByte[61] = endByte[16];
fpByte[62] = endByte[56];
fpByte[63] = endByte[24];
return fpByte;
}
public String getBoxBinary(int i) {
String binary = "";
switch (i) {
case 0:
binary = "0000";
break;
case 1:
binary = "0001";
break;
case 2:
binary = "0010";
break;
case 3:
binary = "0011";
break;
case 4:
binary = "0100";
break;
case 5:
binary = "0101";
break;
case 6:
binary = "0110";
break;
case 7:
binary = "0111";
break;
case 8:
binary = "1000";
break;
case 9:
binary = "1001";
break;
case 10:
binary = "1010";
break;
case 11:
binary = "1011";
break;
case 12:
binary = "1100";
break;
case 13:
binary = "1101";
break;
case 14:
binary = "1110";
break;
case 15:
binary = "1111";
break;
}
return binary;
}
/*
* generate 16 keys for xor
*/
public int[][] generateKeys(int[] keyByte) {
int[] key = new int[56];
int[][] keys = new int[16][48];
// keys[ 0] = new Array();
// keys[ 1] = new Array();
// keys[ 2] = new Array();
// keys[ 3] = new Array();
// keys[ 4] = new Array();
// keys[ 5] = new Array();
// keys[ 6] = new Array();
// keys[ 7] = new Array();
// keys[ 8] = new Array();
// keys[ 9] = new Array();
// keys[10] = new Array();
// keys[11] = new Array();
// keys[12] = new Array();
// keys[13] = new Array();
// keys[14] = new Array();
// keys[15] = new Array();
int[] loop = new int[] { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 };
for (int i = 0; i < 7; i++) {
for (int j = 0, k = 7; j < 8; j++, k--) {
key[i * 8 + j] = keyByte[8 * k + i];
}
}
int i = 0;
for (i = 0; i < 16; i++) {
int tempLeft = 0;
int tempRight = 0;
for (int j = 0; j < loop[i]; j++) {
tempLeft = key[0];
tempRight = key[28];
for (int k = 0; k < 27; k++) {
key[k] = key[k + 1];
key[28 + k] = key[29 + k];
}
key[27] = tempLeft;
key[55] = tempRight;
}
// var tempKey = new Array(48);
int[] tempKey = new int[48];
tempKey[0] = key[13];
tempKey[1] = key[16];
tempKey[2] = key[10];
tempKey[3] = key[23];
tempKey[4] = key[0];
tempKey[5] = key[4];
tempKey[6] = key[2];
tempKey[7] = key[27];
tempKey[8] = key[14];
tempKey[9] = key[5];
tempKey[10] = key[20];
tempKey[11] = key[9];
tempKey[12] = key[22];
tempKey[13] = key[18];
tempKey[14] = key[11];
tempKey[15] = key[3];
tempKey[16] = key[25];
tempKey[17] = key[7];
tempKey[18] = key[15];
tempKey[19] = key[6];
tempKey[20] = key[26];
tempKey[21] = key[19];
tempKey[22] = key[12];
tempKey[23] = key[1];
tempKey[24] = key[40];
tempKey[25] = key[51];
tempKey[26] = key[30];
tempKey[27] = key[36];
tempKey[28] = key[46];
tempKey[29] = key[54];
tempKey[30] = key[29];
tempKey[31] = key[39];
tempKey[32] = key[50];
tempKey[33] = key[44];
tempKey[34] = key[32];
tempKey[35] = key[47];
tempKey[36] = key[43];
tempKey[37] = key[48];
tempKey[38] = key[38];
tempKey[39] = key[55];
tempKey[40] = key[33];
tempKey[41] = key[52];
tempKey[42] = key[45];
tempKey[43] = key[41];
tempKey[44] = key[49];
tempKey[45] = key[35];
tempKey[46] = key[28];
tempKey[47] = key[31];
int m;
switch (i) {
case 0:
for (m = 0; m < 48; m++) {
keys[0][m] = tempKey[m];
}
break;
case 1:
for (m = 0; m < 48; m++) {
keys[1][m] = tempKey[m];
}
break;
case 2:
for (m = 0; m < 48; m++) {
keys[2][m] = tempKey[m];
}
break;
case 3:
for (m = 0; m < 48; m++) {
keys[3][m] = tempKey[m];
}
break;
case 4:
for (m = 0; m < 48; m++) {
keys[4][m] = tempKey[m];
}
break;
case 5:
for (m = 0; m < 48; m++) {
keys[5][m] = tempKey[m];
}
break;
case 6:
for (m = 0; m < 48; m++) {
keys[6][m] = tempKey[m];
}
break;
case 7:
for (m = 0; m < 48; m++) {
keys[7][m] = tempKey[m];
}
break;
case 8:
for (m = 0; m < 48; m++) {
keys[8][m] = tempKey[m];
}
break;
case 9:
for (m = 0; m < 48; m++) {
keys[9][m] = tempKey[m];
}
break;
case 10:
for (m = 0; m < 48; m++) {
keys[10][m] = tempKey[m];
}
break;
case 11:
for (m = 0; m < 48; m++) {
keys[11][m] = tempKey[m];
}
break;
case 12:
for (m = 0; m < 48; m++) {
keys[12][m] = tempKey[m];
}
break;
case 13:
for (m = 0; m < 48; m++) {
keys[13][m] = tempKey[m];
}
break;
case 14:
for (m = 0; m < 48; m++) {
keys[14][m] = tempKey[m];
}
break;
case 15:
for (m = 0; m < 48; m++) {
keys[15][m] = tempKey[m];
}
break;
}
}
return keys;
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -45,7 +46,6 @@ public class ExcelServiceImpl {
PersonBasicServiceImpl personBasicServiceImpl;
@Autowired
PersonBasicMapper personBasicMapper;
@Autowired
......@@ -59,11 +59,11 @@ public class ExcelServiceImpl {
@Autowired
PersonAccountServiceImpl personAccountServiceImpl;
// 邮箱校验正则
static final String EMAIL = "^([a-zA-Z\\d][\\w-]{2,})@(\\w{2,})\\.([a-z]{2,})(\\.[a-z]{2,})?$";
static final String EMAIL = "^([a-zA-Z\\d][\\w-]{2,})@(\\w{2,})\\.([a-z]{2,})(\\.[a-z]{2,})?$";
/**
* 电话校验正则
*/
static final String PHONE = "^1((3|4|5|6|7|8|9){1}\\d{1}|70)\\d{8}$";
static final String PHONE = "^1((3|4|5|6|7|8|9){1}\\d{1}|70)\\d{8}$";
public void templateExport(HttpServletResponse response, ExcelDto excelDto, Map par) throws ClassNotFoundException {
String url = excelDto.getClassUrl();
......@@ -73,7 +73,7 @@ public class ExcelServiceImpl {
case "RYXX":
//List<EXPersonUser> data=this.getEXPersonUser( par);
List<EXPersonUser> data=this.getEXPersonUserAll( par);
List<EXPersonUser> data = this.getEXPersonUserAll(par);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
clz, dataSourcesImpl, true);
break;
......@@ -89,12 +89,12 @@ public class ExcelServiceImpl {
switch (excelDto.getType()) {
case "CZXX":
List<ExStationBasicDto> data=this.getExStationBasicDto(par);
List<ExStationBasicDto> data = this.getExStationBasicDto(par);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
ExStationBasicDto.class, dataSourcesImpl, false);
break;
case "RYXX":
List<EXPersonUser> datad=this.getEXPersonUserAll(par);
List<EXPersonUser> datad = this.getEXPersonUserAll(par);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), datad,
EXPersonUser.class, dataSourcesImpl, false);
break;
......@@ -117,154 +117,151 @@ public class ExcelServiceImpl {
}
//场站信息导出
public List<ExStationBasicDto> getExStationBasicDto(Map<String,Object> map){
List<ExStationBasicDto> data=null;
if(!map.isEmpty()){
String [] ids=null;
if(map.containsKey("ids")&&map.get("ids")!=null&&!"".equals(map.get("ids").toString())){
ids= map.get("ids").toString().split(",");
public List<ExStationBasicDto> getExStationBasicDto(Map<String, Object> map) {
List<ExStationBasicDto> data = null;
if (!map.isEmpty()) {
String[] ids = null;
if (map.containsKey("ids") && map.get("ids") != null && !"".equals(map.get("ids").toString())) {
ids = map.get("ids").toString().split(",");
}
data=stationBasicMapper.getExStationBasicDto(
map.containsKey("stationMasterName")? map.get("stationMasterName").toString():null,
map.containsKey("stationName")? map.get("stationName").toString():null,
map.containsKey("stationType")? map.get("stationType").toString():null,
map.containsKey("orgCode")? map.get("orgCode").toString():null,
data = stationBasicMapper.getExStationBasicDto(
map.containsKey("stationMasterName") ? map.get("stationMasterName").toString() : null,
map.containsKey("stationName") ? map.get("stationName").toString() : null,
map.containsKey("stationType") ? map.get("stationType").toString() : null,
map.containsKey("orgCode") ? map.get("orgCode").toString() : null,
ids
);
);
}
return data;
return data;
}
//场站导入
private void addExStationBasicDto(MultipartFile multipartFile) throws Exception {
List<ExStationBasicDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, ExStationBasicDto.class, 1);
List<StationBasic> excelEntityList = new ArrayList<>();
//数据验证
for (int i = 0; i < excelDtoList.size(); i++) {
ExStationBasicDto exStationBasicDto=excelDtoList.get(i);
this.yanzheng(exStationBasicDto.getStationName(),"场站名称", i);
this.yanzheng(exStationBasicDto.getStationCode(),"场站编号", i);
this.yanzheng(exStationBasicDto.getStationFlag(),"项目状态", i);
this.yanzheng(exStationBasicDto.getStationType(),"场站类型", i);
this.yanzheng(exStationBasicDto.getStationMasterName(),"站长", i);
this.yanzheng(exStationBasicDto.getMobilePhone(),"手机号码", i);
this.yanzheng(exStationBasicDto.getEmail(),"邮箱", i);
this.yanzheng(exStationBasicDto.getDevopsTime(),"运维时间", i);
this.yanzheng(exStationBasicDto.getOwnerUnit(),"运维单位", i);
this.yanzheng(exStationBasicDto.getAddress(),"场站地址", i);
this.yanzheng(exStationBasicDto.getArea(),"所属片区", i);
this.yanzheng(exStationBasicDto.getBriefIntroduction(),"场站简介", i);
}
excelDtoList.forEach(item -> {
StationBasic fireChemical = new StationBasic();
fireChemical = Bean.toPo(item, fireChemical);
if (fireChemical.getArea() != null) {
String[] type = fireChemical.getArea().split("@");
fireChemical.setAreaName(type[0]);
fireChemical.setArea(type[1]);
CompanyModel companyModel=personBasicServiceImpl.getCompanyModel(Long.parseLong(type[1]));
fireChemical.setAreaCode(companyModel.getCompanyCode());
}
if (fireChemical.getStationType() != null) {
String[] type = fireChemical.getStationType().split("@");
fireChemical.setStationTypeName(type[0]);
fireChemical.setStationType(type[1]);
}
//平台增加场站
CompanyModel companyModeldata=new CompanyModel();
companyModeldata.setCompanyName(fireChemical.getStationName());
companyModeldata.setCompanyType("company");
companyModeldata.setLevel("station");
companyModeldata.setParentId(Long.valueOf(fireChemical.getArea()));
companyModeldata.setCompanyCode(fireChemical.getStationCode());
companyModeldata= this.addCompanyModel(companyModeldata);
fireChemical.setProjectOrgCode(companyModeldata.getOrgCode());
fireChemical.setPlatformStationId(companyModeldata.getSequenceNbr().toString());
excelEntityList.add(fireChemical);
});
stationBasicServiceImpl.saveBatch(excelEntityList);
}
//获取人员数据
public List<EXPersonUser> getEXPersonUser(Map map){
List<EXPersonUser> listdata= personBasicMapper.getEXPersonUser(
map.containsKey("name")? map.get("name").toString():null,
map.containsKey("accountName")? map.get("accountName").toString():null,
map.containsKey("projectName")?map.get("projectName").toString():null,
map.containsKey("orgCode")?map.get("orgCode").toString():null);
return listdata;
}
//场站导入
private void addExStationBasicDto(MultipartFile multipartFile) throws Exception {
List<ExStationBasicDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, ExStationBasicDto.class, 1);
List<StationBasic> excelEntityList = new ArrayList<>();
//数据验证
for (int i = 0; i < excelDtoList.size(); i++) {
ExStationBasicDto exStationBasicDto = excelDtoList.get(i);
this.yanzheng(exStationBasicDto.getStationName(), "场站名称", i);
this.yanzheng(exStationBasicDto.getStationCode(), "场站编号", i);
this.yanzheng(exStationBasicDto.getStationFlag(), "项目状态", i);
this.yanzheng(exStationBasicDto.getStationType(), "场站类型", i);
this.yanzheng(exStationBasicDto.getStationMasterName(), "站长", i);
this.yanzheng(exStationBasicDto.getMobilePhone(), "手机号码", i);
this.yanzheng(exStationBasicDto.getEmail(), "邮箱", i);
this.yanzheng(exStationBasicDto.getDevopsTime(), "运维时间", i);
this.yanzheng(exStationBasicDto.getOwnerUnit(), "运维单位", i);
this.yanzheng(exStationBasicDto.getAddress(), "场站地址", i);
this.yanzheng(exStationBasicDto.getArea(), "所属片区", i);
this.yanzheng(exStationBasicDto.getBriefIntroduction(), "场站简介", i);
}
excelDtoList.forEach(item -> {
StationBasic fireChemical = new StationBasic();
fireChemical = Bean.toPo(item, fireChemical);
if (fireChemical.getArea() != null) {
String[] type = fireChemical.getArea().split("@");
fireChemical.setAreaName(type[0]);
fireChemical.setArea(type[1]);
CompanyModel companyModel = personBasicServiceImpl.getCompanyModel(Long.parseLong(type[1]));
fireChemical.setAreaCode(companyModel.getCompanyCode());
}
if (fireChemical.getStationType() != null) {
String[] type = fireChemical.getStationType().split("@");
fireChemical.setStationTypeName(type[0]);
fireChemical.setStationType(type[1]);
}
//平台增加场站
CompanyModel companyModeldata = new CompanyModel();
companyModeldata.setCompanyName(fireChemical.getStationName());
companyModeldata.setCompanyType("company");
companyModeldata.setLevel("station");
companyModeldata.setParentId(Long.valueOf(fireChemical.getArea()));
companyModeldata.setCompanyCode(fireChemical.getStationCode());
companyModeldata = this.addCompanyModel(companyModeldata);
public void yanzheng(Object obj,String name,int i){
//验证数据库重复
if(obj==null){
throw new InnerInvokException("第" + (i + 2) + "行,"+name+"数据不能空", "403", "第" + (i + 2) + "行,"+name+"数据不能空", 403);
}
if(obj!=null && name.equals("手机号码")&&String.valueOf(obj).matches(PHONE)) {
throw new InnerInvokException("第" + (i + 2) + "行," + name + "手机号码填写错误", "403", "第" + (i + 2) + "行," + name + "手机号码填写错误", 403);
}
if(obj!=null && name.equals("邮箱")&&String.valueOf(obj).matches(EMAIL)) {
throw new InnerInvokException("第" + (i + 2) + "行," + name + "邮箱填写错误", "403", "第" + (i + 2) + "行," + name + "邮箱填写错误", 403);
}
}
fireChemical.setProjectOrgCode(companyModeldata.getOrgCode());
fireChemical.setPlatformStationId(companyModeldata.getSequenceNbr().toString());
excelEntityList.add(fireChemical);
});
stationBasicServiceImpl.saveBatch(excelEntityList);
}
//获取人员数据
public List<EXPersonUser> getEXPersonUser(Map map) {
List<EXPersonUser> listdata = personBasicMapper.getEXPersonUser(
map.containsKey("name") ? map.get("name").toString() : null,
map.containsKey("accountName") ? map.get("accountName").toString() : null,
map.containsKey("projectName") ? map.get("projectName").toString() : null,
map.containsKey("orgCode") ? map.get("orgCode").toString() : null);
return listdata;
}
public void yanzheng(Object obj, String name, int i) {
//验证数据库重复
if (obj == null) {
throw new InnerInvokException("第" + (i + 2) + "行," + name + "数据不能空", "403", "第" + (i + 2) + "行," + name + "数据不能空", 403);
}
if (obj != null && name.equals("手机号码") && String.valueOf(obj).matches(PHONE)) {
throw new InnerInvokException("第" + (i + 2) + "行,手机号码填写错误", "403", "第" + (i + 2) + "行," + name + "手机号码填写错误", 403);
}
if (obj != null && name.equals("邮箱") && String.valueOf(obj).matches(EMAIL)) {
throw new InnerInvokException("第" + (i + 2) + "行,邮箱填写错误", "403", "第" + (i + 2) + "行," + name + "邮箱填写错误", 403);
}
}
//人员导出
//人员导出
public List<EXPersonUser> getEXPersonUserAll(Map map){
String [] ids=null;
if(map.containsKey("ids")&&map.get("ids")!=null&&!"".equals(map.get("ids").toString())){
ids= map.get("ids").toString().split(",");
public List<EXPersonUser> getEXPersonUserAll(Map map) {
String[] ids = null;
if (map.containsKey("ids") && map.get("ids") != null && !"".equals(map.get("ids").toString())) {
ids = map.get("ids").toString().split(",");
}
List<EXPersonUser> listdata= personBasicMapper.getEXPersonUserAll(
map.containsKey("name")? map.get("name").toString():null,
map.containsKey("accountName")? map.get("accountName").toString():null,
map.containsKey("projectName")?map.get("projectName").toString():null,
map.containsKey("orgCode")?map.get("orgCode").toString():null,
List<EXPersonUser> listdata = personBasicMapper.getEXPersonUserAll(
map.containsKey("name") ? map.get("name").toString() : null,
map.containsKey("accountName") ? map.get("accountName").toString() : null,
map.containsKey("projectName") ? map.get("projectName").toString() : null,
map.containsKey("orgCode") ? map.get("orgCode").toString() : null,
ids);
return listdata;
}
private CompanyModel addCompanyModel( CompanyModel companyModel) {
private CompanyModel addCompanyModel(CompanyModel companyModel) {
FeignClientResult<CompanyModel> Model = Privilege.companyClient.create(companyModel);
CompanyModel user=new CompanyModel();
CompanyModel user = new CompanyModel();
if (!ObjectUtils.isEmpty(Model)) {
if(Model.getStatus()==200){
if (Model.getStatus() == 200) {
user = Model.getResult();
}else{
} else {
throw new RuntimeException(Model.getMessage());
}
}
return user;
}
//人员导入更新
private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
List<EXPersonUser> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, EXPersonUser.class, 1);
this.updateEXPersonUserda(excelDtoList);
}
//人员导入更新
private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
List<EXPersonUser> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, EXPersonUser.class, 1);
this.updateEXPersonUserda(excelDtoList);
}
private List<String> getDataDictionary(String type) {
List<String> collect =new ArrayList<>();
FeignClientResult<List<DictionarieValueModel>> de= Systemctl.dictionarieClient.dictValues(type);
List<DictionarieValueModel> listco=new ArrayList<>();
List<String> collect = new ArrayList<>();
FeignClientResult<List<DictionarieValueModel>> de = Systemctl.dictionarieClient.dictValues(type);
List<DictionarieValueModel> listco = new ArrayList<>();
if (!ObjectUtils.isEmpty(de)) {
if (de.getStatus() == 200) {
listco = de.getResult();
......@@ -278,52 +275,85 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
return collect;
}
public void getdata( List<String> list,String name,int i){
public void getdata(List<String> list, String name, int i) {
if(name!=null&&!list.contains(name)){
throw new InnerInvokException("第" + (i + 2) + "行,证件类型和证件类型不匹配", "403", "第" + (i + 2) + "行,证件类型和证件类型不匹配", 403);
if (name != null && !list.contains(name)) {
throw new InnerInvokException("第" + (i + 2) + "行,证件类型和证件名称不匹配", "403", "第" + (i + 2) + "行,证件类型和证件名称不匹配", 403);
}
}
@Transactional
public void updateEXPersonUserda(List<EXPersonUser> excelDtoList) {
List<PersonBasic> listPersonBasic = new ArrayList<>();
List<PersonSkillEducation> listPersonSkillEducation = new ArrayList<>();
List<PersonCertificate> listPersonCertificate = new ArrayList<>();
QueryWrapper<PersonAccount> wrapper = new QueryWrapper();
//效验证件类型获取四种字典
List<String> list1= getDataDictionary("职业技能鉴定证书");
List<String> list2= getDataDictionary("专业技术资格证书");
List<String> list3= getDataDictionary("岗位资质鉴定证书");
List<String> list4= getDataDictionary("技能鉴定工种");
List<String> list1 = getDataDictionary("职业技能鉴定证书");
List<String> list2 = getDataDictionary("专业技术资格证书");
List<String> list3 = getDataDictionary("岗位资质鉴定证书");
List<String> list4 = getDataDictionary("技能鉴定工种");
//数据验证
for (int i = 0; i < excelDtoList.size(); i++) {
if (excelDtoList.get(i).getAccountName() != null) {
wrapper.eq("account_name", excelDtoList.get(i).getAccountName());
PersonAccount personAccount = personAccountServiceImpl.getOne(wrapper);
if (personAccount == null) {
throw new InnerInvokException("第" + (i + 2) + "行,平台账号名名称错误请检查", "403", "第" + (i + 2) + "行,平台账号名名称错误请检查", 403);
}
//姓名
if (excelDtoList.get(i).getName() != null && (!excelDtoList.get(i).getName().equals(personAccount.getName()))) {
throw new InnerInvokException("第" + (i + 2) + "行,姓名不允许导入时修改", "403", "第" + (i + 2) + "行,姓名不允许导入时修改", 403);
}
//工号
if (excelDtoList.get(i).getJobNumber() != null && (!excelDtoList.get(i).getJobNumber().equals(personAccount.getJobNumber()))) {
throw new InnerInvokException("第" + (i + 2) + "行,工号不允许导入时修改", "403", "第" + (i + 2) + "行,工号不允许导入时修改", 403);
}
//所属场站
if (excelDtoList.get(i).getProjectName() != null && (!excelDtoList.get(i).getProjectName().equals(personAccount.getProjectName()))) {
throw new InnerInvokException("第" + (i + 2) + "行,所属场站不允许导入时修改", "403", "第" + (i + 2) + "行,行所属场站不允许导入时修改", 403);
}
//证件类型
if (excelDtoList.get(i).getIdType() != null && (!excelDtoList.get(i).getIdType().equals(personAccount.getIdType()))) {
throw new InnerInvokException("第" + (i + 2) + "行,证件类型不允许导入时修改", "403", "第" + (i + 2) + "行,证件类型不允许导入时修改", 403);
}
//证件编号
if (excelDtoList.get(i).getIdNumber() != null && (!excelDtoList.get(i).getIdNumber().equals(personAccount.getIdNumber()))) {
throw new InnerInvokException("第" + (i + 2) + "行,证件编号不允许导入时修改", "403", "第" + (i + 2) + "行,证件编号不允许导入时修改", 403);
}
PersonBasic personBasic = personBasicMapper.selectById(personAccount.getPersonId());
//电话
if (excelDtoList.get(i).getPhoneNum() != null && (!excelDtoList.get(i).getPhoneNum().equals(personBasic.getPhone()))) {
throw new InnerInvokException("第" + (i + 2) + "行,电话不允许导入时修改", "403", "第" + (i + 2) + "行,电话不允许导入时修改", 403);
}
}
//身高和体重 ,字段验证
if(excelDtoList.get(i).getWeight()!=null&&(0 >= excelDtoList.get(i).getWeight()||excelDtoList.get(i).getWeight()>200)) {
if (excelDtoList.get(i).getWeight() != null && (0 >= excelDtoList.get(i).getWeight() || excelDtoList.get(i).getWeight() > 200)) {
throw new InnerInvokException("第" + (i + 2) + "行,体重必须大于0小于等于200", "403", "第" + (i + 2) + "行,体重必须大于0小于等于200", 403);
}
if(excelDtoList.get(i).getHeight()!=null&&(0 >= excelDtoList.get(i).getHeight()||excelDtoList.get(i).getHeight()>200)) {
if (excelDtoList.get(i).getHeight() != null && (0 >= excelDtoList.get(i).getHeight() || excelDtoList.get(i).getHeight() > 200)) {
throw new InnerInvokException("第" + (i + 2) + "行,身高必须大于0小于等于200", "403", "第" + (i + 2) + "行,身高必须大于0小于等于200", 403);
}
//效验类型
if(excelDtoList.get(i).getDocumentType()!=null){
if (excelDtoList.get(i).getDocumentType() != null) {
switch (excelDtoList.get(i).getDocumentType()) {
case "职业技能鉴定证书":
getdata(list1,excelDtoList.get(i).getCertificateName(),i);
getdata(list1, excelDtoList.get(i).getCertificateName(), i);
break;
case "专业技术资格证书":
getdata(list2,excelDtoList.get(i).getCertificateName(),i);
getdata(list2, excelDtoList.get(i).getCertificateName(), i);
break;
case "岗位资质鉴定证书":
getdata(list3,excelDtoList.get(i).getCertificateName(),i);
getdata(list3, excelDtoList.get(i).getCertificateName(), i);
break;
case "技能鉴定工种":
getdata(list4,excelDtoList.get(i).getCertificateName(),i);
getdata(list4, excelDtoList.get(i).getCertificateName(), i);
break;
default:
break;
......@@ -331,33 +361,27 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
}
}
for (EXPersonUser exPersonUser : excelDtoList) {
//根据平台账号获取用户id
QueryWrapper<PersonAccount> wrapper = new QueryWrapper();
wrapper.eq("account_name",exPersonUser.getAccountName());
PersonAccount personAccount=personAccountServiceImpl.getOne(wrapper);
wrapper.eq("account_name", exPersonUser.getAccountName());
PersonAccount personAccount = personAccountServiceImpl.getOne(wrapper);
//获取基本信息
PersonBasic personBasic = personBasicMapper.selectById(personAccount.getPersonId());
PersonBasic personBasic = personBasicMapper.selectById(personAccount.getPersonId());
BeanUtils.copyProperties(exPersonUser, personBasic);
listPersonBasic.add(personBasic);
//人员技能
QueryWrapper<PersonSkillEducation> wrapper1 = new QueryWrapper();
wrapper1.eq("person_id",personAccount.getPersonId());
PersonSkillEducation personSkillEducation=personSkillEducationService.getOne(wrapper1);
wrapper1.eq("person_id", personAccount.getPersonId());
PersonSkillEducation personSkillEducation = personSkillEducationService.getOne(wrapper1);
BeanUtils.copyProperties(exPersonUser, personSkillEducation);
listPersonSkillEducation.add(personSkillEducation);
//人员资质
QueryWrapper<PersonCertificate> wrapper2 = new QueryWrapper();
wrapper2.eq("person_id",personAccount.getPersonId());
PersonCertificate personCertificate=personCertificateService.getOne(wrapper2);
wrapper2.eq("person_id", personAccount.getPersonId());
PersonCertificate personCertificate = personCertificateService.getOne(wrapper2);
BeanUtils.copyProperties(exPersonUser, personCertificate);
listPersonCertificate.add(personCertificate);
}
......@@ -366,5 +390,4 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
personCertificateService.saveOrUpdateBatch(listPersonCertificate);
}
}
......@@ -18,6 +18,7 @@ import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -53,6 +54,8 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
//人员教育信息
@Autowired
PersonSkillEducationServiceImpl personSkillEducationService;
@Value("${amos.secret.key}")
String secretKey;
/**
* 分页查询
......@@ -118,9 +121,9 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
}
usd.setOrgRoleSeqs(map);
//密码
usd.setPassword(DesUtil.encode(personAccount.getPassword(), "qaz"));
usd.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey));
//二次密码
usd.setRePassword(DesUtil.encode(personAccount.getSecondaryPassword(), "qaz"));
usd.setRePassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey));
//用户名
usd.setRealName(personAccount.getName());
//账号
......@@ -143,17 +146,19 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
//单位
companyModel = this.getCompanyModel(personAccount.getProjectId());
if (departmentModel != null) {
personBasic.setProjectOrgCode(departmentModel.getOrgCode());
//personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
} else {
personBasic.setProjectOrgCode(companyModel.getOrgCode());
}
personBasic.setProjectOrgCode(companyModel.getOrgCode());
if (personUser.getNativePlace()!=null) {
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
}
personAccount.setPuserId(agencyUserModel.getUserId());
personAccount.setProjectName(companyModel.getCompanyName());
personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey));
personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey));
this.personBasicMapper.updateById(personBasic);
this.personAccountService.updateById(personAccount);
}
......@@ -205,9 +210,9 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
}
usd.setOrgRoleSeqs(map);
//密码
usd.setPassword(DesUtil.encode(personAccount.getPassword(), "qaz"));
usd.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey));
//二次密码
usd.setRePassword(DesUtil.encode(personAccount.getSecondaryPassword(), "qaz"));
usd.setRePassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey));
//用户名
usd.setRealName(personAccount.getName());
//账号
......@@ -233,15 +238,17 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
BeanUtils.copyProperties(personUser, personBasic);
if (departmentModel != null) {
personBasic.setProjectOrgCode(departmentModel.getOrgCode());
//personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
} else {
personBasic.setProjectOrgCode(companyModel.getOrgCode());
}
personBasic.setProjectOrgCode(companyModel.getOrgCode());
if (personUser.getNativePlace() != null) {
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
}
personAccount.setProjectName(companyModel.getCompanyName());
personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey));
personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey));
this.personBasicMapper.updateById(personBasic);
personAccountService.updateById(personAccount);
return model;
......@@ -275,6 +282,9 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
//人员账号信息
PersonAccount personAccount = personAccountService.getOne(wrapper4);
personAccount.setPhoneNum(personBasic.getPhone());
//对于密码进行解密
personAccount.setPassword(DesUtil.decode(personAccount.getPassword(), secretKey));
personAccount.setSecondaryPassword(DesUtil.decode(personAccount.getSecondaryPassword(), secretKey));
if (personBasic.getNativePlace() != null) {
personUser.setNativePlace(JSON.parseArray(personBasic.getNativePlace(), Integer.class));
}
......@@ -418,5 +428,4 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
return page;
}
}
\ No newline at end of file
......@@ -72,3 +72,9 @@ spring.security.user.password=a1234560
fire-rescue=123
mybatis-plus.global-config.db-config.update-strategy=ignored
# user-amos setting : This value is the secretkey for person manage moudle accout password encryption.please don't change it!!!
amos.secret.key=qaz
# if your service can't be access ,you can use this setting , you need change ip as your.
#eureka.instance.prefer-ip-address=true
#eureka.instance.ip-address=172.16.3.122
\ 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.yeejoin.amos.knowledgebase.face.orm.dao.MessageMapper">
<select id="selectMessageListByOwner" parameterType="string" resultType="map">
SELECT
km.rec_user_id AS sponsor,
km.rec_date AS starttingTime,
km.message_type AS messageType,
km.message_title AS messageTitle,
km.message_content AS messageContent,
km.target_seq AS targetSeq,
kmp.message_owner AS owner,
kmp.message_status AS messageStatus,
kmp.sequence_nbr AS sequenceNbr
FROM
knowledge_message_personal kmp
LEFT JOIN knowledge_message km
ON kmp.message_seq = km.sequence_nbr
where kmp.message_owner = #{owner}
<if test="messageType!=null and messageType.length!=0">
and km.message_type = #{messageType}
</if>
ORDER BY
kmp.message_status ASC,
km.rec_date DESC
</select>
<select id="selectMessageBySeq" parameterType="long" resultType="map">
SELECT
km.rec_user_id AS sponsor,
km.rec_date AS starttingTime,
km.message_type AS messageType,
km.message_title AS messageTitle,
km.message_content AS messageContent,
km.target_seq AS targetSeq,
kmp.message_owner AS owner,
kmp.message_status AS messageStatus,
kmp.sequence_nbr AS sequenceNbr
FROM
knowledge_message_personal kmp
LEFT JOIN knowledge_message km
ON kmp.message_seq = km.sequence_nbr
where kmp.sequence_nbr = #{sequenceNbr}
</select>
<select id="selectMessageListByPage" parameterType="java.util.Map" resultType="map">
SELECT
km.rec_user_id AS sponsor,
km.rec_date AS starttingTime,
km.message_type AS messageType,
km.message_title AS messageTitle,
km.message_content AS messageContent,
km.target_seq AS targetSeq,
kmp.message_owner AS owner,
kmp.message_status AS messageStatus,
kmp.sequence_nbr AS sequenceNbr
FROM
knowledge_message_personal kmp
LEFT JOIN knowledge_message km
ON kmp.message_seq = km.sequence_nbr
where kmp.message_owner = #{owner}
<if test="messageType!=null and messageType.length!=0">
and km.message_type = #{messageType}
</if>
ORDER BY
kmp.message_status ASC,
km.rec_date DESC
LIMIT #{current},#{size}
</select>
<select id="selectMessageListByCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
knowledge_message_personal kmp
LEFT JOIN knowledge_message km
ON kmp.message_seq = km.sequence_nbr
where kmp.message_owner = #{owner}
<if test="messageType!=null and messageType.length!=0">
and km.message_type = #{messageType}
</if>
ORDER BY
kmp.message_status ASC,
km.rec_date DESC
</select>
</mapper>
......@@ -2,7 +2,12 @@ package com.yeejoin.amos.boot.module.tzs.api.mapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface ViewJgClaimMapper {
String supervisoryCode(String code);
List<Map<String, Object>> getDetialMapList(String record);
}
......@@ -32,4 +32,6 @@ public interface IEquipmentCategoryService {
List<CategoryOtherInfo> checkCode(Map<String,Object> obj);
List<String> updateOtherInfo(Map<String, Object> map);
Map<String,Map<String,Object>> getFormRecordById(Map<String, Object> map);
}
package com.yeejoin.amos.boot.module.tzs.api.service;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus;
/**
......@@ -8,7 +9,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus;
*/
public interface IUserCheckStatusService {
UserCheckStatus getUserCheckStatus(String useName);
UserCheckStatus getUserCheckStatus(ReginParams reginParams);
UserCheckStatus updateUserCheckStatus(String useName, String status);
}
......@@ -29,4 +29,10 @@ public interface IdxFeignService {
* */
@RequestMapping(value = "/table/getPage", method = RequestMethod.GET)
ResponseModel<Page<Map<String,Object>>> getPage(@RequestParam Map map);
/**
*根据record查询表格数据详情
*/
@RequestMapping(value = "/report/form/getFormRecordById", method = RequestMethod.GET)
ResponseModel<Map<String,Map<String,Object>>>getFormRecordById(@RequestParam Map map);
}
......@@ -280,13 +280,16 @@
d2.name AS cylinder_variety_name,
d3.name AS cylinder_status_str,
ct.qrCode,
ct.electronic_label_code
ct.electronic_label_code,
cu.region_code
FROM
tz_cylinder_info AS ci
LEFT JOIN cb_data_dictionary AS d1 ON d1.type = 'CZJZMC' AND d1.code = ci.filling_media
LEFT JOIN cb_data_dictionary AS d2 ON d2.sequence_nbr = ci.cylinder_variety
LEFT JOIN cb_data_dictionary AS d3 ON d3.sequence_nbr = ci.cylinder_status
LEFT JOIN tz_cylinder_tags AS ct ON ct.sequence_code = ci.sequence_code
LEFT JOIN tz_cylinder_unit AS cu ON ci.app_id = cu.app_id
where ci.is_not_es IS NULL
AND region_code is not null
</select>
</mapper>
......@@ -7,6 +7,41 @@
SELECT "SEQUENCE_NBR" FROM idx_biz_view_jg_claim WHERE SUPERVISORY_CODE=#{code}
</select>
<select id="getDetialMapList" resultType="java.util.Map">
SELECT
SEQUENCE_NBR,
ORG_BRANCH_NAME,
ORG_BRANCH_CODE,
USE_UNIT_NAME,
REC_DATE,
USE_UNIT_CREDIT_CODE,
EQU_LIST_CODE,
EQU_LIST,
EQU_CATEGORY,
USE_ORG_CODE,
CODE96333,
EQU_CODE,
SUPERVISORY_CODE,
USE_PLACE,
ADDRESS,
EQU_STATE,
STATUS,
EDIT_STATUS
FROM idx_biz_view_jg_claim
<where>
<if test="record !=null and record != ''">
SEQUENCE_NBR =#{record}
</if>
</where>
</select>
</mapper>
......
......@@ -24,6 +24,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.component.emq.EmqKeeper;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
import java.net.InetAddress;
import java.net.UnknownHostException;
......@@ -42,6 +43,7 @@ import java.net.UnknownHostException;
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@EnableSwagger2WebMvc
@EnableEurekaClient
@EnableScheduling
@MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
......
......@@ -209,6 +209,18 @@ public class EquipmentCategoryController extends BaseController {
return ResponseHelper.buildResponse(equipmentCategoryService.updateOtherInfo(map));
}
/**
* 根据record查询表格数据详情
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getFormRecordById", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "表格查询详情", notes = "表格查询详情")
public ResponseModel<Object> getFormRecordById(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(equipmentCategoryService.getFormRecordById(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@RequestMapping(value = "/checkCode", method = RequestMethod.POST)
@ApiOperation(httpMethod = "post", value = "校验96333码", notes = "校验96333码")
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.tzs.api.common.MobileLoginParam;
......@@ -63,12 +64,12 @@ public class TzsAppController {
private static final String JIANGUAN="/";
/**
* 获取设计信息
* 小程序获取设备详情
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentInfo")
@ApiOperation(httpMethod = "GET", value = "获取设计信息", notes = "获取设计信息")
@ApiOperation(httpMethod = "GET", value = "小程序获取设备详情", notes = "小程序获取设备详情")
public ResponseModel<Object> getEquipmentInfo(String record) {
return ResponseHelper.buildResponse(appService.getEquipmentInfo(record));
}
......@@ -207,5 +208,13 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.equipmentCount(unitCode));
}
//设备列表
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备列表", notes = "设备列表")
@GetMapping(value = "/getTable")
public ResponseModel<Page<Map<String,Object>>> getTable(@RequestParam Map<String,Object> map) {
return ResponseHelper.buildResponse(appService.getTable(map));
}
}
......@@ -46,8 +46,7 @@ public class UserCheckStatusController extends BaseController {
if (ObjectUtils.isEmpty(reginParams)) {
return null;
}
String useName = reginParams.getUserModel().getUserName();
return ResponseHelper.buildResponse(userCheckStatusService.getUserCheckStatus(useName));
return ResponseHelper.buildResponse(userCheckStatusService.getUserCheckStatus(reginParams));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
......@@ -28,7 +28,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -55,6 +57,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private Resource equipCategory;
@Autowired
private JdbcTemplate bizJdbcTemplate;
@Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper;
@Autowired
......@@ -65,6 +70,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Autowired
IdxFeignService idxFeignService;
@Autowired
private static final String TABLENAME="tableName";
@Value("${regulator.unit.code}")
private String code;
......@@ -80,8 +88,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private static final String XIAN = "610100";
//判断行政区划查询市还是区
private static final String END_CODE = "0000";
//一码通监督管理表单id
private static final String SUPERVISION_FROM_ID = "1627903532906602497";
//一码通复制功能url参数key
private static final String COPY_KEY = "stashType";
/**
* 分页查询
*/
......@@ -526,7 +537,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
public List<JSONObject> getCompanyType() {
ResponseModel<AgencyUserModel> me = privilegeFeginService.getMe();
List<CompanyModel> companys = me.getResult().getCompanys();
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<CompanyModel> companys = reginParams.getUserModel().getCompanys();
List<JSONObject> objectList = new ArrayList<>();
for (CompanyModel company : companys) {
JSONObject object = new JSONObject();
......@@ -539,6 +553,70 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
@Override
public Map<String, Map<String, Object>> getFormRecordById(Map<String, Object> map) {
ResponseModel<Map<String, Map<String, Object>>> responseModel = idxFeignService.getFormRecordById(map);
Map<String, Map<String, Object>> result = responseModel.getResult();
if (!ObjectUtils.isEmpty(map.get(COPY_KEY))) {
result.get(SUPERVISION_FROM_ID).remove("CLAIM_STATUS");
result.get(SUPERVISION_FROM_ID).remove("CODE96333");
result.get(SUPERVISION_FROM_ID).remove("SUPERVISORY_CODE");
}
return result;
}
/**
* 分页查询数据
*/
public Page<Map<String, Object>> getPage(Map<String, Object> map) {
String tableName = map.get(TABLENAME).toString();
Object sort = map.get("sort");
Integer number = ValidationUtil.isEmpty(map.get("number")) ? 0 : Integer.valueOf(map.get("number").toString());
Integer size = ValidationUtil.isEmpty(map.get("size")) ? 0 : Integer.valueOf(map.get("size").toString());
Page<Map<String, Object>> page = new Page<>(number, size);
Assert.hasText(tableName, "表名不能为空");
String selectSql = "SELECT * FROM " + tableName;
String countSql = " SELECT COUNT(*) count FROM " + tableName;
StringJoiner andJoiner = new StringJoiner(" AND ");
for (Map.Entry<String, Object> entry : map.entrySet()) {
if (!(entry.getKey().equals("tableName") || entry.getKey().equals("number") || entry.getKey().equals("size") || entry.getKey().equals("sort")) && !ValidationUtil.isEmpty(entry.getValue())) {
if (!ValidationUtil.isEmpty(entry.getValue()) && entry.getValue().toString().contains("[") && entry.getValue().toString().contains("]")) {
String jsonValue = entry.getValue().toString().replace("[", "[\"").replace("]", "\"]").replaceAll(" ", "").replaceAll(",", "\",\"");
StringJoiner orJoiner = new StringJoiner(" or ");
// 兼容数据库存储String和list格式
JSON.parseArray(jsonValue).stream().forEach(x -> {
orJoiner.add(entry.getKey() + " like '%" + x + "%'");
});
andJoiner.add("(" + orJoiner + ")");
} else {
andJoiner.add(entry.getKey() + " like '%" + entry.getValue().toString() + "%'");
}
}
}
if (!ValidationUtil.isEmpty(andJoiner.toString())) {
selectSql = selectSql + " WHERE " + andJoiner;
countSql = countSql + " WHERE " + andJoiner;
}
if (!ValidationUtil.isEmpty(sort)) {
String[] split = sort.toString().split(",");
selectSql = selectSql + " ORDER BY " + split[0] + (split[1].equals("descend") ? " DESC " : " ASC ");
}
int begin = (number - 1) * size;
if (size > 0) {
selectSql += " LIMIT " + begin + "," + size;
}
Long count = bizJdbcTemplate.queryForObject(countSql, Long.class);
String finalSelectSql = selectSql;
List<Map<String, Object>> mapList = bizJdbcTemplate.queryForList(finalSelectSql);
page.setTotal(count);
page.setRecords(mapList);
return page;
}
/**
* levlel=company,是企业,如果不是都是监管单位,
* * 在接口中查询当前登录人所属单位是监管单位还是企业。
......@@ -562,21 +640,21 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String code = object.getString("orgCode");
String companyCode = object.getString("companyCode");
if (!ValidationUtil.isEmpty(level)) {
ResponseModel<Page<Map<String, Object>>> m = new ResponseModel<>();
Page<Map<String, Object>> m = new Page<>();
if (LEVEL.equals(level)) {
//企业
map.put("USE_UNIT_CREDIT_CODE", companyCode);
m = idxFeignService.getPage(map);
m = this.getPage(map);
map.remove("USE_UNIT_CREDIT_CODE");
} else {
//监管单位
map.put("ORG_BRANCH_CODE", code);
m = idxFeignService.getPage(map);
m = this.getPage(map);
map.remove("ORG_BRANCH_CODE");
}
total += m.getResult().getTotal();
if (!ValidationUtil.isEmpty(m) && !ValidationUtil.isEmpty(m.getResult()) && !ValidationUtil.isEmpty(m.getResult().getRecords())) {
res.addAll(m.getResult().getRecords());
total += m.getTotal();
if (!ValidationUtil.isEmpty(m) && !ValidationUtil.isEmpty(m.getRecords())) {
res.addAll(m.getRecords());
}
}
}
......@@ -602,7 +680,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return mapPage;
}
private static final String TABLENAME = "tableName";
public List<Map<String, Object>> scalp(Map<String, Object> map) {
List<Map<String, Object>> list = new ArrayList<>();
......
......@@ -18,9 +18,11 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.*;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.tzs.api.mapper.ViewJgClaimMapper;
import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.RegUnitInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -46,6 +48,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
......@@ -68,9 +71,14 @@ public class TzsAppService {
DesignInfoService designInfoService;
@Autowired
IdxFeignService idxFeignService;
@Autowired
EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
EquipmentCategoryServiceImpl equipmentCategoryServiceImpl;
@Autowired
ProduceInfoService produceInfoService;
@Autowired
......@@ -124,8 +132,6 @@ public class TzsAppService {
@Autowired
OtherInfoService otherInfoService;
@Autowired
EquipmentCategoryServiceImpl equipmentCategoryServiceImpl;
@Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper;
......@@ -146,6 +152,8 @@ public class TzsAppService {
String minioPath;
@Autowired
private RegUnitInfoMapper regUnitInfoMapper;
@Autowired
ViewJgClaimMapper viewJgClaimMapper;
public static final String WXUSER_TOKEN = "wxUser_token";
/**
......@@ -168,7 +176,8 @@ public class TzsAppService {
Map<String, Object> map = new HashMap();
map.put("SEQUENCE_NBR", record);
map.put("tableName", "idx_biz_view_jg_claim");
List<Map<String, Object>> detialMapList = equipmentCategoryServiceImpl.getTable(map).getRecords();
ResponseModel<Page<Map<String, Object>>> model=idxFeignService.getPage(map);
List<Map<String, Object>> detialMapList = model.getResult().getRecords();
if (!ValidationUtil.isEmpty(detialMapList)) {
map = detialMapList.iterator().next();
}
......@@ -187,7 +196,7 @@ public class TzsAppService {
// 施工
JSONObject constructionJsonObject = new JSONObject();
List constructionList = new ArrayList();
getGroupList(record, ConstructionInfo.class, ConstructionInfoModel.class, constructionInfoService, constructionList, true);
getGroupList(record, ConstructionInfo.class, ConstructionInfoModel.class, constructionInfoService, constructionList, true);
constructionJsonObject.put("title", "施工");
constructionJsonObject.put("tabValue", constructionList);
jsonArray.add(constructionJsonObject);
......@@ -266,11 +275,17 @@ public class TzsAppService {
}
} else {
int count = entityList.size();
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(iterator.next()));
JSONObject result = getFieldList(dto, jsonObject, count);
list.add(result);
}
int count = entityList.size();
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(iterator.next()));
JSONObject result = getFieldList(dto, jsonObject, count);
list.add(result);
}
}
......@@ -317,7 +332,7 @@ public class TzsAppService {
JSONObject object = JSON.parseObject(JSON.toJSONString(obj));
if (!ValidationUtil.isEmpty(object)) {
object.getString("url");
object.put("url", minioPath + object.getString("url"));
object.put("url",object.getString("url"));
json.add(object);
}
}
......@@ -363,7 +378,7 @@ public class TzsAppService {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
String urlString = it.next();
jsonObject.put("fileUrl", minioPath + urlString);
jsonObject.put("fileUrl", urlString);
jsonObject.put("fileName", code);
}
} catch (IOException e) {
......@@ -498,4 +513,16 @@ public class TzsAppService {
page.setRecords(list);
return page;
}
public Page<Map<String,Object>> getTable(Map<String, Object> map) {
Page<Map<String, Object>> table=null;
String teqy = (String)map.get("teqy");
if (ValidationUtil.isEmpty(teqy) ) {
table = equipmentCategoryServiceImpl.getTable(map);
}else {
map.remove("teqy");
table = idxFeignService.getPage(map).getResult();
}
return table;
}
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.api.dto.UserCheckStatusDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus;
import com.yeejoin.amos.boot.module.tzs.api.mapper.UserCheckStatusMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IUserCheckStatusService;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 装备分类服务实现类
*
......@@ -24,18 +30,34 @@ public class UserCheckStatusServiceImpl extends BaseService<UserCheckStatusDto,
@Autowired
UserCheckStatusMapper userCheckStatusMapper;
//使用单位sequence_nbr
private final Long USEUNITID = 1460532889249755137L;
@Override
public UserCheckStatus getUserCheckStatus(String useName) {
UserCheckStatus userCheckStatus = userCheckStatusMapper.selectOne(new QueryWrapper<UserCheckStatus>().eq("use_name", useName));
if (ObjectUtils.isEmpty(userCheckStatus)) {
UserCheckStatus checkStatus = new UserCheckStatus();
checkStatus.setUseName(useName);
checkStatus.setStatus("0");
int result = userCheckStatusMapper.insert(checkStatus);
if (result == 1) {
return userCheckStatus;
} else {
return null;
public UserCheckStatus getUserCheckStatus(ReginParams reginParams) {
UserCheckStatus userCheckStatus = new UserCheckStatus();
userCheckStatus.setStatus("1");
Map<Long, List<RoleModel>> orgRoles = reginParams.getUserModel().getOrgRoles();
if(!ObjectUtils.isEmpty(orgRoles)){
Set<Long> longs = orgRoles.keySet();
for (Long aLong : longs) {
for (RoleModel roleModel : orgRoles.get(aLong)) {
if(USEUNITID.equals(roleModel.getSequenceNbr())){
String useName = reginParams.getUserModel().getUserName();
userCheckStatus = userCheckStatusMapper.selectOne(new QueryWrapper<UserCheckStatus>().eq("use_name", useName));
if (ObjectUtils.isEmpty(userCheckStatus)) {
UserCheckStatus checkStatus = new UserCheckStatus();
checkStatus.setUseName(useName);
checkStatus.setStatus("0");
int result = userCheckStatusMapper.insert(checkStatus);
if (result == 1) {
return userCheckStatus;
} else {
return null;
}
}
}
}
}
}
return userCheckStatus;
......
......@@ -612,7 +612,7 @@ public class CylinderInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEsCyinderInfoList")
@ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶基本信息", notes = "获取登陆人所在气瓶基本信息")
public ResponseModel<IPage<ESCylinderInfoDto>> getEsCyinderInfoList(@RequestParam(value = "pageNum") int pageNum,
public ResponseModel<Page<ESCylinderInfoDto>> getEsCyinderInfoList(@RequestParam(value = "pageNum") int pageNum,
@RequestParam(value = "pageSize") int pageSize,
CylinderInfoDto cylinderInfoDto) {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
......@@ -624,7 +624,7 @@ public class CylinderInfoController extends BaseController {
cylinderInfoDto.setCreditCode(companyCode);
}
if (ValidationUtil.isEmpty(cylinderInfoDto.getRegionCode()) && ValidationUtil.isEmpty(cylinderInfoDto.getCreditCode()) && cylinderInfoDto.getIsWarn() == 0) {
return null;
return ResponseHelper.buildResponse(new Page<ESCylinderInfoDto>());
}
Page<ESCylinderInfoDto> pageResult = cylinderInfoServiceImpl.queryByKeys(cylinderInfoDto, pageNum, pageSize);
return ResponseHelper.buildResponse(pageResult);
......
......@@ -124,7 +124,8 @@ public class RegUnitInfoController extends BaseController {
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/unit-type/list")
@ApiOperation(httpMethod = "GET", value = "单位类型列表", notes = "单位类型列表")
public ResponseModel<List<DataDictionary>> unitTypeList() {
......@@ -133,7 +134,8 @@ public class RegUnitInfoController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@GetMapping(value = "/management-unit/tree")
@ApiOperation(httpMethod = "GET", value = "管辖机构树", notes = "管辖机构树")
public ResponseModel<Collection> managementUnitTree(@RequestParam(required = false)String orgCode) {
......
......@@ -97,7 +97,8 @@ public class UnitInfoController extends BaseController {
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
//@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@GetMapping(value = "/region/tree")
@ApiOperation(httpMethod = "GET", value = "获取组织机构树", notes = "获取组织机构树")
public ResponseModel<Collection<RegionModel>> getRegionTree(@RequestParam(value = "parentId",required = false) Long parentId) {
......
......@@ -11,16 +11,23 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderFillingRecordMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderFillingRecordService;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -47,6 +54,18 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper;
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
/**
* 分页查询
*/
......@@ -177,10 +196,25 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(new HttpHost("36.46.151.113", 9200, "http"))
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest();
request.indices("cylinder_info");
......
......@@ -26,10 +26,16 @@ import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
......@@ -129,6 +135,19 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String cylPackageId;
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
@Autowired
StartPlatformTokenService startPlatformTokenService;
......@@ -709,11 +728,27 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) {
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(new HttpHost("36.46.151.113", 9200, "http"))
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest();
request.indices("cylinder_info");
......
......@@ -611,7 +611,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
userRoleList = allRoleList.stream().filter(r -> r.getRoleName().equals(unitType.getName()))
.collect(Collectors.toList());
for (RoleModel roleModel : allRoleList.stream()
.filter(r -> r.getRoleName().equals(unitType.getExtend())).collect(Collectors.toList())) {
.filter(r -> unitType.getExtend().contains(r.getSequenceNbr().toString())).collect(Collectors.toList())) {
userRoleList.add(roleModel);
}
userRoleList.forEach(r -> {
......
......@@ -39,6 +39,7 @@ eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.por
eureka.instance.ip-address = 172.16.3.34
## ES properties:
biz.elasticsearch.port=9200
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
......
{
"appApplyInfo": [
{
"name": "城燃管道",
"appKey": "studio_normalapp_4403119",
"image": "upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png"
},
{
"name": "气瓶安全追溯系统",
"appKey": "studio_normalapp_3404491",
"image": "upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png"
......
{
"appApplyInfo": [
{
"name": "城燃管道",
"appKey": "studio_normalapp_4403119",
"image": "upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png"
},
{
"name": "气瓶安全追溯系统",
"appKey": "studio_normalapp_3404491",
"image": "upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png"
},
{
"name": "特种设备安全追溯",
"appKey": "studio_normalapp_4391091",
"image": "upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png"
}
]
}
\ No newline at end of file
......@@ -294,24 +294,24 @@
<repository>
<id>Releases</id>
<name>Releases</name>
<url>http://36.46.149.14:8081/nexus/content/repositories/releases/</url>
<url>http://113.142.68.105:8081/nexus/content/repositories/releases/</url>
</repository>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
<url>http://113.142.68.105:8081/nexus/content/groups/public/</url>
</repository>
<repository>
<id>Snapshots</id>
<name>Snapshots</name>
<url>http://36.46.149.14:8081/nexus/content/repositories/snapshots/</url>
<url>http://113.142.68.105:8081/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>thirdparty</id>
<name>thirdparty</name>
<url>http://36.46.149.14:8081/nexus/content/repositories/thirdparty/</url>
<url>http://113.142.68.105:8081/nexus/content/repositories/thirdparty/</url>
</repository>
</repositories>
......
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