feat: 初始化
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
package com.yida.data.system;
|
||||
|
||||
|
||||
import cc.mrbird.febs.common.security.starter.annotation.EnableFebsCloudResourceServer;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
@EnableAsync
|
||||
@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
|
||||
@EnableFebsCloudResourceServer
|
||||
@EnableTransactionManagement
|
||||
@MapperScan("com.yida.data.system.mapper")
|
||||
@EnableFeignClients(basePackages = "com.yida.data")
|
||||
@EnableScheduling
|
||||
public class FebsServerSystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new SpringApplicationBuilder(FebsServerSystemApplication.class)
|
||||
.web(WebApplicationType.SERVLET)
|
||||
.run(args);
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.yida.data.system.aes;
|
||||
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AesException extends FebsException {
|
||||
|
||||
public final static int OK = 0;
|
||||
public final static int ValidateSignatureError = -40001;
|
||||
public final static int ParseXmlError = -40002;
|
||||
public final static int ComputeSignatureError = -40003;
|
||||
public final static int IllegalAesKey = -40004;
|
||||
public final static int ValidateCorpidError = -40005;
|
||||
public final static int EncryptAESError = -40006;
|
||||
public final static int DecryptAESError = -40007;
|
||||
public final static int IllegalBuffer = -40008;
|
||||
//public final static int EncodeBase64Error = -40009;
|
||||
//public final static int DecodeBase64Error = -40010;
|
||||
//public final static int GenReturnXmlError = -40011;
|
||||
|
||||
private int code;
|
||||
|
||||
private static String getMessage(int code) {
|
||||
switch (code) {
|
||||
case ValidateSignatureError:
|
||||
return "签名验证错误";
|
||||
case ParseXmlError:
|
||||
return "xml解析失败";
|
||||
case ComputeSignatureError:
|
||||
return "sha加密生成签名失败";
|
||||
case IllegalAesKey:
|
||||
return "SymmetricKey非法";
|
||||
case ValidateCorpidError:
|
||||
return "corpid校验失败";
|
||||
case EncryptAESError:
|
||||
return "aes加密失败";
|
||||
case DecryptAESError:
|
||||
return "aes解密失败";
|
||||
case IllegalBuffer:
|
||||
return "解密后得到的buffer非法";
|
||||
// case EncodeBase64Error:
|
||||
// return "base64加密错误";
|
||||
// case DecodeBase64Error:
|
||||
// return "base64解密错误";
|
||||
// case GenReturnXmlError:
|
||||
// return "xml生成失败";
|
||||
default:
|
||||
return null; // cannot be
|
||||
}
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
AesException(int code) {
|
||||
super(getMessage(code));
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.yida.data.system.aes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
class ByteGroup {
|
||||
ArrayList<Byte> byteContainer = new ArrayList<Byte>();
|
||||
|
||||
public byte[] toBytes() {
|
||||
byte[] bytes = new byte[byteContainer.size()];
|
||||
for (int i = 0; i < byteContainer.size(); i++) {
|
||||
bytes[i] = byteContainer.get(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public ByteGroup addBytes(byte[] bytes) {
|
||||
for (byte b : bytes) {
|
||||
byteContainer.add(b);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return byteContainer.size();
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* 对企业微信发送给企业后台的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
package com.yida.data.system.aes;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 提供基于PKCS7算法的加解密接口.
|
||||
*/
|
||||
class PKCS7Encoder {
|
||||
static Charset CHARSET = Charset.forName("utf-8");
|
||||
static int BLOCK_SIZE = 32;
|
||||
|
||||
/**
|
||||
* 获得对明文进行补位填充的字节.
|
||||
*
|
||||
* @param count 需要进行填充补位操作的明文字节个数
|
||||
* @return 补齐用的字节数组
|
||||
*/
|
||||
static byte[] encode(int count) {
|
||||
// 计算需要填充的位数
|
||||
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
|
||||
if (amountToPad == 0) {
|
||||
amountToPad = BLOCK_SIZE;
|
||||
}
|
||||
// 获得补位所用的字符
|
||||
char padChr = chr(amountToPad);
|
||||
String tmp = new String();
|
||||
for (int index = 0; index < amountToPad; index++) {
|
||||
tmp += padChr;
|
||||
}
|
||||
return tmp.getBytes(CHARSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除解密后明文的补位字符
|
||||
*
|
||||
* @param decrypted 解密后的明文
|
||||
* @return 删除补位字符后的明文
|
||||
*/
|
||||
static byte[] decode(byte[] decrypted) {
|
||||
int pad = (int) decrypted[decrypted.length - 1];
|
||||
if (pad < 1 || pad > 32) {
|
||||
pad = 0;
|
||||
}
|
||||
return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数字转化成ASCII码对应的字符,用于对明文进行补码
|
||||
*
|
||||
* @param a 需要转化的数字
|
||||
* @return 转化得到的字符
|
||||
*/
|
||||
static char chr(int a) {
|
||||
byte target = (byte) (a & 0xFF);
|
||||
return (char) target;
|
||||
}
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 对企业微信发送给企业后台的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
package com.yida.data.system.aes;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* SHA1 class
|
||||
* <p>
|
||||
* 计算消息签名接口.
|
||||
*/
|
||||
class SHA1 {
|
||||
|
||||
/**
|
||||
* 用SHA1算法生成安全签名
|
||||
*
|
||||
* @param token 票据
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机字符串
|
||||
* @param encrypt 密文
|
||||
* @return 安全签名
|
||||
* @throws AesException
|
||||
*/
|
||||
public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException {
|
||||
try {
|
||||
String[] array = new String[]{token, timestamp, nonce, encrypt};
|
||||
StringBuffer sb = new StringBuffer();
|
||||
// 字符串排序
|
||||
Arrays.sort(array);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sb.append(array[i]);
|
||||
}
|
||||
String str = sb.toString();
|
||||
// SHA1签名生成
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||
md.update(str.getBytes());
|
||||
byte[] digest = md.digest();
|
||||
|
||||
StringBuffer hexstr = new StringBuffer();
|
||||
String shaHex = "";
|
||||
for (int i = 0; i < digest.length; i++) {
|
||||
shaHex = Integer.toHexString(digest[i] & 0xFF);
|
||||
if (shaHex.length() < 2) {
|
||||
hexstr.append(0);
|
||||
}
|
||||
hexstr.append(shaHex);
|
||||
}
|
||||
return hexstr.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.ComputeSignatureError);
|
||||
}
|
||||
}
|
||||
}
|
||||
+409
@@ -0,0 +1,409 @@
|
||||
/**
|
||||
* 对企业微信发送给企业后台的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
* <p>
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
*/
|
||||
package com.yida.data.system.aes;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 提供接收和推送给企业微信消息的加解密接口(UTF8编码的字符串).
|
||||
* <ol>
|
||||
* <li>第三方回复加密消息给企业微信</li>
|
||||
* <li>第三方收到企业微信发送的消息,验证消息的安全性,并对消息进行解密。</li>
|
||||
* </ol>
|
||||
* 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案
|
||||
* <ol>
|
||||
* <li>在官方网站下载JCE无限制权限策略文件(JDK7的下载地址:
|
||||
* http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</li>
|
||||
* <li>下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt</li>
|
||||
* <li>如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件</li>
|
||||
* <li>如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件</li>
|
||||
* </ol>
|
||||
*/
|
||||
@Slf4j
|
||||
public class WXBizMsgCrypt {
|
||||
static Charset CHARSET = Charset.forName("utf-8");
|
||||
Base64 base64 = new Base64();
|
||||
byte[] aesKey;
|
||||
String token;
|
||||
String receiveid;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param token 企业微信后台,开发者设置的token
|
||||
* @param encodingAesKey 企业微信后台,开发者设置的EncodingAESKey
|
||||
* @param receiveid, 不同场景含义不同,详见文档
|
||||
*
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public WXBizMsgCrypt(String token, String encodingAesKey, String receiveid) throws AesException {
|
||||
if (encodingAesKey.length() != 43) {
|
||||
throw new AesException(AesException.IllegalAesKey);
|
||||
}
|
||||
|
||||
this.token = token;
|
||||
this.receiveid = receiveid;
|
||||
aesKey = Base64.decodeBase64(encodingAesKey + "=");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// WXBizMsgCrypt wxcpt = new WXBizMsgCrypt("yta6ad", "n0KuvcacrFw761RqgNTsN3UwHFw3KYptFij2XWrWW4s", "wxfc7961cd4039bc6d");
|
||||
// wxcpt.DecryptMsg("dd57e9c2b26b073d5777497e8dd43f940d90d8e2", "1635322300", "203081013", "<xml>\n" +
|
||||
// " <ToUserName><![CDATA[gh_d688014af56d]]></ToUserName>\n" +
|
||||
// " <Encrypt><![CDATA[hY3vFoh9E1Dtb8e6MbAwmLwlul0MEWRk0idIsJvI5iavXpnuGJneYFIfysSTqAx/ZOc8yCo8XKd8dNeYExxOmtJ2i39yvLgXXHx3GOeWAo5t2q0lGgt1B31snJSIvp9XALaNXBcYmQYF0XgInaQmc1yW1HXxVL5Q/2OXkmdup7e+O2st4MMUvfowyOoHoxBWhN8GHJmetvyt7hb+Ize6yyruOvoZRX7E8jQlF2BFX+M46mUlXwD9a6XQo3t/AjX7ebJBWeHbVILeeBOHe4TynPlrhAXuEMOxIttM6KpTmC+PX+pbV3xJUkKs78T+HPBsrLkWXOfCyyN3pBIIorAUdTtFwWcteUP6Xa4Kj6Dhn+RutMieIYBGMGS8LczxxxeKSjbgEEDIkXhe3OkF53MTwOttiN6CyoJ9bGYD3ksvLkMi6frJWAHAWj9sRGYOzKKo6yEMxp6b7cHkjiqjl6Bf3KtGEBVrV0N5Rq+uv1Yvev+NUfLN2rYnPQNWxZZen+kEeZod8VC3MPLetID9kpHNE6XtIZ7ZgNtvC0GrC5h9zswtGjDIq1aSNlt5XivKuAu4BIYnt7xAb5O7CtQgUv3G0VnxncQjeO8fw/zIeqT2nJhd17nfz0KMCZZkN5fO/cbD]]></Encrypt>\n" +
|
||||
// "</xml>");
|
||||
}
|
||||
|
||||
// 生成4个字节的网络字节序
|
||||
byte[] getNetworkBytesOrder(int sourceNumber) {
|
||||
byte[] orderBytes = new byte[4];
|
||||
orderBytes[3] = (byte) (sourceNumber & 0xFF);
|
||||
orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF);
|
||||
orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF);
|
||||
orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF);
|
||||
return orderBytes;
|
||||
}
|
||||
|
||||
// 还原4个字节的网络字节序
|
||||
int recoverNetworkBytesOrder(byte[] orderBytes) {
|
||||
int sourceNumber = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sourceNumber <<= 8;
|
||||
sourceNumber |= orderBytes[i] & 0xff;
|
||||
}
|
||||
return sourceNumber;
|
||||
}
|
||||
|
||||
// 随机生成16位字符串
|
||||
String getRandomStr() {
|
||||
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
Random random = new Random();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
int number = random.nextInt(base.length());
|
||||
sb.append(base.charAt(number));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 对明文进行加密.
|
||||
*
|
||||
* @param text 需要加密的明文
|
||||
* @return 加密后base64编码的字符串
|
||||
* @throws AesException aes加密失败
|
||||
*/
|
||||
String encrypt(String randomStr, String text) throws AesException {
|
||||
ByteGroup byteCollector = new ByteGroup();
|
||||
byte[] randomStrBytes = randomStr.getBytes(CHARSET);
|
||||
byte[] textBytes = text.getBytes(CHARSET);
|
||||
byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length);
|
||||
byte[] receiveidBytes = receiveid.getBytes(CHARSET);
|
||||
|
||||
// randomStr + networkBytesOrder + text + receiveid
|
||||
byteCollector.addBytes(randomStrBytes);
|
||||
byteCollector.addBytes(networkBytesOrder);
|
||||
byteCollector.addBytes(textBytes);
|
||||
byteCollector.addBytes(receiveidBytes);
|
||||
|
||||
// ... + pad: 使用自定义的填充方式对明文进行补位填充
|
||||
byte[] padBytes = PKCS7Encoder.encode(byteCollector.size());
|
||||
byteCollector.addBytes(padBytes);
|
||||
|
||||
// 获得最终的字节流, 未加密
|
||||
byte[] unencrypted = byteCollector.toBytes();
|
||||
|
||||
try {
|
||||
// 设置加密模式为AES的CBC模式
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
|
||||
IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);
|
||||
|
||||
// 加密
|
||||
byte[] encrypted = cipher.doFinal(unencrypted);
|
||||
|
||||
// 使用BASE64对加密后的字符串进行编码
|
||||
String base64Encrypted = base64.encodeToString(encrypted);
|
||||
|
||||
return base64Encrypted;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.EncryptAESError);
|
||||
}
|
||||
}
|
||||
|
||||
String decrypt(String text) throws AesException {
|
||||
return decrypt(text, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对密文进行解密.
|
||||
* 应用消息回调时receiveid应该为corpid,应对比receiveid与corpid是否一致
|
||||
*
|
||||
* 加解密库里,ReceiveId 在各个场景的含义不同:
|
||||
* 企业应用的回调,表示corpid
|
||||
* 第三方事件的回调,表示suiteid
|
||||
* 机器人场景的回调,是一个空字符串
|
||||
*
|
||||
* @param text 需要解密的密文
|
||||
* @return 解密得到的明文
|
||||
* @throws AesException aes解密失败
|
||||
*/
|
||||
String decrypt(String text, boolean flag) throws AesException {
|
||||
byte[] original;
|
||||
try {
|
||||
// 设置解密模式为AES的CBC模式
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||
SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES");
|
||||
IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
|
||||
cipher.init(Cipher.DECRYPT_MODE, key_spec, iv);
|
||||
|
||||
// 使用BASE64对密文进行解码
|
||||
byte[] encrypted = Base64.decodeBase64(text);
|
||||
|
||||
// 解密
|
||||
original = cipher.doFinal(encrypted);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.DecryptAESError);
|
||||
}
|
||||
|
||||
String xmlContent, from_receiveid;
|
||||
try {
|
||||
// 去除补位字符
|
||||
byte[] bytes = PKCS7Encoder.decode(original);
|
||||
|
||||
// 分离16位随机字符串,网络字节序和receiveid
|
||||
byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20);
|
||||
|
||||
int xmlLength = recoverNetworkBytesOrder(networkOrder);
|
||||
|
||||
xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET);
|
||||
from_receiveid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length),
|
||||
CHARSET);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.IllegalBuffer);
|
||||
}
|
||||
log.info("解密后的密文, encrypt: {}", xmlContent);
|
||||
log.info("解密后的from_receiveid: {}", from_receiveid);
|
||||
// 判断是否对比receiveid
|
||||
if (flag) {
|
||||
// receiveid不相同的情况
|
||||
if (!from_receiveid.equals(receiveid)) {
|
||||
throw new AesException(AesException.ValidateCorpidError);
|
||||
}
|
||||
}
|
||||
return xmlContent;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将企业微信回复用户的消息加密打包.
|
||||
* <ol>
|
||||
* <li>对要发送的消息进行AES-CBC加密</li>
|
||||
* <li>生成安全签名</li>
|
||||
* <li>将消息密文和安全签名打包成xml格式</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param replyMsg 企业微信待回复用户的消息,xml格式的字符串
|
||||
* @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp
|
||||
* @param nonce 随机串,可以自己生成,也可以用URL参数的nonce
|
||||
*
|
||||
* @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public String EncryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException {
|
||||
// 加密
|
||||
String encrypt = encrypt(getRandomStr(), replyMsg);
|
||||
|
||||
// 生成安全签名
|
||||
if (timeStamp == "") {
|
||||
timeStamp = Long.toString(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt);
|
||||
|
||||
// System.out.println("发送给平台的签名是: " + signature[1].toString());
|
||||
// 生成发送的xml
|
||||
String result = XMLParse.generate(encrypt, signature, timeStamp, nonce);
|
||||
return result;
|
||||
}
|
||||
|
||||
public String DecryptMsg(String msgSignature, String timeStamp, String nonce, String postData) {
|
||||
return DecryptMsg(msgSignature, timeStamp, nonce, postData, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商待开发应用回调验证
|
||||
* 检验消息的真实性,并且获取解密后的明文.
|
||||
* <ol>
|
||||
* <li>利用收到的密文生成安全签名,进行签名验证</li>
|
||||
* <li>若验证通过,则提取xml中的加密消息</li>
|
||||
* <li>对消息进行解密</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param msgSignature 签名串,对应URL参数的msg_signature
|
||||
* @param timeStamp 时间戳,对应URL参数的timestamp
|
||||
* @param nonce 随机串,对应URL参数的nonce
|
||||
* @param postData 密文,对应POST请求的数据
|
||||
*
|
||||
* @return 解密后的原文
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public String DecryptMsg(String msgSignature, String timeStamp, String nonce, String postData, boolean flag)
|
||||
throws AesException {
|
||||
|
||||
// 密钥,公众账号的app secret
|
||||
// 提取密文
|
||||
Object[] encrypt = XMLParse.extract(postData);
|
||||
|
||||
// 验证安全签名
|
||||
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString());
|
||||
|
||||
// 和URL中的签名比较是否相等
|
||||
// System.out.println("第三方收到URL中的签名:" + msg_sign);
|
||||
// System.out.println("第三方校验签名:" + signature);
|
||||
if (!signature.equals(msgSignature)) {
|
||||
throw new AesException(AesException.ValidateSignatureError);
|
||||
}
|
||||
|
||||
// 解密
|
||||
return decrypt(encrypt[1].toString(), flag);
|
||||
}
|
||||
|
||||
public String VerifyURL(String msgSignature, String timeStamp, String nonce, String echoStr)
|
||||
throws AesException {
|
||||
return VerifyURL(msgSignature, timeStamp, nonce, echoStr, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商待开发应用回调验证
|
||||
* 验证URL
|
||||
* @param msgSignature 签名串,对应URL参数的msg_signature
|
||||
* @param timeStamp 时间戳,对应URL参数的timestamp
|
||||
* @param nonce 随机串,对应URL参数的nonce
|
||||
* @param echoStr 随机串,对应URL参数的echostr
|
||||
*
|
||||
* @return 解密之后的echostr
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public String VerifyURL(String msgSignature, String timeStamp, String nonce, String echoStr, boolean flag)
|
||||
throws AesException {
|
||||
String signature = SHA1.getSHA1(token, timeStamp, nonce, echoStr);
|
||||
|
||||
if (!signature.equals(msgSignature)) {
|
||||
throw new AesException(AesException.ValidateSignatureError);
|
||||
}
|
||||
|
||||
return decrypt(echoStr, flag);
|
||||
}
|
||||
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* 对企业微信发送给企业后台的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
package com.yida.data.system.aes;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
/**
|
||||
* XMLParse class
|
||||
* <p>
|
||||
* 提供提取消息格式中的密文及生成回复消息格式的接口.
|
||||
*/
|
||||
class XMLParse {
|
||||
|
||||
/**
|
||||
* 提取出xml数据包中的加密消息
|
||||
*
|
||||
* @param xmltext 待提取的xml字符串
|
||||
* @return 提取出的加密消息字符串
|
||||
* @throws AesException
|
||||
*/
|
||||
public static Object[] extract(String xmltext) throws AesException {
|
||||
Object[] result = new Object[3];
|
||||
try {
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
|
||||
String FEATURE = null;
|
||||
// This is the PRIMARY defense. If DTDs (doctypes) are disallowed, almost all XML entity attacks are prevented
|
||||
// Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl
|
||||
FEATURE = "http://apache.org/xml/features/disallow-doctype-decl";
|
||||
dbf.setFeature(FEATURE, true);
|
||||
|
||||
// If you can't completely disable DTDs, then at least do the following:
|
||||
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities
|
||||
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities
|
||||
// JDK7+ - http://xml.org/sax/features/external-general-entities
|
||||
FEATURE = "http://xml.org/sax/features/external-general-entities";
|
||||
dbf.setFeature(FEATURE, false);
|
||||
|
||||
// Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities
|
||||
// Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities
|
||||
// JDK7+ - http://xml.org/sax/features/external-parameter-entities
|
||||
FEATURE = "http://xml.org/sax/features/external-parameter-entities";
|
||||
dbf.setFeature(FEATURE, false);
|
||||
|
||||
// Disable external DTDs as well
|
||||
FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
|
||||
dbf.setFeature(FEATURE, false);
|
||||
|
||||
// and these as well, per Timothy Morgan's 2014 paper: "XML Schema, DTD, and Entity Attacks"
|
||||
dbf.setXIncludeAware(false);
|
||||
dbf.setExpandEntityReferences(false);
|
||||
|
||||
// And, per Timothy Morgan: "If for some reason support for inline DOCTYPEs are a requirement, then
|
||||
// ensure the entity settings are disabled (as shown above) and beware that SSRF attacks
|
||||
// (http://cwe.mitre.org/data/definitions/918.html) and denial
|
||||
// of service attacks (such as billion laughs or decompression bombs via "jar:") are a risk."
|
||||
|
||||
// remaining parser logic
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
StringReader sr = new StringReader(xmltext);
|
||||
InputSource is = new InputSource(sr);
|
||||
Document document = db.parse(is);
|
||||
|
||||
Element root = document.getDocumentElement();
|
||||
NodeList nodelist1 = root.getElementsByTagName("Encrypt");
|
||||
result[0] = 0;
|
||||
result[1] = nodelist1.item(0).getTextContent();
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.ParseXmlError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成xml消息
|
||||
*
|
||||
* @param encrypt 加密后的消息密文
|
||||
* @param signature 安全签名
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机字符串
|
||||
* @return 生成的xml字符串
|
||||
*/
|
||||
public static String generate(String encrypt, String signature, String timestamp, String nonce) {
|
||||
|
||||
String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n"
|
||||
+ "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n"
|
||||
+ "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>";
|
||||
return String.format(format, encrypt, signature, timestamp, nonce);
|
||||
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package com.yida.data.system.collect;
|
||||
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.system.Log;
|
||||
import com.yida.data.system.constant.LogConstant;
|
||||
import com.yida.data.system.constant.PoolConstant;
|
||||
import com.yida.data.system.service.LogService;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* redis日志收集类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/18
|
||||
*/
|
||||
@Slf4j
|
||||
public class RedisLogCollect {
|
||||
|
||||
private final RedisService redisService;
|
||||
private final LogService logService;
|
||||
private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
|
||||
PoolConstant.CORE_POOL_SIZE, PoolConstant.MAXIMUM_POOL_SIZE,
|
||||
PoolConstant.KEEP_ALIVE_TIME, TimeUnit.SECONDS,
|
||||
new SynchronousQueue<>());
|
||||
|
||||
public RedisLogCollect(RedisService redisService, LogService logService) {
|
||||
this.redisService = redisService;
|
||||
this.logService = logService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启redis数据收集
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/18 10:39
|
||||
*/
|
||||
public void redisServerStart() {
|
||||
threadPoolExecutor.execute(this::collectOperationLog);
|
||||
log.info("RedisLogCollect启动成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 收集操作日志
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/18 11:11
|
||||
*/
|
||||
@SuppressWarnings({"InfiniteLoopStatement", "BusyWait"})
|
||||
private void collectOperationLog() {
|
||||
while (true) {
|
||||
//操作日志数据集合
|
||||
List<Log> systemLogInfoList = new ArrayList<>();
|
||||
try {
|
||||
Thread.sleep(LogConstant.MAX_INTERVAL);
|
||||
} catch (Exception e) {
|
||||
log.error("线程休眠失败: {}", e.getMessage(), e);
|
||||
}
|
||||
try {
|
||||
//从redis获取操作数据集合
|
||||
systemLogInfoList = getLogList(CachePrefixConstant.OPERATION_LOG_LIST, LogConstant.MAX_SEND_SIZE);
|
||||
if (!CollectionUtils.isEmpty(systemLogInfoList)) {
|
||||
//调用es保存方法
|
||||
logService.saveLogList(systemLogInfoList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("从redis队列拉取日志失败: {}", e.getMessage(), e);
|
||||
if (!CollectionUtils.isEmpty(systemLogInfoList)) {
|
||||
//错误时将日志数据存入redis
|
||||
redisService.lSet(CachePrefixConstant.OPERATION_LOG_LIST, systemLogInfoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Log> getLogList(String key, int size) {
|
||||
List<Log> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
//判断集合长度
|
||||
long redisSize = redisService.lGetListSize(key);
|
||||
if (redisSize < size) {
|
||||
size = Math.toIntExact(redisSize);
|
||||
}
|
||||
if (size == 0) {
|
||||
return list;
|
||||
}
|
||||
//获取数据
|
||||
for (int i = 1; i <= size; i++) {
|
||||
//删除redis数据
|
||||
Object object = redisService.lLeftPop(key);
|
||||
if (object != null) {
|
||||
Log systemLogInfo = (Log) object;
|
||||
list.add(systemLogInfo);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取redis集合数据失败: {}", e.getMessage(), e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.yida.data.system.configure;
|
||||
|
||||
import com.yida.data.system.collect.RedisLogCollect;
|
||||
import com.yida.data.system.service.LogService;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 日志收集启动类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/18
|
||||
*/
|
||||
@Component
|
||||
@Order(100)
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class CollectLogStartBean implements InitializingBean {
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
private final LogService logService;
|
||||
|
||||
/**
|
||||
* 配置启动后拉取日志数据
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/18 9:23
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
try {
|
||||
//调用拉取日志方法
|
||||
logServerStart();
|
||||
} catch (Exception e) {
|
||||
log.error("启动日志收集服务失败: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动redis拉取数据类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/18 10:21
|
||||
*/
|
||||
private void logServerStart() {
|
||||
RedisLogCollect redisLogCollect = new RedisLogCollect(redisService, logService);
|
||||
redisLogCollect.redisServerStart();
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package com.yida.data.system.configure;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.constant.QywxServiceProviderConstant;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.EduQywxServiceProvider;
|
||||
import com.yida.data.common.core.entity.system.EduQywxServiceProviderSchool;
|
||||
import com.yida.data.common.core.utils.WxServiceProviderUtil;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.system.service.EduQywxServiceProviderSchoolService;
|
||||
import com.yida.data.system.service.EduQywxServiceProviderService;
|
||||
import com.yida.data.system.service.IDeptService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
@Order(10)
|
||||
@Slf4j
|
||||
public class InitializeRunner implements ApplicationRunner {
|
||||
|
||||
private final RedisService redisService;
|
||||
private final WxServiceProviderUtil wxServiceProviderUtil;
|
||||
|
||||
private final IDeptService deptService;
|
||||
private final EduQywxServiceProviderService eduQywxServiceProviderService;
|
||||
private final EduQywxServiceProviderSchoolService eduQywxServiceProviderSchoolService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
log.info("初始化部门缓存");
|
||||
List<Dept> allDept = deptService.list();
|
||||
Map<Object, Object> items = new HashMap<>();
|
||||
|
||||
for (Dept dept : allDept) {
|
||||
items.put(dept.getDeptId().toString(), dept);
|
||||
}
|
||||
redisService.hmset(CachePrefixConstant.SYS_DEPT_DATA, items);
|
||||
// initProviderSchool();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化服务商对应学校加密corpId
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/11/10 9:13
|
||||
*/
|
||||
// public void initProviderSchool() {
|
||||
// // 查询所有服务商
|
||||
// List<EduQywxServiceProvider> providerList = eduQywxServiceProviderService.list();
|
||||
// // 查询所有企业微信学校
|
||||
// List<Dept> deptList = deptService.list(Wrappers.lambdaQuery(new Dept()).eq(Dept::getSchoolType, Dept.TYPE_QYWX));
|
||||
// // 加密key缓存map
|
||||
// Map<Object, Object> items = new HashMap<>(16);
|
||||
// // 原始key缓存map
|
||||
// Map<Object, Object> originalItems = new HashMap<>(16);
|
||||
//
|
||||
// // 处理关联数据
|
||||
// for (EduQywxServiceProvider provider : providerList) {
|
||||
// for (Dept dept : deptList) {
|
||||
// // 查询是否有关联数据
|
||||
// EduQywxServiceProviderSchool providerSchool = eduQywxServiceProviderSchoolService
|
||||
// .getOne(Wrappers.lambdaQuery(new EduQywxServiceProviderSchool())
|
||||
// .eq(EduQywxServiceProviderSchool::getProviderCorpId, provider.getCorpId())
|
||||
// .eq(EduQywxServiceProviderSchool::getDeptOriginalCorpId, dept.getCorpId()));
|
||||
// if (Objects.isNull(providerSchool)) {
|
||||
// continue;
|
||||
// }
|
||||
// if (StringUtils.isNotBlank(providerSchool.getDeptEncryptionCorpId())) {
|
||||
// providerSchool = new EduQywxServiceProviderSchool();
|
||||
// providerSchool.setProviderCorpId(provider.getCorpId());
|
||||
// providerSchool.setDeptOriginalCorpId(dept.getCorpId());
|
||||
// // 转换corpId
|
||||
// String providerToken = wxServiceProviderUtil
|
||||
// .getProviderToken(provider.getCorpId(), provider.getServiceProviderSecret());
|
||||
// String convertCorpId = wxServiceProviderUtil.convertCorpId(providerToken, dept.getCorpId());
|
||||
// providerSchool.setDeptEncryptionCorpId(convertCorpId);
|
||||
// eduQywxServiceProviderSchoolService.save(providerSchool);
|
||||
// }
|
||||
// items.put(provider.getCorpId() + "." + providerSchool.getDeptEncryptionCorpId(), providerSchool);
|
||||
// originalItems.put(provider.getCorpId() + "." + providerSchool.getDeptOriginalCorpId(), providerSchool);
|
||||
// }
|
||||
// }
|
||||
// if (CollUtil.isNotEmpty(items)) {
|
||||
// redisService.hmset(QywxServiceProviderConstant.PROVIDER_SCHOOL_CORP_DATA, items);
|
||||
// redisService.hmset(QywxServiceProviderConstant.PROVIDER_SCHOOL_CORP_ORIGINAL_DATA, originalItems);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.yida.data.system.configure;
|
||||
|
||||
import com.p6spy.engine.spy.appender.MessageFormattingStrategy;
|
||||
import com.yida.data.common.core.utils.DateUtil;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 自定义 p6spy sql输出格式
|
||||
*
|
||||
* @author MrBird
|
||||
*/
|
||||
public class P6spySqlFormatConfigure implements MessageFormattingStrategy {
|
||||
|
||||
@Override
|
||||
public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) {
|
||||
return StringUtils.isNotBlank(sql) ? DateUtil.formatFullTime(LocalDateTime.now(), DateUtil.FULL_TIME_SPLIT_PATTERN)
|
||||
+ " | 耗时 " + elapsed + " ms | SQL 语句:" + StringUtils.LF + sql.replaceAll("[\\s]+", StringUtils.SPACE) + ";" : StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.yida.data.system.configure;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.yida.data.common.core.entity.WxPublicQr;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.system.dto.QywxCallbackHandleDTO;
|
||||
import com.yida.data.system.service.EduAgentWxPublicReceiverService;
|
||||
import com.yida.data.system.service.QywxHandleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 企业微信回调mq处理类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/10/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class QywxHandleRabbitReceiver {
|
||||
|
||||
private final QywxHandleService qywxHandleService;
|
||||
|
||||
/**
|
||||
* 企业微信处理接收者
|
||||
*/
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(RabbitConstant.QYWX_HANDLE_QUEUE),
|
||||
exchange = @Exchange(RabbitConstant.QYWX_HANDLE_EXCHANGE)
|
||||
))
|
||||
public void qywxHandleRabbitReceiver(QywxCallbackHandleDTO dto, Channel channel, Message message) throws IOException {
|
||||
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||
try {
|
||||
// 处理企业微信回调信息
|
||||
switch (dto.getQywxCallbackTypeEnum()) {
|
||||
// 自开发回调
|
||||
case POST:
|
||||
qywxHandleService.handlePostCallback(dto);
|
||||
break;
|
||||
// 代开发应用模板回调
|
||||
case POST_NORMAL:
|
||||
qywxHandleService.handlePostNormalCallback(dto);
|
||||
break;
|
||||
// 处理企业微信代开发应用回调信息
|
||||
case POST_EVENT:
|
||||
qywxHandleService.handlePostEventCallback(dto);
|
||||
break;
|
||||
default:
|
||||
throw new FebsException("回调类型错误");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("rabbitmq处理企业微信回调消息失败, msg: {}", dto, e);
|
||||
// 重新回到队列
|
||||
// channel.basicNack(deliveryTag, false, true);
|
||||
} finally {
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(deliveryTag, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.yida.data.system.configure;
|
||||
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
public class RabbitConfig {
|
||||
|
||||
/**
|
||||
* 微信公众号扫描事件回调交换机
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public DirectExchange wxPublicQrExchange() {
|
||||
return new DirectExchange(RabbitConstant.WXPUBLIC_QR_EXCHANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域后台绑定接收消息队列队列
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Queue agentReceiveMsgQueue() {
|
||||
return new Queue(RabbitConstant.AGENT_RECEIVE_MSG_QUEUE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域后台绑定接收消息绑定
|
||||
*/
|
||||
@Bean
|
||||
public Binding agentReceiveMsgBinding(@Qualifier("agentReceiveMsgQueue") Queue queue,
|
||||
@Qualifier("wxPublicQrExchange") DirectExchange exchange) {
|
||||
return BindingBuilder.bind(queue).to(exchange).with(RabbitConstant.AGENT_RECEIVE_MSG_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域后台绑定接收消息队列队列
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Queue visitorInviteCodeQueue() {
|
||||
return new Queue(RabbitConstant.VISITOR_INVITE_CODE_QUEUE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域后台绑定接收消息绑定
|
||||
*/
|
||||
@Bean
|
||||
public Binding visitorInviteCodeBinding(@Qualifier("visitorInviteCodeQueue") Queue queue,
|
||||
@Qualifier("wxPublicQrExchange") DirectExchange exchange) {
|
||||
return BindingBuilder.bind(queue).to(exchange).with(RabbitConstant.VISITOR_INVITE_CODE_KEY);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DirectExchange qywxHandleExchange() {
|
||||
return new DirectExchange(RabbitConstant.QYWX_HANDLE_EXCHANGE);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue qywxHandleQueue() {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
// 设置同时只能一个消费者进行消费
|
||||
args.put("x-single-active-consumer", true);
|
||||
return new Queue(RabbitConstant.QYWX_HANDLE_QUEUE, true, false, false, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding qywxHandleBinding(@Qualifier("qywxHandleQueue") Queue queue,
|
||||
@Qualifier("qywxHandleExchange") DirectExchange exchange) {
|
||||
return BindingBuilder.bind(queue).to(exchange).with(RabbitConstant.QYWX_HANDLE_KEY);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.yida.data.system.configure;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.yida.data.common.core.entity.WxPublicQr;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.system.service.EduAgentWxPublicReceiverService;
|
||||
import java.io.IOException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class SysRabbitReceiver {
|
||||
|
||||
private final EduAgentWxPublicReceiverService eduAgentWxPublicReceiverService;
|
||||
|
||||
/**
|
||||
* 区域后台消息接收者
|
||||
*/
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(RabbitConstant.AGENT_RECEIVE_MSG_QUEUE),
|
||||
exchange = @Exchange(RabbitConstant.TELEPHONE_EXCHANGE)
|
||||
))
|
||||
public void receiveAgentReceiver(WxPublicQr wxPublicQr, Channel channel, Message message) throws IOException {
|
||||
boolean success = true;
|
||||
try {
|
||||
eduAgentWxPublicReceiverService.wxPublicQrCall(wxPublicQr);
|
||||
} catch (Exception e) {
|
||||
success = false;
|
||||
log.error("消费消息失败", e);
|
||||
} finally {
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), success);
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.yida.data.system.configure;
|
||||
|
||||
import com.yida.data.system.constant.PoolConstant;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
@Configuration
|
||||
public class SystemBaseConfigure {
|
||||
|
||||
@Bean(PoolConstant.QYWX_CALL_POOL)
|
||||
public ThreadPoolTaskExecutor qywxCallThread(){
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(2);
|
||||
executor.setMaxPoolSize(5);
|
||||
executor.setQueueCapacity(100);
|
||||
executor.setKeepAliveSeconds(30);
|
||||
executor.setThreadNamePrefix("Febs-Qywx-Call-Thread");
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(60);
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.yida.data.system.constant;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 操作日志常量类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/15
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class LogConstant {
|
||||
|
||||
/**
|
||||
* 最大每次发送日志条数
|
||||
*/
|
||||
public static final int MAX_SEND_SIZE = 5000;
|
||||
|
||||
/**
|
||||
* 日志抓取频次间隔时间.单位毫秒
|
||||
*/
|
||||
public static final int MAX_INTERVAL = 10000;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.yida.data.system.constant;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 线程池常量类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/1/18
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class PoolConstant {
|
||||
|
||||
/**
|
||||
* 核心线程池大小
|
||||
*/
|
||||
public static final Integer CORE_POOL_SIZE = 0;
|
||||
|
||||
/**
|
||||
* 最大线程池大小
|
||||
*/
|
||||
public static final Integer MAXIMUM_POOL_SIZE = 5;
|
||||
|
||||
/**
|
||||
* 线程最大空闲时间.单位秒
|
||||
*/
|
||||
public static final Long KEEP_ALIVE_TIME = 60L;
|
||||
|
||||
public static final String QYWX_CALL_POOL="qywx_call_pool";
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduSysFile;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.school.vo.smart.WxConfigVO;
|
||||
import com.yida.data.system.service.CommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Api(tags = "通用接口")
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class CommonController {
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@ApiOperation("公共上传接口")
|
||||
@PostMapping("/upload")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "上传文件")
|
||||
public ResultBean upload(MultipartFile file,
|
||||
@ApiParam("限制大小(单位:MB)") @RequestParam(required = false) Integer maxSize) {
|
||||
if (maxSize != null) {
|
||||
if (maxSize * 1024 * 1024 < file.getSize()) {
|
||||
throw new FebsException(String.format("超过最大限制大小%dMB", maxSize));
|
||||
}
|
||||
}
|
||||
EduSysFile eduSysFile = commonService.upload(file);
|
||||
StringBuilder stringBuilder = new StringBuilder(eduSysFile.getUrl());
|
||||
if (StrUtil.isNotBlank(eduSysFile.getCoverUrl())) {
|
||||
stringBuilder.append(",")
|
||||
.append(eduSysFile.getCoverUrl());
|
||||
}
|
||||
return ResultBean.buildSuccess(stringBuilder.toString());
|
||||
}
|
||||
|
||||
@GetMapping("/getWxJsConfig")
|
||||
@ApiOperation("获取企业微信JS-SDK配置")
|
||||
ResultBean<WxConfigVO> getWxJsConfig(
|
||||
@RequestParam @ApiParam(value = "部门id", required = true) Long deptId,
|
||||
@RequestParam @ApiParam(value = "当前网页的URL,不包含#及其后面部分", required = true) String url) {
|
||||
return ResultBean.buildSuccess(commonService.getWxJsConfig(deptId, url));
|
||||
}
|
||||
|
||||
@GetMapping("/getWxPublicJsConfig")
|
||||
@ApiOperation("获取微信JS-SDK配置")
|
||||
ResultBean<WxConfigVO> getWxPublicJsConfig(
|
||||
@RequestParam @ApiParam(value = "部门id", required = true) Long deptId,
|
||||
@RequestParam @ApiParam(value = "当前网页的URL,不包含#及其后面部分", required = true) String url) {
|
||||
return ResultBean.buildSuccess(commonService.getWxPublicJsConfig(deptId, url));
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.QueryRequest;
|
||||
import com.yida.data.common.core.entity.system.DataPermissionTest;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.system.service.IDataPermissionTestService;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Controller
|
||||
*
|
||||
* @author MrBird
|
||||
* @date 2020-04-14 15:25:33
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("dataPermissionTest")
|
||||
@RequiredArgsConstructor
|
||||
public class DataPermissionTestController {
|
||||
|
||||
private final IDataPermissionTestService dataPermissionTestService;
|
||||
|
||||
@GetMapping("list")
|
||||
@PreAuthorize("hasAuthority('others:datapermission')")
|
||||
public FebsResponse dataPermissionTestList(QueryRequest request, DataPermissionTest dataPermissionTest) {
|
||||
Map<String, Object> dataTable = FebsUtil.getDataTable(this.dataPermissionTestService.findDataPermissionTests(request, dataPermissionTest));
|
||||
return new FebsResponse().data(dataTable);
|
||||
}
|
||||
}
|
||||
+283
@@ -0,0 +1,283 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.QueryRequest;
|
||||
import com.yida.data.common.core.entity.constant.StringConstant;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.dto.*;
|
||||
import com.yida.data.system.mapper.EduAreaMapper;
|
||||
import com.yida.data.system.service.IDeptService;
|
||||
import com.yida.data.system.service.IUserService;
|
||||
import com.yida.data.system.vo.*;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("dept")
|
||||
@RequiredArgsConstructor
|
||||
public class DeptController {
|
||||
|
||||
private final IDeptService deptService;
|
||||
|
||||
private final IUserService userService;
|
||||
|
||||
@Resource
|
||||
private EduAreaMapper eduAreaMapper;
|
||||
|
||||
/**
|
||||
* 查询父级部门
|
||||
*/
|
||||
@ApiOperation("查询父级部门")
|
||||
@GetMapping("/getParent")
|
||||
public ResultBean<Dept> getParent(@ApiParam("部门id") Long deptId) {
|
||||
return ResultBean.buildSuccess(deptService.getById(deptService.getById(deptId).getParentId()));
|
||||
}
|
||||
|
||||
@ApiOperation("向上查询父级部门")
|
||||
@GetMapping("/findParentUp")
|
||||
public ResultBean<AllDeptInfoVO> findParentUp(@ApiParam("部门id") Long deptId,
|
||||
@ApiParam("最上级部门类型,0表示学校,1表示班级,2表示年级,3表示学段,4表示校区,5公司,6" +
|
||||
"学校部门") Integer type) {
|
||||
return ResultBean.buildSuccess(deptService.findParentUp(deptId, type));
|
||||
}
|
||||
|
||||
@GetMapping("/findListByParent")
|
||||
@ApiOperation("查询所有子节点")
|
||||
public ResultBean<List<Dept>> findListByParent(Long deptId) {
|
||||
return ResultBean.buildSuccess(deptService.findListByParent(Arrays.asList(deptId), 0));
|
||||
}
|
||||
|
||||
@ApiOperation("查询直接子节点")
|
||||
@GetMapping("/findChildByParent")
|
||||
public ResultBean findChildByParent(@ApiParam("父节点id,不能为空") @RequestParam Long deptId,
|
||||
@ApiParam("子节点类型,0表示学校,5公司,6部门,7教育局,默认所有直接子节点") Integer type) {
|
||||
return ResultBean.buildSuccess(deptService.findChildByParent(deptId, type));
|
||||
}
|
||||
|
||||
@ApiOperation("向下查询到要查询的部门类别的子部门(可查询非直接子部门)")
|
||||
@GetMapping("/findChildByParentAndType")
|
||||
public ResultBean<List<Dept>> findChildByParentAndType(@ApiParam("父节点id,不能为空") Long parentId,
|
||||
@ApiParam("子节点类型,0表示学校,5公司,6部门,7教育局,默认所有直接子节点") Integer type) {
|
||||
return ResultBean.buildSuccess(deptService.findChildByParentAndType(Arrays.asList(parentId), type));
|
||||
}
|
||||
|
||||
@ApiOperation("根据部门id查询所属学校")
|
||||
@GetMapping("findSchoolByDept")
|
||||
public ResultBean<Dept> findSchoolByDept(Long deptId) {
|
||||
return ResultBean.buildSuccess(deptService.findSchooleByDept(deptId));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public FebsResponse deptList(QueryRequest request, Dept dept) {
|
||||
Map<String, Object> depts = this.deptService.findDepts(request, dept);
|
||||
return new FebsResponse().data(depts);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("hasAuthority('dept:add')")
|
||||
@OperationLog(module = ModuleName.DEPT, methods = "新增部门", type = OperationLogTypeEnum.INSERT)
|
||||
public void addDept(@Valid Dept dept) {
|
||||
this.deptService.createDept(dept);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{deptIds}")
|
||||
@PreAuthorize("hasAuthority('dept:delete')")
|
||||
@OperationLog(module = ModuleName.DEPT, methods = "删除部门", type = OperationLogTypeEnum.DELETE)
|
||||
public void deleteDepts(@NotBlank(message = "{required}") @PathVariable String deptIds) {
|
||||
String[] ids = deptIds.split(StringConstant.COMMA);
|
||||
this.deptService.deleteDepts(ids);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@PreAuthorize("hasAuthority('dept:update')")
|
||||
@OperationLog(module = ModuleName.DEPT, methods = "修改部门", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updateDept(@Valid Dept dept) {
|
||||
this.deptService.updateDept(dept);
|
||||
}
|
||||
|
||||
@PostMapping("excel")
|
||||
@PreAuthorize("hasAuthority('dept:export')")
|
||||
public void export(Dept dept, QueryRequest request, HttpServletResponse response) {
|
||||
List<Dept> depts = this.deptService.findDepts(dept, request);
|
||||
//ExcelKit.$Export(Dept.class, response).downXlsx(depts, false);
|
||||
}
|
||||
|
||||
@GetMapping("/getInfoById")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "根据id查询部门")
|
||||
public ResultBean<Dept> getInfoById(Long deptId) {
|
||||
return ResultBean.buildSuccess(deptService.getById(deptId));
|
||||
}
|
||||
|
||||
@ApiOperation("根据区域查询学校列表")
|
||||
@GetMapping("/getSchoolByArea")
|
||||
public ResultBean<List<Dept>> getSchoolByArea(@ApiParam("区域id") @RequestParam(required = false) Long areaId,
|
||||
@ApiParam("搜索关键词 学校名") @RequestParam(required = false) String schoolName) throws NoSuchMethodException {
|
||||
return ResultBean.buildSuccess(deptService.getSchoolByArea(areaId, schoolName));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询学校列表")
|
||||
@GetMapping("/getPageSchoolByArea")
|
||||
public ResultBean<IPage<Dept>> getPageSchoolByArea(@ApiParam("类型") @RequestParam(required = false) Long areaId,
|
||||
@ApiParam("搜索关键词 学校名") @RequestParam(required = false) String schoolName,
|
||||
@ApiParam("当前页码") @RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@ApiParam("页面大小") @RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
Page<Dept> page = new Page<>();
|
||||
page.setSize(pageSize);
|
||||
page.setCurrent(pageNum);
|
||||
return ResultBean.buildSuccess(deptService.getPageSchoolByArea(areaId, schoolName, page));
|
||||
}
|
||||
|
||||
@ApiOperation("部门树")
|
||||
@GetMapping("/getDeptTree")
|
||||
public ResultBean<List> getDeptTree(@ApiParam("根节点Id") Long deptId,
|
||||
@ApiParam("0-包含学校的企业部门(后勤部等)与学校部门(校区学段等),1-仅学校部门,2-仅企业部门,默认0") @RequestParam(defaultValue =
|
||||
"0") Integer type) {
|
||||
if (deptId == null) {
|
||||
deptId = FebsUtil.getCurrentUser().getDeptId();
|
||||
}
|
||||
return ResultBean.buildSuccess(deptService.getDeptTree(deptId, type));
|
||||
}
|
||||
|
||||
@GetMapping("/getSchoolAreaInfo")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "获取学校和区域信息")
|
||||
public ResultBean<SchoolClassInfoVO> getSchoolAreaInfo(Long schoolId) {
|
||||
return ResultBean.buildSuccess(deptService.getSchoolAreaInfo(schoolId));
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门区域")
|
||||
@GetMapping("/findAreaById")
|
||||
public ResultBean<AreaVO> findAreaById(@RequestParam Long id) {
|
||||
Long byId = deptService.getById(id).getAreaId();
|
||||
return ResultBean.buildSuccess(eduAreaMapper.findAreaById(byId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询代理商管理的学校列表数据
|
||||
*
|
||||
* @param agentSchoolSelectPageDTO 查询代理商管理的学校列表数据请求类
|
||||
* @return com.yida.data.common.core.common.ResultBean<com.baomidou.mybatisplus.core.metadata.IPage <
|
||||
* com.yida.data.system.vo.AgentSchoolVO>>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/27 17:03
|
||||
*/
|
||||
@GetMapping(value = "/listAgentSchoolPage")
|
||||
@ApiOperation(value = "查询代理商管理的学校列表数据", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
public ResultBean<IPage<AgentSchoolSelectPageVO>> listAgentSchoolPage(
|
||||
@Valid AgentSchoolSelectPageDTO agentSchoolSelectPageDTO) {
|
||||
return this.deptService.listAgentSchoolPage(agentSchoolSelectPageDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 代理商保存学校数据
|
||||
*
|
||||
* @param agentSchoolSaveDTO 代理商保存学校请求类
|
||||
* @return com.yida.data.common.core.common.ResultBean<java.lang.String>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/27 17:59
|
||||
*/
|
||||
// @PreAuthorize("hasRole('role:agent:admin')")
|
||||
@PostMapping(value = "/saveAgentSchool", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ApiOperation(value = "代理商保存学校数据", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultBean<String> saveAgentSchool(
|
||||
@Valid @RequestBody AgentSchoolSaveDTO agentSchoolSaveDTO) {
|
||||
return this.deptService.saveAgentSchool(agentSchoolSaveDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学校信息
|
||||
*
|
||||
* @param schoolId 学校id
|
||||
* @return com.yida.data.common.core.common.ResultBean<com.yida.data.system.vo.AgentSchoolDetailVO>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/27 20:54
|
||||
*/
|
||||
// @PreAuthorize("hasRole('role:agent:admin')")
|
||||
@PostMapping(value = "/getAgentSchoolInfo")
|
||||
@ApiOperation(value = "查询学校信息", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
public ResultBean<AgentSchoolDetailVO> getAgentSchoolInfo(
|
||||
@ApiParam(value = "学校id", required = true) @RequestParam Long schoolId) {
|
||||
return this.deptService.getAgentSchoolInfo(schoolId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用或停用学校
|
||||
*
|
||||
* @param schoolId 学校id
|
||||
* @param enableStatus 需要设置的启用或停用状态. 启用: 1, 停用: 0
|
||||
* @return com.yida.data.common.core.common.ResultBean<java.lang.String>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/28 9:43
|
||||
*/
|
||||
// @PreAuthorize("hasRole('role:agent:admin')")
|
||||
@PostMapping(value = "/updateEnableStatus")
|
||||
@ApiOperation(value = "启用或停用学校", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
@OperationLog(module = ModuleName.DEPT, methods = "启用或停用学校", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean<String> updateEnableStatus(
|
||||
@ApiParam(value = "学校id", required = true) @RequestParam Long schoolId,
|
||||
@ApiParam(value = "需要设置的启用或停用状态. 启用: 1, 停用: 0", required = true) @RequestParam Integer enableStatus) {
|
||||
return this.deptService.updateEnableStatus(schoolId, enableStatus);
|
||||
}
|
||||
|
||||
// TODO 2021/9/28 注销学校功能待确认
|
||||
|
||||
/**
|
||||
* 代理商查询学校管理员账号列表数据
|
||||
*
|
||||
* @param schoolAdminAccountSelectPageDTO 代理商查询学校管理员账号列表数据请求类
|
||||
* @return com.yida.data.common.core.common.ResultBean<com.baomidou.mybatisplus.core.metadata.IPage <
|
||||
* com.yida.data.system.vo.SchoolAdminAccountSelectPageVO>>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/29 17:34
|
||||
*/
|
||||
@PostMapping(value = "/listSchoolAdminAccountPage")
|
||||
@ApiOperation(value = "查询学校管理员账号列表数据", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
public ResultBean<IPage<SchoolAdminAccountSelectPageVO>> listSchoolAdminAccountPage(
|
||||
@Valid SchoolAdminAccountSelectPageDTO schoolAdminAccountSelectPageDTO) {
|
||||
return ResultBean.buildSuccess(this.userService.listSchoolAdminAccountPage(schoolAdminAccountSelectPageDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存学校负责人账号
|
||||
*
|
||||
* @param schoolAdminAccountSaveDTO 保存学校负责人账号请求类
|
||||
* @return com.yida.data.common.core.common.ResultBean<java.lang.String>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/28 11:02
|
||||
*/
|
||||
// @PreAuthorize("hasRole('role:agent:admin')")
|
||||
@PostMapping(value = "/saveSchoolAdminAccount", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ApiOperation(value = "保存学校负责人账号", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@OperationLog(module = ModuleName.DEPT, methods = "保存学校负责人账号", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean<String> saveSchoolAdminAccount(
|
||||
@Valid @RequestBody SchoolAdminAccountSaveDTO schoolAdminAccountSaveDTO) {
|
||||
return this.userService.saveSchoolAdminAccount(schoolAdminAccountSaveDTO);
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.Dict;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.service.DictService;
|
||||
import com.yida.data.system.vo.DictTypePageVO;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 字典crud
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/dict")
|
||||
public class DictController {
|
||||
|
||||
@Resource
|
||||
private DictService dictService;
|
||||
|
||||
@ApiOperation("分页查询字典类型")
|
||||
@GetMapping("/listDictTypePage")
|
||||
public ResultBean<IPage<DictTypePageVO>> listDictGroup(@RequestParam(required = false) String typeName,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
return ResultBean.buildSuccess(dictService.listDictTypePage(typeName, pageNum, pageSize));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/selectDict")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "查询字典")
|
||||
public ResultBean<List<Dict>> selectDict(@ApiParam("类型") @RequestParam String type) {
|
||||
return ResultBean.buildSuccess(dictService.list(Wrappers.lambdaQuery(new Dict())
|
||||
.eq(Dict::getType, type).orderByAsc(Dict::getSort)));
|
||||
}
|
||||
|
||||
@PostMapping("/insertDict")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "添加字典", type = OperationLogTypeEnum.SAVE)
|
||||
public ResultBean<Dict> insertDict(@RequestBody Dict dict) {
|
||||
dictService.saveOrUpdate(dict);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/delDict")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "删除字典", type = OperationLogTypeEnum.DELETE)
|
||||
public ResultBean delDict(@ApiParam("字典值id") @RequestParam Long dictId) {
|
||||
dictService.removeById(dictId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@GetMapping("/delDictByType")
|
||||
public ResultBean delDictByType(String type) {
|
||||
dictService.remove(Wrappers.<Dict>lambdaQuery()
|
||||
.eq(Dict::getType, type));
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@GetMapping("/getDictByTypeAndValueOrLabel")
|
||||
public ResultBean getDictCode(String type, String value, String Label) {
|
||||
if (ObjectUtil.isNotNull(value)) {
|
||||
return ResultBean
|
||||
.buildSuccess(
|
||||
dictService.getOne(Wrappers.lambdaQuery(new Dict()).eq(Dict::getType, type).eq(Dict::getValue, value)));
|
||||
}
|
||||
if (ObjectUtil.isNotNull(Label)) {
|
||||
return ResultBean
|
||||
.buildSuccess(
|
||||
dictService.getOne(Wrappers.lambdaQuery(new Dict()).eq(Dict::getType, type).eq(Dict::getLabel, Label)));
|
||||
}
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.common.ResultMsgType;
|
||||
import com.yida.data.system.dto.AgentSchoolRelateSaveDTO;
|
||||
import com.yida.data.system.service.EduAgentSchoolRelateService;
|
||||
import com.yida.data.system.service.EduAgentService;
|
||||
import com.yida.data.system.vo.AgentSchoolRelateVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理员维护代理商 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021-09-26 11:19:45
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/eduAgentManagement")
|
||||
@Api(tags = "代理商管理后台接口")
|
||||
@PreAuthorize("hasRole('role:admin')")
|
||||
public class EduAgentManagementController {
|
||||
|
||||
private final EduAgentService eduAgentService;
|
||||
|
||||
private final EduAgentSchoolRelateService eduAgentSchoolRelateService;
|
||||
|
||||
// /**
|
||||
// * 查询代理商列表数据
|
||||
// *
|
||||
// * @param agentSelectPageDTO 代理商后台列表请求类
|
||||
// * @return com.yida.data.common.core.common.ResultBean<com.baomidou.mybatisplus.core.metadata.IPage < com.yida.data.system.vo.AgentSelectPageVO>>
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/26 11:40
|
||||
// */
|
||||
// @PostMapping(value = "/listAgentPage")
|
||||
// @ApiOperation(value = "查询代理商列表数据", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
// public ResultBean<IPage<AgentSelectPageVO>> listAtlasPage(@Valid AgentSelectPageDTO agentSelectPageDTO) {
|
||||
// try {
|
||||
// return this.eduAgentService.listAgentPage(agentSelectPageDTO);
|
||||
// } catch (Exception e) {
|
||||
// log.error("查询代理商列表数据失败: {}", e.getMessage(), e);
|
||||
// return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 保存代理商数据
|
||||
// *
|
||||
// * @param agentSaveDTO 保存代理商请求类
|
||||
// * @return com.yida.data.common.core.common.ResultBean<java.lang.String>
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/26 13:48
|
||||
// */
|
||||
// @PostMapping(value = "/saveAgent", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
// @ApiOperation(value = "保存代理商数据", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
// public ResultBean<String> saveAgent(@Valid @RequestBody AgentSaveDTO agentSaveDTO) {
|
||||
// try {
|
||||
// return this.eduAgentService.saveAgent(agentSaveDTO);
|
||||
// } catch (Exception e) {
|
||||
// log.error("保存代理商数据失败: {}", e.getMessage(), e);
|
||||
// return ResultBean.buildError(ResultMsgType.SAVE_FAIL.getValue());
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 获取代理商详情
|
||||
// *
|
||||
// * @param agentId 代理商id
|
||||
// * @return com.yida.data.common.core.common.ResultBean<com.yida.data.system.vo.AgentDetailVO>
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/26 14:59
|
||||
// */
|
||||
// @ApiOperation("获取代理商详情")
|
||||
// @GetMapping(value = "/getAgentInfo")
|
||||
// public ResultBean<AgentDetailVO> getAgentInfo(
|
||||
// @ApiParam(value = "代理商id", required = true) @RequestParam Long agentId) {
|
||||
// try {
|
||||
// return this.eduAgentService.getAgentInfo(agentId);
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取代理商详情失败: {}", e.getMessage(), e);
|
||||
// return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
// }
|
||||
// }
|
||||
|
||||
@ApiOperation("查询代理商和学校关联关系")
|
||||
@GetMapping(value = "/listAgentSchoolRelates")
|
||||
public ResultBean<List<AgentSchoolRelateVO>> listAgentSchoolRelates( ) {
|
||||
return ResultBean.buildSuccess(this.eduAgentSchoolRelateService.listAgentSchoolRelates());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存代理商和学校关联关系
|
||||
*
|
||||
* @param agentSchoolRelateSaveDTO 需要保存的关联关系集合数据
|
||||
* @return com.yida.data.common.core.common.ResultBean<java.lang.String>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/26 16:58
|
||||
*/
|
||||
@ApiOperation(value = "保存代理商和学校关联关系", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = "/saveAgentSchoolRelate", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultBean<String> saveAgentSchoolRelate(@Valid @RequestBody AgentSchoolRelateSaveDTO agentSchoolRelateSaveDTO) {
|
||||
try {
|
||||
return this.eduAgentSchoolRelateService.saveAgentSchoolRelate(agentSchoolRelateSaveDTO);
|
||||
} catch (Exception e) {
|
||||
log.error("保存代理商和学校关联关系失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.SAVE_FAIL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取代理商管理员账号详情
|
||||
// *
|
||||
// * @param agentId 代理商id
|
||||
// * @return com.yida.data.common.core.common.ResultBean<com.yida.data.system.vo.AgentAdminAccountDetailVO>
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/29 16:02
|
||||
// */
|
||||
// @ApiOperation("获取代理商管理员账号详情")
|
||||
// @GetMapping(value = "/getAgentAdminAccountInfo")
|
||||
// public ResultBean<AgentAdminAccountDetailVO> getAgentAdminAccountInfo(
|
||||
// @ApiParam(value = "代理商id", required = true) @RequestParam Long agentId) {
|
||||
// try {
|
||||
// return this.eduAgentService.getAgentAdminAccountInfo(agentId);
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取代理商管理员账号详情失败: {}", e.getMessage(), e);
|
||||
// return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 创建代理商管理员账号
|
||||
// *
|
||||
// * @param agentAdminAccountSaveDTO 保存代理商管理员账号请求类
|
||||
// * @return com.yida.data.common.core.common.ResultBean<java.lang.String>
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/28 16:24
|
||||
// */
|
||||
// @PostMapping(value = "/saveAgentAdminAccount", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
// @ApiOperation(value = "保存代理商管理员账号", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
// public ResultBean<String> saveAgentAdminAccount(
|
||||
// @Valid @RequestBody AgentAdminAccountSaveDTO agentAdminAccountSaveDTO) {
|
||||
// return this.eduAgentService.saveAgentAdminAccount(agentAdminAccountSaveDTO);
|
||||
// }
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.agent.EduAgentWxPublicReceiver;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.enums.RoleEnum;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.core.utils.RoleUtil;
|
||||
import com.yida.data.system.service.EduAgentWxPublicReceiverService;
|
||||
import com.yida.data.system.service.IDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "区域后台接收公众号消息")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/agentReceiver")
|
||||
public class EduAgentWxPublicReceiverController {
|
||||
private final EduAgentWxPublicReceiverService eduAgentWxPublicReceiverService;
|
||||
private final RedisService redisService;
|
||||
private final IDeptService deptService;
|
||||
|
||||
@GetMapping("/listReceiver")
|
||||
public ResultBean<IPage<EduAgentWxPublicReceiver>> listReceiverPage(
|
||||
@RequestParam(required = false) String keyword,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
// Long agentId = currentUser.getAgentId();
|
||||
// Asserts.isNotNull(agentId, "请使用区域账户登录");
|
||||
LambdaQueryWrapper<EduAgentWxPublicReceiver> condition = Wrappers.<EduAgentWxPublicReceiver>lambdaQuery();
|
||||
|
||||
// 查询下级部门信息
|
||||
List<Long> childIdList = this.deptService.findListByParent(Collections.singletonList(currentUser.getDeptId()), 0)
|
||||
.stream().map(Dept::getDeptId).collect(Collectors.toList());
|
||||
// 代理商管理员
|
||||
if (RoleEnum.ROLE_AGENT_ADMIN.equals(RoleUtil.getMaxRole(currentUser))) {
|
||||
childIdList.add(currentUser.getDeptId());
|
||||
}
|
||||
// 学校、教育局、代理商及以下具有创建账号的数据 自己创建的角色+当前登陆账号部门以下的角色
|
||||
if (CollectionUtils.isNotEmpty(childIdList)) {
|
||||
condition.in(EduAgentWxPublicReceiver::getCreateDeptId, childIdList).or();
|
||||
}
|
||||
// 代理商其它可以创建账号的数据
|
||||
condition.eq(EduAgentWxPublicReceiver::getCreateId, currentUser.getUserId());
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
condition.like(EduAgentWxPublicReceiver::getNickname, keyword);
|
||||
}
|
||||
condition.orderByDesc(EduAgentWxPublicReceiver::getCreateDate);
|
||||
return ResultBean.buildSuccess(eduAgentWxPublicReceiverService.page(new Page(pageNum, pageSize), condition));
|
||||
}
|
||||
|
||||
@GetMapping("/bind")
|
||||
public ResultBean bind() {
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
// Long agentId = currentUser.getAgentId();
|
||||
// Asserts.isNotNull(agentId, "请使用区域账户登录");
|
||||
Long agentId;
|
||||
if (RoleEnum.ROLE_AGENT_ADMIN.equals(RoleUtil.getMaxRole(currentUser))) {
|
||||
agentId = currentUser.getDeptId();
|
||||
} else {
|
||||
agentId = currentUser.getMainDeptId();
|
||||
}
|
||||
return ResultBean.buildSuccess(eduAgentWxPublicReceiverService.bindReceiver(agentId, currentUser));
|
||||
}
|
||||
|
||||
@PostMapping("/unbindBatch")
|
||||
public ResultBean unbind(@RequestBody List<Long> ids) {
|
||||
eduAgentWxPublicReceiverService.removeByIds(ids);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("查询扫码进度")
|
||||
@GetMapping("/qrPercent")
|
||||
public ResultBean<Object> qrPercent() {
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
Long agentId;
|
||||
if (RoleEnum.ROLE_AGENT_ADMIN.equals(RoleUtil.getMaxRole(currentUser))) {
|
||||
agentId = currentUser.getDeptId();
|
||||
} else {
|
||||
agentId = currentUser.getMainDeptId();
|
||||
}
|
||||
return ResultBean.buildSuccess(
|
||||
redisService.get(CachePrefixConstant.SYS_AGENT_RECEIVER_QR
|
||||
+ "-" + agentId + "-" + currentUser.getUserId()));
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.system.EduApp;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.system.service.EduAppService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "企业微信 应用管理")
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
public class EduAppController {
|
||||
@Resource
|
||||
private EduAppService eduAppService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/listAppPage")
|
||||
public ResultBean listAppPage(@ApiParam("学校id") @RequestParam(required = false) Long schoolId,
|
||||
@ApiParam("当前页码") @RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@ApiParam("页面大小") @RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
if (schoolId == null) {
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
if (currentUser.getDeptType() == 0) {
|
||||
schoolId = currentUser.getDeptId();
|
||||
}
|
||||
}
|
||||
return ResultBean.buildSuccess(eduAppService.listQywxAppPage(new Page<>(pageNum, pageSize), schoolId));
|
||||
}
|
||||
|
||||
@ApiOperation("保存、编辑app")
|
||||
@PostMapping("/saveApp")
|
||||
public ResultBean saveApp(@RequestBody EduApp app) {
|
||||
if (app.getDeptId() == null) {
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
Asserts.isFalse(currentUser.getDeptType() == 5, "未选择学校");
|
||||
app.setDeptId(currentUser.getDeptId());
|
||||
}
|
||||
eduAppService.saveApp(app);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除app")
|
||||
@PostMapping("/delAppBatch")
|
||||
public ResultBean delAppBatch(@RequestBody List<Long> ids) {
|
||||
eduAppService.removeByIds(ids);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("查询app列表")
|
||||
@PostMapping("/listApp")
|
||||
public ResultBean listApp(@ApiParam("应用类别,0-家长,1-教职工") @RequestParam(required = false) Integer type,
|
||||
@ApiParam("学校id") @RequestParam(required = false) Long schoolId,
|
||||
@ApiParam("能否在易达app中显示,0-否,1-是") @RequestParam(required = false) Integer appShow) {
|
||||
if (schoolId == null) {
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
if (ObjectUtil.equal(currentUser.getDeptType(), 0)) {
|
||||
schoolId = currentUser.getDeptId();
|
||||
}
|
||||
}
|
||||
LambdaQueryWrapper<EduApp> condition = Wrappers.<EduApp>lambdaQuery();
|
||||
if (schoolId != null) {
|
||||
condition.eq(EduApp::getDeptId, schoolId);
|
||||
}
|
||||
if (type != null) {
|
||||
condition.eq(EduApp::getType, type);
|
||||
}
|
||||
if (appShow != null) {
|
||||
condition.eq(EduApp::getYidaAppShow, appShow);
|
||||
}
|
||||
return ResultBean.buildSuccess(eduAppService.list(condition));
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduArea;
|
||||
import com.yida.data.system.service.EduAreaService;
|
||||
import com.yida.data.system.vo.CascadeAreaVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "区域管理")
|
||||
@RestController
|
||||
@RequestMapping("/eduArea")
|
||||
public class EduAreaController {
|
||||
|
||||
@Resource
|
||||
private EduAreaService eduAreaService;
|
||||
|
||||
@ApiOperation("保存、编辑区域节点")
|
||||
@PostMapping("/saveArea")
|
||||
public ResultBean saveArea(@RequestBody EduArea area) {
|
||||
if (area.getParentId() != null && eduAreaService.getInfo(area.getParentId()) == null) {
|
||||
return ResultBean.buildError("父节点不存在");
|
||||
}
|
||||
if (eduAreaService.getInfoByName(area.getName(), area.getParentId()) != null) {
|
||||
return ResultBean.buildError("该区域节点已存在");
|
||||
}
|
||||
eduAreaService.saveArea(area);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除区域节点")
|
||||
@PostMapping("/deleteArea")
|
||||
public ResultBean deleteArea(@ApiParam("区域id") @RequestBody Long areaId) {
|
||||
if (areaId == null || eduAreaService.getInfo(areaId) == null) {
|
||||
return ResultBean.buildError("节点不存在");
|
||||
}
|
||||
eduAreaService.deleteArea(areaId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("查询区域信息")
|
||||
@GetMapping("/findAreaTreeOrList")
|
||||
public ResultBean<List<EduArea>> findAreaTreeOrList(@ApiParam("父节点id,默认从省级查询") @RequestParam(required =
|
||||
false) Long parentId,
|
||||
@ApiParam("是否子查询直接儿子节点,0-是,1-否,默认为是") @RequestParam(required = false,
|
||||
defaultValue = "0") Integer isOnlyNext,
|
||||
@ApiParam("返回数据是否为树形结构,0-是,1-否,默认为树形") @RequestParam(required = false,
|
||||
defaultValue = "0") Integer isTree) {
|
||||
return ResultBean.buildSuccess(eduAreaService.findAreaTreeOrList(parentId, isOnlyNext, isTree));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询父区域信息")
|
||||
@GetMapping("/findAreaParentId")
|
||||
public ResultBean<List<Long>> findAreaParentId(@ApiParam("子节点Id") @RequestParam Long areaId) {
|
||||
return ResultBean.buildSuccess(eduAreaService.findAreaParentId(areaId));
|
||||
}
|
||||
|
||||
@ApiOperation("根据街道id查询所有区域信息")
|
||||
@GetMapping("/findAllAreaInfo")
|
||||
public ResultBean<CascadeAreaVO> findAllAreaInfo(@ApiParam("街道子节点Id") @RequestParam Long areaId) {
|
||||
return ResultBean.buildSuccess(eduAreaService.findAllAreaInfo(areaId));
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduBaseApp;
|
||||
import com.yida.data.system.service.EduBaseAppService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 基础应用信息(本地配置) Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023-06-28 14:57:58
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("eduBaseApp")
|
||||
@Api(tags = "基础应用信息配置信息")
|
||||
public class EduBaseAppController {
|
||||
|
||||
private final EduBaseAppService eduBaseAppService;
|
||||
|
||||
@PostMapping(value = "listBaseApp")
|
||||
@ApiOperation(value = "查询基础应用列表数据")
|
||||
public ResultBean<List<EduBaseApp>> listBaseApp() {
|
||||
return ResultBean.buildSuccess(eduBaseAppService.list());
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.system.service.EduHolidayService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@Api(tags = "节假日")
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/holiday")
|
||||
public class EduHolidayController {
|
||||
private final EduHolidayService eduHolidayService;
|
||||
|
||||
@ApiOperation("初始化节假日")
|
||||
@GetMapping("/initHoliday")
|
||||
public ResultBean initHoliday(@ApiParam("年份") Integer year) {
|
||||
eduHolidayService.initHoliday(year);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduSchoolInquireCommonQuestion;
|
||||
import com.yida.data.common.core.entity.system.EduSchoolInquirePhone;
|
||||
import com.yida.data.system.service.EduInquireQuestionService;
|
||||
import com.yida.data.system.vo.FindPhonePageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@Api(tags = "入学咨询")
|
||||
@RestController
|
||||
@RequestMapping("/inquire")
|
||||
@RequiredArgsConstructor
|
||||
public class EduInquireController {
|
||||
private final EduInquireQuestionService inquireService;
|
||||
|
||||
@ApiOperation("常见问题列表")
|
||||
@GetMapping("/findQuestionPage")
|
||||
public ResultBean<IPage<EduSchoolInquireCommonQuestion>> findQuestionPage(@RequestParam(required = false)@ApiParam("标签id") Long labelId,
|
||||
@RequestParam @ApiParam("部门id") Long deptId,
|
||||
@RequestParam (required = false) @ApiParam("问题") String question,
|
||||
@RequestParam (required = false,defaultValue = "1")Integer pageNum,
|
||||
@RequestParam (required = false,defaultValue = "10")Integer pageSize) {
|
||||
|
||||
Page page = new Page<>();
|
||||
page.setSize(pageSize);
|
||||
page.setCurrent(pageNum);
|
||||
return ResultBean.buildSuccess(inquireService.findQuestionPage(labelId,deptId,page,question));
|
||||
}
|
||||
|
||||
@ApiOperation("咨询电话列表")
|
||||
@GetMapping("/findPhonePage")
|
||||
public ResultBean<IPage<FindPhonePageVO>> findPhonePage(@RequestParam (required = false)@ApiParam("标签id") Long labelId,
|
||||
@RequestParam @ApiParam("部门id") Long deptId,
|
||||
@RequestParam (required = false) @ApiParam("学校名称") String schoolName,
|
||||
@RequestParam (required = false,defaultValue = "1")Integer pageNum,
|
||||
@RequestParam (required = false,defaultValue = "10")Integer pageSize) {
|
||||
|
||||
Page page = new Page<>();
|
||||
page.setSize(pageSize);
|
||||
page.setCurrent(pageNum);
|
||||
return ResultBean.buildSuccess(inquireService.findPhonePage(labelId,deptId,page,schoolName));
|
||||
}
|
||||
|
||||
@ApiOperation("新增或修改问题")
|
||||
@PostMapping("/saveOrUpdateQuestion")
|
||||
public ResultBean saveOrUpdateQuestion(@RequestBody List<EduSchoolInquireCommonQuestion> questionList) {
|
||||
|
||||
inquireService.saveOrUpdateQuestion(questionList);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("新增或修改电话")
|
||||
@PostMapping("/saveOrUpdatePhone")
|
||||
public ResultBean saveOrUpdatePhone(@RequestBody List<EduSchoolInquirePhone> phoneList) {
|
||||
|
||||
inquireService.saveOrUpdatePhone(phoneList);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除电话")
|
||||
@GetMapping("/removePhone")
|
||||
public ResultBean removePhone(@RequestParam Long phoneId) {
|
||||
|
||||
inquireService.removePhone(phoneId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除问题")
|
||||
@GetMapping("/removeQuestion")
|
||||
public ResultBean removeQuestion(@RequestParam Long questionId) {
|
||||
|
||||
inquireService.removeQuestion(questionId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("查询问题详情")
|
||||
@GetMapping("/findQuestionById")
|
||||
public ResultBean<EduSchoolInquireCommonQuestion> findQuestionById(@RequestParam Long questionId) {
|
||||
|
||||
|
||||
return ResultBean.buildSuccess( inquireService.findQuestionById(questionId));
|
||||
}
|
||||
|
||||
@ApiOperation("查询电话详情")
|
||||
@GetMapping("/findPhoneById")
|
||||
public ResultBean<EduSchoolInquirePhone> findPhoneById(@RequestParam Long phoneId) {
|
||||
|
||||
|
||||
return ResultBean.buildSuccess(inquireService.findPhoneById(phoneId));
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.common.ResultMsgType;
|
||||
import com.yida.data.common.core.entity.instructions.EduInstructionsContent;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.service.EduInstructionsContentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Controller
|
||||
*
|
||||
* @author ccl
|
||||
* @date 2021-08-30 15:54:11
|
||||
*/
|
||||
@Api(tags = "系统指南")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("instructionsContent")
|
||||
@RequiredArgsConstructor
|
||||
public class EduInstructionsContentController {
|
||||
|
||||
private final EduInstructionsContentService eduInstructionsContentService;
|
||||
|
||||
@ApiOperation("分页获取系统指南内容LIST")
|
||||
@GetMapping("/findPageList")
|
||||
public ResultBean<IPage<EduInstructionsContent>> findPageList(
|
||||
@ApiParam("指南类型") @RequestParam(required = false) String typeCode,
|
||||
@ApiParam("指南标题") @RequestParam(required = false) String title,
|
||||
@ApiParam("当前页码,默认1") @RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@ApiParam("分页大小,默认10") @RequestParam(defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return ResultBean.buildSuccess(
|
||||
eduInstructionsContentService.listPageEduInstructionsContent(new Page(pageNum, pageSize), typeCode, title));
|
||||
} catch (Exception e) {
|
||||
log.error("分页获取系统指南内容LIST失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("根据typeCode或者Id获取单条指南内容")
|
||||
@PostMapping("/getOneEduInstructionsContent")
|
||||
public ResultBean<EduInstructionsContent> getOneEduInstructionsContent(@RequestParam(required = false) String typeCode,
|
||||
@RequestParam(required = false) Integer id
|
||||
) {
|
||||
try {
|
||||
return ResultBean.buildSuccess(eduInstructionsContentService.getOneEduInstructionsContent(typeCode, id));
|
||||
} catch (Exception e) {
|
||||
log.error("根据typeCode或者Id获取单条指南内容失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("新增或修改系统指南内容")
|
||||
@PostMapping("/saveOrUpdateInstructions")
|
||||
@OperationLog(module = ModuleName.INSTRUCTION, methods = "新增或修改系统指南内容", type = OperationLogTypeEnum.SAVE)
|
||||
public ResultBean saveOrUpdateInstructions(@RequestBody EduInstructionsContent eduInstructionsContent) {
|
||||
try {
|
||||
boolean b = eduInstructionsContentService.saveInstructionsContent(eduInstructionsContent, FebsUtil.getCurrentUser());
|
||||
|
||||
if (!b) {
|
||||
return ResultBean.buildError("该类型已存在操作指南");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("新增或修改系统指南内容失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.SAVE_FAIL.getValue());
|
||||
}
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除系统指南内容")
|
||||
@PostMapping("/removeBatch")
|
||||
@OperationLog(module = ModuleName.INSTRUCTION, methods = "删除系统指南内容", type = OperationLogTypeEnum.DELETE)
|
||||
public ResultBean selectProduct(@ApiParam("系统指南内容id") @RequestBody List<Integer> ids) {
|
||||
try {
|
||||
eduInstructionsContentService.deleteByIds(ids);
|
||||
return ResultBean.buildSuccess();
|
||||
} catch (Exception e) {
|
||||
log.error("删除系统指南内容失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.DELETE_FAIL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.common.ResultMsgType;
|
||||
import com.yida.data.common.core.entity.instructions.EduInstructionsType;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.service.EduInstructionsTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Controller
|
||||
*
|
||||
* @author wjm
|
||||
* @date 2021-08-30 15:54:24
|
||||
*/
|
||||
@Api(tags = "系统指南")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("eduInstructionsType")
|
||||
@RequiredArgsConstructor
|
||||
public class EduInstructionsTypeController {
|
||||
|
||||
private final EduInstructionsTypeService eduInstructionsTypeService;
|
||||
|
||||
|
||||
@ApiOperation("系统指南类型列表")
|
||||
@GetMapping("/findList")
|
||||
public ResultBean<List<EduInstructionsType>> selectInstructionsList() {
|
||||
try {
|
||||
return ResultBean.buildSuccess(eduInstructionsTypeService.selectInstructionsTypeList());
|
||||
} catch (Exception e) {
|
||||
log.error("系统指南类型列表失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("新增或修改系统指南类型")
|
||||
@PostMapping("/save")
|
||||
@OperationLog(module = ModuleName.INSTRUCTION, methods = "新增或修改系统指南类型", type = OperationLogTypeEnum.SAVE)
|
||||
public ResultBean insertInstructionsList(@RequestBody EduInstructionsType eduInstructionsType) {
|
||||
try {
|
||||
eduInstructionsTypeService.saveData(eduInstructionsType, FebsUtil.getCurrentUser());
|
||||
return ResultBean.buildSuccess();
|
||||
} catch (Exception e) {
|
||||
log.error("新增或修改系统指南类型失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除系统指南类型")
|
||||
@PostMapping("/removeBatch")
|
||||
@OperationLog(module = ModuleName.INSTRUCTION, methods = "删除系统指南类型", type = OperationLogTypeEnum.DELETE)
|
||||
public ResultBean removeBatch(@ApiParam("系统指南类型id") @RequestBody List<Integer> ids) {
|
||||
try {
|
||||
eduInstructionsTypeService.removeByIds(ids);
|
||||
return ResultBean.buildSuccess();
|
||||
} catch (Exception e) {
|
||||
log.error("删除系统指南类型失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError(ResultMsgType.QUERY_FAIL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduPayWxConfig;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.EduPayWxConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(tags = "微信支付配置信息")
|
||||
@RestController
|
||||
@RequestMapping("/payWxConfig")
|
||||
@AllArgsConstructor
|
||||
public class EduPayWxConfigController {
|
||||
|
||||
private final EduPayWxConfigService eduPayWxConfigService;
|
||||
|
||||
@ApiOperation("获取学校的微支付主体appId")
|
||||
@GetMapping("/getAppIdBySchool")
|
||||
public ResultBean<String> getAppIdBySchool(Long schoolId) {
|
||||
EduPayWxConfig payWxConfig = eduPayWxConfigService.getOne(Wrappers.<EduPayWxConfig>lambdaQuery()
|
||||
.eq(EduPayWxConfig::getSchoolId, schoolId)
|
||||
.select(EduPayWxConfig::getWxPublicId));
|
||||
Asserts.isNotNull(payWxConfig, "未查询到学校微支付");
|
||||
return ResultBean.buildSuccess(payWxConfig.getWxPublicId());
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.school.EduYidaAppAccount;
|
||||
import com.yida.data.system.service.EduAppAccountService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Api(tags = "易达app订阅号")
|
||||
@RestController
|
||||
@RequestMapping("/yida/account")
|
||||
@RequiredArgsConstructor
|
||||
public class EduYidaAppAccountController {
|
||||
private final EduAppAccountService eduAppAccountService;
|
||||
|
||||
@ApiOperation("根据订阅号id查询订阅号")
|
||||
@GetMapping("/getAccountByAccountId")
|
||||
public ResultBean getAccountByAccountId(String accountId) {
|
||||
return ResultBean.buildSuccess(eduAppAccountService.getOne(Wrappers.lambdaQuery(new EduYidaAppAccount())
|
||||
.eq(EduYidaAppAccount::getYidaAppAccountId, accountId)));
|
||||
}
|
||||
|
||||
@ApiOperation("根据学校id与类型查询订阅号")
|
||||
@GetMapping("/getAccountByType")
|
||||
ResultBean<EduYidaAppAccount> getAccountByType(@RequestParam("schoolId") Long schoolId,
|
||||
@ApiParam("0-家长,1-老师") @RequestParam("type") Integer type) {
|
||||
return ResultBean.buildSuccess(eduAppAccountService.getOne(Wrappers.lambdaQuery(new EduYidaAppAccount())
|
||||
.eq(EduYidaAppAccount::getSchoolId, schoolId)
|
||||
.eq(EduYidaAppAccount::getType, type)));
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.EduYidaApp;
|
||||
import com.yida.data.system.service.EduYidaAppService;
|
||||
import com.yida.data.system.service.IDeptService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Api(tags = "易达 app管理")
|
||||
@RestController
|
||||
@RequestMapping("/yida/app")
|
||||
@RequiredArgsConstructor
|
||||
public class EduYidaAppController {
|
||||
private final EduYidaAppService eduYidaAppService;
|
||||
private final IDeptService deptService;
|
||||
|
||||
@ApiOperation("根据学校id查询app")
|
||||
@GetMapping("/getAppBySchool")
|
||||
public ResultBean<EduYidaApp> getAppBySchool(Long schoolId) {
|
||||
Dept school = deptService.getById(schoolId);
|
||||
return ResultBean.buildSuccess(school != null ? eduYidaAppService.getById(school.getYidaAppId()) : null);
|
||||
}
|
||||
|
||||
@ApiOperation("查询易达app列表")
|
||||
@GetMapping("/listApp")
|
||||
public ResultBean<List<EduYidaApp>> listApp(){
|
||||
return ResultBean.buildSuccess(eduYidaAppService.list(Wrappers.<EduYidaApp>lambdaQuery().orderByAsc(EduYidaApp::getId)));
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
//package cc.mrbird.febs.server.system.controller;
|
||||
//
|
||||
//import com.yida.data.common.core.entity.FebsResponse;
|
||||
//import com.yida.data.common.core.entity.QueryRequest;
|
||||
//import com.yida.data.common.core.exception.FebsException;
|
||||
//import com.yida.data.common.core.utils.FebsUtil;
|
||||
//import cc.mrbird.febs.server.system.annotation.ControllerEndpoint;
|
||||
//import cc.mrbird.febs.server.system.service.IEximportService;
|
||||
//import com.google.common.base.Stopwatch;
|
||||
//import com.google.common.collect.ImmutableMap;
|
||||
//import com.google.common.collect.Lists;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.collections4.CollectionUtils;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.springframework.web.bind.annotation.GetMapping;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//import org.springframework.web.multipart.MultipartFile;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import java.io.IOException;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.stream.IntStream;
|
||||
//
|
||||
///**
|
||||
// * @author MrBird
|
||||
// */
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@RequestMapping("eximport")
|
||||
//@RequiredArgsConstructor
|
||||
//public class EximportController {
|
||||
//
|
||||
// private static final String XLSX = ".xlsx";
|
||||
// private final IEximportService eximportService;
|
||||
//
|
||||
// @GetMapping
|
||||
// public FebsResponse findEximports(QueryRequest request) {
|
||||
// Map<String, Object> dataTable = FebsUtil.getDataTable(eximportService.findEximports(request, null));
|
||||
// return new FebsResponse().data(dataTable);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("template")
|
||||
// public void generateImportTemplate(HttpServletResponse response) {
|
||||
// List<Eximport> list = new ArrayList<>();
|
||||
// IntStream.range(0, 20).forEach(i -> {
|
||||
// Eximport eximport = new Eximport();
|
||||
// eximport.setField1("字段1");
|
||||
// eximport.setField2(i + 1);
|
||||
// eximport.setField3("mrbird" + i + "@gmail.com");
|
||||
// list.add(eximport);
|
||||
// });
|
||||
// ExcelKit.$Export(Eximport.class, response).downXlsx(list, true);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("import")
|
||||
// @ControllerEndpoint(exceptionMessage = "导入Excel数据失败")
|
||||
// public FebsResponse importExcels(MultipartFile file) throws IOException, FebsException {
|
||||
// if (file.isEmpty()) {
|
||||
// throw new FebsException("导入数据为空");
|
||||
// }
|
||||
// String filename = file.getOriginalFilename();
|
||||
// if (!StringUtils.endsWith(filename, XLSX)) {
|
||||
// throw new FebsException("只支持.xlsx类型文件导入");
|
||||
// }
|
||||
// Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
// final List<Eximport> data = Lists.newArrayList();
|
||||
// final List<Map<String, Object>> error = Lists.newArrayList();
|
||||
// ExcelKit.$Import(Eximport.class).readXlsx(file.getInputStream(), new ExcelReadHandler<Eximport>() {
|
||||
// @Override
|
||||
// public void onSuccess(int sheet, int row, Eximport eximport) {
|
||||
// eximport.setCreateTime(new Date());
|
||||
// data.add(eximport);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(int sheet, int row, List<ExcelErrorField> errorFields) {
|
||||
// error.add(ImmutableMap.of("row", row, "errorFields", errorFields));
|
||||
// }
|
||||
// });
|
||||
// if (CollectionUtils.isNotEmpty(data)) {
|
||||
// this.eximportService.batchInsert(data);
|
||||
// }
|
||||
// ImmutableMap<String, Object> result = ImmutableMap.of(
|
||||
// "time", stopwatch.stop().toString(),
|
||||
// "data", data,
|
||||
// "error", error
|
||||
// );
|
||||
// return new FebsResponse().data(result);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("excel")
|
||||
// @ControllerEndpoint(exceptionMessage = "导出Excel失败")
|
||||
// public void export(QueryRequest queryRequest, Eximport eximport, HttpServletResponse response) {
|
||||
// List<Eximport> eximports = this.eximportService.findEximports(queryRequest, eximport).getRecords();
|
||||
// ExcelKit.$Export(Eximport.class, response).downXlsx(eximports, false);
|
||||
// }
|
||||
//}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.BaiduApiConfig;
|
||||
import com.yida.data.common.core.entity.system.UnionPayConfig;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.BaiduApiConfigService;
|
||||
import com.yida.data.system.service.UnionPayConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 百度api配置信息 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/6/20
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "百度api配置信息(无鉴权)")
|
||||
@RequestMapping("/in/baiDuApiConfig")
|
||||
public class InBaiDuApiConfigController {
|
||||
|
||||
private final BaiduApiConfigService baiduApiConfigService;
|
||||
|
||||
@ApiOperation("根据学校id查询百度api配置")
|
||||
@GetMapping("/getBaiDuApiConfigByDept")
|
||||
public ResultBean<BaiduApiConfig> getBaiDuApiConfigByDept(@RequestParam Long deptId, @RequestParam String moduleName) {
|
||||
Asserts.isNotNull(deptId, "部门不能为空");
|
||||
return ResultBean.buildSuccess(baiduApiConfigService.getOne(Wrappers.lambdaQuery(new BaiduApiConfig())
|
||||
.eq(BaiduApiConfig::getSchoolId, deptId)
|
||||
.eq(BaiduApiConfig::getModuleName, moduleName)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduBaseApp;
|
||||
import com.yida.data.system.service.EduBaseAppService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 基础app管理(无鉴权)
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023-06-28 15:24:25
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "基础app管理(无鉴权)")
|
||||
@RestController
|
||||
@RequestMapping("/in/deptHomeApp")
|
||||
@RequiredArgsConstructor
|
||||
public class InBaseDeptHomeAppController {
|
||||
|
||||
private final EduBaseAppService eduBaseAppService;
|
||||
|
||||
@ApiOperation("根据id查询基础应用")
|
||||
@GetMapping("/getById")
|
||||
public ResultBean<EduBaseApp> getById(@RequestParam Long id) {
|
||||
return ResultBean.buildSuccess(eduBaseAppService.getById(id));
|
||||
}
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.Dict;
|
||||
import com.yida.data.common.core.entity.system.EduArea;
|
||||
import com.yida.data.common.core.entity.system.EduDeptWxPublic;
|
||||
import com.yida.data.common.core.entity.system.EduSysFile;
|
||||
import com.yida.data.common.core.entity.system.EduWxPublicTemplateMsg;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.mapper.EduDeptWxPublicMapper;
|
||||
import com.yida.data.system.mapper.EduWxPublicTemplateMsgMapper;
|
||||
import com.yida.data.system.service.CommonService;
|
||||
import com.yida.data.system.service.DictService;
|
||||
import com.yida.data.system.service.EduAreaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Api(tags = "通用接口(不鉴权)")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/common")
|
||||
public class InCommonController {
|
||||
|
||||
private final CommonService commonService;
|
||||
private final DictService dictService;
|
||||
private final EduAreaService eduAreaService;
|
||||
private final EduDeptWxPublicMapper eduDeptWxPublicMapper;
|
||||
private final EduWxPublicTemplateMsgMapper eduWxPublicTemplateMsgMapper;
|
||||
|
||||
@ApiOperation("公共上传图片接口(接收base64)")
|
||||
@PostMapping("/uploadImg")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "", type = OperationLogTypeEnum.INSERT)
|
||||
public ResultBean<String> uploadImg(String code) {
|
||||
return ResultBean.buildSuccess(commonService.uploadImg(code));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("公共上传接口")
|
||||
@PostMapping("/upload")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "上传文件")
|
||||
public ResultBean upload(MultipartFile file,
|
||||
@ApiParam("限制大小(单位:MB)") @RequestParam(required = false) Integer maxSize) {
|
||||
if (file == null) {
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
if (maxSize != null) {
|
||||
if (maxSize * 1024 * 1024 < file.getSize()) {
|
||||
throw new FebsException(String.format("超过最大限制大小%dMB", maxSize));
|
||||
}
|
||||
}
|
||||
EduSysFile eduSysFile = commonService.upload(file);
|
||||
StringBuilder stringBuilder = new StringBuilder(eduSysFile.getUrl());
|
||||
if (StrUtil.isNotBlank(eduSysFile.getCoverUrl())) {
|
||||
stringBuilder.append(",")
|
||||
.append(eduSysFile.getCoverUrl());
|
||||
}
|
||||
return ResultBean.buildSuccess(stringBuilder.toString());
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门绑定的公众号信息")
|
||||
@GetMapping("/getDeptWxPublic")
|
||||
public ResultBean<EduDeptWxPublic> getDeptWxPublic(Long deptId) {
|
||||
return ResultBean.buildSuccess(eduDeptWxPublicMapper.selectOne(Wrappers.<EduDeptWxPublic>lambdaQuery()
|
||||
.eq(EduDeptWxPublic::getDeptId, deptId)));
|
||||
}
|
||||
|
||||
@ApiOperation("刷入系统接收第三方消息")
|
||||
@RequestMapping("/saveReceiveMsg")
|
||||
public void saveReceiveMsg() {
|
||||
commonService.saveReceiveMsg();
|
||||
}
|
||||
|
||||
@ApiOperation("查询公众号模板消息")
|
||||
@GetMapping("/getWxTemplateMsg")
|
||||
public ResultBean<EduWxPublicTemplateMsg> getWxTemplateMsg(String wxPublicAppId, Integer templateMsgType) {
|
||||
return ResultBean.buildSuccess(eduWxPublicTemplateMsgMapper.selectOne(
|
||||
Wrappers.<EduWxPublicTemplateMsg>lambdaQuery().eq(EduWxPublicTemplateMsg::getWxPublicAppId, wxPublicAppId)
|
||||
.eq(EduWxPublicTemplateMsg::getTemplateMsgType, templateMsgType)));
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典值")
|
||||
@GetMapping("/getDict")
|
||||
public ResultBean<List<Dict>> getDict(String type) {
|
||||
return ResultBean.buildSuccess(dictService.list(Wrappers.<Dict>lambdaQuery().eq(Dict::getType, type)));
|
||||
}
|
||||
|
||||
@ApiOperation("查询区域")
|
||||
@GetMapping("/getArea")
|
||||
public ResultBean<EduArea> getArea(@ApiParam("区域id") Long id) {
|
||||
return ResultBean.buildSuccess(eduAreaService.getInfo(id));
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.ConstructionPayConfig;
|
||||
import com.yida.data.common.core.entity.system.UnionPayConfig;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.ConstructionPayConfigService;
|
||||
import com.yida.data.system.service.UnionPayConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 建行学习支付配置信息 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/6/19
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "建行学习支付配置信息(无鉴权)")
|
||||
@RequestMapping("/in/constructionPayConfig")
|
||||
public class InConstructionPayConfigController {
|
||||
|
||||
private final ConstructionPayConfigService constructionPayConfigService;
|
||||
|
||||
@ApiOperation("根据部门查询建行支付配置")
|
||||
@GetMapping("/getConstructionPayConfigByDept")
|
||||
public ResultBean<ConstructionPayConfig> getConstructionPayConfigByDept(Long deptId) {
|
||||
Asserts.isNotNull(deptId, "部门不能为空");
|
||||
return ResultBean.buildSuccess(constructionPayConfigService.getOne(Wrappers.lambdaQuery(new ConstructionPayConfig())
|
||||
.eq(ConstructionPayConfig::getDeptId, deptId)));
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.consume.EduConsumeConfig;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.EduConsumeConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 学校消费机服务器信息 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/4/6
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "学校消费机服务器信息(无鉴权)")
|
||||
@RequestMapping("/in/consumeConfig")
|
||||
public class InConsumeConfigController {
|
||||
|
||||
private final EduConsumeConfigService eduConsumeConfigService;
|
||||
|
||||
@ApiOperation("根据部门查询收钱吧支付配置信息")
|
||||
@GetMapping("/getConsumeConfigByDept")
|
||||
public ResultBean<EduConsumeConfig> getConsumeConfigByDept(Long deptId) {
|
||||
Asserts.isNotNull(deptId, "部门不能为空");
|
||||
return ResultBean.buildSuccess(eduConsumeConfigService.getOne(Wrappers.lambdaQuery(new EduConsumeConfig())
|
||||
.eq(EduConsumeConfig::getDeptId, deptId))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
+265
@@ -0,0 +1,265 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.EduDeptWxPublic;
|
||||
import com.yida.data.common.core.entity.system.EduHotWord;
|
||||
import com.yida.data.common.core.entity.system.EduLabel;
|
||||
import com.yida.data.system.dto.FindSchoolPageListDTO;
|
||||
import com.yida.data.system.dto.SchoolInformationDTO;
|
||||
import com.yida.data.system.dto.SchoolPageDTO;
|
||||
import com.yida.data.system.mapper.EduDeptWxPublicMapper;
|
||||
import com.yida.data.system.service.EduLabelService;
|
||||
import com.yida.data.system.service.IDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Validated
|
||||
@Api(tags = "部门管理(无鉴权)")
|
||||
@RestController
|
||||
@RequestMapping("/in/dept")
|
||||
@RequiredArgsConstructor
|
||||
public class InDeptController {
|
||||
|
||||
private final IDeptService deptService;
|
||||
private final EduDeptWxPublicMapper eduDeptWxPublicMapper;
|
||||
private final EduLabelService labelService;
|
||||
|
||||
@ApiOperation("根据corpId查询学校id")
|
||||
@GetMapping("/getSchoolByCorp")
|
||||
public ResultBean<Dept> getSchoolByCorp(@RequestParam String corpId) {
|
||||
return ResultBean.buildSuccess(
|
||||
deptService.getOne(Wrappers.lambdaQuery(new Dept()).eq(Dept::getCorpId, corpId).eq(Dept::getDeptType, 0)));
|
||||
}
|
||||
|
||||
@ApiOperation("获取父部门")
|
||||
@GetMapping("/getParentById")
|
||||
public ResultBean<Dept> getParentById(Long id) {
|
||||
return ResultBean.buildSuccess(deptService.getParentById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("向下获取包含的班级id")
|
||||
@GetMapping("/listClassByDept")
|
||||
public ResultBean<List<Long>> listClassByDept(Long[] ids) {
|
||||
return ResultBean.buildSuccess(deptService.listClassByDept(new ArrayList<>(Arrays.asList(ids))));
|
||||
}
|
||||
|
||||
@GetMapping("/getInfoById")
|
||||
public ResultBean<Dept> getInfoById(Long deptId) {
|
||||
return ResultBean.buildSuccess(deptService.getById(deptId));
|
||||
}
|
||||
|
||||
@GetMapping("/getSchoolByName")
|
||||
public ResultBean<Dept> getSchoolByName(String schoolName) {
|
||||
return ResultBean.buildSuccess(deptService
|
||||
.getOne(Wrappers.lambdaQuery(new Dept()).eq(Dept::getDeptName, schoolName)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学校下属部门(非家校部门)
|
||||
*/
|
||||
@GetMapping("/getDeptBySchoolAndName")
|
||||
public ResultBean<Dept> getDeptBySchoolAndName(Long schoolId, String deptName) {
|
||||
return ResultBean.buildSuccess(deptService.getDeptBySchoolAndName(Arrays.asList(schoolId), deptName));
|
||||
}
|
||||
|
||||
@ApiOperation("根据学校与微信id查询班级信息")
|
||||
@GetMapping("/getClassBySchoolAndWx")
|
||||
public ResultBean<Dept> getClassBySchoolAndWx(Long schoolId, Long classWxId) {
|
||||
return ResultBean.buildSuccess(deptService.getClassBySchoolAndWx(
|
||||
schoolId, classWxId));
|
||||
}
|
||||
|
||||
@ApiOperation("根据学校类型查询学校")
|
||||
@GetMapping("/listSchoolBySchoolType")
|
||||
public ResultBean<List<Dept>> listSchoolBySchoolType(@RequestParam("schoolType") String schoolType) {
|
||||
return ResultBean.buildSuccess(deptService.list(Wrappers.<Dept>lambdaQuery()
|
||||
.eq(Dept::getDeptType, 0)
|
||||
.like(Dept::getSchoolType, schoolType)));
|
||||
}
|
||||
|
||||
@ApiOperation("同步企业微信部门")
|
||||
@GetMapping("/syncQywxDept")
|
||||
public ResultBean syncQywxDept() {
|
||||
log.info("进入同步企业微信");
|
||||
deptService.syncQywxDept(null);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("同步指定学校企业微信部门")
|
||||
@GetMapping("/syncSchoolDept")
|
||||
public ResultBean<String> syncSchoolDept(@RequestParam Long schoolId) {
|
||||
log.info("同步企业微信部门数据: schoolId: [{}]", schoolId);
|
||||
deptService.syncQywxDept(schoolId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("处理挂载在学校下的部门")
|
||||
@GetMapping("/dealNoParentDept")
|
||||
public ResultBean dealNoParentDept() {
|
||||
deptService.dealNoParentDept();
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("查询学校部门")
|
||||
@GetMapping("/getDeptBySchoolAndWxId")
|
||||
ResultBean<Dept> getDeptBySchoolAndWxId(@RequestParam("schoolId") Long schoolId,
|
||||
@RequestParam("wxId") Long wxId) {
|
||||
return ResultBean.buildSuccess(deptService.getSysDeptByDeptAndWx(Arrays.asList(schoolId), wxId));
|
||||
}
|
||||
|
||||
@ApiOperation("查询学校列表")
|
||||
@PostMapping("/listDept")
|
||||
ResultBean<List<Dept>> listDept(@RequestBody List<Long> ids) {
|
||||
return ResultBean.buildSuccess(deptService.listByIds(ids));
|
||||
}
|
||||
|
||||
@ApiOperation("根据公众号id查询学校")
|
||||
@GetMapping("/getSchoolByAppId")
|
||||
public ResultBean<Dept> getSchoolByAppId(String appId) {
|
||||
Dept school = null;
|
||||
EduDeptWxPublic deptWxPublic = eduDeptWxPublicMapper.selectOne(Wrappers.<EduDeptWxPublic>lambdaQuery()
|
||||
.eq(EduDeptWxPublic::getAppId, appId));
|
||||
if (deptWxPublic != null) {
|
||||
school = deptService.getById(deptWxPublic.getDeptId());
|
||||
}
|
||||
return ResultBean.buildSuccess(school);
|
||||
}
|
||||
|
||||
@ApiOperation("查询教育局,代理商下面学校")
|
||||
@GetMapping("/findSchoolListByDeptId")
|
||||
public ResultBean<Page<SchoolInformationDTO>> findSchoolListByDeptId(
|
||||
@RequestParam(required = false) @ApiParam("学校类型") Integer schoolType,
|
||||
@RequestParam(required = false) @ApiParam("学校性质") Integer natureType,
|
||||
@RequestParam(required = false) @ApiParam("公立,民办") Integer schoolOwnership,
|
||||
@RequestParam(required = false) @ApiParam("学校名称") String schoolName,
|
||||
@RequestParam(required = false) @ApiParam("区域id") String address,
|
||||
@RequestParam(required = false) @ApiParam("标签") String label,
|
||||
@RequestParam(required = false) @ApiParam("部门id") Long deptId,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
||||
|
||||
Page<SchoolInformationDTO> page = new Page();
|
||||
page.setCurrent(pageNum);
|
||||
page.setSize(pageSize);
|
||||
return ResultBean.buildSuccess(deptService
|
||||
.findSchoolListByDeptId(deptId, schoolName, schoolType, natureType, address, label, page, schoolOwnership));
|
||||
}
|
||||
|
||||
@ApiOperation("新增或编辑教育局/代理商与学校关联关系")
|
||||
@PostMapping("/saveOrUpdateDeptSchool")
|
||||
public ResultBean saveOrUpdateDeptSchool(@RequestBody SchoolInformationDTO information) {
|
||||
|
||||
deptService.saveOrUpdateDeptSchool(information);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("条件查询学校(入学早知道学校查询)")
|
||||
@PostMapping("/findSchoolPageList")
|
||||
public ResultBean<Page<SchoolInformationDTO>> findSchoolPageList(@RequestBody FindSchoolPageListDTO dto) {
|
||||
|
||||
Page<SchoolInformationDTO> page = new Page();
|
||||
page.setCurrent(dto.getPageNum());
|
||||
page.setSize(dto.getPageSize());
|
||||
return ResultBean.buildSuccess(deptService
|
||||
.findSchoolPageList(dto.getSchoolName(), dto.getSchoolType(), dto.getNatureType(), page, dto.getTag(),
|
||||
dto.getDeptId(), dto.getSchoolOwnership()));
|
||||
}
|
||||
|
||||
@ApiOperation("根据名称和类型查询教育局学校列表")
|
||||
@PostMapping("/listSchoolPage")
|
||||
// @Cacheable(value = CachePrefixConstant.SCHOOL_LIST_SEARCH, key = "#dto.deptId + '-' + #dto.schoolName")
|
||||
public ResultBean<IPage<SchoolInformationDTO>> listSchoolPage(@RequestBody SchoolPageDTO dto) {
|
||||
IPage<SchoolInformationDTO> page = deptService.listSchoolPage(dto);
|
||||
return ResultBean.buildSuccess(page);
|
||||
}
|
||||
|
||||
@ApiOperation("根据住所查询对应可读学校")
|
||||
@GetMapping("/findSchoolByAddress")
|
||||
public ResultBean<Page<SchoolInformationDTO>> findSchoolByAddress(
|
||||
@RequestParam(required = false) @ApiParam("住所") String address,
|
||||
@RequestParam(required = false) @ApiParam("教育局id或代理商id") Long deptId,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
||||
|
||||
Page<SchoolInformationDTO> page = new Page();
|
||||
page.setCurrent(pageNum);
|
||||
page.setSize(pageSize);
|
||||
return ResultBean.buildSuccess(deptService.findSchoolByAddress(page, address, deptId));
|
||||
}
|
||||
|
||||
@ApiOperation("查询所有标签")
|
||||
@GetMapping("/findDeptLabelList")
|
||||
public ResultBean<Page<EduLabel>> findDeptLabelList(@RequestParam(required = false) @ApiParam("部门id") Long deptId,
|
||||
@RequestParam(required = false) @ApiParam("标签") String label,
|
||||
@RequestParam(required = false) @ApiParam("1为教育局对应下属学校标签,2为学校对应招生政策标签,3为入学咨询标签") Integer type,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
||||
|
||||
Page<EduLabel> page = new Page();
|
||||
page.setCurrent(pageNum);
|
||||
page.setSize(pageSize);
|
||||
return ResultBean.buildSuccess(deptService.findDeptLabelList(page, deptId, type, label));
|
||||
}
|
||||
|
||||
@ApiOperation("新建或修改标签")
|
||||
@PostMapping("/saveOrUpdateLabel")
|
||||
public ResultBean saveOrUpdateLabel(@RequestBody EduLabel label) {
|
||||
label.setType(2);
|
||||
List<EduLabel> list = labelService.list(Wrappers.query(new EduLabel()).lambda().eq(EduLabel::getLabel, label.getLabel())
|
||||
.eq(EduLabel::getDeptId, label.getDeptId()).eq(EduLabel::getType, label.getType()));
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
return ResultBean.buildError("已有该标签请勿重复创建");
|
||||
}
|
||||
deptService.saveOrUpdateLabel(label);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除标签")
|
||||
@GetMapping("/removeLabel")
|
||||
public ResultBean removeLabel(@RequestParam Long id) {
|
||||
deptService.removeLabel(id);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("查询热门词汇")
|
||||
@GetMapping("/findHotWord")
|
||||
public ResultBean<List<EduHotWord>> findHotWord(
|
||||
@RequestParam(defaultValue = "1", required = false) @ApiParam("词汇类型:1-学校招生范围,默认1") Integer type,
|
||||
@RequestParam(required = false) @ApiParam("部门id") Long deptId,
|
||||
@RequestParam(defaultValue = "10", required = false) @ApiParam("返回数量:默认10") Integer num) {
|
||||
|
||||
return ResultBean.buildSuccess(deptService.findHotWord(num, type, deptId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询父级部门集合")
|
||||
@PostMapping("/findParentDeptByChilds")
|
||||
public ResultBean<List<Dept>> findParentDeptByChilds(@RequestBody List<Long> deptIds) {
|
||||
return ResultBean.buildSuccess(deptService.findParentDeptByChild(deptIds));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取部门树")
|
||||
@PostMapping("/getDeptTree")
|
||||
public ResultBean<List> getDeptTree(@RequestBody List<Long> deptIds) {
|
||||
return ResultBean.buildSuccess(deptService.getDeptTree(deptIds));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduDeptFunction;
|
||||
import com.yida.data.system.service.EduDeptFunctionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 系统功能 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/2/21
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统功能(无鉴权)")
|
||||
@RequestMapping("/in/function")
|
||||
public class InDeptFunctionController {
|
||||
|
||||
private final EduDeptFunctionService eduDeptFunctionService;
|
||||
|
||||
@ApiOperation("获取部门是否开通当前功能")
|
||||
@GetMapping("/getDeptFunction")
|
||||
public ResultBean<EduDeptFunction> getDeptFunction(String functionName, Long deptId) {
|
||||
return ResultBean.buildSuccess(eduDeptFunctionService.getOne(Wrappers.lambdaQuery(new EduDeptFunction())
|
||||
.eq(EduDeptFunction::getFunctionName, functionName)
|
||||
.eq(EduDeptFunction::getDeptId, deptId)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.Dict;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.service.DictService;
|
||||
import com.yida.data.system.vo.DictTypePageVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 字典crud
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/dict")
|
||||
public class InDictController {
|
||||
|
||||
@Resource
|
||||
private DictService dictService;
|
||||
|
||||
@GetMapping("/selectDict")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "查询字典")
|
||||
public ResultBean<List<Dict>> selectDict(@ApiParam("类型") @RequestParam String type) {
|
||||
return ResultBean.buildSuccess(dictService.list(Wrappers.lambdaQuery(new Dict())
|
||||
.eq(Dict::getType, type).orderByAsc(Dict::getSort)));
|
||||
}
|
||||
|
||||
@GetMapping("/getDictByTypeAndValueOrLabel")
|
||||
public ResultBean getDictCode(String type, String value, String label) {
|
||||
log.info("参数信息: {},{},{}", type, value, label);
|
||||
if (ObjectUtil.isNotNull(value)) {
|
||||
return ResultBean
|
||||
.buildSuccess(
|
||||
dictService.getOne(Wrappers.lambdaQuery(new Dict()).eq(Dict::getType, type).eq(Dict::getValue, value)));
|
||||
}
|
||||
if (ObjectUtil.isNotNull(label)) {
|
||||
return ResultBean
|
||||
.buildSuccess(
|
||||
dictService.getOne(Wrappers.lambdaQuery(new Dict()).eq(Dict::getType, type).eq(Dict::getLabel, label)));
|
||||
}
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.agent.EduAgentWxPublicReceiver;
|
||||
import com.yida.data.system.service.EduAgentWxPublicReceiverService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Api(tags = "区域后台接收公众号(不鉴权)")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/agentReceiver")
|
||||
public class InEduAgentWxPublicReceiverController {
|
||||
private final EduAgentWxPublicReceiverService eduAgentWxPublicReceiverService;
|
||||
|
||||
|
||||
@ApiOperation("根据学校查询接收人员")
|
||||
@GetMapping("/listReceiverBySchool")
|
||||
ResultBean<List<EduAgentWxPublicReceiver>> listReceiverBySchool(@RequestParam("schoolId") Long schoolId) {
|
||||
return ResultBean.buildSuccess(eduAgentWxPublicReceiverService.listReceiverBySchool(schoolId));
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduApp;
|
||||
import com.yida.data.common.core.entity.system.EduAppTemplate;
|
||||
import com.yida.data.common.core.entity.system.EduQywxServiceProvider;
|
||||
import com.yida.data.system.service.EduAppService;
|
||||
|
||||
import com.yida.data.system.service.EduAppTemplateService;
|
||||
import com.yida.data.system.service.EduQywxServiceProviderService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Api(tags = "企业微信 应用管理(不鉴权)")
|
||||
@RestController
|
||||
@RequestMapping("/in/app")
|
||||
@RequiredArgsConstructor
|
||||
public class InEduAppController {
|
||||
private final EduAppService eduAppService;
|
||||
private final EduAppTemplateService eduAppTemplateService;
|
||||
private final EduQywxServiceProviderService eduQywxServiceProviderService;
|
||||
|
||||
@GetMapping("/getAppBySchoolOrCorpIdAndCode")
|
||||
public ResultBean<EduApp> getAppBySchoolOrCorpIdAndCode(Long schoolId, String corpId, String code) {
|
||||
return ResultBean.buildSuccess(eduAppService.getAppBySchoolOrCorpIdAndCode(schoolId, corpId, code));
|
||||
}
|
||||
|
||||
@GetMapping("/getAppTemplateByTemplateId")
|
||||
public ResultBean<EduAppTemplate> getAppTemplateByTemplateId(String templateId, String serviceCorpId) {
|
||||
return ResultBean.buildSuccess(eduAppTemplateService.getOne(Wrappers.lambdaQuery(new EduAppTemplate())
|
||||
.eq(EduAppTemplate::getTemplateId, templateId)
|
||||
.eq(EduAppTemplate::getServiceCorpId, serviceCorpId)
|
||||
));
|
||||
}
|
||||
|
||||
@GetMapping("/getServiceProviderByServiceCorpId")
|
||||
public ResultBean<EduQywxServiceProvider> getServiceProviderByServiceCorpId(String serviceCorpId) {
|
||||
return ResultBean.buildSuccess(eduQywxServiceProviderService.getOne(Wrappers.lambdaQuery(new EduQywxServiceProvider())
|
||||
.eq(EduQywxServiceProvider::getCorpId, serviceCorpId)
|
||||
));
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduDeptPayType;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.EduDeptPayTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 支付方式配置信息 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/6/22
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "支付方式配置信息(无鉴权)")
|
||||
@RequestMapping("/in/deptPayType")
|
||||
public class InEduDeptPayTypeController {
|
||||
|
||||
private final EduDeptPayTypeService eduDeptPayTypeService;
|
||||
|
||||
@ApiOperation("根据部门id查询支付方式配置")
|
||||
@GetMapping("/getPayTypeByDeptId")
|
||||
public ResultBean<EduDeptPayType> getPayTypeByDeptId(Long deptId) {
|
||||
Asserts.isNotNull(deptId, "部门不能为空");
|
||||
return ResultBean.buildSuccess(eduDeptPayTypeService.getOne(Wrappers.<EduDeptPayType>lambdaQuery()
|
||||
.eq(EduDeptPayType::getDeptId, deptId)));
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduHoliday;
|
||||
import com.yida.data.system.service.EduHolidayService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@Api(tags = "节假日(不鉴权)")
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/in/holiday")
|
||||
public class InEduHolidayController {
|
||||
private final EduHolidayService eduHolidayService;
|
||||
|
||||
@ApiOperation("查询所有节假日")
|
||||
@GetMapping("/listAllHoliday")
|
||||
public ResultBean<List<EduHoliday>> listAllHoliday() {
|
||||
return ResultBean.buildSuccess(eduHolidayService.list());
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduSchoolInquireCommonQuestion;
|
||||
import com.yida.data.system.service.EduInquireQuestionService;
|
||||
import com.yida.data.system.vo.FindPhonePageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@Api(tags = "入学咨询(无鉴权)")
|
||||
@RestController
|
||||
@RequestMapping("/in/inquire")
|
||||
@RequiredArgsConstructor
|
||||
public class InEduInquireController {
|
||||
|
||||
private final EduInquireQuestionService inquireService;
|
||||
|
||||
@ApiOperation("常见问题列表")
|
||||
@GetMapping("/findQuestionPage")
|
||||
public ResultBean<IPage<EduSchoolInquireCommonQuestion>> findQuestionPage(@RequestParam (required = false)@ApiParam("标签id") Long labelId,
|
||||
@RequestParam @ApiParam("部门id") Long deptId,
|
||||
@RequestParam (required = false,defaultValue = "1")Integer pageNum,
|
||||
@RequestParam (required = false,defaultValue = "10")Integer pageSize) {
|
||||
|
||||
Page page = new Page<>();
|
||||
page.setSize(pageSize);
|
||||
page.setCurrent(pageNum);
|
||||
return ResultBean.buildSuccess(inquireService.findQuestionPage(labelId,deptId,page,null));
|
||||
}
|
||||
|
||||
@ApiOperation("咨询电话列表")
|
||||
@GetMapping("/findPhonePage")
|
||||
public ResultBean<IPage<FindPhonePageVO>> findPhonePage(@RequestParam (required = false)@ApiParam("标签id") Long labelId,
|
||||
@RequestParam @ApiParam("部门id") Long deptId,
|
||||
@RequestParam (required = false,defaultValue = "1")Integer pageNum,
|
||||
@RequestParam (required = false,defaultValue = "10")Integer pageSize) {
|
||||
|
||||
Page page = new Page<>();
|
||||
page.setSize(pageSize);
|
||||
page.setCurrent(pageNum);
|
||||
return ResultBean.buildSuccess(inquireService.findPhonePage(labelId,deptId,page,null));
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduPayWxConfig;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.EduPayWxConfigService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
|
||||
@Api(tags = "微信支付配置信息")
|
||||
@RestController
|
||||
@RequestMapping("/in/payWxConfig")
|
||||
@AllArgsConstructor
|
||||
public class InEduPayWxConfigController {
|
||||
private final EduPayWxConfigService eduPayWxConfigService;
|
||||
|
||||
@ApiOperation("根据学校查询微信支付配置")
|
||||
@GetMapping("/getPayWxConfigBySchool")
|
||||
public ResultBean<EduPayWxConfig> getPayWxConfigBySchool(Long schoolId) {
|
||||
Asserts.isNotNull(schoolId, "学校不能为空");
|
||||
return ResultBean.buildSuccess(eduPayWxConfigService.getOne(Wrappers.<EduPayWxConfig>lambdaQuery()
|
||||
.eq(EduPayWxConfig::getSchoolId, schoolId)));
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.school.EduYidaAppAccount;
|
||||
import com.yida.data.system.service.EduAppAccountService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Api(tags = "易达app订阅号(不鉴权)")
|
||||
@RestController
|
||||
@RequestMapping("/in/yida/account")
|
||||
@RequiredArgsConstructor
|
||||
public class InEduYidaAppAccountController {
|
||||
private final EduAppAccountService eduAppAccountService;
|
||||
|
||||
@ApiOperation("根据订阅号id查询订阅号")
|
||||
@GetMapping("/getAccountByAccountId")
|
||||
public ResultBean getAccountByAccountId(String accountId) {
|
||||
return ResultBean.buildSuccess(eduAppAccountService.getOne(Wrappers.lambdaQuery(new EduYidaAppAccount())
|
||||
.eq(EduYidaAppAccount::getYidaAppAccountId, accountId)));
|
||||
}
|
||||
|
||||
@ApiOperation("根据学校id与类型查询订阅号")
|
||||
@GetMapping("/getAccountByType")
|
||||
ResultBean<EduYidaAppAccount> getAccountByType(@RequestParam("schoolId") Long schoolId,
|
||||
@ApiParam("0-家长,1-老师") @RequestParam("type") Integer type) {
|
||||
return ResultBean.buildSuccess(eduAppAccountService.getOne(Wrappers.lambdaQuery(new EduYidaAppAccount())
|
||||
.eq(EduYidaAppAccount::getSchoolId, schoolId)
|
||||
.eq(EduYidaAppAccount::getType, type)));
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.EduYidaApp;
|
||||
import com.yida.data.system.service.EduYidaAppService;
|
||||
import com.yida.data.system.service.IDeptService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Api(tags = "易达 app管理(不鉴权)")
|
||||
@RestController
|
||||
@RequestMapping("/in/yida/app")
|
||||
@RequiredArgsConstructor
|
||||
public class InEduYidaAppController {
|
||||
private final EduYidaAppService eduYidaAppService;
|
||||
private final IDeptService deptService;
|
||||
|
||||
@ApiOperation("根据学校id查询app")
|
||||
@GetMapping("/getAppBySchool")
|
||||
public ResultBean<EduYidaApp> getAppBySchool(Long schoolId) {
|
||||
Dept school = deptService.getById(schoolId);
|
||||
return ResultBean.buildSuccess(school != null ? eduYidaAppService.getById(school.getYidaAppId()) : null);
|
||||
}
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.EduQywxServiceProviderSchool;
|
||||
import com.yida.data.system.service.EduQywxServiceProviderSchoolService;
|
||||
import com.yida.data.system.service.QywxCallbackService;
|
||||
import com.yida.data.system.service.QywxServiceProviderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "企业微信同步")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/qywx")
|
||||
public class InQywxController {
|
||||
|
||||
private final QywxCallbackService qywxCallbackService;
|
||||
private final QywxServiceProviderService qywxServiceProviderService;
|
||||
private final EduQywxServiceProviderSchoolService eduQywxServiceProviderSchoolService;
|
||||
|
||||
@GetMapping("/callback/{corpId}")
|
||||
public String get(@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("echostr") String echostr
|
||||
) {
|
||||
return qywxCallbackService.get(corpId, msgSignature, timestamp, nonce, echostr);
|
||||
}
|
||||
|
||||
@PostMapping("/callback/{corpId}")
|
||||
public String post(@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestBody String body) {
|
||||
return qywxCallbackService.post(corpId, msgSignature, timestamp, nonce, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商代开发应用模板验证URL回调
|
||||
*/
|
||||
@GetMapping("/normal/callback/{corpId}")
|
||||
public String getNormal(@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("echostr") String echostr) {
|
||||
return qywxCallbackService.getNormal(corpId, msgSignature, timestamp, nonce, echostr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商代开发应用模板接口回调
|
||||
*/
|
||||
@PostMapping("/normal/callback/{corpId}")
|
||||
public String postNormal(@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestBody String body) {
|
||||
return qywxCallbackService.postNormal(corpId, msgSignature, timestamp, nonce, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商代开发应用客户验证URL回调
|
||||
*/
|
||||
@GetMapping("/normal/customer/callback/{providerCorpId}/{corpId}")
|
||||
public String getNormalCustomer(@PathVariable String providerCorpId,
|
||||
@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("echostr") String echostr) {
|
||||
return qywxCallbackService.getNormalCustomer(providerCorpId, corpId, msgSignature, timestamp, nonce, echostr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商代开发应用客户接口回调
|
||||
* 此回调暂不做任何处理
|
||||
*/
|
||||
@PostMapping("/normal/customer/callback/{providerCorpId}/{corpId}")
|
||||
public String postNormalCustomer(
|
||||
@PathVariable String providerCorpId,
|
||||
@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestBody String body) {
|
||||
return qywxCallbackService.postNormalCustomer(providerCorpId, corpId, msgSignature, timestamp, nonce, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商代开发应用验证URL回调
|
||||
*/
|
||||
@GetMapping("/event/callback/{providerCorpId}/{corpId}")
|
||||
public String getEvent(@PathVariable String providerCorpId,
|
||||
@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("echostr") String echostr) {
|
||||
return qywxCallbackService.getEvent(providerCorpId, corpId, msgSignature, timestamp, nonce, echostr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商代开发应用回调
|
||||
*/
|
||||
@PostMapping("/event/callback/{providerCorpId}/{corpId}")
|
||||
public String postEvent(
|
||||
@PathVariable String providerCorpId,
|
||||
@PathVariable String corpId,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestBody String body) {
|
||||
return qywxCallbackService.postEvent(providerCorpId, corpId, msgSignature, timestamp, nonce, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密对应服务商的学校corpId
|
||||
*/
|
||||
@GetMapping("/changeCorpId/{providerCorpId}/{corpId}")
|
||||
public ResultBean<String> changeCorpId(@PathVariable String providerCorpId, @PathVariable String corpId) {
|
||||
qywxServiceProviderService.changeCorpId(providerCorpId, corpId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商对应学校加密corpId数据(原始值为key)
|
||||
*/
|
||||
@GetMapping("/getCorpByOriginalData")
|
||||
public ResultBean<EduQywxServiceProviderSchool> getCorpByOriginalData(@RequestParam String providerCorpId,
|
||||
@RequestParam String deptOriginalCorpId) {
|
||||
EduQywxServiceProviderSchool providerSchool = eduQywxServiceProviderSchoolService.getOne(Wrappers.lambdaQuery(new EduQywxServiceProviderSchool())
|
||||
.eq(EduQywxServiceProviderSchool::getProviderCorpId, providerCorpId)
|
||||
.eq(EduQywxServiceProviderSchool::getDeptOriginalCorpId, deptOriginalCorpId));
|
||||
return ResultBean.buildSuccess(providerSchool);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商对应学校加密corpId数据(加密值为key)
|
||||
*/
|
||||
@GetMapping("/getCorpByEncryptionData")
|
||||
public ResultBean<EduQywxServiceProviderSchool> getCorpByEncryptionData(@RequestParam String providerCorpId,
|
||||
@RequestParam String deptEncryptionCorpId) {
|
||||
EduQywxServiceProviderSchool providerSchool = eduQywxServiceProviderSchoolService.getOne(Wrappers.lambdaQuery(new EduQywxServiceProviderSchool())
|
||||
.eq(EduQywxServiceProviderSchool::getProviderCorpId, providerCorpId)
|
||||
.eq(EduQywxServiceProviderSchool::getDeptEncryptionCorpId, deptEncryptionCorpId));
|
||||
return ResultBean.buildSuccess(providerSchool);
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.Role;
|
||||
import com.yida.data.system.service.IRoleService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Api(tags = "角色管理 不鉴权")
|
||||
@RestController
|
||||
@RequestMapping("/in/role")
|
||||
public class InRoleController {
|
||||
@Resource
|
||||
private IRoleService roleService;
|
||||
|
||||
@ApiOperation("根据角色名查询角色 不存在进行新增")
|
||||
@GetMapping("/getRoleByName")
|
||||
public ResultBean<Role> getRoleByName(String roleName) {
|
||||
return ResultBean.buildSuccess(roleService.getRoleByNameOrCreate(roleName));
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.UPayConfig;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.UPayConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 收钱吧支付配置信息 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/3/21
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "收钱吧支付配置信息(无鉴权)")
|
||||
@RequestMapping("/in/uPayConfig")
|
||||
public class InUPayConfigController {
|
||||
|
||||
private final UPayConfigService uPayConfigService;
|
||||
|
||||
@ApiOperation("根据部门查询收钱吧支付配置信息")
|
||||
@GetMapping("/getUPayConfigByDept")
|
||||
public ResultBean<UPayConfig> getUPayConfigByDept(Long deptId) {
|
||||
Asserts.isNotNull(deptId, "部门不能为空");
|
||||
return ResultBean.buildSuccess(uPayConfigService.getOne(Wrappers.lambdaQuery(new UPayConfig())
|
||||
.eq(UPayConfig::getDeptId, deptId))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.UnionPayConfig;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.system.service.UnionPayConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 银联云闪付支付配置信息 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/6/23
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "银联云闪付支付配置信息(无鉴权)")
|
||||
@RequestMapping("/in/unionPayConfig")
|
||||
public class InUnionPayConfigController {
|
||||
|
||||
private final UnionPayConfigService unionPayConfigService;
|
||||
|
||||
@ApiOperation("根据部门查询银联云闪付支付配置")
|
||||
@GetMapping("/getUnionPayConfigByDept")
|
||||
public ResultBean<UnionPayConfig> getUnionPayConfigByDept(Long deptId) {
|
||||
Asserts.isNotNull(deptId, "部门不能为空");
|
||||
return ResultBean.buildSuccess(unionPayConfigService.getUnionPayConfigByDept(deptId));
|
||||
}
|
||||
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.SystemUser;
|
||||
import com.yida.data.system.service.IUserRoleService;
|
||||
import com.yida.data.system.service.IUserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/user")
|
||||
public class InUserController {
|
||||
|
||||
private final IUserRoleService userRoleService;
|
||||
private final IUserService userService;
|
||||
|
||||
@ApiOperation("根据手机号绑定角色关系")
|
||||
@GetMapping("/bindRoleByMobile")
|
||||
public ResultBean bindRoleByMobile(@RequestParam String mobile, @RequestParam String roleName) {
|
||||
userRoleService.bindRoleByMobile(mobile, roleName);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("根据微信号绑定角色关系")
|
||||
@GetMapping("/bindRoleByUser")
|
||||
public ResultBean bindRoleByUser(@RequestParam Long sysUserId, @RequestParam String roleName) {
|
||||
userRoleService.bindRoleByUser(sysUserId, roleName);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("/查询用户信息")
|
||||
@GetMapping("/getInfoByUsername")
|
||||
public ResultBean<SystemUser> getInfoByUsername(String username) {
|
||||
return ResultBean.buildSuccess(userService.findUserDetail(username));
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping("/add")
|
||||
public ResultBean add(@RequestBody SystemUser systemUser) {
|
||||
return ResultBean.buildSuccess(userService.createUser(systemUser));
|
||||
}
|
||||
|
||||
@ApiOperation("订阅易达app")
|
||||
@GetMapping("/subscribeYidaApp")
|
||||
public ResultBean subscribeYidaApp(@ApiParam("易达app用户id") String userId,
|
||||
@ApiParam("学校id") Long schoolId,
|
||||
@ApiParam("订阅号类型,0-家长,1-老师") Integer type) {
|
||||
userService.subscribeYidaApp(userId, schoolId, type);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("根据角色名修改用户角色")
|
||||
@PostMapping("/updateUserRoleByRoleName")
|
||||
public ResultBean updateUserRoleByRoleName(@RequestParam Long userId, @RequestBody List<String> roleNames) {
|
||||
userService.updateUserRoleByRoleName(userId, roleNames);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("获取企业微信用户授权后创建职工用户信息")
|
||||
@GetMapping("createStaff")
|
||||
public ResultBean<String> createStaff(@ApiParam("学校Id") Long schoolId,
|
||||
@ApiParam("通过成员授权获取到的code") String code) {
|
||||
userService.createStaff(schoolId, code);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.WhiteList;
|
||||
import com.yida.data.system.service.WhiteListService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 白名单 Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/2/21
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "白名单(无鉴权)")
|
||||
@RequestMapping("/in/whiteList")
|
||||
public class InWhiteListController {
|
||||
|
||||
private final WhiteListService whiteListService;
|
||||
|
||||
@ApiOperation("根据功能名称获取对应的白名单信息")
|
||||
@GetMapping("/getWhiteList")
|
||||
public ResultBean<WhiteList> getWhiteList(String functionName) {
|
||||
return ResultBean.buildSuccess(whiteListService.getOne(Wrappers.lambdaQuery(new WhiteList())
|
||||
.eq(WhiteList::getFunctionName, functionName)));
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
|
||||
import com.yida.data.system.service.WxPublicService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(tags = "微信公众号同步")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/wxPublic")
|
||||
public class InWxPublicController {
|
||||
|
||||
private final WxPublicService wxPublicService;
|
||||
|
||||
@GetMapping("/callback/{appId}")
|
||||
public String get(@RequestParam("signature") String signature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("echostr") String echostr,
|
||||
@PathVariable("appId") String appId) {
|
||||
return wxPublicService.get(signature, timestamp, nonce, echostr, appId);
|
||||
}
|
||||
|
||||
@PostMapping("/callback/{appId}")
|
||||
public String post(
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestBody String body,
|
||||
@PathVariable("appId") String appId) {
|
||||
wxPublicService.post(msgSignature, timestamp, nonce, body, appId);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.Log;
|
||||
import com.yida.data.common.core.utils.ExcelUtil;
|
||||
import com.yida.data.system.dto.ListLogDTO;
|
||||
import com.yida.data.system.service.LogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Api("日志")
|
||||
@Slf4j
|
||||
@RequestMapping(value = "/log")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class LogController {
|
||||
|
||||
private final LogService logService;
|
||||
|
||||
@GetMapping(value = "/listLog")
|
||||
public ResultBean<Page<Log>> findLogPageList(ListLogDTO dto) {
|
||||
try {
|
||||
return ResultBean.buildSuccess(logService.findLogPageList(dto));
|
||||
} catch (Exception e) {
|
||||
log.error("查询日志列表数据失败: {}", e.getMessage(), e);
|
||||
return ResultBean.buildError("查询失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/export")
|
||||
public void exportLog(ListLogDTO dto, HttpServletResponse response) {
|
||||
Page<Log> list = logService.findLogPageList(dto);
|
||||
ExcelUtil.export("日志", Log.class, list.getContent(), response);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.QueryRequest;
|
||||
import com.yida.data.common.core.entity.constant.StringConstant;
|
||||
import com.yida.data.common.core.entity.system.LoginLog;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.service.ILoginLogService;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("loginLog")
|
||||
public class LoginLogController {
|
||||
|
||||
private final ILoginLogService loginLogService;
|
||||
|
||||
@GetMapping
|
||||
public FebsResponse loginLogList(LoginLog loginLog, QueryRequest request) {
|
||||
Map<String, Object> dataTable = FebsUtil.getDataTable(this.loginLogService.findLoginLogs(loginLog, request));
|
||||
return new FebsResponse().data(dataTable);
|
||||
}
|
||||
|
||||
@GetMapping("currentUser")
|
||||
public FebsResponse getUserLastSevenLoginLogs() {
|
||||
String currentUsername = FebsUtil.getCurrentUsername();
|
||||
List<LoginLog> userLastSevenLoginLogs = this.loginLogService.findUserLastSevenLoginLogs(currentUsername);
|
||||
return new FebsResponse().data(userLastSevenLoginLogs);
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
@PreAuthorize("hasAuthority('loginlog:delete')")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "删除登录日志", type = OperationLogTypeEnum.DELETE)
|
||||
public void deleteLogs(@NotBlank(message = "{required}") @PathVariable String ids) {
|
||||
String[] loginLogIds = ids.split(StringConstant.COMMA);
|
||||
this.loginLogService.deleteLoginLogs(loginLogIds);
|
||||
}
|
||||
|
||||
@PostMapping("excel")
|
||||
@PreAuthorize("hasAuthority('loginlog:export')")
|
||||
public void export(QueryRequest request, LoginLog loginLog, HttpServletResponse response) {
|
||||
List<LoginLog> loginLogs = this.loginLogService.findLoginLogs(loginLog, request).getRecords();
|
||||
//ExcelKit.$Export(LoginLog.class, response).downXlsx(loginLogs, false);
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.constant.StringConstant;
|
||||
import com.yida.data.common.core.entity.router.VueRouter;
|
||||
import com.yida.data.common.core.entity.system.Menu;
|
||||
import com.yida.data.common.core.entity.system.Role;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.service.IMenuService;
|
||||
import com.yida.data.system.service.IRoleService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/menu")
|
||||
public class MenuController {
|
||||
|
||||
private final IMenuService menuService;
|
||||
|
||||
private final IRoleService roleService;
|
||||
|
||||
@GetMapping("/{username}")
|
||||
public FebsResponse getUserRouters(@NotBlank(message = "{required}") @PathVariable String username) {
|
||||
Map<String, Object> result = new HashMap<>(4);
|
||||
List<VueRouter<Menu>> userRouters = this.menuService.getUserRouters(username);
|
||||
List<Menu> userRealMenus = this.menuService.findUserRealMenus(username, null);
|
||||
String userPermissions = userRealMenus.stream().map(Menu::getPerms).collect(Collectors.joining(StringConstant.COMMA));
|
||||
List<Role> userRoleList = this.roleService.findUserRole(username);
|
||||
List<Role> mainRoleList = this.roleService.findMainRole(username);
|
||||
|
||||
String[] permissionArray = new String[0];
|
||||
if (StringUtils.isNoneBlank(userPermissions)) {
|
||||
permissionArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(userPermissions, StringConstant.COMMA);
|
||||
}
|
||||
// 判断登录用户角色信息
|
||||
String[] roleArray = new String[0];
|
||||
if (!CollectionUtils.isEmpty(userRoleList)) {
|
||||
String userRoles = userRoleList.stream()
|
||||
.filter(role -> Objects.nonNull(role) && StringUtils.isNotBlank(role.getRolePerms()))
|
||||
.map(Role::getRolePerms)
|
||||
.collect(Collectors.joining(StringConstant.COMMA));
|
||||
if (StringUtils.isNoneBlank(userPermissions)) {
|
||||
roleArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(userRoles, StringConstant.COMMA);
|
||||
}
|
||||
}
|
||||
// 判断登录主角色信息
|
||||
String[] mainRoleArray = new String[0];
|
||||
if (!CollectionUtils.isEmpty(mainRoleList)) {
|
||||
String mainRoles = mainRoleList.stream()
|
||||
.filter(role -> Objects.nonNull(role) && StringUtils.isNotBlank(role.getRolePerms()))
|
||||
.map(Role::getRolePerms)
|
||||
.collect(Collectors.joining(StringConstant.COMMA));
|
||||
if (StringUtils.isNoneBlank(mainRoles)) {
|
||||
mainRoleArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(mainRoles, StringConstant.COMMA);
|
||||
}
|
||||
}
|
||||
|
||||
result.put("routes", userRouters);
|
||||
result.put("permissions", permissionArray);
|
||||
result.put("roles", roleArray);
|
||||
result.put("mainRoles", mainRoleArray);
|
||||
return new FebsResponse().data(result);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public FebsResponse menuList(Menu menu) {
|
||||
Map<String, Object> menus = this.menuService.findMenus(menu);
|
||||
return new FebsResponse().data(menus);
|
||||
}
|
||||
|
||||
@GetMapping("/permissions")
|
||||
public String findUserPermissions(String username) {
|
||||
return this.menuService.findUserPermissions(username);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("hasAuthority('menu:add')")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "新增菜单/按钮", type = OperationLogTypeEnum.INSERT)
|
||||
public void addMenu(@Valid Menu menu) {
|
||||
this.menuService.createMenu(menu);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{menuIds}")
|
||||
@PreAuthorize("hasAuthority('menu:delete')")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "删除菜单/按钮", type = OperationLogTypeEnum.DELETE)
|
||||
public void deleteMenus(@NotBlank(message = "{required}") @PathVariable String menuIds) {
|
||||
String[] ids = menuIds.split(StringConstant.COMMA);
|
||||
this.menuService.deleteMeuns(ids);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@PreAuthorize("hasAuthority('menu:update')")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "修改菜单/按钮", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updateMenu(@Valid Menu menu) {
|
||||
this.menuService.updateMenu(menu);
|
||||
}
|
||||
|
||||
@PostMapping("excel")
|
||||
@PreAuthorize("hasAuthority('menu:export')")
|
||||
public void export(Menu menu, HttpServletResponse response) {
|
||||
List<Menu> menus = this.menuService.findMenuList(menu);
|
||||
//ExcelKit.$Export(Menu.class, response).downXlsx(menus, false);
|
||||
}
|
||||
|
||||
@ApiOperation("根据登录账号查询菜单数, 角色相关菜单数据")
|
||||
@GetMapping("/listMenuByUserNameNoCheck")
|
||||
public FebsResponse listMenuByUserNameNoCheck(@RequestParam String username) {
|
||||
Map<String, Object> menus = this.menuService.listMenuByUserNameNoCheck(username);
|
||||
return new FebsResponse().data(menus);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.EduDeptWxPublic;
|
||||
import com.yida.data.system.mapper.EduDeptWxPublicMapper;
|
||||
import com.yida.data.system.service.IDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@Validated
|
||||
@Api(tags = "部门管理(无鉴权 外部使用)")
|
||||
@RestController
|
||||
@RequestMapping("/out/dept")
|
||||
@RequiredArgsConstructor
|
||||
public class OutDeptController {
|
||||
|
||||
private final IDeptService deptService;
|
||||
private final EduDeptWxPublicMapper eduDeptWxPublicMapper;
|
||||
|
||||
@ApiOperation("根据公众号id查询学校")
|
||||
@GetMapping("/getSchoolByAppId")
|
||||
public ResultBean<Dept> getSchoolByAppId(String appId) {
|
||||
Dept school = null;
|
||||
EduDeptWxPublic deptWxPublic = eduDeptWxPublicMapper.selectOne(Wrappers.<EduDeptWxPublic>lambdaQuery()
|
||||
.eq(EduDeptWxPublic::getAppId, appId));
|
||||
if (deptWxPublic != null) {
|
||||
school = deptService.getById(deptWxPublic.getDeptId());
|
||||
}
|
||||
return ResultBean.buildSuccess(school);
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.system.service.QywxService;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 企业微信初始化数据API
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/11/25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/qywx")
|
||||
public class QywxController {
|
||||
|
||||
private final QywxService qywxService;
|
||||
|
||||
@ApiOperation("初始化家校部门信息")
|
||||
@GetMapping("/initSchoolDept")
|
||||
public ResultBean initSchoolDept(@ApiParam @RequestParam Long schoolId) {
|
||||
qywxService.initSchoolDept(schoolId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("初始化通讯录部门信息")
|
||||
@GetMapping("/initDept")
|
||||
public ResultBean initDept(@ApiParam @RequestParam Long schoolId) {
|
||||
qywxService.initDept(schoolId);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("初始化职工信息")
|
||||
@GetMapping("/initStaff")
|
||||
public ResultBean initStaff(@ApiParam @RequestParam Long schoolId) {
|
||||
qywxService.initStaff(schoolId, FebsUtil.getCurrentUser());
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("初始化学生和家长信息")
|
||||
@GetMapping("/initUser")
|
||||
public ResultBean initUser(@ApiParam @RequestParam Long schoolId) {
|
||||
qywxService.initUser(schoolId, FebsUtil.getCurrentUser());
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.QueryRequest;
|
||||
import com.yida.data.common.core.entity.constant.StringConstant;
|
||||
import com.yida.data.common.core.entity.system.Role;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.service.IRoleService;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("role")
|
||||
public class RoleController {
|
||||
|
||||
private final IRoleService roleService;
|
||||
|
||||
@GetMapping
|
||||
public FebsResponse roleList(QueryRequest queryRequest, Role role) {
|
||||
Map<String, Object> dataTable = FebsUtil.getDataTable(roleService.findRoles(role, queryRequest));
|
||||
return new FebsResponse().data(dataTable);
|
||||
}
|
||||
|
||||
@GetMapping("options")
|
||||
public FebsResponse roles() {
|
||||
List<Role> allRoles = roleService.findAllRoles();
|
||||
return new FebsResponse().data(allRoles);
|
||||
}
|
||||
|
||||
@GetMapping("check/{roleName}")
|
||||
public boolean checkRoleName(@NotBlank(message = "{required}") @PathVariable String roleName) {
|
||||
Role result = this.roleService.findByName(roleName);
|
||||
return result == null;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("hasAuthority('role:add')")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "新增角色", type = OperationLogTypeEnum.INSERT)
|
||||
public void addRole(@Valid Role role) {
|
||||
this.roleService.createRole(role);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{roleIds}")
|
||||
@PreAuthorize("hasAuthority('role:delete')")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "删除角色失败", type = OperationLogTypeEnum.DELETE)
|
||||
public void deleteRoles(@NotBlank(message = "{required}") @PathVariable String roleIds) {
|
||||
String[] ids = roleIds.split(StringConstant.COMMA);
|
||||
this.roleService.deleteRoles(ids);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@PreAuthorize("hasAuthority('role:update')")
|
||||
@OperationLog(module = ModuleName.SYSTEM, methods = "修改角色", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updateRole(@Valid Role role) {
|
||||
this.roleService.updateRole(role);
|
||||
}
|
||||
|
||||
@PostMapping("excel")
|
||||
@PreAuthorize("hasAuthority('role:export')")
|
||||
public void export(QueryRequest queryRequest, Role role, HttpServletResponse response) {
|
||||
List<Role> roles = this.roleService.findRoles(role, queryRequest).getRecords();
|
||||
//ExcelKit.$Export(Role.class, response).downXlsx(roles, false);
|
||||
}
|
||||
|
||||
@ApiOperation("根据角色查询菜单")
|
||||
@GetMapping("/listMenuByRole")
|
||||
public ResultBean<List> listMenuByRole(@ApiParam("角色id") @RequestParam Long[] roleIds) {
|
||||
return ResultBean.buildSuccess(roleService.listMenuByRole(roleIds));
|
||||
}
|
||||
|
||||
@ApiOperation("根据角色查询菜单")
|
||||
@GetMapping("/listMenuByRoleName")
|
||||
public ResultBean<List> listMenuByRoleName(@ApiParam("角色名称") @RequestParam String[] roleNames) {
|
||||
return ResultBean.buildSuccess(roleService.listMenuByRoleName(roleNames));
|
||||
}
|
||||
|
||||
@ApiOperation("根据角色名查询角色 不存在进行新增")
|
||||
@GetMapping("/getRoleByName")
|
||||
public ResultBean<Role> getRoleByName(String roleName) {
|
||||
return ResultBean.buildSuccess(roleService.getRoleByNameOrCreate(roleName));
|
||||
}
|
||||
}
|
||||
+322
@@ -0,0 +1,322 @@
|
||||
package com.yida.data.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.QueryRequest;
|
||||
import com.yida.data.common.core.entity.constant.StringConstant;
|
||||
import com.yida.data.common.core.entity.system.EduUserLogo;
|
||||
import com.yida.data.common.core.entity.system.LoginLog;
|
||||
import com.yida.data.common.core.entity.system.SystemUser;
|
||||
import com.yida.data.common.core.entity.system.SystemUserMenu;
|
||||
import com.yida.data.common.core.entity.system.UserRole;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.common.core.utils.ExcelUtil;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.system.dto.MenuForUserDTO;
|
||||
import com.yida.data.system.service.EduUserLogoService;
|
||||
import com.yida.data.system.service.ILoginLogService;
|
||||
import com.yida.data.system.service.IUserDataPermissionService;
|
||||
import com.yida.data.system.service.IUserRoleService;
|
||||
import com.yida.data.system.service.IUserService;
|
||||
import com.yida.data.system.service.SystemUserMenuService;
|
||||
import com.yida.data.system.vo.ExportUserInfoVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("user")
|
||||
public class UserController {
|
||||
|
||||
private final IUserService userService;
|
||||
private final IUserDataPermissionService userDataPermissionService;
|
||||
private final ILoginLogService loginLogService;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final IUserRoleService userRoleService;
|
||||
private final SystemUserMenuService systemUserMenuService;
|
||||
private final EduUserLogoService eduUserLogoService;
|
||||
|
||||
@GetMapping("success")
|
||||
public void loginSuccess(HttpServletRequest request) {
|
||||
String currentUsername = FebsUtil.getCurrentUsername();
|
||||
// update last login time
|
||||
userService.updateLoginTime(currentUsername);
|
||||
// save login log
|
||||
LoginLog loginLog = new LoginLog();
|
||||
loginLog.setUsername(currentUsername);
|
||||
loginLog.setSystemBrowserInfo(request.getHeader("user-agent"));
|
||||
loginLogService.saveLoginLog(loginLog);
|
||||
}
|
||||
|
||||
@GetMapping("index")
|
||||
public FebsResponse index() {
|
||||
Map<String, Object> data = new HashMap<>(5);
|
||||
// 获取系统访问记录
|
||||
Long totalVisitCount = loginLogService.findTotalVisitCount();
|
||||
data.put("totalVisitCount", totalVisitCount);
|
||||
Long todayVisitCount = loginLogService.findTodayVisitCount();
|
||||
data.put("todayVisitCount", todayVisitCount);
|
||||
Long todayIp = loginLogService.findTodayIp();
|
||||
data.put("todayIp", todayIp);
|
||||
// 获取近期系统访问记录
|
||||
List<Map<String, Object>> lastTenVisitCount = loginLogService.findLastTenDaysVisitCount(null);
|
||||
data.put("lastTenVisitCount", lastTenVisitCount);
|
||||
SystemUser param = new SystemUser();
|
||||
param.setUsername(FebsUtil.getCurrentUsername());
|
||||
List<Map<String, Object>> lastTenUserVisitCount = loginLogService.findLastTenDaysVisitCount(param);
|
||||
data.put("lastTenUserVisitCount", lastTenUserVisitCount);
|
||||
return new FebsResponse().data(data);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping
|
||||
// @PreAuthorize("hasAuthority('user:view') and hasAnyRole('role:admin', 'role:agent:admin', 'role:education:principal')")
|
||||
public FebsResponse userList(QueryRequest queryRequest, SystemUser user) {
|
||||
Map<String, Object> dataTable = FebsUtil.getDataTable(userService.findUserDetailList(user, queryRequest));
|
||||
return new FebsResponse().data(dataTable);
|
||||
}
|
||||
|
||||
@GetMapping("check/{username}")
|
||||
public boolean checkUserName(@NotBlank(message = "{required}") @PathVariable String username) {
|
||||
return userService.findByName(username) == null;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("hasAuthority('user:add')")
|
||||
@OperationLog(module = ModuleName.USER, methods = "新增用户", type = OperationLogTypeEnum.INSERT)
|
||||
public void addUser(@Valid SystemUser user) {
|
||||
userService.createUser(user);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@PreAuthorize("hasAuthority('user:update')")
|
||||
@OperationLog(module = ModuleName.USER, methods = "修改用户", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updateUser(@Valid SystemUser user) {
|
||||
userService.updateUser(user);
|
||||
}
|
||||
|
||||
@GetMapping("/{userId}")
|
||||
@PreAuthorize("hasAuthority('user:update')")
|
||||
public FebsResponse findUserDataPermissions(@NotBlank(message = "{required}") @PathVariable String userId) {
|
||||
String dataPermissions = userDataPermissionService.findByUserId(userId);
|
||||
return new FebsResponse().data(dataPermissions);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{userIds}")
|
||||
@PreAuthorize("hasAuthority('user:delete')")
|
||||
@OperationLog(module = ModuleName.USER, methods = "删除用户", type = OperationLogTypeEnum.DELETE)
|
||||
public void deleteUsers(@NotBlank(message = "{required}") @PathVariable String userIds) {
|
||||
String[] ids = userIds.split(StringConstant.COMMA);
|
||||
userService.deleteUsers(ids);
|
||||
}
|
||||
|
||||
@GetMapping("/updatePassword")
|
||||
@OperationLog(module = ModuleName.USER, methods = "修改密码", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updatePassword(String password, String newPassword, String repeatPassword) {
|
||||
userService.updatePassword(password, newPassword, repeatPassword, FebsUtil.getCurrentUsername());
|
||||
}
|
||||
|
||||
@GetMapping("/validatePassword")
|
||||
public ResultBean validatePassword(String password) {
|
||||
userService.validatePassword(password, FebsUtil.getCurrentUsername());
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@PutMapping("profile")
|
||||
@OperationLog(module = ModuleName.USER, methods = "修改个人信息", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updateProfile(@Valid SystemUser user) throws FebsException {
|
||||
userService.updateProfile(user);
|
||||
}
|
||||
|
||||
@PutMapping("avatar")
|
||||
@OperationLog(module = ModuleName.USER, methods = "修改头像", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updateAvatar(@NotBlank(message = "{required}") String avatar) {
|
||||
userService.updateAvatar(avatar);
|
||||
}
|
||||
|
||||
@GetMapping("password/check")
|
||||
public boolean checkPassword(@NotBlank(message = "{required}") String password) {
|
||||
String currentUsername = FebsUtil.getCurrentUsername();
|
||||
SystemUser user = userService.findByName(currentUsername);
|
||||
return user != null && passwordEncoder.matches(password, user.getPassword());
|
||||
}
|
||||
|
||||
@PutMapping("password")
|
||||
@OperationLog(module = ModuleName.USER, methods = "修改密码", type = OperationLogTypeEnum.UPDATE)
|
||||
public void updatePassword(@NotBlank(message = "{required}") String password) {
|
||||
userService.updatePassword(password);
|
||||
}
|
||||
|
||||
@PutMapping("password/reset")
|
||||
@PreAuthorize("hasAuthority('user:reset')")
|
||||
@OperationLog(module = ModuleName.USER, methods = "重置用户密码", type = OperationLogTypeEnum.UPDATE)
|
||||
public void resetPassword(@NotBlank(message = "{required}") String usernames) {
|
||||
String[] usernameArr = usernames.split(StringConstant.COMMA);
|
||||
userService.resetPassword(usernameArr);
|
||||
}
|
||||
|
||||
@PostMapping("excel")
|
||||
@PreAuthorize("hasAuthority('user:export')")
|
||||
public void export(QueryRequest queryRequest, SystemUser user, HttpServletResponse response) {
|
||||
List<SystemUser> users = userService.findUserDetailList(user, queryRequest).getRecords();
|
||||
List<ExportUserInfoVO> userInfoVOS = users.stream().map(x -> {
|
||||
ExportUserInfoVO userInfoVO = new ExportUserInfoVO();
|
||||
BeanUtils.copyProperties(x, userInfoVO);
|
||||
userInfoVO.setSex("0".equals(x.getSex()) ? "男" : "1".equals(x.getSex()) ? "女" : "保密");
|
||||
userInfoVO.setStatus("0".equals(x.getStatus()) ? "锁定" : "有效");
|
||||
return userInfoVO;
|
||||
}).collect(Collectors.toList());
|
||||
ExcelUtil.export("用户数据", ExportUserInfoVO.class, userInfoVOS, response);
|
||||
}
|
||||
|
||||
@GetMapping("/getInfoByUsername")
|
||||
public ResultBean getInfoByUsername(String username) {
|
||||
return ResultBean.buildSuccess(userService.findUserDetail(username));
|
||||
}
|
||||
|
||||
@GetMapping("/getInfoById")
|
||||
public ResultBean getInfoById(Long id) {
|
||||
return ResultBean.buildSuccess(userService.getOne(Wrappers.lambdaQuery(new SystemUser()).eq(SystemUser::getUserId, id)));
|
||||
}
|
||||
|
||||
@GetMapping("/listInfoById")
|
||||
public ResultBean listInfoById(Long[] ids) {
|
||||
return ResultBean.buildSuccess(userService.listByIds(Arrays.asList(ids)));
|
||||
}
|
||||
|
||||
@ApiOperation("锁定或解锁用户")
|
||||
@GetMapping("/lockUser")
|
||||
@OperationLog(module = ModuleName.USER, methods = "锁定或解锁用户", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean lockUser(Long id) {
|
||||
userService.lockUser(id);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("重置密码")
|
||||
@GetMapping("/resetPwd")
|
||||
@OperationLog(module = ModuleName.USER, methods = "重置密码", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean resetPwd(Long id) {
|
||||
userService.resetPwd(id);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping("/add")
|
||||
@OperationLog(module = ModuleName.USER, methods = "添加用户", type = OperationLogTypeEnum.INSERT)
|
||||
public ResultBean add(@RequestBody SystemUser systemUser) {
|
||||
return ResultBean.buildSuccess(userService.createUser(systemUser));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@OperationLog(module = ModuleName.USER, methods = "修改用户", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean updateUserWithName(@RequestBody SystemUser user) {
|
||||
userService.updateUserWithName(user);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除用户")
|
||||
@PostMapping("/delUser")
|
||||
@OperationLog(module = ModuleName.USER, methods = "批量删除用户", type = OperationLogTypeEnum.DELETE)
|
||||
public ResultBean delUser(@RequestBody String[] ids) {
|
||||
userService.deleteUsers(ids);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户角色")
|
||||
@PostMapping("/addUserRole")
|
||||
@OperationLog(module = ModuleName.USER, methods = "添加用户角色", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean addUserRole(@RequestBody UserRole[] userRole) {
|
||||
userRoleService.bindRoleByRoleName(userRole);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("绑定openId")
|
||||
@GetMapping("/bindOpenId")
|
||||
public ResultBean bindOpenId(Long userId, String openId) {
|
||||
SystemUser user = new SystemUser();
|
||||
user.setUserId(userId);
|
||||
user.setOpenId(openId);
|
||||
userService.updateById(user);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("新增用户对应菜单")
|
||||
@PostMapping("/saveUserMenu")
|
||||
@OperationLog(module = ModuleName.USER, methods = "新增用户对应菜单", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean saveUserMenu(@RequestBody MenuForUserDTO menuForUserDTO) {
|
||||
systemUserMenuService.saveUserMenu(menuForUserDTO);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户对应菜单")
|
||||
@PostMapping("/updateUserMenu")
|
||||
@OperationLog(module = ModuleName.USER, methods = "修改用户对应菜单", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean updateUserMenu(@RequestBody MenuForUserDTO menuForUserDTO) {
|
||||
systemUserMenuService.updateUserMenu(menuForUserDTO);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户对应菜单")
|
||||
@GetMapping("/removeUserMenu")
|
||||
@OperationLog(module = ModuleName.USER, methods = "删除用户对应菜单", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean removeUserMenu(@ApiParam("用户id") @RequestParam Long userId) {
|
||||
systemUserMenuService.remove(Wrappers.lambdaQuery(new SystemUserMenu())
|
||||
.eq(SystemUserMenu::getUserId, userId));
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户对应菜单")
|
||||
@GetMapping("/findUserMenu")
|
||||
public ResultBean<List<Long>> findUserMenu(@ApiParam("用户id") @RequestParam Long userId) {
|
||||
return ResultBean.buildSuccess(systemUserMenuService.findUserMenu(userId));
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户菜单logo")
|
||||
@GetMapping("/getLogo")
|
||||
public ResultBean<EduUserLogo> getLogo(Long userId) {
|
||||
return ResultBean.buildSuccess(eduUserLogoService.getById(userId));
|
||||
}
|
||||
|
||||
@ApiOperation("保存logo")
|
||||
@PostMapping("/saveLogo")
|
||||
@OperationLog(module = ModuleName.USER, methods = "保存logo", type = OperationLogTypeEnum.INSERT)
|
||||
public ResultBean saveLogo(@RequestBody EduUserLogo logo) {
|
||||
eduUserLogoService.saveOrUpdate(logo);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.BaiduApiConfig;
|
||||
|
||||
/**
|
||||
* 百度api配置信息 Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023-06-20 20:42:47
|
||||
*/
|
||||
public interface BaiduApiConfigMapper extends BaseMapper<BaiduApiConfig> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.ConstructionPayConfig;
|
||||
|
||||
/**
|
||||
* 建行学校信息配置 Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023-06-19 16:30:18
|
||||
*/
|
||||
public interface ConstructionPayConfigMapper extends BaseMapper<ConstructionPayConfig> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.DataPermissionTest;
|
||||
|
||||
import cc.mrbird.febs.common.datasource.starter.annotation.DataPermission;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
@DataPermission(methods = {"selectPage"})
|
||||
public interface DataPermissionTestMapper extends BaseMapper<DataPermissionTest> {
|
||||
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.system.dto.AgentSchoolSelectPageDTO;
|
||||
import com.yida.data.system.vo.AgentSchoolSelectPageVO;
|
||||
import com.yida.data.system.vo.SchoolClassInfoVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
*/
|
||||
public interface DeptMapper extends BaseMapper<Dept> {
|
||||
|
||||
List<Dept> findListByAera(@Param("type") Integer type,
|
||||
@Param("areaIds") List<Long> areaIds,
|
||||
@Param("schoolName") String schoolName);
|
||||
|
||||
SchoolClassInfoVO getSchoolAreaInfo(Long schoolId);
|
||||
|
||||
/**
|
||||
* 查询代理商管理的学校列表数据
|
||||
*
|
||||
* @param toPage 分页数据
|
||||
* @param agentSchoolSelectPageDTO 查询代理商管理的学校列表数据请求类
|
||||
* @param childIdList 子部门id集合
|
||||
* @param currentUser 当前登陆用户数据
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.system.vo.AgentSchoolVO>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/27 17:18
|
||||
*/
|
||||
IPage<AgentSchoolSelectPageVO> listAgentSchoolPage(Page<Dept> toPage,
|
||||
@Param("dto") AgentSchoolSelectPageDTO agentSchoolSelectPageDTO,
|
||||
@Param("childIdList") List<Long> childIdList,
|
||||
@Param("currentUser") CurrentUser currentUser);
|
||||
|
||||
/**
|
||||
* 查询代理商关联学校
|
||||
*
|
||||
* @param agentId 代理商id
|
||||
* @param areaIds 区域id集合
|
||||
* @return java.util.List<com.yida.data.common.core.entity.system.Dept>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/28 15:30
|
||||
*/
|
||||
List<Dept> listSchoolByAgentId(@Param("agentId") Long agentId,
|
||||
@Param("areaIds") List<Long> areaIds,
|
||||
@Param("schoolName") String schoolName);
|
||||
|
||||
/**
|
||||
* 具有创建账号的数据 自己创建的账号+当前登陆账号部门以下的账号
|
||||
*
|
||||
* @param currentUser 登陆用户
|
||||
* @param childIdList 子部门id集合
|
||||
* @param areaIds 区域id集合
|
||||
* @param schoolName 学校名称
|
||||
* @return java.util.List<com.yida.data.common.core.entity.system.Dept>
|
||||
* @author ZYJ
|
||||
* @date 2022/1/12 17:11
|
||||
*/
|
||||
List<Dept> listSchool(@Param("currentUser") CurrentUser currentUser,
|
||||
@Param("childIdList") List<Long> childIdList,
|
||||
@Param("areaIds") List<Long> areaIds,
|
||||
@Param("schoolName") String schoolName);
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.DeptSchoolInformation;
|
||||
import com.yida.data.system.dto.SchoolInformationDTO;
|
||||
import com.yida.data.system.dto.SchoolPageDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface DeptSchoolInformationMapper extends BaseMapper<DeptSchoolInformation> {
|
||||
|
||||
/**
|
||||
* 分页查询学校
|
||||
* @param deptId 教育局或代理商id
|
||||
* @param schoolName 学校名称
|
||||
* @param schoolType 学校类型
|
||||
* @param natureType 学校性质
|
||||
* @param areaId 区域id
|
||||
* @param tag 标签
|
||||
* @return
|
||||
*/
|
||||
Page<SchoolInformationDTO> findSchoolListByDeptId(@Param("deptId") Long deptId, @Param("schoolName") String schoolName,
|
||||
@Param("schoolType") Integer schoolType, @Param("natureType") Integer natureType,
|
||||
@Param("address") String address, @Param("tag") String tag,
|
||||
@Param("page") Page<SchoolInformationDTO> page, @Param("schoolOwnership") Integer schoolOwnership);
|
||||
|
||||
Page<SchoolInformationDTO> findSchoolPageList(@Param("schoolName") String schoolName, @Param("schoolType") List<Integer> schoolType,
|
||||
@Param("natureType") List<Integer> natureType, @Param("deptSchoolId") List<Long> deptSchoolId,
|
||||
@Param("page") Page<SchoolInformationDTO> page, @Param("deptId") Long deptId,
|
||||
@Param("schoolOwnership") List<Integer> schoolOwnership);
|
||||
|
||||
Page<SchoolInformationDTO> findSchoolByAddress(@Param("page") Page<SchoolInformationDTO> page, @Param("address") String address, @Param("deptId") Long deptId);
|
||||
|
||||
List<Long> findDeptSchoolId(@Param("tags") String[] tags);
|
||||
|
||||
IPage<SchoolInformationDTO> listSchoolPage(Page<Dept> page, @Param("dto") SchoolPageDTO dto);
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.DeptSchoolInformationNature;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface DeptSchoolInformationNatureMapper extends BaseMapper<DeptSchoolInformationNature> {
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.DeptSchoolLabel;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface DeptSchoolLabelMapper extends BaseMapper<DeptSchoolLabel> {
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.DeptSchoolRelate;
|
||||
|
||||
/**
|
||||
* 部门-学校关联表mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021-11-23
|
||||
*/
|
||||
public interface DeptSchoolRelateMapper extends BaseMapper<DeptSchoolRelate> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.DeptSchoolStudentRange;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface DeptSchoolStudentRangeMapper extends BaseMapper<DeptSchoolStudentRange> {
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.Dict;
|
||||
import com.yida.data.system.vo.DictTypePageVO;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface DictMapper extends BaseMapper<Dict> {
|
||||
|
||||
IPage<DictTypePageVO> listDictTypePage(Page page, @Param("typeName") String typeName);
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.agent.EduAgent;
|
||||
import com.yida.data.system.dto.AgentSelectPageDTO;
|
||||
import com.yida.data.system.vo.AgentSelectPageVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 代理商表 Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021-09-26 11:19:45
|
||||
*/
|
||||
public interface EduAgentMapper extends BaseMapper<EduAgent> {
|
||||
|
||||
/**
|
||||
* 查询代理商列表数据
|
||||
*
|
||||
* @param toPage 分页数据
|
||||
* @param agentSelectPageDTO 代理商后台列表请求类
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.system.vo.AgentSelectPageVO>
|
||||
* @author ZYJ
|
||||
* @date 2021/9/26 13:23
|
||||
*/
|
||||
IPage<AgentSelectPageVO> listAgentPage(Page<EduAgent> toPage,
|
||||
@Param("dto") AgentSelectPageDTO agentSelectPageDTO);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.agent.EduAgentSchoolRelate;
|
||||
|
||||
/**
|
||||
* 代理商-学校关联表 Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021-09-26 15:41:06
|
||||
*/
|
||||
public interface EduAgentSchoolRelateMapper extends BaseMapper<EduAgentSchoolRelate> {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.agent.EduAgentWxPublicReceiver;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EduAgentWxPublicReceiverMapper extends BaseMapper<EduAgentWxPublicReceiver> {
|
||||
|
||||
List<EduAgentWxPublicReceiver> listReceiverBySchool(@Param("schoolId") Long schoolId);
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.school.EduYidaAppAccount;
|
||||
|
||||
public interface EduAppAccountMapper extends BaseMapper<EduYidaAppAccount> {
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.system.EduApp;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface EduAppMapper extends BaseMapper<EduApp> {
|
||||
|
||||
IPage<EduApp> listAppPage(Page page, @Param("schoolId") Long schoolId);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduAppTemplate;
|
||||
|
||||
/**
|
||||
* 企业微信服务商代开发应用模板dao
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/11/3
|
||||
*/
|
||||
public interface EduAppTemplateMapper extends BaseMapper<EduAppTemplate> {
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduArea;
|
||||
|
||||
import com.yida.data.system.vo.AreaVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface EduAreaMapper extends BaseMapper<EduArea> {
|
||||
List<EduArea> findAreaByParentId(Long parentId);
|
||||
|
||||
EduArea checkArea(@Param("parentId") Long parentId, @Param("name") String name);
|
||||
|
||||
Integer updateParentName(@Param("parentName") String parentName, @Param("ids") List<Long> id);
|
||||
|
||||
AreaVO findAreaById(@Param("id") Long id);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduBaseApp;
|
||||
|
||||
/**
|
||||
* 基础应用信息(本地配置) Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023-06-28 14:57:58
|
||||
*/
|
||||
public interface EduBaseAppMapper extends BaseMapper<EduBaseApp> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.consume.EduConsumeConfig;
|
||||
|
||||
/**
|
||||
* 学校消费机服务器信息Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023-04-06 17:31:11
|
||||
*/
|
||||
public interface EduConsumeConfigMapper extends BaseMapper<EduConsumeConfig> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduDeptFunction;
|
||||
|
||||
/**
|
||||
* 部门对应的第三方系统功能Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023-02-20 15:29:05
|
||||
*/
|
||||
public interface EduDeptFunctionMapper extends BaseMapper<EduDeptFunction> {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduDeptPayType;
|
||||
|
||||
public interface EduDeptPayTypeMapper extends BaseMapper<EduDeptPayType> {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduDeptWxPublic;
|
||||
|
||||
public interface EduDeptWxPublicMapper extends BaseMapper<EduDeptWxPublic> {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduHoliday;
|
||||
|
||||
import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac;
|
||||
|
||||
public interface EduHolidayMapper extends BaseMapper<EduHoliday> {
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduHotWord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface EduHotWordMapper extends BaseMapper<EduHotWord> {
|
||||
List<EduHotWord> findHotWord(@Param("num") Integer num, @Param("type") Integer type, @Param("deptId") Long deptId);
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.instructions.EduInstructionsContent;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author wjm
|
||||
* @date 2021-08-30 15:54:11
|
||||
*/
|
||||
public interface EduInstructionsContentMapper extends BaseMapper<EduInstructionsContent> {
|
||||
|
||||
IPage<EduInstructionsContent> listPageEduInstructionsContent(Page page,
|
||||
@Param("typeCode") String typeCode,
|
||||
@Param("title") String title);
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.instructions.EduInstructionsType;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author wjm
|
||||
* @date 2021-08-30 15:54:24
|
||||
*/
|
||||
public interface EduInstructionsTypeMapper extends BaseMapper<EduInstructionsType> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.system.EduLabel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
|
||||
public interface EduLabelMapper extends BaseMapper<EduLabel> {
|
||||
Page<EduLabel> findDeptLabelList(@Param("page") Page<EduLabel> page, @Param("deptId") Long deptId, @Param("type") Integer type, @Param("label") String label);
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduPayWxConfig;
|
||||
|
||||
public interface EduPayWxConfigMapper extends BaseMapper<EduPayWxConfig> {
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduQywxServiceProvider;
|
||||
|
||||
/**
|
||||
* 企业微信服务商dao
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/11/3
|
||||
*/
|
||||
public interface EduQywxServiceProviderMapper extends BaseMapper<EduQywxServiceProvider> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduQywxServiceProviderSchool;
|
||||
|
||||
/**
|
||||
* 企业微信服务商-学校密文corpId对照表dao
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/11/9
|
||||
*/
|
||||
public interface EduQywxServiceProviderSchoolMapper extends BaseMapper<EduQywxServiceProviderSchool> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduSchoolInquireCommonQuestionLabel;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface EduSchoolInquireCommonQuestionLabelMapper extends BaseMapper<EduSchoolInquireCommonQuestionLabel> {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.system.EduSchoolInquireCommonQuestion;
|
||||
import com.yida.data.system.vo.FindPhonePageVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface EduSchoolInquireCommonQuestionMapper extends BaseMapper<EduSchoolInquireCommonQuestion> {
|
||||
IPage<EduSchoolInquireCommonQuestion> findQuestionPage(@Param("page") Page objectPage, @Param("labelId") Long labelId,
|
||||
@Param("deptId") Long deptId, @Param("question") String question);
|
||||
|
||||
IPage<FindPhonePageVO> findPhonePage(@Param("labelId") Long labelId, @Param("deptId") Long deptId, @Param("page") Page page, @Param("schoolName") String schoolName);
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduSchoolInquirePhoneLabel;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface EduSchoolInquirePhoneLabelMapper extends BaseMapper<EduSchoolInquirePhoneLabel> {
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduSchoolInquirePhone;
|
||||
|
||||
/**
|
||||
* @author ccl
|
||||
*/
|
||||
public interface EduSchoolInquirePhoneMapper extends BaseMapper<EduSchoolInquirePhone> {
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduSysFile;
|
||||
|
||||
public interface EduSysFileMapper extends BaseMapper<EduSysFile> {
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.yida.data.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.system.EduUserApp;
|
||||
|
||||
public interface EduUserAppMapper extends BaseMapper<EduUserApp> {
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user