Commit a542b4dc authored by jiawei's avatar jiawei

Merge branch 'master' of http://111.203.232.171:8888/lee/chnmuseum-party

 Conflicts:
	src/main/java/cn/wisenergy/chnmuseum/party/web/controller/AuditController.java
parents 9d2ded2f 6d326d5d
package cn.wisenergy.chnmuseum.party.common.util;
import javax.crypto.Cipher;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.Base64;
public final class RSAUtils {
private static final String KEY_ALGORITHM = "RSA";
private static final int KEY_SIZE = 2048;
public static final String SIGNATURE_ALGORITHM = "SHA256withRSA";
public static final String RSA_TYPE = "RSA/ECB/PKCS1Padding";
private final static String PUBLIC_KEY_NAME = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsTVgqPjswjCKU7kjOfZO/jB1Oiz3zrW0kLfjBiRXHnXrm3Br4cgpA78snK/isaVykOBJYL549JkgHqTo17RSdqdS2i0rjzEUtKEotSpoP9XzNxt3ufKSq1MxBU5ZVuJTJ4Juat9RKcgNvhTc5NYMjF7PsBrrqPolgOd9Y5VyMaNRch+3owlDNzck0zWXAWas8KNJuV68ZH6hqu0Lb0QfrWETkm4o3ah7A1ss/UB//XSg0wipMa2em9WI6hUxW87JKR3W63dx89q9aP589UeE5XpamDhr1fglIpzeS/SdA61cY4K5v9v+mGxI3jePc6RSETvwc8P68/XNViSgT+uJAwIDAQAB";
private final static String PRIVATE_KEY_NAME = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCxNWCo+OzCMIpTuSM59k7+MHU6LPfOtbSQt+MGJFcedeubcGvhyCkDvyycr+KxpXKQ4Elgvnj0mSAepOjXtFJ2p1LaLSuPMRS0oSi1Kmg/1fM3G3e58pKrUzEFTllW4lMngm5q31EpyA2+FNzk1gyMXs+wGuuo+iWA531jlXIxo1FyH7ejCUM3NyTTNZcBZqzwo0m5XrxkfqGq7QtvRB+tYROSbijdqHsDWyz9QH/9dKDTCKkxrZ6b1YjqFTFbzskpHdbrd3Hz2r1o/nz1R4TlelqYOGvV+CUinN5L9J0DrVxjgrm/2/6YbEjeN49zpFIRO/Bzw/rz9c1WJKBP64kDAgMBAAECggEAKf9ohSNZmTw/zE/YVWhWmE+LuNnncQoHXTT3jQEX1JRF3nTqXHw/nC+2tvvIUinP2R4OxereZ7nSrvCObnDCCnTlYefKpwkOyzBWoXkHc/mUxr6vxVYEBK6Ws5c5/SluY7K50IJUjf5no2D2aRWBq9LcjfQTXdzK/p3eTbehdLnHITIilY699lN0CIwPpvNjAIOwYzyoqI7xQ8S5bopl1A1gKK7MN9EQb6aqn7kNSQCkwRq+1dETlZpfl7He4Fc4Q7brEQf7Qzdk2s2ddnlOU8Q4An4A+m2NMow0abe7g1EnVlw4cag0E6/tbC21Hy6Oa/LpZmRMiZU4iuo/PvSYYQKBgQDXJUiM0ILUqGcv6FbKFEu6MjT2JgClK2xiMFv8MKPyDth+XxjhvqV1FKMVNXkdrtR8lw3qnTquaxqor4IQMLsZa775H2zefYuqiOnFD9W4NpjwxG7yWhtbpSgWIQSHXVDO6mIR6Qh0lAUk4AYwjEae1auZgBoM5YsKMxN7PFDUHwKBgQDS2+Jg9GP1j8cmO14J/f+wBqTme1oz4bkES9tGcFapdVdlkPf5ahVH+yDhrgGVCcO2w6sam06WrmxV4H4OV5wl94hr36NC6S2lmIIF9DuX21cZandWI5vJr6umxrlo3f5+tpSC9Ekgd7Yro44+DohlMrUbAFwm6+hSIin210hOnQKBgFMJEr02ZKhK7rhwxb5souWUJxixhiI5ZjVnULk+1KfBzxDHB0VpXVaYxnCTGNG5/kyvyDE6ycEzmTBtvJcfF7cx/J0N4ejlL5h8Cy2BdQ0KFXEnf2KOIGz4i0YvLB5Kh7u0fnFHLXpA/tNCm2D1YvQ+p2IxLNy5YzZmjChOGSwlAoGAYAyTYTDR+8DDqbGvU4PlHazZHrgfzbRLkB5xwvNXNpfh+L0BiBZ/nStSvhqCU/5/rVgSL+uA7/iCFthM84GK+mx4MxNLDiajiWQgDlBDeRgL4+Lwe0d7JnMkELNDL/a3f8bxfXmDegut6tD08WWzUc24W5VdZMlfKVKwpOVJ5a0CgYByPWRuA7yJ+cWkmZl9yMCpNziSJgm7A1TwI9SRpfgx+azrLVSPZAYKzwmpsiOmuD/SSyDS7YE2d4QT/C+jbGlGYa3pGN7XUqmJVPhn9sJzoCHQf5LPbS5cLRC0c0qjFwsOw5hTVa0pPTiyRjF7xKc4yzBotifs4VdhXSH5GurFJg==";
private final static String SERVICE_PUBLIC_KEY_NAME = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsTVgqPjswjCKU7kjOfZO/jB1Oiz3zrW0kLfjBiRXHnXrm3Br4cgpA78snK/isaVykOBJYL549JkgHqTo17RSdqdS2i0rjzEUtKEotSpoP9XzNxt3ufKSq1MxBU5ZVuJTJ4Juat9RKcgNvhTc5NYMjF7PsBrrqPolgOd9Y5VyMaNRch+3owlDNzck0zWXAWas8KNJuV68ZH6hqu0Lb0QfrWETkm4o3ah7A1ss/UB//XSg0wipMa2em9WI6hUxW87JKR3W63dx89q9aP589UeE5XpamDhr1fglIpzeS/SdA61cY4K5v9v+mGxI3jePc6RSETvwc8P68/XNViSgT+uJAwIDAQAB";
/**
* 生成公、私钥
* 根据需要返回String或byte[]类型
*
* @return
*/
public static ArrayList<String> createRSAKeys() {
ArrayList<String> array = new ArrayList<>();
try {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGORITHM);
keyPairGenerator.initialize(KEY_SIZE, new SecureRandom());
KeyPair keyPair = keyPairGenerator.generateKeyPair();
PublicKey publicKey = keyPair.getPublic();
PrivateKey privateKey = keyPair.getPrivate();
//获取公、私钥值
String publicKeyValue = Base64.getEncoder().encodeToString(publicKey.getEncoded());
String privateKeyValue = Base64.getEncoder().encodeToString(privateKey.getEncoded());
//存入
array.add(publicKeyValue);
array.add(privateKeyValue);
} catch (Exception e) {
e.printStackTrace();
}
return array;
}
//获取本地RSA公钥
public static PublicKey getPublicKey() {
try {
return getPublicKey(PUBLIC_KEY_NAME);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//获取本地RSA公钥
public static String getPublicKeyString() {
try {
return PUBLIC_KEY_NAME;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//获取服务器RSA公钥
public static PublicKey getServicePublicKey() {
try {
return getPublicKey(SERVICE_PUBLIC_KEY_NAME);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//获取RSA公钥 根据钥匙字段
public static PublicKey getPublicKey(String key) {
try {
byte[] byteKey = Base64.getDecoder().decode(key);
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(byteKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
return keyFactory.generatePublic(x509EncodedKeySpec);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//获取RSA私钥 根据钥匙字段
private static PrivateKey getPrivateKey(String key) {
try {
byte[] byteKey = Base64.getDecoder().decode(key);
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(byteKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
return keyFactory.generatePrivate(pkcs8EncodedKeySpec);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//本地RSA私钥 签名
public static String sign(String requestData) {
String signature = null;
byte[] signed;
try {
PrivateKey privateKey = getPrivateKey(PRIVATE_KEY_NAME);
Signature Sign = Signature.getInstance(SIGNATURE_ALGORITHM);
Sign.initSign(privateKey);
Sign.update(requestData.getBytes());
signed = Sign.sign();
signature = Base64.getEncoder().encodeToString(signed);
} catch (Exception e) {
e.printStackTrace();
}
return signature;
}
//公钥验证签名 base64签名 signature 签名内容requestData
public static boolean verifySign(String requestData, String signature) {
boolean verifySignSuccess = false;
try {
PublicKey publicKey = getServicePublicKey();
Signature verifySign = Signature.getInstance(SIGNATURE_ALGORITHM);
verifySign.initVerify(publicKey);
verifySign.update(requestData.getBytes());
verifySignSuccess = verifySign.verify(Base64.getDecoder().decode(signature));
} catch (Exception e) {
e.printStackTrace();
}
return verifySignSuccess;
}
public static String encrypt(String clearText) {
String encryptedBase64 = "";
try {
Key key = getServicePublicKey();
final Cipher cipher = Cipher.getInstance(RSA_TYPE);
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] encryptedBytes = cipher.doFinal(clearText.getBytes(StandardCharsets.UTF_8));
encryptedBase64 = Base64.getEncoder().encodeToString(encryptedBytes);
} catch (Exception e) {
e.printStackTrace();
}
return encryptedBase64;
}
public static String encrypt(String clearText, String publicKey) {
String encryptedBase64 = "";
try {
Key key = getPublicKey(publicKey);
final Cipher cipher = Cipher.getInstance(RSA_TYPE);
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] encryptedBytes = cipher.doFinal(clearText.getBytes(StandardCharsets.UTF_8));
encryptedBase64 = Base64.getEncoder().encodeToString(encryptedBytes);
} catch (Exception e) {
e.printStackTrace();
}
return encryptedBase64;
}
public static String decrypt(String encryptedBase64, String privateKey) {
String decryptedString = "";
try {
Key key = getPrivateKey(privateKey);
final Cipher cipher = Cipher.getInstance(RSA_TYPE);
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] encryptedBytes = Base64.getDecoder().decode(encryptedBase64);
byte[] decryptedBytes = cipher.doFinal(encryptedBytes);
decryptedString = new String(decryptedBytes);
} catch (Exception e) {
e.printStackTrace();
}
return decryptedString;
}
}
package cn.wisenergy.chnmuseum.party.common.util;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
public class SignUtils {
private static final String ALGORITHM = "RSA";
private static final String SIGN_SHA256RSA_ALGORITHMS = "SHA256WithRSA";
private static final String DEFAULT_CHARSET = "UTF-8";
private final static String PUBLIC_KEY_NAME = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsTVgqPjswjCKU7kjOfZO/jB1Oiz3zrW0kLfjBiRXHnXrm3Br4cgpA78snK/isaVykOBJYL549JkgHqTo17RSdqdS2i0rjzEUtKEotSpoP9XzNxt3ufKSq1MxBU5ZVuJTJ4Juat9RKcgNvhTc5NYMjF7PsBrrqPolgOd9Y5VyMaNRch+3owlDNzck0zWXAWas8KNJuV68ZH6hqu0Lb0QfrWETkm4o3ah7A1ss/UB//XSg0wipMa2em9WI6hUxW87JKR3W63dx89q9aP589UeE5XpamDhr1fglIpzeS/SdA61cY4K5v9v+mGxI3jePc6RSETvwc8P68/XNViSgT+uJAwIDAQAB";
private final static String PRIVATE_KEY_NAME = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCxNWCo+OzCMIpTuSM59k7+MHU6LPfOtbSQt+MGJFcedeubcGvhyCkDvyycr+KxpXKQ4Elgvnj0mSAepOjXtFJ2p1LaLSuPMRS0oSi1Kmg/1fM3G3e58pKrUzEFTllW4lMngm5q31EpyA2+FNzk1gyMXs+wGuuo+iWA531jlXIxo1FyH7ejCUM3NyTTNZcBZqzwo0m5XrxkfqGq7QtvRB+tYROSbijdqHsDWyz9QH/9dKDTCKkxrZ6b1YjqFTFbzskpHdbrd3Hz2r1o/nz1R4TlelqYOGvV+CUinN5L9J0DrVxjgrm/2/6YbEjeN49zpFIRO/Bzw/rz9c1WJKBP64kDAgMBAAECggEAKf9ohSNZmTw/zE/YVWhWmE+LuNnncQoHXTT3jQEX1JRF3nTqXHw/nC+2tvvIUinP2R4OxereZ7nSrvCObnDCCnTlYefKpwkOyzBWoXkHc/mUxr6vxVYEBK6Ws5c5/SluY7K50IJUjf5no2D2aRWBq9LcjfQTXdzK/p3eTbehdLnHITIilY699lN0CIwPpvNjAIOwYzyoqI7xQ8S5bopl1A1gKK7MN9EQb6aqn7kNSQCkwRq+1dETlZpfl7He4Fc4Q7brEQf7Qzdk2s2ddnlOU8Q4An4A+m2NMow0abe7g1EnVlw4cag0E6/tbC21Hy6Oa/LpZmRMiZU4iuo/PvSYYQKBgQDXJUiM0ILUqGcv6FbKFEu6MjT2JgClK2xiMFv8MKPyDth+XxjhvqV1FKMVNXkdrtR8lw3qnTquaxqor4IQMLsZa775H2zefYuqiOnFD9W4NpjwxG7yWhtbpSgWIQSHXVDO6mIR6Qh0lAUk4AYwjEae1auZgBoM5YsKMxN7PFDUHwKBgQDS2+Jg9GP1j8cmO14J/f+wBqTme1oz4bkES9tGcFapdVdlkPf5ahVH+yDhrgGVCcO2w6sam06WrmxV4H4OV5wl94hr36NC6S2lmIIF9DuX21cZandWI5vJr6umxrlo3f5+tpSC9Ekgd7Yro44+DohlMrUbAFwm6+hSIin210hOnQKBgFMJEr02ZKhK7rhwxb5souWUJxixhiI5ZjVnULk+1KfBzxDHB0VpXVaYxnCTGNG5/kyvyDE6ycEzmTBtvJcfF7cx/J0N4ejlL5h8Cy2BdQ0KFXEnf2KOIGz4i0YvLB5Kh7u0fnFHLXpA/tNCm2D1YvQ+p2IxLNy5YzZmjChOGSwlAoGAYAyTYTDR+8DDqbGvU4PlHazZHrgfzbRLkB5xwvNXNpfh+L0BiBZ/nStSvhqCU/5/rVgSL+uA7/iCFthM84GK+mx4MxNLDiajiWQgDlBDeRgL4+Lwe0d7JnMkELNDL/a3f8bxfXmDegut6tD08WWzUc24W5VdZMlfKVKwpOVJ5a0CgYByPWRuA7yJ+cWkmZl9yMCpNziSJgm7A1TwI9SRpfgx+azrLVSPZAYKzwmpsiOmuD/SSyDS7YE2d4QT/C+jbGlGYa3pGN7XUqmJVPhn9sJzoCHQf5LPbS5cLRC0c0qjFwsOw5hTVa0pPTiyRjF7xKc4yzBotifs4VdhXSH5GurFJg==";
public static String sign(String content, String privateKey) {
try {
PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey));
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
PrivateKey priKey = keyFactory.generatePrivate(priPKCS8);
Signature signature = Signature.getInstance(SIGN_SHA256RSA_ALGORITHMS);
signature.initSign(priKey);
signature.update(content.getBytes(DEFAULT_CHARSET));
byte[] signed = signature.sign();
return Base64.getEncoder().encodeToString(signed);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
......@@ -21,6 +21,7 @@ public final class AesFlushingCipher {
public AesFlushingCipher(int mode, byte[] secretKey, long nonce, long offset) {
try {
//cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher = Cipher.getInstance("AES/CTR/NoPadding");
blockSize = cipher.getBlockSize();
zerosBlock = new byte[blockSize];
......
......@@ -5,7 +5,6 @@ import java.io.IOException;
public interface DataSink {
interface Factory {
DataSink createDataSink();
}
......
......@@ -15,49 +15,46 @@ public class VideoTestUtil {
private static final String cipher = "3348c95c60520be7";
private static final int dataLength = 4096;
public static final void main(String[] args){
public static void main(String[] args){
//加密视频
new Thread(new Runnable() {
@Override
public void run() {
try {
log.info("开始加解密");
File f = new File(plainFilePath, "中华人民共和国成立.mp4");
FileInputStream fis = new FileInputStream(f);
File encryptFile = new File(plainFilePath, "中华人民共和国成立.chnmuseum");
AesCipherDataSink encryptingDataSink = new AesCipherDataSink(
"3348c95c60520be7".getBytes(StandardCharsets.UTF_8),
new DataSink() {
private FileOutputStream fileOutputStream;
@Override
public void open() throws IOException {
fileOutputStream = new FileOutputStream(encryptFile);
}
@Override
public void write(byte[] buffer, int offset, int length) throws IOException {
fileOutputStream.write(buffer, offset, length);
}
@Override
public void close() throws IOException {
fileOutputStream.close();
}
});
encryptingDataSink.open();
int len;
byte[] buffer = new byte[dataLength];
while ((len = fis.read(buffer)) != -1) {
encryptingDataSink.write(buffer, 0, len);
}
encryptingDataSink.close();
fis.close();
log.info("加解密完成");
} catch (Exception e) {
log.info(e.getLocalizedMessage());
new Thread(() -> {
try {
log.info("开始加解密");
File f = new File(plainFilePath, "中华人民共和国成立.mp4");
FileInputStream fis = new FileInputStream(f);
File encryptFile = new File(plainFilePath, "中华人民共和国成立.chnmuseum");
AesCipherDataSink encryptingDataSink = new AesCipherDataSink(
"3348c95c60520be7".getBytes(StandardCharsets.UTF_8),
new DataSink() {
private FileOutputStream fileOutputStream;
@Override
public void open() throws IOException {
fileOutputStream = new FileOutputStream(encryptFile);
}
@Override
public void write(byte[] buffer, int offset, int length) throws IOException {
fileOutputStream.write(buffer, offset, length);
}
@Override
public void close() throws IOException {
fileOutputStream.close();
}
});
encryptingDataSink.open();
int len;
byte[] buffer = new byte[dataLength];
while ((len = fis.read(buffer)) != -1) {
encryptingDataSink.write(buffer, 0, len);
}
encryptingDataSink.close();
fis.close();
log.info("加解密完成");
} catch (Exception e) {
log.info(e.getLocalizedMessage());
}
}).start();
}
......
......@@ -20,11 +20,11 @@ import java.util.List;
*/
public interface LearningContentBoardMapper extends BaseMapper<LearningContentBoard> {
@Select("SELECT lcb.*, eb.`name` as exhibition_board_name FROM learning_content_board lcb, exhibition_board eb WHERE lcb.learning_content_id=eb.id and lcb.learning_content_id = #{learningContentId}")
@Select("SELECT lcb.*, eb.`name` as exhibition_board_name FROM learning_content_board lcb, exhibition_board eb WHERE lcb.exhibition_board_id=eb.id and lcb.learning_content_id = #{learningContentId}")
List<LearningContentBoard> selectBoardListByLearningContentId(String learningContentId);
@Select("<script>" + "SELECT eb.* FROM learning_content_board lcb, exhibition_board eb "
+ "WHERE lcb.learning_content_id=eb.id "
+ "WHERE lcb.exhibition_board_id=eb.id "
+ "<if test='learningContentId!=null'> and lcb.learning_content_id = #{learningContentId} </if>"
+ "<if test='nameOrCode!=null'> and eb.name like CONCAT('%',#{nameOrCode},'%')</if>"
+ "</script>"
......
......@@ -21,4 +21,6 @@ public interface TBoxOperationMapper extends BaseMapper<TBoxOperation> {
List<TBoxOperation> getList(@Param("status") String status,@Param("areaId") String areaId);
List<TBoxOperation> selectBoxPage(Page<TBoxOperation> page,@Param("user") TUser user);
List<TBoxOperation> selectPageList(Page<TBoxOperation> page,@Param("tBoxOperation") TBoxOperation tBoxOperation);
}
......@@ -55,7 +55,7 @@ public class Audit implements Serializable {
@NotBlank(message = "提交人员不能为空", groups = {Add.class})
private String userId;
@ApiModelProperty(value = "审核内容", allowableValues = "视频内容 ASSET, 展板内容 EXHIBITION_BOARD, 学习内容 LEARNING_CONTENT, 账户 ACCOUNT")
@ApiModelProperty(value = "审核内容", allowableValues = "ASSET,EXHIBITION_BOARD,LEARNING_CONTENT,ACCOUNT")
@TableField("type")
@NotBlank(message = "0,看板;1 视频;2 学习内容;3 账号禁用不能为空", groups = {Add.class})
private String type;
......@@ -64,7 +64,7 @@ public class Audit implements Serializable {
@TableField("operation")
private String operation;
@ApiModelProperty(value = "审核状态", allowableValues = "待初审 TBC, 驳回 REFUSED,待复审 TBCA, 通过APPROVED_FINAL")
@ApiModelProperty(value = "审核状态", allowableValues = "TBC,REFUSED,TBCA,APPROVED_FINAL")
@TableField("status")
private String status;
......@@ -73,19 +73,27 @@ public class Audit implements Serializable {
@NotNull(message = "创建日期不能为空", groups = {Add.class})
private LocalDateTime createTime;
@ApiModelProperty("更新日期")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty("初审日期")
@TableField(value = "first_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime firstTime;
@ApiModelProperty("复审日期")
@TableField(value = "second_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime secondTime;
@ApiModelProperty("0:未删除,1:已删除")
@TableField("is_deleted")
private Boolean isDeleted;
@ApiModelProperty("备注")
@TableField("remarks")
private String remarks;
@ApiModelProperty("初审意见")
@TableField("first_remarks")
private String firstRemarks;
@ApiModelProperty("复审意见")
@TableField("second_remarks")
private String secondRemarks;
@ApiModelProperty(value = "审核层级", allowableValues = "初审 TBC,复审 TBCA")
@ApiModelProperty(value = "审核层级", allowableValues = "TBC,TBCA")
@TableField("level")
private String level;
......
......@@ -124,6 +124,10 @@ public class ExhibitionBoard implements Serializable {
@TableField(exist = false)
private String assetName;
@ApiModelProperty("展板视频URL")
@TableField(exist = false)
private String videoUrl;
@ApiModelProperty("展板视频URL列表")
@TableField(exist = false)
private List<String> videoUrlList;
......
......@@ -101,6 +101,10 @@ public class LearningContent implements Serializable {
@TableField(exist = false)
private List<String> exhibitionBoardIdList;
@ApiModelProperty("展板内容名称列表")
@TableField(exist = false)
private List<String> exhibitionBoardNameList;
@ApiModelProperty("展板分类名称列表")
@TableField(exist = false)
private List<String> exhibitionBoardCatNameList;
......@@ -115,7 +119,7 @@ public class LearningContent implements Serializable {
@ApiModelProperty("展板列表")
@TableField(exist = false)
private List<LearningContentBoard> learningContentBoardList;
private List<ExhibitionBoard> exhibitionBoardList;
@ApiModelProperty("所含展板数量(列表使用)")
@TableField(exist = false)
......
......@@ -48,14 +48,14 @@ public class Menu extends Model<Menu> {
* 菜单地址
*/
@ApiModelProperty(value = "菜单地址")
@TableField("menu_url")
private String menuUrl;
@TableField("url")
private String url;
/**
* 菜单名称
*/
@ApiModelProperty(value = "菜单名称")
@TableField("menu_name")
private String menuName;
@TableField("name")
private String name;
/**
* 上级菜单ID
*/
......@@ -81,6 +81,27 @@ public class Menu extends Model<Menu> {
@ApiModelProperty(value = "级别")
private Integer level;
/**
* 图标
*/
@TableField("icon")
@ApiModelProperty(value = "图标")
private String icon;
/**
* 页面风格
*/
@TableField("color")
@ApiModelProperty(value = "页面风格")
private String color;
/**
* 头像
*/
@TableField("avatar")
@ApiModelProperty(value = "头像")
private String avatar;
/**
* 下级
*/
......@@ -121,20 +142,20 @@ public class Menu extends Model<Menu> {
this.isDeleted = isDeleted;
}
public String getMenuUrl() {
return menuUrl;
public String getUrl() {
return url;
}
public void setMenuUrl(String menuUrl) {
this.menuUrl = menuUrl;
public void setUrl(String url) {
this.url = url;
}
public String getMenuName() {
return menuName;
public String getName() {
return name;
}
public void setMenuName(String menuName) {
this.menuName = menuName;
public void setName(String name) {
this.name = name;
}
public String getParentId() {
......@@ -177,22 +198,54 @@ public class Menu extends Model<Menu> {
this.children = children;
}
@Override
protected Serializable pkVal() {
return this.id;
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
@Override
public String toString() {
return "Menu{" +
", id=" + id +
"id='" + id + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
", isDeleted=" + isDeleted +
", menuUrl=" + menuUrl +
", menuName=" + menuName +
", parentId=" + parentId +
", is button=" + isButton +
"}";
", url='" + url + '\'' +
", name='" + name + '\'' +
", parentId='" + parentId + '\'' +
", isButton=" + isButton +
", sort=" + sort +
", level=" + level +
", icon='" + icon + '\'' +
", color='" + color + '\'' +
", avatar='" + avatar + '\'' +
", children=" + children +
'}';
}
@Override
protected Serializable pkVal() {
return this.id;
}
}
package cn.wisenergy.chnmuseum.party.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -52,23 +38,31 @@ public class TBoxOperation implements Serializable {
@ApiModelProperty("机顶盒所属单位id")
@TableField("organ_id")
private String organId;
@ApiModelProperty("mac地址")
@TableField("mac")
private String mac;
@ApiModelProperty("状态 1.未激活 2.已激活 3.故障")
@TableField("status")
private Integer status;
@ApiModelProperty("区域id")
@TableField("area_id")
private String areaId;
@ApiModelProperty(hidden = true)
@TableField("public_key")
private String publicKey;
@ApiModelProperty(hidden = true)
@TableField("private_key")
private String privateKey;
@ApiModelProperty("创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty("修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
......@@ -81,5 +75,4 @@ public class TBoxOperation implements Serializable {
@TableField(exist = false)
private String areaName;
}
......@@ -20,4 +20,6 @@ public interface TBoxOperationService extends IService<TBoxOperation> {
List<TBoxOperation> getList(String status,String areaId);
Page<TBoxOperation> selectBoxPage(Page<TBoxOperation> page, TUser user);
Page<TBoxOperation> selectPage(Page<TBoxOperation> page, TBoxOperation tBoxOperation);
}
......@@ -38,5 +38,10 @@ public class TBoxOperationServiceImpl extends ServiceImpl<TBoxOperationMapper, T
public Page<TBoxOperation> selectBoxPage(Page<TBoxOperation> page, TUser user) {
return page.setRecords(tBoxOperationMapper.selectBoxPage(page, user));
}
@Override
public Page<TBoxOperation> selectPage(Page<TBoxOperation> page, TBoxOperation tBoxOperation) {
return page.setRecords(tBoxOperationMapper.selectPageList(page, tBoxOperation));
}
}
......@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -58,13 +59,12 @@ public class AuditController extends BaseController {
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "name", value = "账号名称或提交人", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "name", value = "账号名称或提交人", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "status", value = "待初审 TBC, 驳回 REFUSED,待复审 TBCA, 通过APPROVED_FINAL", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "level", value = "初审 TBC,复审 TBCA", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "status", value = "TBC,REFUSED,TBCA,APPROVED_FINAL", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "level", value = "TBC,TBCA", paramType = "query", dataType = "String")
})
public Map<String, Object> getUserList(String name, String status, String level) {
Page<Audit> auditList;
try {
TUser user1 = getcurUser();
TUser user = new TUser();
if (StringUtils.isNotBlank(name)) {
user.setUserName(name);
......@@ -75,7 +75,6 @@ public class AuditController extends BaseController {
if (StringUtils.isNotBlank(level)) {
user.setAuditStatus(level);
}
user.setOrgCode(user1.getOrgCode());
auditList = auditService.getUserList(getPage(), user);
return getResult(auditList);
} catch (Exception e) {
......@@ -89,11 +88,20 @@ public class AuditController extends BaseController {
@ApiOperation(value = "修改禁用审核信息", notes = "修改禁用审核信息")
public Map<String, Object> updateAudit(@RequestBody @Validated(value = {Update.class}) Audit audit) {
boolean flag;
if (!AuditStatusEnum.TBCA.name().equals(audit.getStatus())) {
if (AuditStatusEnum.APPROVED_FINAL.name().equals(audit.getStatus())&&AuditStatusEnum.TBC.name().equals(audit.getLevel())) {
audit.setLevel(AuditStatusEnum.TBCA.name());
audit.setStatus(AuditStatusEnum.TBCA.name());
}
if (!AuditStatusEnum.REFUSED.name().equals(audit.getStatus())) {
audit.setRemarks("");
if (AuditStatusEnum.TBC.name().equals(audit.getLevel())) {
audit.setFirstTime(LocalDateTime.now());
if (!AuditStatusEnum.REFUSED.name().equals(audit.getStatus())) {
audit.setFirstRemarks("");
}
}else{
audit.setSecondTime(LocalDateTime.now());
if (!AuditStatusEnum.REFUSED.name().equals(audit.getStatus())) {
audit.setSecondRemarks("");
}
}
try {
if (AuditTypeEnum.ACCOUNT.name().equals(audit.getType())) {
......@@ -179,14 +187,13 @@ public class AuditController extends BaseController {
@RequiresPermissions("/audit/getById")
public Map<String, Object> getById(String id) {
HashMap<String, Object> resultMap = new HashMap<>();
try {
Audit audit = new Audit();
UpdateWrapper<Audit> wrapper = new UpdateWrapper<>();
wrapper.eq("ref_item_id", id);
audit = auditService.getOne(wrapper);
resultMap.put("resultCode", "500");
resultMap.put("message", "用户未登录!");
resultMap.put("resultCode", "200");
resultMap.put("message", "操作成功");
resultMap.put("data", audit);
return resultMap;
} catch (Exception e) {
......
......@@ -3,7 +3,7 @@ package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.auth.SHA256PasswordEncryptionService;
import cn.wisenergy.chnmuseum.party.auth.util.JwtTokenUtil;
import cn.wisenergy.chnmuseum.party.common.enums.LanguageEnum;
import cn.wisenergy.chnmuseum.party.common.util.DateUtil;
import cn.wisenergy.chnmuseum.party.common.mvc.InterfaceException;
import cn.wisenergy.chnmuseum.party.common.util.TimeUtils;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.vo.AudioVo;
......@@ -61,17 +61,14 @@ public class ChinaMobileRestApiController extends BaseController {
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private EmployeeServiceImpl employeeService;
@Resource
private TUserServiceImpl userService;
@Resource
private RunLogServiceImpl runLogService;
private TOrganServiceImpl organService;
@Resource
private SysLogController sysLogController;
private RunLogServiceImpl runLogService;
@Resource
private TAreaServiceImpl areaService;
......@@ -118,6 +115,35 @@ public class ChinaMobileRestApiController extends BaseController {
//用户登录是否被锁定 一小时 redisKey 前缀
private static final String SHIRO_IS_LOCK = "shiro_is_lock_";
/**
* 机顶盒激活状态查询
*
* @param
* @return
*/
@ApiOperation(value = "获取机顶盒密钥", notes = "获取机顶盒密钥")
@GetMapping("/equitment/key")
@RequiresPermissions("equitment:key")
public Map<String, Object> getBoxPrivateKey(@RequestParam(value = "mac") String mac) {
try {
final LambdaQueryWrapper<TBoxOperation> queryWrapper = Wrappers.<TBoxOperation>lambdaQuery().eq(TBoxOperation::getMac, mac.trim().toUpperCase());
final TBoxOperation tBoxOperation = this.boxOperationService.getOne(queryWrapper);
if (tBoxOperation != null) {
final String organId = tBoxOperation.getOrganId();
final TUser tUser = getcurUser();
if (tUser != null && organId.equals(tUser.getOrgId())) {
return getResult(tBoxOperation.getPrivateKey());
} else {
throw new InterfaceException("400", "您无权获取本单位机顶盒密钥");
}
}
throw new InterfaceException("400", "未查询到相关机顶盒信息");
} catch (Exception e) {
e.printStackTrace();
}
return getFailResult();
}
/**
* 机顶盒激活状态查询
*
......@@ -239,6 +265,7 @@ public class ChinaMobileRestApiController extends BaseController {
JSONObject resultMap = new JSONObject(true);
try {
TUser user = userService.getById(userId);
TOrgan organ = organService.getById(user.getOrgId());
if (null == user) {
resultMap.put("resultCode", 500);
......@@ -255,7 +282,7 @@ public class ChinaMobileRestApiController extends BaseController {
jsonObject.put("effectiveDate", user.getEffectiveDate());
jsonObject.put("expireDate", user.getExiredDate());
jsonObject.put("orgCode", user.getOrgId());
jsonObject.put("orgName", user.getOrgName());
jsonObject.put("orgName", organ.getName());
resultMap.put("resultCode", 200);
resultMap.put("message", "成功");
......@@ -292,7 +319,7 @@ public class ChinaMobileRestApiController extends BaseController {
* 插入机顶盒日志表
*/
@ApiOperation(value = "插入机顶盒日志表", notes = "插入机顶盒日志表")
@PostMapping(value = "/insertRunLog")
@PostMapping(value = "/equitment/runLog")
public ResponseEntity<JSONObject> insertRunLog(RunLog runLog) {
JSONObject resultMap = new JSONObject();
......
......@@ -347,6 +347,7 @@ public class ExhibitionBoardController extends BaseController {
final String videoUrl = asset.getVideoUrl();
final List<VideoVo> videoVoList = JSONObject.parseObject(videoUrl, new TypeReference<List<VideoVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setVideoUrl(videoUrl);
exhibitionBoard.setVideoUrlList(videoVoList.stream().map(VideoVo::getFileUrl).collect(Collectors.toList()));
}
return getResult(exhibitionBoard);
......
......@@ -5,10 +5,15 @@ import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.enums.AuditTypeEnum;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.AudioVo;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.common.vo.VideoVo;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -27,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <pre>
......@@ -55,11 +61,15 @@ public class LearningContentController extends BaseController {
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private LearningProjectService learningProjectService;
@Resource
private AuditService auditService;
@Resource
private AssetService assetService;
@PostMapping("/save")
@RequiresPermissions("learning:content:save")
......@@ -295,6 +305,64 @@ public class LearningContentController extends BaseController {
learningContent.setLearningProjectName(learningProject.getName());
}
final LambdaQueryWrapper<LearningContentBoardCat> queryWrapper = Wrappers.<LearningContentBoardCat>lambdaQuery().eq(LearningContentBoardCat::getLearningContentId, id);
queryWrapper.select(LearningContentBoardCat::getExhibitionBoardCatId);
final List<String> exhibitionBoardCatIdList = this.learningContentBoardCatService.listObjs(queryWrapper, Object::toString);
final List<ExhibitionBoardCat> exhibitionBoardCats = this.exhibitionBoardCatService.listByIds(exhibitionBoardCatIdList);
learningContent.setExhibitionBoardCatIdList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardCatNameList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getName).collect(Collectors.toList()));
final LambdaQueryWrapper<LearningContentCopyrightOwner> queryWrapper1 = Wrappers.<LearningContentCopyrightOwner>lambdaQuery().eq(LearningContentCopyrightOwner::getLearningContentId, id);
queryWrapper1.select(LearningContentCopyrightOwner::getCopyrightOwnerId);
final List<String> copyrightOwnerIdList = this.learningContentCopyrightOwnerService.listObjs(queryWrapper1, Object::toString);
final List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(copyrightOwnerIdList);
learningContent.setCopyrightOwnerIdList(copyrightOwnerList.stream().map(CopyrightOwner::getId).collect(Collectors.toList()));
learningContent.setCopyrightOwnerNameList(copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.toList()));
final LambdaQueryWrapper<LearningContentBoard> queryWrapper2 = Wrappers.<LearningContentBoard>lambdaQuery().eq(LearningContentBoard::getLearningContentId, id);
queryWrapper2.select(LearningContentBoard::getExhibitionBoardId);
final List<String> exhibitionBoardIdList = this.learningContentBoardService.listObjs(queryWrapper2, Object::toString);
final List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.listByIds(exhibitionBoardIdList);
learningContent.setExhibitionBoardIdList(exhibitionBoardList.stream().map(ExhibitionBoard::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardNameList(exhibitionBoardList.stream().map(ExhibitionBoard::getName).collect(Collectors.toList()));
for (ExhibitionBoard exhibitionBoard : exhibitionBoardList) {
String exhibitionBoardCatId = exhibitionBoard.getExhibitionBoardCatId();
if (exhibitionBoardCatId != null) {
exhibitionBoard.setExhibitionBoardCatName(this.exhibitionBoardCatService.getById(exhibitionBoardCatId).getName());
}
String boardCopyrightOwnerId = exhibitionBoard.getBoardCopyrightOwnerId();
if (boardCopyrightOwnerId != null) {
exhibitionBoard.setBoardCopyrightOwnerName(this.copyrightOwnerService.getById(boardCopyrightOwnerId).getName());
}
final String guideAudioUrl = exhibitionBoard.getGuideAudioUrl();
final List<AudioVo> audioVoList = JSONObject.parseObject(guideAudioUrl, new TypeReference<List<AudioVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setAudioUrlList(audioVoList.stream().map(AudioVo::getFileUrl).collect(Collectors.toList()));
final String refMaterialUrl = exhibitionBoard.getRefMaterialUrl();
final List<AudioVo> refMaterialVoList = JSONObject.parseObject(refMaterialUrl, new TypeReference<List<AudioVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setMaterialUrlList(refMaterialVoList.stream().map(AudioVo::getFileUrl).collect(Collectors.toList()));
String assetId = exhibitionBoard.getAssetId();
if (assetId != null) {
final Asset asset = this.assetService.getById(assetId);
exhibitionBoard.setAssetName(this.assetService.getById(assetId).getName());
final String assetCopyrightOwnerId = asset.getAssetCopyrightOwnerId();
final String assetCopyrightOwnerName = this.copyrightOwnerService.getById(assetCopyrightOwnerId).getName();
exhibitionBoard.setAssetCopyrightOwnerName(assetCopyrightOwnerName);
final String videoUrl = asset.getVideoUrl();
final List<VideoVo> videoVoList = JSONObject.parseObject(videoUrl, new TypeReference<List<VideoVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setVideoUrl(videoUrl);
exhibitionBoard.setVideoUrlList(videoVoList.stream().map(VideoVo::getFileUrl).collect(Collectors.toList()));
}
}
learningContent.setExhibitionBoardList(exhibitionBoardList);
return getResult(learningContent);
}
......@@ -308,12 +376,12 @@ public class LearningContentController extends BaseController {
@ApiOperation(value = "学习内容排序")
@PutMapping(value = "/sort")
@RequiresPermissions("learning:content:sort")
public Map<String,Object> updateSortorder(String sourceId, String targetId) {
public Map<String, Object> updateSortorder(String sourceId, String targetId) {
String moveType;
LearningContent theSource = this.learningContentService.getById(sourceId);
LearningContent theTarget = this.learningContentService.getById(targetId);
if(theSource.getSortorder() > theTarget.getSortorder()) {
if (theSource.getSortorder() > theTarget.getSortorder()) {
moveType = "down";
} else {
moveType = "up";
......
package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.auth.SHA256PasswordEncryptionService;
import cn.wisenergy.chnmuseum.party.common.util.RSAUtils;
import cn.wisenergy.chnmuseum.party.model.TBoxOperation;
import cn.wisenergy.chnmuseum.party.model.TUser;
import cn.wisenergy.chnmuseum.party.service.TBoxOperationService;
import cn.wisenergy.chnmuseum.party.service.impl.TUserServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import cn.wisenergy.chnmuseum.party.model.TBoxOperation;
import cn.wisenergy.chnmuseum.party.service.TBoxOperationService;
import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.cglib.core.Local;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -54,7 +42,6 @@ public class TBoxOperationController extends BaseController {
@Resource
private TUserServiceImpl userService;
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
......@@ -65,7 +52,7 @@ public class TBoxOperationController extends BaseController {
@PostMapping("/selectPageList")
@RequiresPermissions("/boxOperation/selectPageList")
@ApiOperation(value = "获取机顶盒基础信息分页列表", notes = "获取机顶盒基础信息分页列表")
public Map<String, Object> selectPageList(String organId,String areaId) {
public Map<String, Object> selectPageList(String organId, String areaId) {
TUser user1 = getcurUser();
TUser user = new TUser();
if (StringUtils.isNotBlank(organId)) {
......@@ -77,9 +64,8 @@ public class TBoxOperationController extends BaseController {
}
//设置数据权限
user.setOrgCode(user1.getOrgCode());
Page<TBoxOperation> page = null;
try {
page = tBoxOperationService.selectBoxPage(getPage(), user);
Page<TBoxOperation> page = tBoxOperationService.selectBoxPage(getPage(), user);
return getResult(page);
} catch (Exception e) {
e.printStackTrace();
......@@ -92,10 +78,14 @@ public class TBoxOperationController extends BaseController {
@ApiOperation(value = "添加机顶盒运维信息", notes = "添加机顶盒运维信息")
public Map<String, Object> saveTBoxOperation(TBoxOperation tBoxOperation) {
// 保存业务节点信息
tBoxOperation.setCreateTime(LocalDateTime.now());
tBoxOperation.setUpdateTime(LocalDateTime.now());
boolean result = false;
boolean result;
try {
if (tBoxOperation != null && StringUtils.isNotBlank(tBoxOperation.getMac())) {
tBoxOperation.setMac(tBoxOperation.getMac().toUpperCase());
}
final ArrayList<String> rsaKeys = RSAUtils.createRSAKeys();
tBoxOperation.setPublicKey(rsaKeys.get(0));
tBoxOperation.setPrivateKey(rsaKeys.get(1));
result = tBoxOperationService.save(tBoxOperation);
if (!result) {
return getFailResult();
......@@ -104,30 +94,31 @@ public class TBoxOperationController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
}
// 保存失败
return getFailResult();
// 保存失败
return getFailResult();
}
@PutMapping("/update")
@RequiresPermissions("/boxOperation/update")
@ApiOperation(value = "修改机顶盒运维信息信息", notes = "修改机顶盒运维信息信息")
public Map<String, Object> updateTBoxOperation(TBoxOperation tBoxOperation) {
try {
tBoxOperation.setUpdateTime(LocalDateTime.now());
boolean flag = tBoxOperationService.updateById(tBoxOperation);
UpdateWrapper<TUser> wrapper = new UpdateWrapper<>();
wrapper.eq("org_id",tBoxOperation.getOrganId());
wrapper.eq("type","3");
TUser user = userService.getOne(wrapper);
String password = user.getPassword();
if (flag&&user!=null) {
return getResult(password);
}
return getFailResult();
} catch (Exception e) {
return getFailResult();
}
try {
if (tBoxOperation != null && StringUtils.isNotBlank(tBoxOperation.getMac())) {
tBoxOperation.setMac(tBoxOperation.getMac().toUpperCase());
}
boolean flag = tBoxOperationService.updateById(tBoxOperation);
UpdateWrapper<TUser> wrapper = new UpdateWrapper<>();
wrapper.eq("org_id", tBoxOperation.getOrganId());
wrapper.eq("type", "3");
TUser user = userService.getOne(wrapper);
String password = user.getPassword();
if (flag) {
return getResult(password);
}
return getFailResult();
} catch (Exception e) {
return getFailResult();
}
}
@DeleteMapping("/delete")
......@@ -137,7 +128,7 @@ public class TBoxOperationController extends BaseController {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "query", dataType = "String")
})
public Map<String, Object> deleteTBoxOperation(String id) {
boolean result = false;
boolean result;
try {
result = tBoxOperationService.removeById(id);
if (!result) {
......@@ -159,12 +150,12 @@ public class TBoxOperationController extends BaseController {
//设置数据权限
String areaId = user.getAreaId();
try {
tBoxOperationList = tBoxOperationService.getList(status,areaId);
tBoxOperationList = tBoxOperationService.getList(status, getAreaId(areaId));
return getResult(tBoxOperationList);
} catch (Exception e) {
e.printStackTrace();
}
return getFailResult();
return getFailResult();
}
@ApiImplicitParams(value = {
......@@ -179,24 +170,23 @@ public class TBoxOperationController extends BaseController {
@ApiOperation(value = "获取机顶盒运维信息分页列表", notes = "获取机顶盒运维信息分页列表")
public Map<String, Object> getTBoxOperationPageList(String organId, Integer status, String areaId) {
TUser user = getcurUser();
UpdateWrapper<TBoxOperation> wrapper = new UpdateWrapper<>();
TBoxOperation tBoxOperation = new TBoxOperation();
if (StringUtils.isNotBlank(organId)) {
wrapper.eq("organ_id", organId);
tBoxOperation.setOrganId(organId);
}
if (status != null) {
wrapper.eq("status", status);
tBoxOperation.setStatus(status);
}
if (StringUtils.isNotBlank(areaId)) {
wrapper.eq("area_id", areaId);
tBoxOperation.setAreaId(areaId);
}
if (StringUtils.isNotBlank(user.getAreaId())) {
//设置数据权限
wrapper.likeRight("area_id", getAreaId(user.getAreaId()));
tBoxOperation.setAreaId(getAreaId(user.getAreaId()));
}
wrapper.orderByDesc("create_time");
Page<TBoxOperation> page = null;
try {
page = this.tBoxOperationService.page(getPage(), wrapper);
page = this.tBoxOperationService.selectPage(getPage(), tBoxOperation);
return getResult(page);
} catch (Exception e) {
e.printStackTrace();
......@@ -219,13 +209,11 @@ public class TBoxOperationController extends BaseController {
}
public String getAreaId(String areaId){
if ("00".equals(areaId.substring(4))) {
areaId = areaId.substring(0, 4);
}
public String getAreaId(String areaId) {
if ("0000".equals(areaId.substring(2))) {
areaId = areaId.substring(0, 2);
} else if ("00".equals(areaId.substring(4))) {
areaId = areaId.substring(0, 4);
}
return areaId;
}
......
......@@ -13,15 +13,15 @@
<result column="operation" property="operation"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="first_time" property="firstTime"/>
<result column="second_time" property="secondTime"/>
<result column="is_deleted" property="isDeleted"/>
<result column="remarks" property="remarks"/>
<result column="first_remarks" property="firstRemarks"/>
<result column="second_remarks" property="secondRemarks"/>
<result column="level" property="level"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, content, organ_id, ref_item_id, user_id, type, operation, status, create_time, update_time, is_deleted, remarks
</sql>
<select id="getUserList" resultMap="BaseResultMap">
select a.*,o.name org_name,u.user_name user_name
......
......@@ -8,16 +8,19 @@
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="is_deleted" property="isDeleted" />
<result column="menu_url" property="menuUrl" />
<result column="menu_name" property="menuName" />
<result column="url" property="url" />
<result column="name" property="name" />
<result column="parent_id" property="parentId" />
<result column="is_button" property="isButton" />
<result column="level" property="level" />
<result column="icon" property="icon" />
<result column="color" property="color" />
<result column="avatar" property="avatar" />
</resultMap>
<select id="getUserMenuPerms" resultMap="BaseResultMap">
SELECT distinct
m.id,m.menu_name,m.menu_url,m.parent_id,m.sort,m.is_button,m.level
m.id,m.name,m.url,m.parent_id,m.sort,m.is_button,m.level,m.icon,m.color,m.avatar
FROM
ref_role_menu rm
LEFT JOIN menu m ON m.id = rm.menu_id
......@@ -30,7 +33,7 @@
</foreach>
</if>
</where>
ORDER BY m.level desc
ORDER BY m.level desc,m.sort
</select>
</mapper>
......@@ -9,6 +9,8 @@
<result column="mac" property="mac"/>
<result column="status" property="status"/>
<result column="area_id" property="areaId"/>
<result column="public_key" property="publicKey" />
<result column="private_key" property="privateKey" />
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="organ_name" property="organName"/>
......@@ -17,7 +19,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, organ_id, mac, status, area_id, create_time, update_time
id, organ_id, mac, status, area_id, public_key, private_key, create_time, update_time
</sql>
<select id="getList" resultMap="BaseResultMap">
......@@ -53,4 +55,21 @@ left join t_organ r on r.id = b.organ_id
and u.type = 3
order by b.create_time desc
</select>
<select id="selectPageList" resultMap="BaseResultMap">
SELECT b.*,r.`name` organ_name
FROM t_box_operation b
left join t_organ r on r.id = b.organ_id
where 1=1
<if test="tBoxOperation.organId != null and tBoxOperation.organId != '' ">
and b.organ_id =#{tBoxOperation.organId}
</if>
<if test="tBoxOperation.status != null">
and b.status =#{tBoxOperation.status}
</if>
<if test="tBoxOperation.areaId != null and tBoxOperation.areaId != '' ">
and r.area_id like concat(#{tBoxOperation.areaId}, '%')
</if>
</select>
</mapper>
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