fix: resolve merge conflicts in .gitignore
| | |
| | | *.class |
| | | ###################################################################### |
| | | # Build Tools |
| | | |
| | | # Mobile Tools for Java (J2ME) |
| | | .mtj.tmp/ |
| | | .gradle |
| | | /build/ |
| | | !gradle/wrapper/gradle-wrapper.jar |
| | | |
| | | # Package Files # |
| | | *.jar |
| | | *.war |
| | | *.ear |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | |
| | | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml |
| | | hs_err_pid* |
| | | ###################################################################### |
| | | # IDE |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### JRebel ### |
| | | rebel.xml |
| | | |
| | | ### NetBeans ### |
| | | nbproject/private/ |
| | | build/* |
| | | nbbuild/ |
| | | dist/ |
| | | nbdist/ |
| | | .nb-gradle/ |
| | | |
| | | ###################################################################### |
| | | # Others |
| | | *.log |
| | | *.xml.versionsBackup |
| | | *.swp |
| | | |
| | | !*/build/*.java |
| | | !*/build/*.html |
| | | !*/build/*.xml |
New file |
| | |
| | | The MIT License (MIT) |
| | | |
| | | Copyright (c) 2018 RuoYi |
| | | |
| | | Permission is hereby granted, free of charge, to any person obtaining a copy of |
| | | this software and associated documentation files (the "Software"), to deal in |
| | | the Software without restriction, including without limitation the rights to |
| | | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| | | the Software, and to permit persons to whom the Software is furnished to do so, |
| | | subject to the following conditions: |
| | | |
| | | The above copyright notice and this permission notice shall be included in all |
| | | copies or substantial portions of the Software. |
| | | |
| | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| | | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| | | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| | | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| | | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi</artifactId> |
| | | <version>3.8.6</version> |
| | | </parent> |
| | | <description> |
| | | 银行接口模块 |
| | | </description> |
| | | <groupId>org.taxi591</groupId> |
| | | <artifactId>bankapi</artifactId> |
| | | <version>1.0.0-SNAPSHOT</version> |
| | | <properties> |
| | | <httpclient_version>4.5.2</httpclient_version> |
| | | </properties> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpclient</artifactId> |
| | | <version>${httpclient_version}</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
New file |
| | |
| | | package com.taxi591.bankapi; |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | @EnableConfigurationProperties({BankProperties.class}) |
| | | @ConditionalOnProperty(value = BankProperties.ENBALE_PREFIX, matchIfMissing = true) |
| | | @ComponentScan("com.taxi591.bankapi.service") |
| | | public class BankConfig { |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | |
| | | import static com.taxi591.bankapi.BankProperties.PREFIX; |
| | | |
| | | @Data |
| | | @ConfigurationProperties(prefix = PREFIX) |
| | | public class BankProperties { |
| | | |
| | | public static final String PREFIX = "com.taxi591.bank"; |
| | | |
| | | public static final String ENBALE_PREFIX = PREFIX+".enable"; |
| | | |
| | | private Boolean enable = true; |
| | | |
| | | |
| | | private String baseUrl="http://hello.enjoy.abchina.com"; |
| | | |
| | | /** |
| | | * 证书路径 |
| | | */ |
| | | private String pfxPath; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String keystorePassword; |
| | | |
| | | /** |
| | | * 公钥路径 |
| | | */ |
| | | private String cerPath; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.dto; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 直连商户平台缴费销账输入对象,需要转换成json串发送给第三方系统 |
| | | * @author DELL |
| | | * |
| | | */ |
| | | @Data |
| | | public class ChargeBillRequest implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 格式 */ |
| | | private String format; |
| | | |
| | | /** 消息 */ |
| | | private Message message; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ChargeBillRequest[format=" + format + ",message=" + message.toString() + "]"; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象实体message内部类 |
| | | * |
| | | */ |
| | | @Data |
| | | public class Message implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 消息头部 */ |
| | | private Head head; |
| | | |
| | | /** 消息体 */ |
| | | private Info info; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return JSON.toJSONString(this); |
| | | } |
| | | |
| | | /** |
| | | * message子对象head消息头内部类 |
| | | */ |
| | | @Data |
| | | public class Head implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 渠道编码 */ |
| | | private String channel; |
| | | |
| | | /** 交易码 */ |
| | | private String transCode; |
| | | |
| | | /** 交易上行下送标志位 */ |
| | | private String transFlag; |
| | | |
| | | /** 缴费中心交易序列号 */ |
| | | private String transSeqNum; |
| | | |
| | | /** 时间戳 */ |
| | | private String timeStamp; |
| | | |
| | | /** 4为分行iGoal码 */ |
| | | private String branchCode; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return JSON.toJSONString(this); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * message子对象info消息实体内部类 |
| | | */ |
| | | @Data |
| | | public class Info implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 缴费项目编号*/ |
| | | private String epayCode; |
| | | |
| | | /** 第三方商户编号*/ |
| | | private String merchantId; |
| | | |
| | | /** 缴费中心流水号*/ |
| | | private String traceNo; |
| | | |
| | | /** 输入要素1*/ |
| | | private String input1; |
| | | |
| | | /** 输入要素2*/ |
| | | private String input2; |
| | | |
| | | /** 输入要素3*/ |
| | | private String input3; |
| | | |
| | | /** 输入要素4*/ |
| | | private String input4; |
| | | |
| | | /** 输入要素5*/ |
| | | private String input5; |
| | | |
| | | /** 农行16位客户号*/ |
| | | private String userId; |
| | | |
| | | /** 缴费金额计算规则*/ |
| | | private String amtRule; |
| | | |
| | | /** 合并支付的子账单数*/ |
| | | private String payBillCount; |
| | | |
| | | /** 合并支付的子账单累加总金额*/ |
| | | private String payBillAmt; |
| | | |
| | | /** 合并支付的子账单*/ |
| | | private String payBillNo; |
| | | |
| | | /** 套餐名称*/ |
| | | private String optionName; |
| | | |
| | | /** 套餐编码*/ |
| | | private String optionCode; |
| | | |
| | | /** 套餐金额*/ |
| | | private String optionAmt; |
| | | |
| | | /** 支付方式交易码*/ |
| | | private String payType; |
| | | |
| | | /** 缴费支付账号*/ |
| | | private String payAcc; |
| | | |
| | | /** 支付系统流水号*/ |
| | | private String transPaySeq; |
| | | |
| | | /** 支付系统日期*/ |
| | | private String transDate; |
| | | |
| | | /** 支付系统时间*/ |
| | | private String transTime; |
| | | |
| | | /** 会计日期*/ |
| | | private String settleDate; |
| | | |
| | | /** 清算模式*/ |
| | | private String clearType; |
| | | |
| | | /** 缓存域信息*/ |
| | | private String cacheMem; |
| | | |
| | | /** 销账报文重发次数,通过此字段识别销账报文是否为重发的,0表示首次、1表示重发一次,2表示重发2次,最多重发3次*/ |
| | | private String resendTimes; |
| | | |
| | | /** 第三方支付平台商户订单号 第三方平台例如微信支付宝的支付订单号 add 2020-01-13*/ |
| | | private String numOpenMerchantOrder; |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return JSON.toJSONString(this); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.dto; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 直连商户平台账单销账返回对象 |
| | | * @author DELL |
| | | * |
| | | */ |
| | | @Data |
| | | public class ChargeBillResponse implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 格式 */ |
| | | private String format; |
| | | |
| | | /** 消息体 */ |
| | | private Message message; |
| | | |
| | | |
| | | public ChargeBillResponse(){ |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 构造函数,通过输入对象,构造返回对象数据信息 |
| | | * @param request |
| | | */ |
| | | public ChargeBillResponse(ChargeBillRequest request) { |
| | | this.setFormat(request.getFormat()); |
| | | this.setMessage(new Message(request.getMessage())); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return JSON.toJSONString(this); |
| | | } |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象返回实体message内部类 |
| | | * |
| | | */ |
| | | @Data |
| | | public class Message implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 消息头部 */ |
| | | private Head head; |
| | | |
| | | /** 消息实体 */ |
| | | private Info info; |
| | | |
| | | public Message() { |
| | | this.head = new Head(); |
| | | this.info = new Info(); |
| | | } |
| | | |
| | | public Message(ChargeBillRequest.Message requestMessage){ |
| | | this.setHead(new Head(requestMessage.getHead())); |
| | | this.setInfo(new Info(requestMessage.getInfo())); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return JSON.toJSONString(this); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 账单销账内部消息对象返回实体Head内部类 |
| | | * |
| | | */ |
| | | @Data |
| | | public class Head implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 渠道 */ |
| | | private String channel; |
| | | |
| | | /** 交易码 */ |
| | | private String transCode; |
| | | |
| | | /** 交易上行下送标志 */ |
| | | private String transFlag; |
| | | |
| | | /** 缴费中心交易序列号 */ |
| | | private String transSeqNum; |
| | | |
| | | /** 时间戳 */ |
| | | private String timeStamp; |
| | | |
| | | /** 查询返回码 */ |
| | | private String returnCode ; |
| | | |
| | | /** 返回提示信息 */ |
| | | private String returnMessage; |
| | | |
| | | public Head() { |
| | | |
| | | } |
| | | |
| | | public Head(ChargeBillRequest.Message.Head reqMessHead) { |
| | | this.setChannel(reqMessHead.getChannel()); |
| | | this.setTransSeqNum(reqMessHead.getTransSeqNum()); |
| | | this.setTransCode(reqMessHead.getTransCode()); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return JSON.toJSONString(this); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象返回实体Info内部类 |
| | | * |
| | | */ |
| | | @Data |
| | | public class Info implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 缴费项目唯一标识号*/ |
| | | private String epayCode; |
| | | |
| | | /** 缴费中心流水号*/ |
| | | private String traceNo; |
| | | |
| | | /** 退款标志位*/ |
| | | private String refundFlag; |
| | | |
| | | /** 第三方支付平台商户订单号 第三方平台例如微信支付宝的支付订单号 add 2020-01-13*/ |
| | | private String numOpenMerchantOrder; |
| | | |
| | | public Info() { |
| | | |
| | | } |
| | | |
| | | public Info(ChargeBillRequest.Message.Info reqMessInfo) { |
| | | this.setEpayCode(reqMessInfo.getEpayCode()); |
| | | this.setTraceNo(reqMessInfo.getTraceNo()); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return JSON.toJSONString(this); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class CovertPayBackResult implements Serializable { |
| | | /** |
| | | * 解析结果 |
| | | */ |
| | | private ChargeBillRequest result; |
| | | /** |
| | | * 返回银行应答内容 |
| | | */ |
| | | private String back; |
| | | |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.dto; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 直连商户平台账单查询输入对象,需要转换成json串发送给第三方系统 |
| | | * @author DELL |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class QueryBillRequest implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 格式 */ |
| | | @JSONField(name = "format") |
| | | private String format; |
| | | |
| | | /** 消息 */ |
| | | @JSONField(name = "message") |
| | | private Message message; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillRequest[format=" + format + ",message=" + message.toString() + "]"; |
| | | } |
| | | |
| | | public String getFormat() { |
| | | return format; |
| | | } |
| | | |
| | | @JSONField(name = "format") |
| | | public void setFormat(String format) { |
| | | this.format = format; |
| | | } |
| | | |
| | | public Message getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | @JSONField(name = "message") |
| | | public void setMessage(Message message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象实体message内部类 |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class Message implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 消息头部 */ |
| | | @JSONField(name = "head") |
| | | private Head head; |
| | | |
| | | /** 消息体 */ |
| | | @JSONField(name = "info") |
| | | private Info info; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillRequest.Message[head=" + head.toString() + ",info=" + info.toString() + "]"; |
| | | } |
| | | |
| | | public Head getHead() { |
| | | return head; |
| | | } |
| | | |
| | | @JSONField(name = "head") |
| | | public void setHead(Head head) { |
| | | this.head = head; |
| | | } |
| | | |
| | | public Info getInfo() { |
| | | return info; |
| | | } |
| | | |
| | | @JSONField(name = "info") |
| | | public void setInfo(Info info) { |
| | | this.info = info; |
| | | } |
| | | |
| | | /** |
| | | * message子对象head消息头内部类 |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class Head implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 渠道编码 */ |
| | | @JSONField(name = "channel") |
| | | private String channel; |
| | | |
| | | /** 交易码 */ |
| | | @JSONField(name = "transCode") |
| | | private String transCode; |
| | | |
| | | /** 交易上行下送标志位 */ |
| | | @JSONField(name = "transFlag") |
| | | private String transFlag; |
| | | |
| | | /** 缴费中心交易序列号 */ |
| | | @JSONField(name = "transSeqNum") |
| | | private String transSeqNum; |
| | | |
| | | /** 时间戳 */ |
| | | @JSONField(name = "timeStamp") |
| | | private String timeStamp; |
| | | |
| | | /** 4为分行iGoal码 */ |
| | | @JSONField(name = "branchCode") |
| | | private String branchCode; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillRequest.Message.Head[channel=" + channel +",transCode=" + transCode + |
| | | ",transFlag=" + transFlag + ",transSeqNum=" + transSeqNum + ",timestamp=" + timeStamp + ",branchCode=" + branchCode + "]"; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | @JSONField(name = "channel") |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public String getTransFlag() { |
| | | return transFlag; |
| | | } |
| | | |
| | | @JSONField(name = "transFlag") |
| | | public void setTransFlag(String transFlag) { |
| | | this.transFlag = transFlag; |
| | | } |
| | | |
| | | public String getTransCode() { |
| | | return transCode; |
| | | } |
| | | |
| | | @JSONField(name = "transCode") |
| | | public void setTransCode(String transCode) { |
| | | this.transCode = transCode; |
| | | } |
| | | |
| | | public String getTransSeqNum() { |
| | | return transSeqNum; |
| | | } |
| | | |
| | | @JSONField(name = "transSeqNum") |
| | | public void setTransSeqNum(String transSeqNum) { |
| | | this.transSeqNum = transSeqNum; |
| | | } |
| | | |
| | | |
| | | public String getTimeStamp() { |
| | | return timeStamp; |
| | | } |
| | | |
| | | @JSONField(name = "timeStamp") |
| | | public void setTimeStamp(String timeStamp) { |
| | | this.timeStamp = timeStamp; |
| | | } |
| | | |
| | | public String getBranchCode() { |
| | | return branchCode; |
| | | } |
| | | |
| | | @JSONField(name = "branchCode") |
| | | public void setBranchCode(String branchCode) { |
| | | this.branchCode = branchCode; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * message子对象info消息实体内部类 |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class Info implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 缴费项目编号*/ |
| | | @JSONField(name = "epayCode") |
| | | private String epayCode; |
| | | |
| | | /** 第三方商户编号*/ |
| | | @JSONField(name = "merchantId") |
| | | private String merchantId; |
| | | |
| | | /** 输入要素1*/ |
| | | @JSONField(name = "input1") |
| | | private String input1; |
| | | |
| | | /** 输入要素2*/ |
| | | @JSONField(name = "input2") |
| | | private String input2; |
| | | |
| | | /** 输入要素3*/ |
| | | @JSONField(name = "input3") |
| | | private String input3; |
| | | |
| | | /** 输入要素4*/ |
| | | @JSONField(name = "input4") |
| | | private String input4; |
| | | |
| | | /** 输入要素5*/ |
| | | @JSONField(name = "input5") |
| | | private String input5; |
| | | |
| | | /** 16位客户号*/ |
| | | @JSONField(name = "userId") |
| | | private String userId; |
| | | |
| | | /** 缴费中心流水号*/ |
| | | @JSONField(name = "traceNo") |
| | | private String traceNo; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillRequest.Message.Info[epayCode=" + epayCode + ",merchantId=" + merchantId + |
| | | ",input1=" + input1 + ",input2=" + input2 + ",input3=" + input3 + ",input4=" + input4 + ",input5=" + input5 + |
| | | ",userId=" + userId + ",traceNo=" + traceNo + "]"; |
| | | } |
| | | |
| | | public String getEpayCode() { |
| | | return epayCode; |
| | | } |
| | | |
| | | @JSONField(name = "epayCode") |
| | | public void setEpayCode(String epayCode) { |
| | | this.epayCode = epayCode; |
| | | } |
| | | |
| | | public String getMerchantId() { |
| | | return merchantId; |
| | | } |
| | | |
| | | @JSONField(name = "merchantId") |
| | | public void setMerchantId(String merchantId) { |
| | | this.merchantId = merchantId; |
| | | } |
| | | |
| | | public String getInput1() { |
| | | return input1; |
| | | } |
| | | |
| | | @JSONField(name = "input1") |
| | | public void setInput1(String input1) { |
| | | this.input1 = input1; |
| | | } |
| | | |
| | | public String getInput2() { |
| | | return input2; |
| | | } |
| | | |
| | | @JSONField(name = "input2") |
| | | public void setInput2(String input2) { |
| | | this.input2 = input2; |
| | | } |
| | | |
| | | public String getInput3() { |
| | | return input3; |
| | | } |
| | | |
| | | @JSONField(name = "input3") |
| | | public void setInput3(String input3) { |
| | | this.input3 = input3; |
| | | } |
| | | |
| | | public String getInput4() { |
| | | return input4; |
| | | } |
| | | |
| | | @JSONField(name = "input4") |
| | | public void setInput4(String input4) { |
| | | this.input4 = input4; |
| | | } |
| | | |
| | | public String getInput5() { |
| | | return input5; |
| | | } |
| | | |
| | | @JSONField(name = "input5") |
| | | public void setInput5(String input5) { |
| | | this.input5 = input5; |
| | | } |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | @JSONField(name = "userId") |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getTraceNo() { |
| | | return traceNo; |
| | | } |
| | | |
| | | @JSONField(name = "traceNo") |
| | | public void setTraceNo(String traceNo) { |
| | | this.traceNo = traceNo; |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.dto; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * 直连商户平台账单查询返回对象 |
| | | * @author DELL |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class QueryBillResponse implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 格式 */ |
| | | @JSONField(name = "format") |
| | | private String format; |
| | | |
| | | /** 消息体 */ |
| | | @JSONField(name = "message") |
| | | private Message message; |
| | | |
| | | |
| | | public QueryBillResponse(){ |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 构造函数,通过输入对象,构造返回对象数据信息 |
| | | * @param request |
| | | */ |
| | | public QueryBillResponse(QueryBillRequest request) { |
| | | this.setFormat(request.getFormat()); |
| | | this.setMessage(new Message(request.getMessage())); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse[format=" + format + ",message=" + message==null?"":message.toString() + "]"; |
| | | } |
| | | |
| | | public String getFormat() { |
| | | return format; |
| | | } |
| | | |
| | | @JSONField(name = "format") |
| | | public void setFormat(String format) { |
| | | this.format = format; |
| | | } |
| | | |
| | | public Message getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | @JSONField(name = "message") |
| | | public void setMessage(Message message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象返回实体message内部类 |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class Message implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 消息头部 */ |
| | | @JSONField(name = "head") |
| | | private Head head; |
| | | |
| | | /** 消息实体 */ |
| | | @JSONField(name = "info") |
| | | private Info info; |
| | | |
| | | public Message() { |
| | | this.head = new Head(); |
| | | this.info = new Info(); |
| | | } |
| | | |
| | | public Message(QueryBillRequest.Message requestMessage){ |
| | | this.setHead(new Head(requestMessage.getHead())); |
| | | this.setInfo(new Info(requestMessage.getInfo())); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse.Message[head=" + head.toString() + ",info=" + info.toString() + "]"; |
| | | } |
| | | |
| | | public Head getHead() { |
| | | return head; |
| | | } |
| | | |
| | | @JSONField(name = "head") |
| | | public void setHead(Head head) { |
| | | this.head = head; |
| | | } |
| | | |
| | | public Info getInfo() { |
| | | return info; |
| | | } |
| | | |
| | | @JSONField(name = "info") |
| | | public void setInfo(Info info) { |
| | | this.info = info; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象返回实体Head内部类 |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class Head implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 渠道 */ |
| | | @JSONField(name = "channel") |
| | | private String channel; |
| | | |
| | | /** 交易码 */ |
| | | @JSONField(name = "transCode") |
| | | private String transCode; |
| | | |
| | | /** 交易上行下送标志 */ |
| | | @JSONField(name = "transFlag") |
| | | private String transFlag; |
| | | |
| | | /** 缴费中心交易序列号 */ |
| | | @JSONField(name = "transSeqNum") |
| | | private String transSeqNum; |
| | | |
| | | /** 时间戳 */ |
| | | @JSONField(name = "timeStamp") |
| | | private String timeStamp; |
| | | |
| | | /** 查询返回码 */ |
| | | @JSONField(name = "returnCode") |
| | | private String returnCode ; |
| | | |
| | | /** 返回提示信息 */ |
| | | @JSONField(name = "returnMessage") |
| | | private String returnMessage; |
| | | |
| | | |
| | | public Head(QueryBillRequest.Message.Head reqMessHead) { |
| | | this.setChannel(reqMessHead.getChannel()); |
| | | this.setTransSeqNum(reqMessHead.getTransSeqNum()); |
| | | this.setTransCode(reqMessHead.getTransCode()); |
| | | this.setReturnCode(""); |
| | | this.setReturnMessage(""); |
| | | this.setTimeStamp(""); |
| | | } |
| | | |
| | | |
| | | public Head() { |
| | | |
| | | } |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse.Message.Head[channel=" + channel + ",transCode=" + transCode + ",transSeqNum=" + transSeqNum |
| | | + ",timeStamp=" + timeStamp + ",returnCode=" + returnCode + ",returnMessage=" + returnMessage + "]"; |
| | | } |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public String getTransCode() { |
| | | return transCode; |
| | | } |
| | | |
| | | @JSONField(name = "transCode") |
| | | public void setTransCode(String transCode) { |
| | | this.transCode = transCode; |
| | | } |
| | | |
| | | public String getTransFlag() { |
| | | return transFlag; |
| | | } |
| | | |
| | | @JSONField(name = "transFlag") |
| | | public void setTransFlag(String transFlag) { |
| | | this.transFlag = transFlag; |
| | | } |
| | | |
| | | @JSONField(name = "channel") |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public String getTransSeqNum() { |
| | | return transSeqNum; |
| | | } |
| | | |
| | | @JSONField(name = "transSeqNum") |
| | | public void setTransSeqNum(String transSeqNum) { |
| | | this.transSeqNum = transSeqNum; |
| | | } |
| | | |
| | | |
| | | public String getTimeStamp() { |
| | | return timeStamp; |
| | | } |
| | | |
| | | @JSONField(name = "timestamp") |
| | | public void setTimeStamp(String timeStamp) { |
| | | this.timeStamp = timeStamp; |
| | | } |
| | | |
| | | public String getReturnCode() { |
| | | return returnCode; |
| | | } |
| | | |
| | | @JSONField(name = "returnCode") |
| | | public void setReturnCode(String returnCode) { |
| | | this.returnCode = returnCode; |
| | | } |
| | | |
| | | public String getReturnMessage() { |
| | | return returnMessage; |
| | | } |
| | | |
| | | @JSONField(name = "returnMessage") |
| | | public void setReturnMessage(String returnMessage) { |
| | | this.returnMessage = returnMessage; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象返回实体Info内部类 |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class Info implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 缴费项目唯一标识号*/ |
| | | @JSONField(name = "epayCode") |
| | | private String epayCode; |
| | | |
| | | /** 直连商户第三方商户号*/ |
| | | @JSONField(name = "merchantId") |
| | | private String merchantId; |
| | | |
| | | /** 缴费中心流水号*/ |
| | | @JSONField(name = "traceNo") |
| | | private String traceNo; |
| | | |
| | | /** 输入要素1*/ |
| | | @JSONField(name = "input1") |
| | | private String input1; |
| | | |
| | | /** 输入要素2*/ |
| | | @JSONField(name = "input2") |
| | | private String input2; |
| | | |
| | | /** 输入要素3*/ |
| | | @JSONField(name = "input3") |
| | | private String input3; |
| | | |
| | | /** 输入要素4*/ |
| | | @JSONField(name = "input4") |
| | | private String input4; |
| | | |
| | | /** 输入要素5*/ |
| | | @JSONField(name = "input5") |
| | | private String input5; |
| | | |
| | | /** 户主名称*/ |
| | | @JSONField(name = "custName") |
| | | private String custName; |
| | | |
| | | /** 户主地址*/ |
| | | @JSONField(name = "custAddress") |
| | | private String custAddress; |
| | | |
| | | /** 账单关联客户手机号,部分项目可根据该字段,要求客户做短信验证码校验后才显示账单结果*/ |
| | | @JSONField(name = "cellPhone") |
| | | private String cellPhone; |
| | | |
| | | /** 缓存域信息*/ |
| | | @JSONField(name = "cacheMem") |
| | | private String cacheMem; |
| | | |
| | | /** 备注字段*/ |
| | | @JSONField(name = "remark") |
| | | private String remark; |
| | | |
| | | /** 跳转商户地址*/ |
| | | @JSONField(name = "callBackUrl") |
| | | private String callBackUrl; |
| | | |
| | | /** 跳转商户地址超链接提示*/ |
| | | @JSONField(name = "callBackText") |
| | | private String callBackText; |
| | | |
| | | /** 缴费金额计算规则*/ |
| | | @JSONField(name = "amtRule") |
| | | private String amtRule; |
| | | |
| | | /** 子账单数量*/ |
| | | @JSONField(name = "totalBillCount") |
| | | private String totalBillCount; |
| | | /** 定制附言信息(有定制电子回单附言信息的,需添加自定义定制附言信息字段)*/ |
| | | @JSONField(name = "merchantRemark") |
| | | private String merchantRemark; |
| | | |
| | | /** 账单信息体*/ |
| | | @JSONField(name = "bills") |
| | | private ArrayList<Bill> bills; |
| | | |
| | | |
| | | public Info() { |
| | | |
| | | } |
| | | public Info(QueryBillRequest.Message.Info reqMessInfo) { |
| | | this.setEpayCode(reqMessInfo.getEpayCode()); |
| | | this.setInput1(reqMessInfo.getInput1()); |
| | | this.setInput2(reqMessInfo.getInput2()); |
| | | this.setInput3(reqMessInfo.getInput3()); |
| | | this.setInput4(reqMessInfo.getInput4()); |
| | | this.setInput5(reqMessInfo.getInput5()); |
| | | this.bills = new ArrayList<Bill>(); |
| | | } |
| | | |
| | | /** |
| | | * @return the merchantRemark |
| | | */ |
| | | public String getMerchantRemark() { |
| | | return merchantRemark; |
| | | } |
| | | |
| | | /** |
| | | * @param merchantRemark the merchantRemark to set |
| | | */ |
| | | @JSONField(name = "merchantRemark") |
| | | public void setMerchantRemark(String merchantRemark) { |
| | | this.merchantRemark = merchantRemark; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse.Message.Info[epayCode=" + epayCode + ", input1=" |
| | | + input1 + ", input2=" + input2 + ", input3=" + input3 |
| | | + ", input4=" + input4 + ", input5=" + input5 |
| | | + ", totalBillCount=" + totalBillCount + ",merchantRemark=" |
| | | + merchantRemark + ", bills=" + bills.toString() + "]"; |
| | | } |
| | | |
| | | public String getEpayCode() { |
| | | return epayCode; |
| | | } |
| | | |
| | | @JSONField(name = "epayCode") |
| | | public void setEpayCode(String epayCode) { |
| | | this.epayCode = epayCode; |
| | | } |
| | | |
| | | public String getMerchantId() { |
| | | return merchantId; |
| | | } |
| | | |
| | | @JSONField(name = "merchantId") |
| | | public void setMerchantId(String merchantId) { |
| | | this.merchantId = merchantId; |
| | | } |
| | | |
| | | public String getTraceNo() { |
| | | return traceNo; |
| | | } |
| | | |
| | | @JSONField(name = "traceNo") |
| | | public void setTraceNo(String traceNo) { |
| | | this.traceNo = traceNo; |
| | | } |
| | | |
| | | public String getInput1() { |
| | | return input1; |
| | | } |
| | | |
| | | @JSONField(name = "input1") |
| | | public void setInput1(String input1) { |
| | | this.input1 = input1; |
| | | } |
| | | |
| | | public String getInput2() { |
| | | return input2; |
| | | } |
| | | |
| | | @JSONField(name = "input2") |
| | | public void setInput2(String input2) { |
| | | this.input2 = input2; |
| | | } |
| | | |
| | | public String getInput3() { |
| | | return input3; |
| | | } |
| | | |
| | | @JSONField(name = "input3") |
| | | public void setInput3(String input3) { |
| | | this.input3 = input3; |
| | | } |
| | | |
| | | public String getInput4() { |
| | | return input4; |
| | | } |
| | | |
| | | @JSONField(name = "input4") |
| | | public void setInput4(String input4) { |
| | | this.input4 = input4; |
| | | } |
| | | |
| | | public String getInput5() { |
| | | return input5; |
| | | } |
| | | |
| | | @JSONField(name = "input5") |
| | | public void setInput5(String input5) { |
| | | this.input5 = input5; |
| | | } |
| | | |
| | | public String getCustName() { |
| | | return custName; |
| | | } |
| | | |
| | | @JSONField(name = "custName") |
| | | public void setCustName(String custName) { |
| | | this.custName = custName; |
| | | } |
| | | |
| | | public String getCustAddress() { |
| | | return custAddress; |
| | | } |
| | | |
| | | @JSONField(name = "custAddress") |
| | | public void setCustAddress(String custAddress) { |
| | | this.custAddress = custAddress; |
| | | } |
| | | |
| | | public String getCellPhone() { |
| | | return cellPhone; |
| | | } |
| | | |
| | | @JSONField(name = "cellPhone") |
| | | public void setCellPhone(String cellPhone) { |
| | | this.cellPhone = cellPhone; |
| | | } |
| | | |
| | | public String getCacheMem() { |
| | | return cacheMem; |
| | | } |
| | | |
| | | @JSONField(name = "cacheMem") |
| | | public void setCacheMem(String cacheMem) { |
| | | this.cacheMem = cacheMem; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | @JSONField(name = "remark") |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public String getCallBackUrl() { |
| | | return callBackUrl; |
| | | } |
| | | |
| | | @JSONField(name = "callBackUrl") |
| | | public void setCallBackUrl(String callBackUrl) { |
| | | this.callBackUrl = callBackUrl; |
| | | } |
| | | |
| | | public String getCallBackText() { |
| | | return callBackText; |
| | | } |
| | | |
| | | @JSONField(name = "callBackText") |
| | | public void setCallBackText(String callBackText) { |
| | | this.callBackText = callBackText; |
| | | } |
| | | |
| | | public String getAmtRule() { |
| | | return amtRule; |
| | | } |
| | | |
| | | @JSONField(name = "amtRule") |
| | | public void setAmtRule(String amtRule) { |
| | | this.amtRule = amtRule; |
| | | } |
| | | |
| | | public String getTotalBillCount() { |
| | | return totalBillCount; |
| | | } |
| | | |
| | | @JSONField(name = "totalBillCount") |
| | | public void setTotalBillCount(String totalBillCount) { |
| | | this.totalBillCount = totalBillCount; |
| | | } |
| | | |
| | | public ArrayList<Bill> getBills() { |
| | | return bills; |
| | | } |
| | | |
| | | /** |
| | | * @param bills |
| | | * 设置账单循环域子账单 |
| | | */ |
| | | @JSONField(name = "bills") |
| | | public void setBill(ArrayList<Bill> bills) { |
| | | this.bills = bills; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * 账单查询内部消息对象返回实体Bill内部类 |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class Bill implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 账单编号*/ |
| | | @JSONField(name = "billNo") |
| | | private String billNo; |
| | | |
| | | /** 账单名称*/ |
| | | @JSONField(name = "billName") |
| | | private String billName; |
| | | |
| | | /** 欠费金额*/ |
| | | @JSONField(name = "oweAmt") |
| | | private String oweAmt; |
| | | |
| | | /** 手续费*/ |
| | | @JSONField(name = "feeAmt") |
| | | private String feeAmt; |
| | | |
| | | /** 最小金额*/ |
| | | @JSONField(name = "minAmt") |
| | | private String minAmt; |
| | | |
| | | /** 最大金额*/ |
| | | @JSONField(name = "maxAmt") |
| | | private String maxAmt; |
| | | |
| | | /** 余额*/ |
| | | @JSONField(name = "balance") |
| | | private String balance; |
| | | |
| | | /** 缴费账单到期日*/ |
| | | @JSONField(name = "expireDate") |
| | | private String expireDate; |
| | | |
| | | /** 收款商户号*/ |
| | | @JSONField(name = "rcvMerchantId") |
| | | private String rcvMerchantId; |
| | | |
| | | /** 收款账号*/ |
| | | @JSONField(name = "rcvAcc") |
| | | private String rcvAcc; |
| | | |
| | | /** 分账模板号*/ |
| | | @JSONField(name = "tempSplitAcc") |
| | | private String tempSplitAcc; |
| | | |
| | | /** 均匀时段缴费 */ |
| | | @JSONField(name = "unitDetail") |
| | | private UnitDetail unitDetail; |
| | | |
| | | /** 选择套餐*/ |
| | | @JSONField(name = "optionDetails") |
| | | private ArrayList<OptionDetail> optionDetails; |
| | | |
| | | /** 账单详情描述*/ |
| | | @JSONField(name = "descDetails") |
| | | private ArrayList<DescDetail> descDetails; |
| | | /** 平台商户分账子商户循环域 */ |
| | | @JSONField(name = "splitSubMerInfos") |
| | | private ArrayList<SplitSubMerInfo> splitSubMerInfos; |
| | | |
| | | /** 子账单必缴标志,多账单合并支付时默认选中不可不选 true:必选 false:非必选 */ |
| | | @JSONField(name = "mustPayFlag") |
| | | private String mustPayFlag; |
| | | |
| | | |
| | | /** |
| | | * @return |
| | | */ |
| | | public String getMustPayFlag() { |
| | | return mustPayFlag; |
| | | } |
| | | |
| | | /** |
| | | * @param mustPayFlag |
| | | */ |
| | | @JSONField(name = "mustPayFlag") |
| | | public void setMustPayFlag(String mustPayFlag) { |
| | | this.mustPayFlag = mustPayFlag; |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | */ |
| | | public String getTempSplitAcc() { |
| | | return tempSplitAcc; |
| | | } |
| | | /** |
| | | * 获取平台商户分账子商户循环域信息 |
| | | * @return |
| | | */ |
| | | public ArrayList<SplitSubMerInfo> getSplitSubMerInfos() { |
| | | return splitSubMerInfos; |
| | | } |
| | | /** |
| | | * 设置平台商户分账子商户循环域信息 |
| | | * @param splitSubMerInfos |
| | | */ |
| | | @JSONField(name = "splitSubMerInfos") |
| | | public void setSplitSubMerInfos(ArrayList<SplitSubMerInfo> splitSubMerInfos) { |
| | | this.splitSubMerInfos = splitSubMerInfos; |
| | | } |
| | | |
| | | public Bill() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Bill [billNo=" + billNo + ", billName=" + billName |
| | | + ", oweAmt=" + oweAmt + ", feeAmt=" + feeAmt |
| | | + ", minAmt=" + minAmt + ", maxAmt=" + maxAmt |
| | | + ", balance=" + balance + ", expireDate=" |
| | | + expireDate + ", rcvMerchantId=" + rcvMerchantId |
| | | + ", rcvAcc=" + rcvAcc + ", tempSplitAcc=" |
| | | + tempSplitAcc + ", unitDetail=" + unitDetail |
| | | + ", optionDetails=" + optionDetails |
| | | + ", descDetails=" + descDetails |
| | | + ", splitSubMerInfos=" + splitSubMerInfos |
| | | + ", mustPayFlag=" + mustPayFlag + "]"; |
| | | } |
| | | |
| | | public String getBillNo() { |
| | | return billNo; |
| | | } |
| | | |
| | | @JSONField(name = "billNo") |
| | | public void setBillNo(String billNo) { |
| | | this.billNo = billNo; |
| | | } |
| | | |
| | | public String getBillName() { |
| | | return billName; |
| | | } |
| | | |
| | | @JSONField(name = "billName") |
| | | public void setBillName(String billName) { |
| | | this.billName = billName; |
| | | } |
| | | |
| | | public String getOweAmt() { |
| | | return oweAmt; |
| | | } |
| | | |
| | | @JSONField(name = "oweAmt") |
| | | public void setOweAmt(String oweAmt) { |
| | | this.oweAmt = oweAmt; |
| | | } |
| | | |
| | | public String getFeeAmt() { |
| | | return feeAmt; |
| | | } |
| | | |
| | | @JSONField(name = "feeAmt") |
| | | public void setFeeAmt(String feeAmt) { |
| | | this.feeAmt = feeAmt; |
| | | } |
| | | |
| | | public String getMinAmt() { |
| | | return minAmt; |
| | | } |
| | | |
| | | @JSONField(name = "minAmt") |
| | | public void setMinAmt(String minAmt) { |
| | | this.minAmt = minAmt; |
| | | } |
| | | |
| | | public String getMaxAmt() { |
| | | return maxAmt; |
| | | } |
| | | |
| | | @JSONField(name = "maxAmt") |
| | | public void setMaxAmt(String maxAmt) { |
| | | this.maxAmt = maxAmt; |
| | | } |
| | | |
| | | public String getBalance() { |
| | | return balance; |
| | | } |
| | | @JSONField(name = "balance") |
| | | public void setBalance(String balance) { |
| | | this.balance = balance; |
| | | } |
| | | |
| | | public String getExpireDate() { |
| | | return expireDate; |
| | | } |
| | | @JSONField(name = "expireDate") |
| | | public void setExpireDate(String expireDate) { |
| | | this.expireDate = expireDate; |
| | | } |
| | | |
| | | public String getRcvMerchantId() { |
| | | return rcvMerchantId; |
| | | } |
| | | @JSONField(name = "rcvMerchantId") |
| | | public void setRcvMerchantId(String rcvMerchantId) { |
| | | this.rcvMerchantId = rcvMerchantId; |
| | | } |
| | | |
| | | public String getRcvAcc() { |
| | | return rcvAcc; |
| | | } |
| | | @JSONField(name = "rcvAcc") |
| | | public void setRcvAcc(String rcvAcc) { |
| | | this.rcvAcc = rcvAcc; |
| | | } |
| | | |
| | | /** |
| | | * 分账模板号 |
| | | * @return |
| | | */ |
| | | public String getTmpSplitAcc() { |
| | | return tempSplitAcc; |
| | | } |
| | | @JSONField(name = "tempSplitAcc") |
| | | public void setTempSplitAcc(String tempSplitAcc) { |
| | | this.tempSplitAcc = tempSplitAcc; |
| | | } |
| | | |
| | | public UnitDetail getUnitDetail() { |
| | | return unitDetail; |
| | | } |
| | | @JSONField(name = "unitDetail") |
| | | public void setUnitDetail(UnitDetail unitDetail) { |
| | | this.unitDetail = unitDetail; |
| | | } |
| | | |
| | | public ArrayList<DescDetail> getDescDetails() { |
| | | return descDetails; |
| | | } |
| | | /** |
| | | * 设置账单描述详情键值对 |
| | | * @param feeDetails |
| | | */ |
| | | @JSONField(name = "descDetails") |
| | | public void setDescDetails(ArrayList<DescDetail> descDetails) { |
| | | this.descDetails = descDetails; |
| | | } |
| | | |
| | | public ArrayList<OptionDetail> getOptionDetails() { |
| | | return optionDetails; |
| | | } |
| | | @JSONField(name = "optionDetails") |
| | | public void setOptionDetails(ArrayList<OptionDetail> optionDetails) { |
| | | this.optionDetails = optionDetails; |
| | | } |
| | | |
| | | /** |
| | | * 均匀时段 |
| | | * |
| | | * @date 2017年12月21日 |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class UnitDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 单位名称 */ |
| | | @JSONField(name = "unitName") |
| | | private String unitName; |
| | | |
| | | /** 单位金额 */ |
| | | @JSONField(name = "unitAmount") |
| | | private String unitAmount; |
| | | |
| | | /** 最小单位数量 */ |
| | | @JSONField(name = "minUnitNum") |
| | | private String minUnitNum; |
| | | public UnitDetail(){} |
| | | |
| | | public UnitDetail(String unitName, String unitAmount, String minUnitNum) { |
| | | super(); |
| | | this.unitName = unitName; |
| | | this.unitAmount = unitAmount; |
| | | this.minUnitNum = minUnitNum; |
| | | } |
| | | public String getUnitName() { |
| | | return unitName; |
| | | } |
| | | |
| | | @JSONField(name = "unitAmount") |
| | | public void setUnitName(String unitName) { |
| | | this.unitName = unitName; |
| | | } |
| | | |
| | | public String getUnitAmount() { |
| | | return unitAmount; |
| | | } |
| | | |
| | | @JSONField(name = "unitAmount") |
| | | public void setUnitAmount(String unitAmount) { |
| | | this.unitAmount = unitAmount; |
| | | } |
| | | |
| | | public String getMinUnitNum() { |
| | | return minUnitNum; |
| | | } |
| | | |
| | | @JSONField(name = "minUnitNum") |
| | | public void setMinUnitNum(String minUnitNum) { |
| | | this.minUnitNum = minUnitNum; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse.Message.Info.Bill.unitDetail[unitName=" + unitName |
| | | + ", unitAmount=" + unitAmount + ", minUnitNum=" + minUnitNum + "]"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @title 选择套餐循环 |
| | | * |
| | | * @date 2017-12-18 |
| | | * |
| | | * |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class OptionDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /**套餐编号 根据编号排序*/ |
| | | @JSONField(name = "optionCode") |
| | | private String optionCode; |
| | | |
| | | /**套餐名称*/ |
| | | @JSONField(name = "optionName") |
| | | private String optionName; |
| | | |
| | | /**套餐金额*/ |
| | | @JSONField(name = "optionAmt") |
| | | private String optionAmt; |
| | | |
| | | public OptionDetail(){ |
| | | |
| | | } |
| | | |
| | | public OptionDetail(String optionCode, String optionName, String optionAmt) { |
| | | super(); |
| | | this.optionCode = optionCode; |
| | | this.optionName = optionName; |
| | | this.optionAmt = optionAmt; |
| | | } |
| | | |
| | | public String getOptionCode() { |
| | | return optionCode; |
| | | } |
| | | |
| | | @JSONField(name = "optionCode") |
| | | public void setOptionCode(String optionCode) { |
| | | this.optionCode = optionCode; |
| | | } |
| | | |
| | | public String getOptionName() { |
| | | return optionName; |
| | | } |
| | | |
| | | @JSONField(name = "optionName") |
| | | public void setOptionName(String optionName) { |
| | | this.optionName = optionName; |
| | | } |
| | | |
| | | public String getOptionAmt() { |
| | | return optionAmt; |
| | | } |
| | | @JSONField(name = "optionAmt") |
| | | public void setOptionAmt(String optionAmt) { |
| | | this.optionAmt = optionAmt; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse.Message.Info.Bill.OptionDetail[optionCode=" + optionCode |
| | | + ", optionName=" + optionName + ", optionAmt=" + optionAmt + "]"; |
| | | } |
| | | |
| | | } |
| | | /** |
| | | * @title 账单详情 |
| | | * |
| | | * @date 2017-12-18 |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class DescDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /**账单详情-名称*/ |
| | | @JSONField(name = "sCpt") |
| | | private String sCpt; |
| | | |
| | | /**账单详情-取值*/ |
| | | @JSONField(name = "sVal") |
| | | private String sVal; |
| | | |
| | | |
| | | public DescDetail(){ |
| | | |
| | | } |
| | | |
| | | public DescDetail(String sCpt, String sVal) { |
| | | super(); |
| | | this.sCpt = sCpt; |
| | | this.sVal = sVal; |
| | | } |
| | | |
| | | public String getSCpt() { |
| | | return sCpt; |
| | | } |
| | | |
| | | @JSONField(name = "sCpt") |
| | | public void setSCpt(String sCpt) { |
| | | this.sCpt = sCpt; |
| | | } |
| | | |
| | | public String getSVal() { |
| | | return sVal; |
| | | } |
| | | |
| | | @JSONField(name = "sVal") |
| | | public void setSVal(String sVal) { |
| | | this.sVal = sVal; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse.Message.Info.Bill.FeeDetail[sCpt=" + sCpt + ",sVal=" + sVal + "]"; |
| | | } |
| | | } |
| | | /** |
| | | * @title 平台商户分账子商户循环域 |
| | | * |
| | | * @date 2020-10-22 |
| | | * |
| | | * @author marui |
| | | */ |
| | | @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) |
| | | public class SplitSubMerInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /**二级子商户号*/ |
| | | @JSONField(name = "splitMerchantId") |
| | | private String splitMerchantId; |
| | | |
| | | /**二级子商户分账金额*/ |
| | | @JSONField(name = "splitAmount") |
| | | private String splitAmount; |
| | | |
| | | |
| | | public SplitSubMerInfo(){ |
| | | |
| | | } |
| | | |
| | | public SplitSubMerInfo(String splitMerchantId, String splitAmount) { |
| | | super(); |
| | | this.splitMerchantId = splitMerchantId; |
| | | this.splitAmount = splitAmount; |
| | | } |
| | | |
| | | public String getSplitMerchantId() { |
| | | return splitMerchantId; |
| | | } |
| | | |
| | | @JSONField(name = "splitMerchantId") |
| | | public void setSplitMerchantId(String splitMerchantId) { |
| | | this.splitMerchantId = splitMerchantId; |
| | | } |
| | | |
| | | public String getSplitAmount() { |
| | | return splitAmount; |
| | | } |
| | | |
| | | @JSONField(name = "splitAmount") |
| | | public void setSplitAmount(String splitAmount) { |
| | | this.splitAmount = splitAmount; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryBillResponse.Message.Info.Bill.SplitSubMerInfo[splitMerchantId=" + splitMerchantId |
| | | + ", splitAmount=" + splitAmount + "]"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.service; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.TypeReference; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.taxi591.bankapi.dto.ChargeBillRequest; |
| | | import com.taxi591.bankapi.dto.ChargeBillResponse; |
| | | import com.taxi591.bankapi.dto.CovertPayBackResult; |
| | | import com.taxi591.bankapi.utils.Base64; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.function.Function; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class BankService { |
| | | |
| | | @Autowired |
| | | SignatureAndVerification signatureAndVerification; |
| | | |
| | | static final String TIMESTAMP_PATTERN = "yyyyMMddHHmmssSSS"; |
| | | |
| | | /** |
| | | * 创建银行应答 |
| | | * @param request 银行请求对象 |
| | | * @param dealResult 是否处理成功 |
| | | * @return |
| | | */ |
| | | public String createResponse(ChargeBillRequest request,Boolean dealResult){ |
| | | ChargeBillResponse response = new ChargeBillResponse(request); |
| | | response.getMessage().getHead().setReturnCode(dealResult?"0000":"1111"); |
| | | response.getMessage().getHead().setReturnMessage(dealResult?"处理成功":"处理失败"); |
| | | response.getMessage().getInfo().setRefundFlag("false"); |
| | | response.getMessage().getHead().setTimeStamp(DateUtils.dateTimeNow(TIMESTAMP_PATTERN)); |
| | | if (!dealResult){ |
| | | if (Integer.parseInt(request.getMessage().getInfo().getResendTimes())==3){ |
| | | response.getMessage().getInfo().setRefundFlag("true"); |
| | | }else{ |
| | | response.getMessage().getInfo().setRefundFlag("false"); |
| | | } |
| | | } |
| | | String respJSON = JSON.toJSONString(response); |
| | | String sign = signatureAndVerification.signWhithsha1withrsa(respJSON); |
| | | String respStr = null; |
| | | try { |
| | | respStr = sign + "||" + new String(org.apache.commons.codec.binary.Base64.encodeBase64(respJSON.getBytes("utf-8"))); |
| | | } catch (UnsupportedEncodingException e) { |
| | | } |
| | | return respStr; |
| | | } |
| | | |
| | | /** |
| | | * 处理支付回调数据 |
| | | * @param httpRequest http请求对象 |
| | | * @param consumer 处理函数 |
| | | * @return |
| | | */ |
| | | public CovertPayBackResult covertPayCallBack(HttpServletRequest httpRequest, Function<ChargeBillRequest,Boolean> consumer) { |
| | | CovertPayBackResult result = new CovertPayBackResult(); |
| | | String requestContent = ""; |
| | | try { |
| | | // 接收报文 |
| | | requestContent = SignatureAndVerification.getRequestBody(httpRequest).trim(); |
| | | String sign = requestContent.substring(0, |
| | | requestContent.indexOf("||"));; |
| | | String requestBody = requestContent.substring(sign |
| | | .length() + 2);; |
| | | Pattern p=Pattern.compile("\""); |
| | | Matcher m=p.matcher(requestBody); |
| | | while(m.find()){ |
| | | requestBody=requestBody.replace(m.group(), ""); |
| | | } |
| | | String request = new String(Base64.decodeFast(requestBody)); |
| | | log.info("-----ChargeBillController------------解析完成后的requestBody-------{}" + request); |
| | | ChargeBillRequest chargeBillRequest = JSON.parseObject(request, |
| | | new TypeReference<ChargeBillRequest>() { |
| | | }); |
| | | if (chargeBillRequest==null){ |
| | | log.error("支付回调解析失败:{}",requestContent); |
| | | throw new ServiceException("支付回调解析失败"); |
| | | } |
| | | boolean isok = signatureAndVerification.read_cer_and_verify_sign(requestBody,sign); |
| | | if (!isok){ |
| | | throw new ServiceException("支付回调验签失败"); |
| | | } |
| | | Boolean dealBack = true; |
| | | if (consumer!=null){ |
| | | dealBack = consumer.apply(chargeBillRequest); |
| | | } |
| | | result.setResult(chargeBillRequest); |
| | | result.setBack(createResponse(chargeBillRequest,dealBack)); |
| | | }catch (ServiceException e){ |
| | | result.setBack(e.getMessage()); |
| | | throw e; |
| | | }catch (Exception e){ |
| | | log.error("解析异常:{}",requestContent,e); |
| | | throw new ServiceException("支付回调解析异常"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public void covertBillTo(){ |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.service; |
| | | |
| | | import com.taxi591.bankapi.BankProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.security.KeyStore; |
| | | import java.security.PrivateKey; |
| | | import java.security.PublicKey; |
| | | import java.security.Signature; |
| | | import java.security.cert.CertificateFactory; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.Enumeration; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 验签和加签工具类 |
| | | * @author yzz |
| | | * |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class SignatureAndVerification { |
| | | |
| | | @Autowired |
| | | BankProperties bankProperties; |
| | | |
| | | |
| | | |
| | | public static String getRequestBody(HttpServletRequest request) |
| | | throws IOException { |
| | | /** 读取httpbody内容 */ |
| | | StringBuilder httpBody = new StringBuilder(); |
| | | BufferedReader br = null; |
| | | try { |
| | | br = new BufferedReader(new InputStreamReader( |
| | | request.getInputStream())); |
| | | String line = null; |
| | | while ((line = br.readLine()) != null) { |
| | | httpBody.append(line); |
| | | } |
| | | } catch (IOException ex) { |
| | | throw ex; |
| | | } finally { |
| | | if (br != null) { |
| | | try { |
| | | br.close(); |
| | | } catch (IOException ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return httpBody.toString(); |
| | | } |
| | | /** |
| | | * 加签名 |
| | | * @param dataString |
| | | * @return |
| | | */ |
| | | public String signWhithsha1withrsa(String dataString) { |
| | | String signatureString = null; |
| | | String filePath=bankProperties.getPfxPath(); |
| | | try { |
| | | KeyStore ks = KeyStore.getInstance("PKCS12"); |
| | | FileInputStream fis = new FileInputStream(filePath); |
| | | char[] nPassword = null; |
| | | if ((bankProperties.getKeystorePassword() == null) |
| | | || bankProperties.getKeystorePassword().trim().equals("")) { |
| | | nPassword = null; |
| | | } else { |
| | | nPassword = bankProperties.getKeystorePassword().toCharArray(); |
| | | } |
| | | ks.load(fis, nPassword); |
| | | fis.close(); |
| | | |
| | | Enumeration<String> enums = ks.aliases(); |
| | | String keyAlias = null; |
| | | if (enums.hasMoreElements()) |
| | | { |
| | | keyAlias = (String) enums.nextElement(); |
| | | } |
| | | System.out.println("is key entry=" + ks.isKeyEntry(keyAlias)); |
| | | PrivateKey prikey = (PrivateKey) ks.getKey(keyAlias, nPassword); |
| | | java.security.cert.Certificate cert = ks.getCertificate(keyAlias); |
| | | // SHA1withRSA算法进行签名 |
| | | Signature sign = Signature.getInstance("SHA1withRSA"); |
| | | sign.initSign(prikey); |
| | | byte[] data = dataString.getBytes("utf-8"); |
| | | byte[] dataBase= Base64.encodeBase64(data); |
| | | // 更新用于签名的数据 |
| | | sign.update(dataBase); |
| | | byte[] signature = sign.sign(); |
| | | signatureString = new String(Base64.encodeBase64(signature)); |
| | | System.out.println("加密完成,signature is : " + signatureString); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return signatureString; |
| | | } |
| | | |
| | | /** |
| | | * 读取cer并验证公钥签名 |
| | | * @return |
| | | */ |
| | | public boolean read_cer_and_verify_sign(String requestBody, String signature) { |
| | | String filePath=bankProperties.getCerPath(); |
| | | X509Certificate cert = null; |
| | | boolean flag = false; |
| | | try { |
| | | CertificateFactory cf = CertificateFactory.getInstance("X.509"); |
| | | cert = (X509Certificate) cf |
| | | .generateCertificate(new FileInputStream(new File( |
| | | filePath))); |
| | | PublicKey publicKey = cert.getPublicKey(); |
| | | String publicKeyString = new String(Base64.encodeBase64(publicKey |
| | | .getEncoded())); |
| | | System.out.println("-----------------公钥--------------------"); |
| | | System.out.println(publicKeyString); |
| | | System.out.println("-----------------公钥--------------------"); |
| | | Signature verifySign = Signature.getInstance("SHA1withRSA"); |
| | | verifySign.initVerify(publicKey); |
| | | // 用于验签的数据 |
| | | verifySign.update(requestBody.getBytes("utf-8")); |
| | | flag = verifySign.verify(Base64 |
| | | .decodeBase64(signature)); |
| | | } catch (Exception e) { |
| | | log.error("验签失败,发生异常:{},{}",requestBody,signature,e); |
| | | flag = false; |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 接收报文返回requestBody和使用base64解析后的requestBody以及缴费中心传送的签名 |
| | | */ |
| | | |
| | | public Map<String,String> requestBodyOfBase64(HttpServletRequest request){ |
| | | Map<String,String> requestMap=new HashMap<String,String>(); |
| | | // 接收报文 |
| | | String requestContent=null; |
| | | try { |
| | | requestContent = getRequestBody(request) |
| | | .trim(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String signatureString = null; |
| | | String requestBody = null; |
| | | if (requestContent.contains("||")) { |
| | | signatureString = requestContent.substring(0, |
| | | requestContent.indexOf("||")); |
| | | requestBody = requestContent.substring(signatureString |
| | | .length() + 2); |
| | | }else { |
| | | try { |
| | | requestBody = new String(requestContent.getBytes("GB2312")); |
| | | |
| | | log.info("转码后的报文:{}",requestBody); |
| | | |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | log.info("截取报文的requestBody解密前:{}", requestBody); |
| | | |
| | | String requestBodyOfDecoded = new String( |
| | | Base64.decodeBase64(requestBody)); |
| | | |
| | | /*if (requestBodyOfDecoded.contains("</Message>")) { |
| | | requestBody = requestBodyOfDecoded.substring( |
| | | requestContent.indexOf("</Message>"),requestContent.indexOf("</Message>")+10); |
| | | |
| | | signatureString = requestBodyOfDecoded.substring( |
| | | requestContent.indexOf("<Signature>")+11,requestContent.indexOf("</Signature>")); |
| | | }*/ |
| | | |
| | | log.info("截取报文的signatureString:{}", signatureString); |
| | | |
| | | |
| | | System.out.println("-----解析完成后的requestBody-------" + requestBodyOfDecoded); |
| | | |
| | | //使用base64解析完成后的requestBody |
| | | requestMap.put("requestBodyOfDecoded",requestBodyOfDecoded); |
| | | //解析前的requestBody |
| | | requestMap.put("requestBody",requestBody); |
| | | //获取缴费中心传送过来的签名 |
| | | requestMap.put("signatureString",signatureString); |
| | | return requestMap; |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | |
| | | package com.taxi591.bankapi.utils; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * |
| | | * @version 2.2 |
| | | * @author Mikael Grev Date: 2004-aug-02 Time: 11:31:11 |
| | | */ |
| | | public class Base64 { |
| | | |
| | | public static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray(); |
| | | public static final int[] IA = new int[256]; |
| | | static { |
| | | Arrays.fill(IA, -1); |
| | | for (int i = 0, iS = CA.length; i < iS; i++) |
| | | IA[CA[i]] = i; |
| | | IA['='] = 0; |
| | | } |
| | | |
| | | /** |
| | | * Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as |
| | | * fast as #decode(char[]). The preconditions are:<br> |
| | | * + The array must have a line length of 76 chars OR no line separators at all (one line).<br> |
| | | * + Line separator must be "\r\n", as specified in RFC 2045 + The array must not contain illegal characters within |
| | | * the encoded string<br> |
| | | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br> |
| | | * |
| | | * @param chars The source array. Length 0 will return an empty array. <code>null</code> will throw an exception. |
| | | * @return The decoded array of bytes. May be of length 0. |
| | | */ |
| | | public static byte[] decodeFast(char[] chars, int offset, int charsLen) { |
| | | // Check special case |
| | | if (charsLen == 0) { |
| | | return new byte[0]; |
| | | } |
| | | |
| | | int sIx = offset, eIx = offset + charsLen - 1; // Start and end index after trimming. |
| | | |
| | | // Trim illegal chars from start |
| | | while (sIx < eIx && IA[chars[sIx]] < 0) |
| | | sIx++; |
| | | |
| | | // Trim illegal chars from end |
| | | while (eIx > 0 && IA[chars[eIx]] < 0) |
| | | eIx--; |
| | | |
| | | // get the padding count (=) (0, 1 or 2) |
| | | int pad = chars[eIx] == '=' ? (chars[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end. |
| | | int cCnt = eIx - sIx + 1; // Content count including possible separators |
| | | int sepCnt = charsLen > 76 ? (chars[76] == '\r' ? cCnt / 78 : 0) << 1 : 0; |
| | | |
| | | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes |
| | | byte[] bytes = new byte[len]; // Preallocate byte[] of exact length |
| | | |
| | | // Decode all but the last 0 - 2 bytes. |
| | | int d = 0; |
| | | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { |
| | | // Assemble three bytes into an int from four "valid" characters. |
| | | int i = IA[chars[sIx++]] << 18 | IA[chars[sIx++]] << 12 | IA[chars[sIx++]] << 6 | IA[chars[sIx++]]; |
| | | |
| | | // Add the bytes |
| | | bytes[d++] = (byte) (i >> 16); |
| | | bytes[d++] = (byte) (i >> 8); |
| | | bytes[d++] = (byte) i; |
| | | |
| | | // If line separator, jump over it. |
| | | if (sepCnt > 0 && ++cc == 19) { |
| | | sIx += 2; |
| | | cc = 0; |
| | | } |
| | | } |
| | | |
| | | if (d < len) { |
| | | // Decode last 1-3 bytes (incl '=') into 1-3 bytes |
| | | int i = 0; |
| | | for (int j = 0; sIx <= eIx - pad; j++) |
| | | i |= IA[chars[sIx++]] << (18 - j * 6); |
| | | |
| | | for (int r = 16; d < len; r -= 8) |
| | | bytes[d++] = (byte) (i >> r); |
| | | } |
| | | |
| | | return bytes; |
| | | } |
| | | |
| | | public static byte[] decodeFast(String chars, int offset, int charsLen) { |
| | | // Check special case |
| | | if (charsLen == 0) { |
| | | return new byte[0]; |
| | | } |
| | | |
| | | int sIx = offset, eIx = offset + charsLen - 1; // Start and end index after trimming. |
| | | |
| | | // Trim illegal chars from start |
| | | while (sIx < eIx && IA[chars.charAt(sIx)] < 0) |
| | | sIx++; |
| | | |
| | | // Trim illegal chars from end |
| | | while (eIx > 0 && IA[chars.charAt(eIx)] < 0) |
| | | eIx--; |
| | | |
| | | // get the padding count (=) (0, 1 or 2) |
| | | int pad = chars.charAt(eIx) == '=' ? (chars.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end. |
| | | int cCnt = eIx - sIx + 1; // Content count including possible separators |
| | | int sepCnt = charsLen > 76 ? (chars.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0; |
| | | |
| | | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes |
| | | byte[] bytes = new byte[len]; // Preallocate byte[] of exact length |
| | | |
| | | // Decode all but the last 0 - 2 bytes. |
| | | int d = 0; |
| | | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { |
| | | // Assemble three bytes into an int from four "valid" characters. |
| | | int i = IA[chars.charAt(sIx++)] << 18 | IA[chars.charAt(sIx++)] << 12 | IA[chars.charAt(sIx++)] << 6 | IA[chars.charAt(sIx++)]; |
| | | |
| | | // Add the bytes |
| | | bytes[d++] = (byte) (i >> 16); |
| | | bytes[d++] = (byte) (i >> 8); |
| | | bytes[d++] = (byte) i; |
| | | |
| | | // If line separator, jump over it. |
| | | if (sepCnt > 0 && ++cc == 19) { |
| | | sIx += 2; |
| | | cc = 0; |
| | | } |
| | | } |
| | | |
| | | if (d < len) { |
| | | // Decode last 1-3 bytes (incl '=') into 1-3 bytes |
| | | int i = 0; |
| | | for (int j = 0; sIx <= eIx - pad; j++) |
| | | i |= IA[chars.charAt(sIx++)] << (18 - j * 6); |
| | | |
| | | for (int r = 16; d < len; r -= 8) |
| | | bytes[d++] = (byte) (i >> r); |
| | | } |
| | | |
| | | return bytes; |
| | | } |
| | | |
| | | /** |
| | | * Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as fast |
| | | * as decode(String). The preconditions are:<br> |
| | | * + The array must have a line length of 76 chars OR no line separators at all (one line).<br> |
| | | * + Line separator must be "\r\n", as specified in RFC 2045 + The array must not contain illegal characters within |
| | | * the encoded string<br> |
| | | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br> |
| | | * |
| | | * @param s The source string. Length 0 will return an empty array. <code>null</code> will throw an exception. |
| | | * @return The decoded array of bytes. May be of length 0. |
| | | */ |
| | | public static byte[] decodeFast(String s) { |
| | | // Check special case |
| | | int sLen = s.length(); |
| | | if (sLen == 0) { |
| | | return new byte[0]; |
| | | } |
| | | |
| | | int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. |
| | | |
| | | // Trim illegal chars from start |
| | | while (sIx < eIx && IA[s.charAt(sIx) & 0xff] < 0) |
| | | sIx++; |
| | | |
| | | // Trim illegal chars from end |
| | | while (eIx > 0 && IA[s.charAt(eIx) & 0xff] < 0) |
| | | eIx--; |
| | | |
| | | // get the padding count (=) (0, 1 or 2) |
| | | int pad = s.charAt(eIx) == '=' ? (s.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end. |
| | | int cCnt = eIx - sIx + 1; // Content count including possible separators |
| | | int sepCnt = sLen > 76 ? (s.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0; |
| | | |
| | | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes |
| | | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length |
| | | |
| | | // Decode all but the last 0 - 2 bytes. |
| | | int d = 0; |
| | | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { |
| | | // Assemble three bytes into an int from four "valid" characters. |
| | | int i = IA[s.charAt(sIx++)] << 18 | IA[s.charAt(sIx++)] << 12 | IA[s.charAt(sIx++)] << 6 |
| | | | IA[s.charAt(sIx++)]; |
| | | |
| | | // Add the bytes |
| | | dArr[d++] = (byte) (i >> 16); |
| | | dArr[d++] = (byte) (i >> 8); |
| | | dArr[d++] = (byte) i; |
| | | |
| | | // If line separator, jump over it. |
| | | if (sepCnt > 0 && ++cc == 19) { |
| | | sIx += 2; |
| | | cc = 0; |
| | | } |
| | | } |
| | | |
| | | if (d < len) { |
| | | // Decode last 1-3 bytes (incl '=') into 1-3 bytes |
| | | int i = 0; |
| | | for (int j = 0; sIx <= eIx - pad; j++) |
| | | i |= IA[s.charAt(sIx++)] << (18 - j * 6); |
| | | |
| | | for (int r = 16; d < len; r -= 8) |
| | | dArr[d++] = (byte) (i >> r); |
| | | } |
| | | |
| | | return dArr; |
| | | } |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.utils; |
| | | |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | /** |
| | | * 将String进行base64编码解码,使用utf-8 |
| | | * yuan |
| | | */ |
| | | public class Base64Util { |
| | | |
| | | private static final Logger LOGGER = LoggerFactory.getLogger(Base64Util.class); |
| | | private static final String UTF_8 = "UTF-8"; |
| | | |
| | | /** |
| | | * 对给定的字符串进行base64解码操作 |
| | | */ |
| | | public static String decodeData(String inputData) { |
| | | try { |
| | | if (null == inputData) { |
| | | return null; |
| | | } |
| | | return new String(Base64.decodeBase64(inputData.getBytes(UTF_8)), UTF_8); |
| | | } catch (UnsupportedEncodingException e) { |
| | | LOGGER.error(inputData, e); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 对给定的字符串进行base64加密操作 |
| | | */ |
| | | public static String encodeData(String inputData) { |
| | | try { |
| | | if (null == inputData) { |
| | | return null; |
| | | } |
| | | return new String(Base64.encodeBase64(inputData.getBytes(UTF_8)), UTF_8); |
| | | } catch (UnsupportedEncodingException e) { |
| | | LOGGER.error(inputData, e); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.taxi591.bankapi.utils; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.ClientProtocolException; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | |
| | | /** |
| | | *httpClient操作远程url工具类 |
| | | */ |
| | | public class HttpClientUtils { |
| | | private static Logger logger = LoggerFactory.getLogger(HttpClientUtils.class); |
| | | /** |
| | | * 发送str格式的post请求 |
| | | * @param url |
| | | * @param jsonStr |
| | | * @return |
| | | */ |
| | | public static String doPostStr(String url, String str) { |
| | | // 建立HttpPost对象 |
| | | HttpPost httppost = new HttpPost(url); |
| | | HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); |
| | | CloseableHttpClient client = httpClientBuilder.build(); |
| | | // int statusCode = 0; |
| | | String responseBody = null; |
| | | try { |
| | | // 设置发送内容、编码等 |
| | | StringEntity stringEntity = new StringEntity(str, "utf-8"); |
| | | stringEntity.setContentType("text/plain"); |
| | | httppost.setEntity(stringEntity); |
| | | // 发送Post,并返回一个HttpResponse对象 |
| | | HttpResponse response = client.execute(httppost); |
| | | // // 获取返回码 |
| | | // statusCode = response.getStatusLine().getStatusCode(); |
| | | // 获取返回报文 |
| | | responseBody = EntityUtils.toString(response.getEntity()); |
| | | return responseBody; |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | * @param url |
| | | * @param jsonStr |
| | | * @param 前台的返回流 |
| | | * @return |
| | | */ |
| | | public static void doPostFile(String url, String str,HttpServletResponse httpResponse) { |
| | | ServletOutputStream out = null; |
| | | // 建立HttpPost对象 |
| | | HttpPost httppost = new HttpPost(url); |
| | | HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); |
| | | CloseableHttpClient client = httpClientBuilder.build(); |
| | | try { |
| | | // 设置发送内容、编码等 |
| | | StringEntity stringEntity = new StringEntity(str, "utf-8"); |
| | | stringEntity.setContentType("text/plain"); |
| | | httppost.setEntity(stringEntity); |
| | | // 发送Post,并返回一个HttpResponse对象 |
| | | HttpResponse response = client.execute(httppost); |
| | | // 获取返回报文 |
| | | String responseStr = EntityUtils.toString(response.getEntity()); |
| | | |
| | | //如果系统返回未加密异常则会返回"{"+json+"}" |
| | | if (responseStr.startsWith("{")){ |
| | | //设置响应头信息为页面形式 |
| | | httpResponse.setCharacterEncoding("UTF-8"); |
| | | httpResponse.setContentType("text/html;charset=utf-8"); |
| | | httpResponse.sendRedirect("downloadTraceFail.jsp"); |
| | | |
| | | //如果返回内容为异常信息则返回内容为"签名||base64加密"形式 |
| | | }else if (responseStr.contains("||")) { |
| | | //截取签名信息 |
| | | String headSub = responseStr.substring(0, responseStr.indexOf("||")); |
| | | logger.warn("获取签名的前半部分:"+headSub); |
| | | //截取加密的json信息,进行解密 |
| | | String tailSub = responseStr.substring(responseStr.indexOf("||")+2); |
| | | logger.warn("获取签名的后半部分:"+tailSub); |
| | | //将获取到的json报文进行解析,获取报文体信息 |
| | | responseStr = Base64Util.decodeData(tailSub); |
| | | logger.warn("获取签名解密后:"+responseStr); |
| | | |
| | | //设置响应头信息为页面形式 |
| | | httpResponse.setCharacterEncoding("UTF-8"); |
| | | httpResponse.setContentType("text/html;charset=utf-8"); |
| | | httpResponse.sendRedirect("downloadTraceFail.jsp"); |
| | | |
| | | //返回内容为正常内容,将response消息头读取直接写入httpResponse中 |
| | | }else{ |
| | | Header[] encode = response.getAllHeaders(); |
| | | for (Header header : encode) { |
| | | httpResponse.setHeader(header.getName(), header.getValue()); |
| | | } |
| | | } |
| | | //将获取到的信息封装到httpEntity中,反映到页面中去 |
| | | logger.warn("最终获取到的信息:"+responseStr); |
| | | HttpEntity entity = new StringEntity(responseStr,"UTF-8"); |
| | | //通过输出流将结果反映到页面上 |
| | | out = httpResponse.getOutputStream(); |
| | | entity.writeTo(out); |
| | | out.flush(); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally{ |
| | | if(out != null){ |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * get 请求方法 |
| | | * @param url |
| | | * @return |
| | | */ |
| | | public static String doGet(String url) { |
| | | CloseableHttpClient httpClient = null; |
| | | CloseableHttpResponse response = null; |
| | | String result = ""; |
| | | |
| | | try { |
| | | //通过址默认配置创建一个httpClient实例 |
| | | httpClient = HttpClients.createDefault(); |
| | | //创建httpGet远程连接实例 |
| | | HttpGet httpGet = new HttpGet(url); |
| | | //设置配置请求参数 |
| | | RequestConfig requestConfig = RequestConfig.custom() |
| | | .setConnectTimeout(35000)//连接主机服务超时时间 |
| | | .setConnectionRequestTimeout(35000)//请求超时时间 |
| | | .setSocketTimeout(60000)//数据读取超时时间 |
| | | .build(); |
| | | //为httpGet实例设置配置 |
| | | httpGet.setConfig(requestConfig); |
| | | //执行get请求得到返回对象 |
| | | response = httpClient.execute(httpGet); |
| | | //通过返回对象获取返回数据 |
| | | HttpEntity entity = response.getEntity(); |
| | | //通过EntityUtils中的toString方法将结果转换为字符串 |
| | | result = EntityUtils.toString(entity); |
| | | |
| | | } catch (ClientProtocolException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | //关闭资源 |
| | | if(null != response) { |
| | | try { |
| | | response.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | if(null != httpClient) { |
| | | try { |
| | | httpClient.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * post请求 |
| | | * @param url |
| | | * @param paramMap |
| | | * @return |
| | | */ |
| | | public static String doPost(String url, Map<String,Object> paramMap) { |
| | | CloseableHttpClient httpClient = null; |
| | | CloseableHttpResponse response = null; |
| | | String result = ""; |
| | | |
| | | try { |
| | | //创建httpClient实例 |
| | | httpClient = HttpClients.createDefault(); |
| | | //创建httpPost远程连接实例 |
| | | HttpPost httpPost = new HttpPost(url); |
| | | //配置请求参数实例 |
| | | RequestConfig requestConfig = RequestConfig.custom() |
| | | .setConnectTimeout(35000)//设置连接主机服务超时时间 |
| | | .setConnectionRequestTimeout(35000)//设置连接请求超时时间 |
| | | .setSocketTimeout(60000)//设置读取数据连接超时时间 |
| | | .build(); |
| | | //为httpPost实例设置配置 |
| | | httpPost.setConfig(requestConfig); |
| | | |
| | | //封装post请求参数 |
| | | if(null != paramMap && paramMap.size() > 0) { |
| | | List<NameValuePair> nvps = new ArrayList<NameValuePair>(); |
| | | //通过map集成entrySet方法获取entity |
| | | Set<Entry<String, Object>> entrySet = paramMap.entrySet(); |
| | | //循环遍历,获取迭代器 |
| | | Iterator<Entry<String, Object>> iterator = entrySet.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Entry<String, Object> mapEntry = iterator.next(); |
| | | nvps.add(new BasicNameValuePair(mapEntry.getKey(), mapEntry.getValue().toString())); |
| | | } |
| | | |
| | | //为httpPost设置封装好的请求参数 |
| | | httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8")); |
| | | } |
| | | |
| | | //执行post请求得到返回对象 |
| | | response = httpClient.execute(httpPost); |
| | | //通过返回对象获取数据 |
| | | HttpEntity entity = response.getEntity(); |
| | | //将返回的数据转换为字符串 |
| | | result = EntityUtils.toString(entity); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | //关闭资源 |
| | | if(null != response) { |
| | | try { |
| | | response.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | if(null != httpClient) { |
| | | try { |
| | | httpClient.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param request |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static String getRequestBody(HttpServletRequest request) |
| | | throws IOException { |
| | | /** 读取httpbody内容 */ |
| | | StringBuilder httpBody = new StringBuilder(); |
| | | BufferedReader br = null; |
| | | try { |
| | | br = new BufferedReader(new InputStreamReader( |
| | | request.getInputStream())); |
| | | String line = null; |
| | | while ((line = br.readLine()) != null) { |
| | | httpBody.append(line); |
| | | } |
| | | } catch (IOException ex) { |
| | | throw ex; |
| | | } finally { |
| | | if (br != null) { |
| | | try { |
| | | br.close(); |
| | | } catch (IOException ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return httpBody.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ |
| | | com.taxi591.bankapi.BankConfig |
New file |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ÐÅÏ¢] ÇåÀí¹¤³ÌtargetÉú³É·¾¶¡£ |
| | | echo. |
| | | |
| | | %~d0 |
| | | cd %~dp0 |
| | | |
| | | cd .. |
| | | call mvn clean |
| | | |
| | | pause |
New file |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ÐÅÏ¢] ´ò°üWeb¹¤³Ì£¬Éú³Éwar/jar°üÎļþ¡£ |
| | | echo. |
| | | |
| | | %~d0 |
| | | cd %~dp0 |
| | | |
| | | cd .. |
| | | call mvn clean package -Dmaven.test.skip=true |
| | | |
| | | pause |
New file |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ÐÅÏ¢] ʹÓÃJarÃüÁîÔËÐÐWeb¹¤³Ì¡£ |
| | | echo. |
| | | |
| | | cd %~dp0 |
| | | cd ../ruoyi-admin/target |
| | | |
| | | set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m |
| | | |
| | | java -jar %JAVA_OPTS% ruoyi-admin.jar |
| | | |
| | | cd bin |
| | | pause |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.6</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>generator</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <dependencies> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/org.apache.velocity/velocity-engine-core --> |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>2.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <version>4.13.2</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!-- jdbc 连接包 --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-generator</artifactId> |
| | | <version>3.4.0</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.xizang; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringPool; |
| | | import com.baomidou.mybatisplus.generator.AutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.InjectionConfig; |
| | | import com.baomidou.mybatisplus.generator.config.*; |
| | | import com.baomidou.mybatisplus.generator.config.po.LikeTable; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | import org.junit.Test; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 通过指定 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) 可达到加速的效果。 |
| | | * 这时测试类启动时就只会初始化 Spring 上下文,不再启动 Tomcat 容器 |
| | | */ |
| | | public class CodeGeneratorTests { |
| | | |
| | | private static final String DRIVER_NAME = "com.mysql.cj.jdbc.Driver"; |
| | | |
| | | private static final String JDBC_URL = "jdbc:mysql://xzgt.test.591taxi.cn:13306/xizang?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai"; |
| | | private static final String USER_NAME = "root"; |
| | | private static final String PASSWORD = "8f5z9g52gx4bg"; |
| | | |
| | | |
| | | // 防止误生成 |
| | | private static final String BASE_PACKAGE = "com.ruoyi.system"; |
| | | |
| | | @Test |
| | | public void contextLoads() { |
| | | // 代码生成器 |
| | | AutoGenerator mpg = new AutoGenerator(); |
| | | |
| | | // 全局配置 |
| | | GlobalConfig gc = new GlobalConfig(); |
| | | String projectPath = "D:\\workspaces\\Project\\company\\changyun\\xizang\\xizang\\generator"; |
| | | gc.setOutputDir(projectPath + "/src/main/java") |
| | | .setAuthor("yupeng") |
| | | .setMapperName("%sMapper") |
| | | .setXmlName("%sMapper") |
| | | .setServiceName("%sService") |
| | | .setServiceImplName("%sServiceImpl") |
| | | .setControllerName("%sController") |
| | | .setOpen(false)//当代码生成完成之后是否打开代码所在的文件夹 |
| | | .setSwagger2(true) //实体属性 Swagger2 注解 |
| | | .setFileOverride(true)//是否覆盖 |
| | | //.setActiveRecord(true) |
| | | .setEnableCache(false)// XML 二级缓存 |
| | | .setBaseResultMap(true)// XML ResultMap |
| | | .setBaseColumnList(true);// XML columList |
| | | mpg.setGlobalConfig(gc); |
| | | |
| | | // 数据源配置 |
| | | DataSourceConfig dsc = new DataSourceConfig(); |
| | | dsc.setUrl(JDBC_URL); |
| | | // dsc.setSchemaName("public"); |
| | | dsc.setDriverName(DRIVER_NAME); |
| | | dsc.setUsername(USER_NAME); |
| | | dsc.setPassword(PASSWORD); |
| | | mpg.setDataSource(dsc); |
| | | |
| | | // 包配置 |
| | | PackageConfig pc = new PackageConfig(); |
| | | // pc.setModuleName(scanner("模块名")); |
| | | // pc.setModuleName("sys"); |
| | | pc.setParent(BASE_PACKAGE);//controller entity service service.impl |
| | | pc.setController("controller"); |
| | | pc.setEntity("model"); |
| | | pc.setMapper("mapper"); |
| | | pc.setService("service"); |
| | | |
| | | |
| | | // 自定义mapping文件生成路径配置 |
| | | InjectionConfig cfg = new InjectionConfig() { |
| | | @Override |
| | | public void initMap() { |
| | | // to do nothing |
| | | } |
| | | }; |
| | | // 如果模板引擎是 velocity |
| | | String templatePath = "/templates/mapper.xml.vm"; |
| | | |
| | | // 自定义输出配置 |
| | | List<FileOutConfig> focList = new ArrayList<>(); |
| | | // 自定义配置会被优先输出 |
| | | focList.add(new FileOutConfig(templatePath) { |
| | | @Override |
| | | public String outputFile(TableInfo tableInfo) { |
| | | // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! |
| | | return projectPath + "/src/main/resources/mapping/" |
| | | + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; |
| | | } |
| | | }); |
| | | cfg.setFileOutConfigList(focList); |
| | | mpg.setCfg(cfg); |
| | | // 配置模板 |
| | | TemplateConfig templateConfig = new TemplateConfig(); |
| | | templateConfig.setXml(null); |
| | | mpg.setTemplate(templateConfig); |
| | | mpg.setPackageInfo(pc); |
| | | |
| | | // 配置模板 |
| | | // 不生成controller |
| | | //TemplateConfig templateConfig = new TemplateConfig(); |
| | | //templateConfig.setController(null); |
| | | //mpg.setTemplate(templateConfig); |
| | | |
| | | |
| | | // 策略配置 |
| | | StrategyConfig strategy = new StrategyConfig(); |
| | | //设置字段和表名的是否把下划线完成驼峰命名规则 |
| | | strategy.setNaming(NamingStrategy.underline_to_camel); |
| | | strategy.setEntitySerialVersionUID(true); |
| | | strategy.setEntityColumnConstant(false); |
| | | |
| | | |
| | | //设置生成的实体类继承的父类 |
| | | // strategy.setSuperEntityClass(BaseModel.class); |
| | | // 生成字段常量 |
| | | // strategy.setEntityColumnConstant(true); |
| | | // strategy.setSuperEntityColumns("create_by", "update_by", "disabled", "create_time", "last_time"); |
| | | strategy.setEntityLombokModel(true);//是否启动lombok |
| | | |
| | | strategy.setRestControllerStyle(true);//是否生成resetController |
| | | strategy.setLogicDeleteFieldName("isDelete"); |
| | | |
| | | // 字段自动操作策略 |
| | | /* List<TableFill> tableFillList = new ArrayList<>(); |
| | | tableFillList.add(new TableFill("create_time", FieldFill.INSERT)); |
| | | tableFillList.add(new TableFill("update_time", FieldFill.INSERT_UPDATE)); |
| | | // 表字段与属性映射关系 |
| | | strategy.setTableFillList(tableFillList);*/ |
| | | |
| | | // 公共父类 |
| | | // strategy.setSuperControllerClass("com.sxt.BaseController"); |
| | | // 写于父类中的公共字段 |
| | | // strategy.setSuperEntityColumns("person_id","person_name"); |
| | | //要设置生成哪些表 如果不设置就是生成所有的表 |
| | | // strategy.setInclude(scanner("表名,多个英文逗号分割").split(",")); |
| | | strategy.setControllerMappingHyphenStyle(true); |
| | | strategy.setEntityTableFieldAnnotationEnable(true); |
| | | // strategy.setTablePrefix(pc.getModuleName() + ""); |
| | | // strategy.setLikeTable(new LikeTable("room")); |
| | | //strategy.setLikeTable(new LikeTable("member")); |
| | | strategy.setLikeTable(new LikeTable("sys_file"));// 生成表名 |
| | | // strategy.setLikeTable(new LikeTable("t_hotel"));// 生成表名 |
| | | // strategy.setLikeTable(new LikeTable("t_scan_message"));// 生成表名 |
| | | // strategy.setNotLikeTable(new LikeTable("hotel_info"));// 不生成表名 |
| | | // strategy.setLikeTable(); |
| | | // strategy.setTablePrefix("sys_"); |
| | | mpg.setStrategy(strategy); |
| | | mpg.execute(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi</artifactId> |
| | | <version>3.8.6</version> |
| | | |
| | | <name>ruoyi</name> |
| | | <url>http://www.ruoyi.vip</url> |
| | | <description>若依管理系统</description> |
| | | |
| | | <properties> |
| | | <ruoyi.version>3.8.6</ruoyi.version> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| | | <java.version>1.8</java.version> |
| | | <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> |
| | | <druid.version>1.2.16</druid.version> |
| | | <bitwalker.version>1.21</bitwalker.version> |
| | | <swagger.version>3.0.0</swagger.version> |
| | | <kaptcha.version>2.3.3</kaptcha.version> |
| | | <pagehelper.boot.version>1.4.6</pagehelper.boot.version> |
| | | <fastjson.version>2.0.39</fastjson.version> |
| | | <oshi.version>6.4.4</oshi.version> |
| | | <commons.io.version>2.13.0</commons.io.version> |
| | | <commons.collections.version>3.2.2</commons.collections.version> |
| | | <poi.version>4.1.2</poi.version> |
| | | <velocity.version>2.3</velocity.version> |
| | | <jwt.version>0.9.1</jwt.version> |
| | | </properties> |
| | | |
| | | <!-- 依赖声明 --> |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | |
| | | <!-- SpringBoot的依赖配置--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-dependencies</artifactId> |
| | | <version>2.5.15</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | |
| | | <!-- 阿里数据库连接池 --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>${druid.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 解析客户端操作系统、浏览器等 --> |
| | | <dependency> |
| | | <groupId>eu.bitwalker</groupId> |
| | | <artifactId>UserAgentUtils</artifactId> |
| | | <version>${bitwalker.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 获取系统信息 --> |
| | | <dependency> |
| | | <groupId>com.github.oshi</groupId> |
| | | <artifactId>oshi-core</artifactId> |
| | | <version>${oshi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- Swagger3依赖 --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | <version>${swagger.version}</version> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>io.swagger</groupId>--> |
| | | <!-- <artifactId>swagger-models</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | </dependency> |
| | | |
| | | <!-- io常用工具类 --> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>${commons.io.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- excel工具 --> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>${poi.version}</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | <version>${poi.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml-schemas</artifactId> |
| | | <version>${poi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- velocity代码生成使用模板 --> |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>${velocity.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- collections工具类 --> |
| | | <dependency> |
| | | <groupId>commons-collections</groupId> |
| | | <artifactId>commons-collections</artifactId> |
| | | <version>${commons.collections.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里JSON解析器 --> |
| | | <dependency> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | | <version>${fastjson.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- Token生成与解析--> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | <version>${jwt.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 验证码 --> |
| | | <dependency> |
| | | <groupId>pro.fessional</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | | <version>${kaptcha.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 定时任务--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 代码生成--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 系统模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-system</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 通用工具--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <modules> |
| | | <module>ruoyi-admin</module> |
| | | <module>ruoyi-framework</module> |
| | | <module>ruoyi-system</module> |
| | | <module>ruoyi-quartz</module> |
| | | <module>ruoyi-generator</module> |
| | | <module>ruoyi-common</module> |
| | | <module>ruoyi-applet</module> |
| | | <module>bankapi</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.1</version> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${project.build.sourceEncoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>public</id> |
| | | <name>aliyun nexus</name> |
| | | <url>https://maven.aliyun.com/repository/public</url> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | <pluginRepositories> |
| | | <pluginRepository> |
| | | <id>public</id> |
| | | <name>aliyun nexus</name> |
| | | <url>https://maven.aliyun.com/repository/public</url> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | <snapshots> |
| | | <enabled>false</enabled> |
| | | </snapshots> |
| | | </pluginRepository> |
| | | </pluginRepositories> |
| | | |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.6</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>ruoyi-admin</artifactId> |
| | | |
| | | <description> |
| | | web服务入口 |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.taxi591</groupId> |
| | | <artifactId>bankapi</artifactId> |
| | | <version>1.0.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.8.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.guava</groupId> |
| | | <artifactId>guava</artifactId> |
| | | <version>31.1-jre</version> <!-- 请根据需要选择合适的版本 --> |
| | | </dependency> |
| | | <!-- spring-boot-devtools --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> <!-- 表示依赖不会传递 --> |
| | | </dependency> |
| | | |
| | | <!-- swagger3--> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.xiaoymin</groupId>--> |
| | | <!-- <artifactId>swagger-bootstrap-ui</artifactId>--> |
| | | <!-- <version>1.9.6</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | |
| | | <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 --> |
| | | <dependency> |
| | | <groupId>io.swagger</groupId> |
| | | <artifactId>swagger-models</artifactId> |
| | | <version>1.6.2</version> |
| | | </dependency> |
| | | |
| | | <!-- Mysql驱动包 --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.github.pagehelper</groupId>--> |
| | | <!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | </dependency> |
| | | |
| | | <!-- 定时任务--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.github.pagehelper</groupId>--> |
| | | <!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | </dependency> |
| | | |
| | | <!-- 代码生成--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.github.pagehelper</groupId>--> |
| | | <!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | </dependency> |
| | | |
| | | <!-- zxing生成二维码 --> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-test</artifactId> |
| | | <version>5.1.3.RELEASE</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.httpcomponents</groupId>--> |
| | | <!-- <artifactId>httpcore</artifactId>--> |
| | | <!-- <version>4.3.2</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>4.9.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.78</version> |
| | | </dependency> |
| | | |
| | | <!-- easypoi --> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-base</artifactId> |
| | | <version>4.3.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-web</artifactId> |
| | | <version>4.3.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-annotation</artifactId> |
| | | <version>4.3.0</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里云短信 --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>dysmsapi20170525</artifactId> |
| | | <version>2.0.10</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>2.5.15</version> |
| | | <configuration> |
| | | <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> |
| | | </configuration> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>3.1.0</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <warName>${project.artifactId}</warName> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.ruoyi; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import springfox.documentation.oas.annotations.EnableOpenApi; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | |
| | | /** |
| | | * 启动程序 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Slf4j |
| | | @EnableOpenApi |
| | | @EnableCaching |
| | | @EnableScheduling//开启定时任务 |
| | | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) |
| | | public class RuoYiApplication |
| | | { |
| | | public static void main(String[] args) { |
| | | |
| | | |
| | | ConfigurableApplicationContext application = SpringApplication.run(RuoYiApplication.class, args); |
| | | try { |
| | | |
| | | Environment env = application.getEnvironment(); |
| | | log.info("\n----------------------------------------------------------\n\t" + |
| | | "应用 '{}' 运行成功! 访问连接:\n\t" + |
| | | "Swagger文档: \t\thttp://{}:{}/doc.html\n" + |
| | | "----------------------------------------------------------", |
| | | env.getProperty("spring.application.name", "后台"), |
| | | InetAddress.getLocalHost().getHostAddress(), |
| | | env.getProperty("server.port", "8081")); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 当不存在此 wxRestTemplate 使用此方法的bean注入 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | @ConditionalOnMissingBean(name = "restTemplate") |
| | | public RestTemplate wxRestTemplate() { |
| | | //复杂构造函数的使用 |
| | | SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); |
| | | // 设置超时 |
| | | requestFactory.setConnectTimeout(6000); |
| | | requestFactory.setReadTimeout(6000); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | restTemplate.setRequestFactory(requestFactory); |
| | | return restTemplate; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi; |
| | | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | |
| | | /** |
| | | * web容器中进行部署 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RuoYiServletInitializer extends SpringBootServletInitializer |
| | | { |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) |
| | | { |
| | | return application.sources(RuoYiApplication.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.aspect; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | @Aspect |
| | | @Component |
| | | |
| | | public class StateAspect { |
| | | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | @Pointcut("execution(* com.ruoyi.web.controller.manage.*.*(..)) && !execution( * com.ruoyi.web.controller.manage.LoginController.*.*(..))") |
| | | public void state(){} |
| | | |
| | | @Before("state()") |
| | | public void isfrozen(){ |
| | | System.err.println("进入切面"); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SysUser sysUser = sysUserService.selectUserById(loginUser.getUserId()); |
| | | if (sysUser.getStatus().equals("1")){ |
| | | throw new ServiceException("当前账号已停用"); |
| | | } |
| | | if (roleService.selectRoleByUserId(sysUser.getUserId()).getStatus()==1){ |
| | | throw new ServiceException("当前角色已停用"); |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.ruoyi.common.constant.AmountConstant; |
| | | import com.ruoyi.common.enums.BillTypeEnum; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.TBillDto; |
| | | import com.ruoyi.system.model.TOrderBill; |
| | | import com.ruoyi.system.model.TPayOrder; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.ruoyi.system.service.TOrderBillService; |
| | | import com.ruoyi.system.service.TPayOrderService; |
| | | import com.taxi591.bankapi.dto.CovertPayBackResult; |
| | | import com.taxi591.bankapi.dto.QueryBillRequest; |
| | | import com.taxi591.bankapi.dto.QueryBillResponse; |
| | | import com.taxi591.bankapi.service.BankService; |
| | | import com.taxi591.bankapi.service.SignatureAndVerification; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | @RestController |
| | | @RequestMapping("open/bank") |
| | | @Slf4j |
| | | public class BankOutController { |
| | | |
| | | @Autowired |
| | | BankService bankService; |
| | | |
| | | @Autowired |
| | | TBillService tBillService; |
| | | |
| | | @Autowired |
| | | SignatureAndVerification signatureAndVerification; |
| | | |
| | | @Autowired |
| | | TOrderBillService orderBillService; |
| | | |
| | | @Autowired |
| | | TPayOrderService payOrderService; |
| | | |
| | | @PostMapping(value = "payCallback") |
| | | public @ResponseBody String payCallback(HttpServletRequest request){ |
| | | CovertPayBackResult result = bankService.covertPayCallBack(request, (billRequest) -> { |
| | | tBillService.completePay(billRequest); |
| | | return true; |
| | | }); |
| | | return result.getBack(); |
| | | } |
| | | |
| | | @PostMapping(value = "queryBill") |
| | | public void bills(HttpServletRequest request, HttpServletResponse httpServletResponse){ |
| | | log.info("进入QueryBillController账单查询接口--------(金额规则为0的)-------"); |
| | | |
| | | String responseJson = null; |
| | | try { |
| | | //接收报文request返回截取并返回requestBody和使用base64解析后的requestBody |
| | | Map<String, String> requestMap = signatureAndVerification.requestBodyOfBase64(request); |
| | | //使用base64解析完成后的requestBody |
| | | String requestBodyOfDecoded = requestMap.get("requestBodyOfDecoded"); |
| | | //解析前的requestBody |
| | | String requestBody = requestMap.get("requestBody"); |
| | | //获取缴费中心传送过来的签名 |
| | | String signatureString = requestMap.get("signatureString"); |
| | | |
| | | // 验签 |
| | | boolean flag = signatureAndVerification.read_cer_and_verify_sign(requestBody, |
| | | signatureString); |
| | | |
| | | log.info("【QueryBill:getBill4DirectJoinMerch】缴费中心响应的报文验签结果为:{}" , flag); |
| | | |
| | | QueryBillRequest queryBillRequest = JSON.parseObject(requestBodyOfDecoded, |
| | | new TypeReference<QueryBillRequest>() { |
| | | }); |
| | | //交易编号 |
| | | String traceNo = queryBillRequest.getMessage().getInfo() |
| | | .getTraceNo(); |
| | | //返回给缴费中心的响应 |
| | | QueryBillResponse response = new QueryBillResponse(queryBillRequest); |
| | | QueryBillResponse.Message respMessage = response.getMessage(); |
| | | QueryBillResponse.Message.Head respHead = response.getMessage() |
| | | .getHead(); |
| | | QueryBillResponse.Message.Info respInfo = response.getMessage() |
| | | .getInfo(); |
| | | //缴费账单子账单 |
| | | ArrayList<QueryBillResponse.Message.Info.Bill> respBills = new ArrayList<QueryBillResponse.Message.Info.Bill>(); |
| | | ArrayList<QueryBillResponse.Message.Info.Bill.DescDetail> respDescDetail = |
| | | new ArrayList<QueryBillResponse.Message.Info.Bill.DescDetail>(); |
| | | QueryBillResponse.Message.Info.Bill respBill = respInfo.new Bill(); |
| | | //缴费子商户账单 |
| | | // ArrayList<QueryBillResponse.Message.Info.Bill.SplitSubMerInfo> splitSubMerInfos = new ArrayList<QueryBillResponse.Message.Info.Bill.SplitSubMerInfo>(); |
| | | |
| | | //封装返回给缴费中心的响应 |
| | | |
| | | String epayCode = queryBillRequest.getMessage().getInfo() |
| | | .getEpayCode(); |
| | | respInfo.setEpayCode(epayCode); |
| | | String merchantId = queryBillRequest.getMessage().getInfo() |
| | | .getMerchantId(); |
| | | respInfo.setMerchantId(merchantId); |
| | | respInfo.setTraceNo(traceNo); |
| | | respInfo.setInput1(queryBillRequest.getMessage().getInfo() |
| | | .getInput1()); |
| | | respInfo.setInput2(queryBillRequest.getMessage().getInfo() |
| | | .getInput2()); |
| | | respInfo.setInput3(queryBillRequest.getMessage().getInfo() |
| | | .getInput3()); |
| | | respInfo.setInput4(queryBillRequest.getMessage().getInfo() |
| | | .getInput4()); |
| | | respInfo.setInput5(queryBillRequest.getMessage().getInfo() |
| | | .getInput5()); |
| | | String orderid= queryBillRequest.getMessage().getInfo().getInput1(); |
| | | if (StringUtils.isEmpty(orderid)){ |
| | | respHead.setReturnCode("0009"); |
| | | respHead.setReturnMessage("参数错误,input1订单号不能为空"); |
| | | }else{ |
| | | if (flag){ |
| | | |
| | | TPayOrder order = payOrderService.getById(orderid); |
| | | List<TOrderBill> orderBills = orderBillService.getByOrderNo(orderid); |
| | | List<TBillDto> bills = orderBills.stream().map(ob |
| | | -> tBillService.getDetailByBillId(ob.getBillId())).collect(Collectors.toList()); |
| | | respBill.setBillNo(orderid); |
| | | List<String> types = bills.stream().map(bill -> BillTypeEnum.getByCode(Integer.parseInt(bill.getBillType())).getName()).distinct().collect(Collectors.toList()); |
| | | // 封装详细账单信息 |
| | | respBill.setBillName("缴费:"+CollectionUtil.join(types,",")); |
| | | respBill.setOweAmt(BigDecimal.valueOf(order.getAmount()).divide(AmountConstant.b100,2, RoundingMode.HALF_DOWN).toPlainString()); |
| | | respBills.add(respBill); |
| | | respInfo.setCustName(order.getUserName()); |
| | | respInfo.setCustAddress(""); |
| | | respInfo.setCacheMem(""); |
| | | respInfo.setRemark(""); |
| | | respInfo.setCallBackText("西藏国资委"); |
| | | //respInfo.setCallBackUrl("https://abcsr.keepfx.cn/b/ejy/payResult/"); |
| | | //使用base64加密信息 |
| | | // respInfo.setCallBackUrl("aHR0cDp3d3cuYWJjaGluYS5jb20vY24v"); |
| | | //金额规则字段 |
| | | String amtRule = "0"; |
| | | respInfo.setAmtRule(amtRule); |
| | | /*QueryBillResponse.Message.Info.Bill.UnitDetail unitDetail = respBill.new UnitDetail( |
| | | "unitName", "6.66", "1");*/ |
| | | //欠费金额 |
| | | respBill.setFeeAmt("0.00"); |
| | | // |
| | | // QueryBillResponse.Message.Info.Bill.DescDetail descDtail1 = respBill.new DescDetail( |
| | | // "缴费月份:", "2020年6月份"); |
| | | // QueryBillResponse.Message.Info.Bill.DescDetail descDtail2 = respBill.new DescDetail( |
| | | // "供电局编号:", "4340152"); |
| | | // QueryBillResponse.Message.Info.Bill.DescDetail descDtail3 = respBill.new DescDetail( |
| | | // "欠费金额:", "0.00元"); |
| | | // QueryBillResponse.Message.Info.Bill.DescDetail descDtail4 = respBill.new DescDetail( |
| | | // "缴费月份:", "2020年6月份"); |
| | | // QueryBillResponse.Message.Info.Bill.DescDetail descDtail5 = respBill.new DescDetail( |
| | | // "服务时间:", "每天0:30-23:30期间均可缴费"); |
| | | // QueryBillResponse.Message.Info.Bill.DescDetail descDtail6 = respBill.new DescDetail( |
| | | // "温馨提示:", "北京电力电费代缴,咨询电话:95598 该用户为:预付费用户"); |
| | | // respDescDetail.add(descDtail1); |
| | | // respDescDetail.add(descDtail2); |
| | | // respDescDetail.add(descDtail3); |
| | | // respDescDetail.add(descDtail4); |
| | | // respDescDetail.add(descDtail5); |
| | | // respDescDetail.add(descDtail6); |
| | | |
| | | // respBill.setRcvMerchantId("103881104410001"); |
| | | |
| | | // 商户子商户详细信息 |
| | | // QueryBillResponse.Message.Info.Bill.SplitSubMerInfo splitSubMerInfo1 =respBill.new SplitSubMerInfo("10388", "0.01"); |
| | | // QueryBillResponse.Message.Info.Bill.SplitSubMerInfo splitSubMerInfo2 =respBill.new SplitSubMerInfo("1038819201", "0.02"); |
| | | // splitSubMerInfos.add(splitSubMerInfo1); |
| | | // splitSubMerInfos.add(splitSubMerInfo2); |
| | | |
| | | // respBill.setSplitSubMerInfos(splitSubMerInfos); |
| | | // respBill.setDescDetails(respDescDetail); |
| | | respInfo.setTotalBillCount(String.valueOf(respBills.size())); |
| | | respInfo.setBill(respBills); |
| | | |
| | | // 有定制电子回单附言信息的,需添加自定义定制附言信息字段 |
| | | respInfo.setMerchantRemark(""); |
| | | respHead.setReturnCode("0000"); |
| | | respHead.setReturnMessage("账单查询成功,返回成功标志"); |
| | | }else { |
| | | respHead.setReturnCode("0009"); |
| | | respHead.setReturnMessage("缴费中心传送给商户的请求报文签名验签失败!"); |
| | | } |
| | | } |
| | | |
| | | respHead.setTransFlag("02"); |
| | | respHead.setTimeStamp(DateUtil.format(new Date(),"yyyyMMddHHmmssSSS")); |
| | | |
| | | respMessage.setInfo(respInfo); |
| | | respMessage.setHead(respHead); |
| | | response.setMessage(respMessage); |
| | | responseJson = JSON.toJSONString(response); |
| | | // 加签名 |
| | | String signatrue = signatureAndVerification |
| | | .signWhithsha1withrsa(responseJson); |
| | | log.info("signatrue" + responseJson); |
| | | log.info("responseJson打印结果是(responseJson加密前):" + responseJson); |
| | | responseJson = signatrue + "||" |
| | | + new String(Base64.encodeBase64(responseJson.getBytes("utf-8"))); |
| | | log.info("responseJson打印结果是(responseJson加密后):{}", responseJson); |
| | | httpServletResponse.setCharacterEncoding("utf-8"); |
| | | httpServletResponse.setContentType("text/plain"); |
| | | httpServletResponse.getWriter().write(responseJson); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.config.FileUploadConfig; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TFile; |
| | | import com.ruoyi.system.service.SysFileService; |
| | | import com.ruoyi.system.service.impl.SysFileServiceImpl; |
| | | import com.ruoyi.web.controller.tool.TencentCosUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.net.URLEncoder; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-05-30 9:27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/cos") |
| | | @Api(tags = "公共-文件上传") |
| | | @Slf4j |
| | | public class COSController { |
| | | |
| | | @Resource |
| | | private TencentCosUtil tencentCosUtil; |
| | | |
| | | @Autowired |
| | | SysFileService sysFileService; |
| | | |
| | | @Autowired |
| | | FileUploadConfig fileUploadConfig; |
| | | |
| | | @Autowired |
| | | TokenService tokenService; |
| | | |
| | | public String getLocalUrlPrefix(){ |
| | | ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()); |
| | | if (servletRequestAttributes==null || servletRequestAttributes.getRequest()==null){ |
| | | return fileUploadConfig.getFileUrlPrefix(); |
| | | } |
| | | HttpServletRequest request = servletRequestAttributes.getRequest(); |
| | | StringBuffer url = new StringBuffer(); |
| | | url.append(request.getScheme()).append("://") |
| | | .append(request.getServerName()) |
| | | .append((request.getServerPort() == 80 ? "" : ":" + request.getServerPort())) |
| | | .append(request.getContextPath()); |
| | | return url.toString(); |
| | | } |
| | | |
| | | public String getLocalFileUrlPrefix(String fileId){ |
| | | String token = tokenService.getLoginUser().getToken(); |
| | | StringBuffer url = new StringBuffer(); |
| | | url.append(getLocalUrlPrefix()) |
| | | .append("/cos/get/").append(fileId).append("?s=").append(URLEncoder.encode(token)) |
| | | ; |
| | | return url.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static void failResponse(String message){ |
| | | ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()); |
| | | HttpServletResponse response = servletRequestAttributes.getResponse(); |
| | | String failResult = JSON.toJSONString(R.fail(message)); |
| | | //设置编码格式 |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | PrintWriter pw = null; |
| | | try { |
| | | pw = response.getWriter(); |
| | | pw.write(failResult); |
| | | pw.flush(); |
| | | } catch (IOException e) { |
| | | log.error("io异常"); |
| | | }finally { |
| | | if (pw!=null) { |
| | | pw.close(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @GetMapping("get/{fileId}") |
| | | public void get(@PathVariable("fileId") String fileid,@RequestParam("s") String s){ |
| | | if (StringUtils.isEmpty(fileid)){ |
| | | failResponse("文件ID不能为空"); |
| | | return; |
| | | } |
| | | if (StringUtils.isEmpty(s)){ |
| | | failResponse("token不能为空"); |
| | | return; |
| | | } |
| | | Object object = redisCache.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + s); |
| | | if (object==null){ |
| | | failResponse("用户登录已失效"); |
| | | return; |
| | | } |
| | | TFile file = sysFileService.getById(fileid); |
| | | if (file==null){ |
| | | failResponse("图片不存在"); |
| | | return; |
| | | } |
| | | tencentCosUtil.download(file); |
| | | } |
| | | |
| | | |
| | | @GetMapping("get/file") |
| | | public void getFile(@RequestParam("fileUrl") String fileUrl,@RequestParam("s") String s){ |
| | | if (StringUtils.isEmpty(fileUrl)){ |
| | | failResponse("文件路径不能为空"); |
| | | return; |
| | | } |
| | | if (StringUtils.isEmpty(s)){ |
| | | failResponse("token不能为空"); |
| | | return; |
| | | } |
| | | Object object = redisCache.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + s); |
| | | if (object==null){ |
| | | failResponse("用户登录已失效"); |
| | | return; |
| | | } |
| | | tencentCosUtil.download(fileUrl); |
| | | } |
| | | |
| | | /** |
| | | * 新上传接口,下一版更新 |
| | | * @param file |
| | | * @param folder 上传到cos的文件目录:如/contract/ |
| | | * @return |
| | | */ |
| | | @PostMapping("/uploadnew") |
| | | @ApiOperation(value = "文件上传,带上传目录,返回文件ID", tags = "公共-文件上传") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件", name = "file", dataType = "MultipartFile", required = true) |
| | | }) |
| | | public R<TFile> uploadnew(@RequestParam("file") MultipartFile file, @RequestParam("folder") String folder) { |
| | | TFile tFile = tencentCosUtil.upload(file,folder); |
| | | tFile.setFileUrl(getLocalFileUrlPrefix(tFile.getId())); |
| | | return R.ok(tFile); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param file |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/upload") |
| | | @ApiOperation(value = "文件上传", tags = "公共-文件上传") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件", name = "file", dataType = "MultipartFile", required = true) |
| | | }) |
| | | public R<String> upload(@RequestParam("file") MultipartFile file,@RequestParam("folder") String folder) { |
| | | String url = tencentCosUtil.upLoadFile(file,folder); |
| | | return R.ok(url, url); |
| | | } |
| | | @PostMapping("/downloadImg") |
| | | @ApiOperation(value = "文件下载", tags = "公共-文件下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件url", name = "url", dataType = "String", required = true) |
| | | }) |
| | | public String downloadImg(@RequestParam("url") String url) { |
| | | return tencentCosUtil.downLoadFileImg(url); |
| | | } |
| | | @PostMapping("/download") |
| | | @ApiOperation(value = "文件下载", tags = "公共-文件下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件url", name = "url", dataType = "String", required = true) |
| | | }) |
| | | public void download(@RequestParam("url") String url) { |
| | | tencentCosUtil.downLoadFile(url); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.exception.GlobalException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.bo.*; |
| | | import com.ruoyi.system.model.StateProcessModule; |
| | | import com.ruoyi.system.model.StateProcessTemplate; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.StateProcessModuleService; |
| | | import com.ruoyi.system.service.StateProcessTemplateService; |
| | | import com.ruoyi.system.vo.ProcessDetailVO; |
| | | import com.ruoyi.system.vo.ProcessTaskListVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api(tags = "审批流程管理") |
| | | @RequestMapping("/state-process") |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateProcessController { |
| | | |
| | | private final StateProcessTemplateService processTemplateService; |
| | | private final StateProcessModuleService processModuleService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | //应用流程分页列表 |
| | | @ApiOperation("应用流程分页列表") |
| | | @PostMapping("/module/page") |
| | | public AjaxResult<List<StateProcessModule>> modulePage(@RequestBody BasePage basePage) { |
| | | LambdaQueryWrapper<StateProcessModule> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.orderByAsc(StateProcessModule::getCategory); |
| | | //查询应用流程列表 |
| | | List<StateProcessModule> result = processModuleService.list(queryWrapper); |
| | | List<String> updateUserId = result.stream().map(BaseModel::getUpdateBy).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(updateUserId)){ |
| | | //根据用户id查询用户信息 |
| | | List<SysUser> sysUsers = sysUserService.selectUserByUserNameList(updateUserId); |
| | | Map<Long, SysUser> sysUserMap; |
| | | if (!CollectionUtils.isEmpty(sysUsers)){ |
| | | sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); |
| | | } else { |
| | | sysUserMap = new HashMap<>(); |
| | | } |
| | | //遍历列表,设置更新人名称 |
| | | result.forEach(e -> { |
| | | SysUser sysUser = sysUserMap.get(e.getUpdateBy()); |
| | | if (Objects.nonNull(sysUser)){ |
| | | e.setUpdateBy(sysUser.getNickName()); |
| | | } |
| | | }); |
| | | } |
| | | return AjaxResult.success(result); |
| | | } |
| | | //修改应用流程 |
| | | @Log(title = "审批流程管理-修改应用流程", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("修改应用流程") |
| | | @PostMapping("/module/update") |
| | | public AjaxResult<PageInfo<StateProcessModule>> moduleUpdate(@RequestBody ProcessModuleUpdateBO processModuleUpdateBO) { |
| | | StateProcessTemplate stateProcessTemplate = processTemplateService.getById(processModuleUpdateBO.getTemplateId()); |
| | | if (Objects.isNull(stateProcessTemplate)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | StateProcessModule stateProcessModule = new StateProcessModule(); |
| | | stateProcessModule.setId(processModuleUpdateBO.getId()); |
| | | stateProcessModule.setTemplateId(processModuleUpdateBO.getTemplateId()); |
| | | stateProcessModule.setTemplateName(stateProcessTemplate.getTemplateName()); |
| | | stateProcessModule.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | stateProcessModule.setCreateTime(LocalDateTime.now()); |
| | | stateProcessModule.setUpdateTime(LocalDateTime.now()); |
| | | stateProcessModule.setRemark(processModuleUpdateBO.getRemark()); |
| | | processModuleService.updateById(stateProcessModule); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //流程模版分页 |
| | | @ApiOperation("流程模版分页") |
| | | @PostMapping("/template/page") |
| | | public AjaxResult<Page<StateProcessTemplate>> page(ProcessTemplatePageBO request) { |
| | | Page<StateProcessTemplate> templatePage = processTemplateService.page(request); |
| | | return AjaxResult.success(templatePage); |
| | | } |
| | | |
| | | //查询流程模版 |
| | | @ApiOperation("查询流程模版") |
| | | @GetMapping("/template/getById") |
| | | public AjaxResult<StateProcessTemplate> selectById(@RequestParam String id) { |
| | | return AjaxResult.success(processTemplateService.getById(id)); |
| | | } |
| | | |
| | | //修改并部署模版 |
| | | @Log(title = "审批流程管理-修改并部署模版", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("修改并部署模版") |
| | | @PostMapping("/template/update") |
| | | public AjaxResult<Boolean> update(@RequestBody ProcessUpdateBO processUpdateBO) { |
| | | return AjaxResult.success(processTemplateService.update(processUpdateBO)); |
| | | } |
| | | |
| | | //删除模版 |
| | | @Log(title = "审批流程管理-删除模版", businessType = BusinessType.DELETE) |
| | | @ApiOperation("删除模版") |
| | | @GetMapping("/template/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam String id) { |
| | | StateProcessTemplate template = processTemplateService.getById(id); |
| | | //查询是否存在使用的 |
| | | LambdaUpdateWrapper<StateProcessModule> moduleLambdaUpdateWrapper = new LambdaUpdateWrapper<>();; |
| | | moduleLambdaUpdateWrapper.eq(StateProcessModule::getTemplateId, template.getId()); |
| | | if (processModuleService.getBaseMapper().exists(moduleLambdaUpdateWrapper)) { |
| | | throw new GlobalException("该模版在应用流程中已使用!"); |
| | | } |
| | | //根据key修改所有版本为已删除 |
| | | boolean result = processTemplateService.remove(Wrappers.lambdaQuery(StateProcessTemplate.class) |
| | | .eq(StateProcessTemplate::getTemplateKey, template.getTemplateKey())); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | //创建并部署模版 |
| | | @Log(title = "审批流程管理-创建并部署模版", businessType = BusinessType.INSERT) |
| | | @ApiOperation("创建并部署模版") |
| | | @PostMapping("/template/create") |
| | | public AjaxResult<Boolean> create(@RequestBody ProcessCreateBO processCreateBO) { |
| | | return AjaxResult.success(processTemplateService.create(processCreateBO)); |
| | | } |
| | | |
| | | //流程发起 |
| | | @Log(title = "审批流程管理-流程发起", businessType = BusinessType.INSERT) |
| | | @ApiOperation("流程发起") |
| | | @PostMapping("/start") |
| | | public AjaxResult<Boolean> start(@RequestBody ProcessStartBO processStartBO) { |
| | | return AjaxResult.success(processTemplateService.start(processStartBO)); |
| | | } |
| | | |
| | | //待办 |
| | | @ApiOperation("待办列表") |
| | | @PostMapping("/wait/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> waitTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.waitTaskPage(processTemplatePageBO)); |
| | | } |
| | | |
| | | //已办 |
| | | @ApiOperation("已办列表") |
| | | @PostMapping("/deal/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> dealTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.dealTaskPage(processTemplatePageBO)); |
| | | } |
| | | |
| | | //待办和已办列表 |
| | | @ApiOperation("待办和已办列表") |
| | | @PostMapping("/dealAndWait/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> dealAndWaitTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.dealAndWaitTaskPage(processTemplatePageBO)); |
| | | } |
| | | |
| | | //抄送 |
| | | @ApiOperation("抄送列表") |
| | | @PostMapping("/copy/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> copyTaskPage(@RequestBody ProcessTaskListBO processTaskListBO){ |
| | | return AjaxResult.success(processTemplateService.copyTaskPage(processTaskListBO)); |
| | | } |
| | | |
| | | //审核通过 |
| | | @Log(title = "审批流程管理-审核通过", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("审核通过") |
| | | @PostMapping("/agree") |
| | | public AjaxResult<Object> agree(@RequestBody ProcessAgreeBO processAgreeBO) { |
| | | processTemplateService.agree(processAgreeBO); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //审核拒绝 |
| | | @Log(title = "审批流程管理-审核拒绝", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("审核拒绝") |
| | | @PostMapping("/refuse") |
| | | public AjaxResult<Object> refuse(@RequestBody ProcessRefuseBO processRefuseBO) { |
| | | processTemplateService.refuse(processRefuseBO); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //审核详情 |
| | | @ApiOperation("审核详情") |
| | | @GetMapping("/detail") |
| | | public AjaxResult<ProcessDetailVO> detail(@RequestParam String taskId) { |
| | | ProcessDetailVO detail = processTemplateService.detail(taskId); |
| | | return AjaxResult.success(detail); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 文件列表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author yupeng |
| | | * @since 2025-03-05 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sys-file") |
| | | public class SysFileController { |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.system.importExcel.TBankFlowImportExcel; |
| | | import com.ruoyi.system.model.TBankFlow; |
| | | import com.ruoyi.system.query.TBankFlowQuery; |
| | | import com.ruoyi.system.service.TBankFlowService; |
| | | import com.ruoyi.system.vo.TBankFlowStatisticsVo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Vector; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流水管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-bank-flow") |
| | | public class TBankFlowController { |
| | | @Autowired |
| | | private TBankFlowService flowService; |
| | | |
| | | /** |
| | | * 获取流水列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('flow:bank:detail:list')") |
| | | @ApiOperation(value = "获取银行流水列表") |
| | | @PostMapping("/list") |
| | | public R<PageInfo<TBankFlow>> list(@RequestBody TBankFlowQuery query) { |
| | | return R.ok(flowService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据支付方式统计流水金额") |
| | | @PostMapping("/getPaymentStats") |
| | | public R<TBankFlowStatisticsVo> getPaymentStats(@RequestBody TBankFlowQuery query) { |
| | | return R.ok(flowService.getPaymentStats(query)); |
| | | } |
| | | |
| | | @PostMapping("importBankFlow") |
| | | public void importElectronic(@RequestBody MultipartFile file) { |
| | | try ( |
| | | InputStream is = file.getInputStream(); |
| | | ) { |
| | | List<TBankFlowImportExcel> failList = new Vector<>(); |
| | | EasyExcel.read(is, TBankFlowImportExcel.class, new AnalysisEventListener<TBankFlowImportExcel>() { |
| | | private final List<TBankFlowImportExcel> list = new ArrayList<>(); |
| | | final AtomicInteger all = new AtomicInteger(); |
| | | |
| | | @Override |
| | | public void invoke(TBankFlowImportExcel data, AnalysisContext context) { |
| | | all.addAndGet(1); |
| | | boolean isok = data.validate(); |
| | | if (!isok) { |
| | | failList.add(data); |
| | | return; |
| | | } |
| | | list.add(data); |
| | | int size = list.size(); |
| | | if (size >= 100) { |
| | | flowService.saveImportBatch(list, failList); |
| | | list.clear(); |
| | | } |
| | | } |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | int size = list.size(); |
| | | if (size > 0) { |
| | | flowService.saveImportBatch(list, failList); |
| | | } |
| | | } |
| | | }).sheet().doRead(); |
| | | // 导出导入结果 |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | if (failList.size() > 0) { |
| | | EasyExcel.write(response.getOutputStream(), TBankFlowImportExcel.class).sheet("Sheet1").doWrite(failList); |
| | | } else { |
| | | TBankFlowImportExcel result = new TBankFlowImportExcel(); |
| | | result.setResult("全部成功"); |
| | | failList.add(result); |
| | | EasyExcel.write(response.getOutputStream(), TBankFlowImportExcel.class).sheet("Sheet1").doWrite(failList); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | System.err.println("银行流水返回结果导出失败"); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("getByBankSerialNumber") |
| | | public R<List<TBankFlow>> searchByBankSerialNumber(@RequestParam String bankSerialNumber){ |
| | | List<TBankFlow> tBankFlows = flowService.searchByBankSerialNumber(bankSerialNumber); |
| | | return R.ok(tBankFlows); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TBanner; |
| | | import com.ruoyi.system.query.TBannerQuery; |
| | | import com.ruoyi.system.service.TBannerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 轮播图管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-07 |
| | | */ |
| | | @Api(tags = "轮播图管理") |
| | | @RestController |
| | | @RequestMapping("/t-banner") |
| | | public class TBannerController { |
| | | |
| | | private final TBannerService bannerService; |
| | | @Autowired |
| | | public TBannerController(TBannerService bannerService) { |
| | | this.bannerService = bannerService; |
| | | } |
| | | |
| | | /** |
| | | * 获取轮播图管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:list')") |
| | | @ApiOperation(value = "获取轮播图分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TBanner>> pageList(@RequestBody TBannerQuery query) { |
| | | return R.ok(bannerService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加轮播图管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:add')") |
| | | @Log(title = "轮播图信息-新增轮播图", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加轮播图") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TBanner dto) { |
| | | return R.ok(bannerService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改轮播图 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:edit')") |
| | | @Log(title = "轮播图信息-修改轮播图", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改轮播图") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TBanner dto) { |
| | | return R.ok(bannerService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看轮播图详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:detail')") |
| | | @ApiOperation(value = "查看轮播图详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TBanner> getDetailById(@RequestParam String id) { |
| | | return R.ok(bannerService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除轮播图 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:delete')") |
| | | @Log(title = "轮播图信息-删除轮播图", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除轮播图") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(bannerService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除轮播图 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:delete')") |
| | | @Log(title = "轮播图信息-删除轮播图", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除轮播图") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(bannerService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 账单线下缴费关联表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-bill-confirm") |
| | | public class TBillConfirmController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.model.TBill; |
| | | import com.ruoyi.system.model.TBillConfirm; |
| | | import com.ruoyi.system.model.TBillDetail; |
| | | import com.ruoyi.system.query.TBillQuery; |
| | | import com.ruoyi.system.service.TBillConfirmService; |
| | | import com.ruoyi.system.service.TBillDetailService; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 租金账单 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "账单管理") |
| | | @RestController |
| | | @RequestMapping("/t-bill") |
| | | public class TBillController { |
| | | |
| | | @Autowired |
| | | TBillService tBillService; |
| | | |
| | | @Autowired |
| | | TBillDetailService tBillDetailService; |
| | | |
| | | @Autowired |
| | | TBillConfirmService tBillConfirmService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('bill:list')") |
| | | @PostMapping("list") |
| | | @ApiOperation("分页查询账单列表") |
| | | public R<PageInfo<TBillDto>> list(@RequestBody TBillQuery query){ |
| | | PageInfo<TBillDto> pageInfo = tBillService.queryPage(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('bill:list:addRent')") |
| | | @PostMapping("add") |
| | | @ApiOperation("新增账单") |
| | | public R<PageInfo<TBillDto>> add(@Validated @RequestBody TbillSaveDto bill){ |
| | | tBillService.saveBill(bill); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("通过ID查找详情") |
| | | @GetMapping("getDetailById") |
| | | public R<TBillDto> getDetailById(@RequestParam String id){ |
| | | if (StringUtils.isEmpty(id)){ |
| | | return R.fail(); |
| | | } |
| | | TBillDto dto = tBillService.getDetailByBillId(id); |
| | | if (dto.getBillType().equals("3")){ |
| | | List<TBillDetail> details = tBillDetailService.getByBillId(id); |
| | | for (TBillDetail detail : details) { |
| | | if (detail.getLiveType()==1)dto.setWater(detail); //水费 |
| | | else dto.setElect(detail); //电费 |
| | | } |
| | | } |
| | | if (StringUtils.isNotEmpty(dto.getConfirmId())){ |
| | | TBillConfirm confirm = tBillConfirmService.getById(dto.getConfirmId()); |
| | | dto.setConfirm(confirm); |
| | | } |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("@ss.hasPermi('bill:list:paid')") |
| | | @ApiOperation("确认线下缴费") |
| | | @PostMapping("checkOfflinePay") |
| | | public R checkOfflinePay(@Validated @RequestBody OfflinePayCheckDto dto){ |
| | | tBillService.checkOfflinePay(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('bill:list:sendMsg')") |
| | | @ApiOperation("账单批量发送短信通知") |
| | | @PostMapping("sendSmsByBillIds") |
| | | public R sendSmsByBillIds(@Validated @RequestBody SmsByBillDto dto){ |
| | | Integer failNum = tBillService.sendSmsByBillIds(dto); |
| | | return R.ok(failNum); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("@ss.hasPermi('bill:list:sendMail')") |
| | | @ApiOperation("账单批量发送邮箱通知") |
| | | @PostMapping("sendMailBatchByBillIds") |
| | | public R sendMailBatchByBillIds(@Validated @RequestBody SmsByBillDto dto){ |
| | | Integer failNum = tBillService.sendMailBatchByBillIds(dto); |
| | | return R.ok(failNum); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @PreAuthorize("@ss.hasPermi('bill:list:receipt')") |
| | | @ApiOperation("收款") |
| | | @PostMapping("cashPay") |
| | | public R cashPay(@RequestBody CachPayDto cachPayDto){ |
| | | tBillService.cashPay(cachPayDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("统计") |
| | | @GetMapping("statistics") |
| | | public R<BillStatisticsDto> statistics(){ |
| | | BillStatisticsDto dto = tBillService.statistics(); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 账单水电费子表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-bill-detail") |
| | | public class TBillDetailController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TBill; |
| | | import com.ruoyi.system.model.TCheckAcceptRecord; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.model.THouse; |
| | | import com.ruoyi.system.query.TCheckAcceptRecordQuery; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.ruoyi.system.service.TCheckAcceptRecordService; |
| | | import com.ruoyi.system.service.TContractService; |
| | | import com.ruoyi.system.service.THouseService; |
| | | import com.ruoyi.system.vo.TCheckAcceptRecordVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验收记录 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "验收记录管理") |
| | | @RestController |
| | | @RequestMapping("/t-check-accept-record") |
| | | public class TCheckAcceptRecordController { |
| | | |
| | | private final TCheckAcceptRecordService checkAcceptRecordService; |
| | | private final TContractService contractService; |
| | | private final THouseService houseService; |
| | | @Autowired |
| | | private TBillService billService; |
| | | @Autowired |
| | | public TCheckAcceptRecordController(TCheckAcceptRecordService checkAcceptRecordService, TContractService contractService, THouseService houseService) { |
| | | this.checkAcceptRecordService = checkAcceptRecordService; |
| | | this.contractService = contractService; |
| | | this.houseService = houseService; |
| | | } |
| | | |
| | | /** |
| | | * 获取验收记录管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:check:list')") |
| | | @ApiOperation(value = "获取验收记录分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TCheckAcceptRecordVO>> pageList(@RequestBody TCheckAcceptRecordQuery query) { |
| | | return R.ok(checkAcceptRecordService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 通过合同id查询房屋信息 |
| | | */ |
| | | @ApiOperation(value = "通过合同id查询房屋信息") |
| | | @PostMapping(value = "/getHouseByContractId") |
| | | public R<THouse> getHouseByContractId(@RequestParam String contractId) { |
| | | TContract contract = contractService.getById(contractId); |
| | | THouse house = houseService.getById(contract.getHouseId()); |
| | | return R.ok(house); |
| | | } |
| | | |
| | | /** |
| | | * 通过房屋id查询合同信息 |
| | | */ |
| | | @ApiOperation(value = "通过房屋id查询合同信息") |
| | | @PostMapping(value = "/getContractByHouseId") |
| | | public R<TContract> getContractByHouseId(@RequestParam String houseId) { |
| | | TContract contract = contractService.getOne(Wrappers.lambdaQuery(TContract.class) |
| | | .eq(TContract::getHouseId, houseId) |
| | | .orderByDesc(TContract::getCreateTime) |
| | | .in(TContract::getStatus, 4, 6, 7) |
| | | .last("LIMIT 1")); |
| | | return R.ok(contract); |
| | | } |
| | | |
| | | /** |
| | | * 添加验收记录管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:check:add')") |
| | | @Log(title = "验收记录信息-新增验收记录", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加验收记录") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TCheckAcceptRecord dto) { |
| | | dto.setAcceptanceTime(dto.getCheckTime()); |
| | | LocalDate now = LocalDate.now(); |
| | | String replace = (now + "").replace("-", ""); |
| | | int size = checkAcceptRecordService.list(new LambdaQueryWrapper<TCheckAcceptRecord>() |
| | | .likeRight(TCheckAcceptRecord::getAcceptanceTime, LocalDate.now())).size(); |
| | | dto.setCode(replace.substring(2)+String.format("%03d", size+1)); |
| | | // 添加验收记录 |
| | | checkAcceptRecordService.save(dto); |
| | | if (dto.getCheckMoney()!=null&&(dto.getCheckMoney().compareTo(new BigDecimal("0"))!=0)){ |
| | | TContract contract = contractService.getById(dto.getContractId()); |
| | | // TODO 生成结算帐单 |
| | | TBill tBill = new TBill(); |
| | | tBill.setContractId(dto.getContractId()); |
| | | tBill.setContractNumber(contract.getContractNumber()); |
| | | tBill.setPayableFeesMoney(dto.getCheckMoney()); |
| | | tBill.setPayableFeesTime(LocalDate.now()); |
| | | tBill.setPayFeesStatus("1"); |
| | | tBill.setBillType("4"); |
| | | tBill.setSmsStatus(0); |
| | | billService.save(tBill); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查看验收记录详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:check:detail')") |
| | | @ApiOperation(value = "查看验收记录详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TCheckAcceptRecordVO> getDetailById(@RequestParam String id) { |
| | | TCheckAcceptRecord checkAcceptRecord = checkAcceptRecordService.getById(id); |
| | | TCheckAcceptRecordVO checkAcceptRecordVO = new TCheckAcceptRecordVO(); |
| | | BeanUtils.copyProperties(checkAcceptRecord, checkAcceptRecordVO); |
| | | // 查询合同信息 |
| | | checkAcceptRecordVO.setContract(contractService.getById(checkAcceptRecord.getContractId())); |
| | | // 查询房屋信息 |
| | | checkAcceptRecordVO.setHouse(houseService.getById(checkAcceptRecord.getHouseId())); |
| | | return R.ok(checkAcceptRecordVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除验收记录 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:check:delete')") |
| | | @Log(title = "验收记录信息-删除验收记录", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除验收记录") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(checkAcceptRecordService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除验收记录 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:check:delete')") |
| | | @Log(title = "验收记录信息-删除验收记录", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除验收记录") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(checkAcceptRecordService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.aizuda.bpm.engine.entity.FlwTask; |
| | | import com.aizuda.bpm.mybatisplus.mapper.FlwTaskMapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.ProcessCategoryEnum; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.system.bo.ProcessStartBO; |
| | | import com.ruoyi.system.dto.RevokeDTO; |
| | | import com.ruoyi.system.dto.SetContractDto; |
| | | import com.ruoyi.system.dto.TContractDTO; |
| | | import com.ruoyi.system.dto.TerminateContractDTO; |
| | | import com.ruoyi.system.export.ContractExport; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TContractBillQuery; |
| | | import com.ruoyi.system.query.TContractQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import com.ruoyi.system.task.jobs.StateProcessJob; |
| | | import com.ruoyi.system.vo.BillVO; |
| | | import com.ruoyi.system.vo.CheckAcceptRecordVO; |
| | | import com.ruoyi.system.vo.TContractVO; |
| | | import com.ruoyi.web.controller.tool.NumberToChineseUtils; |
| | | import com.ruoyi.web.controller.tool.WordUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 合同管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "合同管理") |
| | | @RestController |
| | | @RequestMapping("/t-contract") |
| | | public class TContractController { |
| | | @Autowired |
| | | private TContractService contractService; |
| | | @Autowired |
| | | private TContractRentTypeService contractRentTypeService; |
| | | @Autowired |
| | | private THouseService houseService; |
| | | @Autowired |
| | | private TBillService billService; |
| | | @Autowired |
| | | private TCheckAcceptRecordService checkAcceptRecordService; |
| | | @Autowired |
| | | private StateProcessTemplateService stateProcessTemplateService; |
| | | @Autowired |
| | | private FlwTaskMapper flwTaskMapper; |
| | | |
| | | @ApiOperation(value = "获取合同分页列表") |
| | | @PostMapping(value = "/contractList") |
| | | @PreAuthorize("@ss.hasPermi('contract:list')") |
| | | public R<PageInfo<TContract>> contractList(@RequestBody TContractQuery query) { |
| | | return R.ok(contractService.contractList(query)); |
| | | } |
| | | @Log(title = "合同管理-新增合同", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "新增合同") |
| | | @PostMapping(value = "/addContract") |
| | | @PreAuthorize("@ss.hasPermi('contract:list:add')") |
| | | public R<Boolean> addContract(@Validated @RequestBody TContractDTO dto) { |
| | | LocalDateTime changeTime = dto.getChangeTime(); |
| | | long count = contractService.count(new LambdaQueryWrapper<TContract>().eq(TContract::getContractNumber, dto.getContractNumber())); |
| | | if (count!=0){ |
| | | return R.fail("合同编号不可重复"); |
| | | } |
| | | dto.setChangeRent(dto.getMonthRent()); |
| | | dto.setChangeTime(null); |
| | | contractService.save(dto); |
| | | if (dto.getStatus().equals("2")){ |
| | | //发起合同新增审批 |
| | | ProcessStartBO processStartBO = new ProcessStartBO(); |
| | | processStartBO.setCategory(ProcessCategoryEnum.CATEGORY1.getValue().toString()); |
| | | processStartBO.setModuleName("合同新增审批"); |
| | | processStartBO.setName(dto.getContractName()); |
| | | //需要显示发起申请人所在单位 |
| | | // String cedName = SecurityUtils.getLoginUser().getUser().getDept().getDeptName(); |
| | | // String remark = String.format("【镇/街】:%s,【征收实施单位】:%s,【申请金额】:%s万元", stateProject.getStreet(), cedName, stateApplyRecord.getAmount()); |
| | | processStartBO.setRemark(""); |
| | | Map<String, Object> variable = new HashMap<>(); |
| | | variable.put("projectId", dto.getId()); |
| | | processStartBO.setVariable(variable); |
| | | //开启工作流程 |
| | | Boolean start = stateProcessTemplateService.start(processStartBO); |
| | | if(start){ |
| | | FlwTask flwTask = flwTaskMapper.selectOne(Wrappers.lambdaQuery(FlwTask.class) |
| | | .like(FlwTask::getVariable, dto.getId()) |
| | | .orderByDesc(FlwTask::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | if(Objects.nonNull(flwTask)){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, Long>(). |
| | | put("id", flwTask.getId()) |
| | | .build(); |
| | | QuartzManager.addJob(StateProcessJob.class, (StateProcessJob.name+flwTask.getId()).toUpperCase(), TimeJobType.AUTO_AUDIT,new Date(new Date().getTime()+48*60*60*1000L), maps); |
| | | } |
| | | } |
| | | } |
| | | if (dto.getIsIncreasing()){ |
| | | TContractRentType tContractRentType = new TContractRentType(); |
| | | tContractRentType.setContractId(dto.getId()); |
| | | tContractRentType.setIncreasingDecreasing(dto.getIncreasingDecreasing()); |
| | | tContractRentType.setIncreasingDecreasingType(dto.getIncreasingDecreasingType()); |
| | | tContractRentType.setNumericalValue(dto.getNumericalValue()); |
| | | tContractRentType.setChangeTime(changeTime); |
| | | tContractRentType.setCycleTime(dto.getCycleTime()); |
| | | contractRentTypeService.save(tContractRentType); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "合同管理-编辑合同", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "编辑合同") |
| | | @PostMapping(value = "/updateContract") |
| | | @PreAuthorize("@ss.hasPermi('contract:list:edit')") |
| | | public R<Boolean> updateContract(@Validated @RequestBody TContractDTO dto) { |
| | | dto.setChangeTime(null); |
| | | contractService.updateById(dto); |
| | | contractRentTypeService.remove(new LambdaQueryWrapper<TContractRentType>() |
| | | .eq(TContractRentType::getContractId,dto.getId())); |
| | | if (dto.getIsIncreasing()){ |
| | | TContractRentType tContractRentType = new TContractRentType(); |
| | | tContractRentType.setContractId(dto.getId()); |
| | | tContractRentType.setIncreasingDecreasing(dto.getIncreasingDecreasing()); |
| | | tContractRentType.setIncreasingDecreasingType(dto.getIncreasingDecreasingType()); |
| | | tContractRentType.setNumericalValue(dto.getNumericalValue()); |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | tContractRentType.setCycleTime(dto.getCycleTime()); |
| | | contractRentTypeService.save(tContractRentType); |
| | | } |
| | | if (dto.getStatus().equals("2")){ |
| | | //发起合同新增审批 |
| | | ProcessStartBO processStartBO = new ProcessStartBO(); |
| | | processStartBO.setCategory(ProcessCategoryEnum.CATEGORY1.getValue().toString()); |
| | | processStartBO.setModuleName("合同新增审批"); |
| | | processStartBO.setName(dto.getContractName()); |
| | | //需要显示发起申请人所在单位 |
| | | // String cedName = SecurityUtils.getLoginUser().getUser().getDept().getDeptName(); |
| | | // String remark = String.format("【镇/街】:%s,【征收实施单位】:%s,【申请金额】:%s万元", stateProject.getStreet(), cedName, stateApplyRecord.getAmount()); |
| | | processStartBO.setRemark(""); |
| | | Map<String, Object> variable = new HashMap<>(); |
| | | variable.put("projectId", dto.getId()); |
| | | processStartBO.setVariable(variable); |
| | | //开启工作流程 |
| | | Boolean start = stateProcessTemplateService.start(processStartBO); |
| | | if(start){ |
| | | FlwTask flwTask = flwTaskMapper.selectOne(Wrappers.lambdaQuery(FlwTask.class) |
| | | .like(FlwTask::getVariable, dto.getId()) |
| | | .orderByDesc(FlwTask::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | if(Objects.nonNull(flwTask)){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, Long>(). |
| | | put("id", flwTask.getId()) |
| | | .build(); |
| | | QuartzManager.addJob(StateProcessJob.class, (StateProcessJob.name+flwTask.getId()).toUpperCase(), TimeJobType.AUTO_AUDIT,new Date(new Date().getTime()+48*60*60*1000L), maps); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "合同管理-批量删除合同", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除合同") |
| | | @PreAuthorize("@ss.hasPermi('contract:list:delete')") |
| | | @DeleteMapping(value = "/deleteContractByIds") |
| | | public R<Boolean> deleteContractByIds(@RequestParam String ids) { |
| | | if (StringUtils.isNotEmpty(ids)){ |
| | | contractService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询合同信息信息") |
| | | @GetMapping(value = "/getContractById") |
| | | @PreAuthorize("@ss.hasPermi('contract:list:detail')") |
| | | public R<TContractVO> getContractById(@RequestParam String id) { |
| | | TContractVO res = new TContractVO(); |
| | | TContract contract = contractService.getById(id); |
| | | BeanUtils.copyProperties(contract,res); |
| | | TContractRentType contractRentType = contractRentTypeService.lambdaQuery().eq(TContractRentType::getContractId, id).one(); |
| | | if (contractRentType!=null){ |
| | | BeanUtils.copyProperties(contractRentType,res); |
| | | } |
| | | // TContract oldContract = contractService.getOne(new LambdaQueryWrapper<TContract>() |
| | | // .eq(TContract::getHouseId,contract.getHouseId()) |
| | | // .eq(TContract::getStatus, 4) |
| | | // .le(TContract::getStartTime, LocalDateTime.now()) |
| | | // .ge(TContract::getEndTime, LocalDateTime.now())); |
| | | THouse house = houseService.getById(contract.getHouseId()); |
| | | house.setTenantType(contract.getPayType()); |
| | | res.setHouse(house); |
| | | List<TBill> list = billService.lambdaQuery() |
| | | .eq(TBill::getContractId, id) |
| | | .ne(TBill::getPayFeesStatus, 3) |
| | | .list(); |
| | | BigDecimal payMoney = new BigDecimal("0"); |
| | | for (TBill tBill : list) { |
| | | payMoney = payMoney.add(tBill.getOutstandingMoney()).add(tBill.getPayableFeesPenalty()); |
| | | } |
| | | TCheckAcceptRecord tCheckAcceptRecord = checkAcceptRecordService.lambdaQuery().eq(TCheckAcceptRecord::getContractId, id).one(); |
| | | res.setCheckResult(Objects.nonNull(tCheckAcceptRecord)&&Objects.nonNull(tCheckAcceptRecord.getCheckResult())?tCheckAcceptRecord.getCheckResult():null); |
| | | res.setPayMoney(payMoney); |
| | | |
| | | return R.ok(res); |
| | | } |
| | | @Log(title = "合同管理-撤销审批", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "撤销审批") |
| | | @PreAuthorize("@ss.hasPermi('contract:list:cancel')") |
| | | @PostMapping(value = "/updateContractStatus") |
| | | public R<Boolean> updateContractStatus(@RequestBody RevokeDTO dto) { |
| | | TContract contract = contractService.getById(dto.getContractId()); |
| | | contract.setStatus("1"); |
| | | contractService.updateById(contract); |
| | | // 撤销审批实例 |
| | | stateProcessTemplateService.revoke(dto.getInstanceId()); |
| | | |
| | | return R.ok(); |
| | | } |
| | | @PreAuthorize("@ss.hasPermi('contract:list:settlement')") |
| | | @Log(title = "合同管理-确认结算", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "确认结算") |
| | | @PostMapping(value = "/confirmSettlement") |
| | | |
| | | public R<Boolean> confirmSettlement(String id) { |
| | | TContract contract = contractService.getById(id); |
| | | contract.setStatus("8"); |
| | | contractService.updateById(contract); |
| | | // 将所有未缴费账单设置未已失效 |
| | | List<TBill> tBills = billService.list(new LambdaQueryWrapper<TBill>() |
| | | .ne(TBill::getPayFeesStatus, 3) |
| | | .eq(TBill::getContractId, contract.getId())); |
| | | for (TBill tBill : tBills) { |
| | | tBill.setPayFeesStatus("5"); |
| | | } |
| | | billService.updateBatchById(tBills); return R.ok(); |
| | | } |
| | | @ApiOperation(value = "终止合同剩余未缴费账单列表") |
| | | @PostMapping(value = "/contractBillList") |
| | | public R<PageInfo<BillVO>> contractBillList(@RequestBody TContractBillQuery query) { |
| | | return R.ok(contractService.contractBillList(query)); |
| | | } |
| | | @ApiOperation(value = "终止合同") |
| | | @PostMapping(value = "/terminateContract") |
| | | @PreAuthorize("@ss.hasPermi('contract:list:break')") |
| | | public R terminateContract(@RequestBody TerminateContractDTO dto) { |
| | | contractService.terminateContract(dto); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "根据合同id查看验收记录") |
| | | @GetMapping(value = "/getCheckByContractId") |
| | | public R<CheckAcceptRecordVO> getCheckByContractId(String id) { |
| | | return R.ok(contractService.getCheckByContractId(id)); |
| | | } |
| | | @Autowired |
| | | private WordUtil wordUtil; |
| | | @ApiOperation(value = "生成合同附件") |
| | | @PostMapping("/set") |
| | | @Log(title = "生成合同附件", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('contract:list:generate')") |
| | | public R<List<String>> set(@RequestBody SetContractDto dto,HttpServletResponse response){ |
| | | List<TContract> list = contractService.lambdaQuery().in(TContract::getId, dto.getIds()).list(); |
| | | List<String> res = new ArrayList<>(); |
| | | for (TContract contract : list) { |
| | | TBill firstBill = billService.lambdaQuery().eq(TBill::getContractId, contract.getId()) |
| | | .orderByDesc(TBill::getStartTime).last("limit 1").one(); |
| | | |
| | | THouse tHouse = houseService.getById(contract.getHouseId()); |
| | | Map<String, Object> templateParam = new HashMap<>(5); |
| | | templateParam.put("${partyOneName}", contract.getPartyOneName()); |
| | | templateParam.put("${partyTwoName}", contract.getPartyTwoName()); |
| | | templateParam.put("${houseAddress}", tHouse.getHouseAddress()); |
| | | templateParam.put("${houseArea}", tHouse.getHouseArea()+"m²"); |
| | | long between = ChronoUnit.DAYS.between(contract.getStartTime(), contract.getStartPayTime())+1; |
| | | templateParam.put("${day}", between); |
| | | templateParam.put("${endTimeFree}", DateUtils.localDateTimeToStringYear(contract.getStartPayTime().plusDays(1))); |
| | | templateParam.put("${startPayTime}", DateUtils.localDateTimeToStringYear(contract.getStartPayTime())); |
| | | templateParam.put("${startTime}", DateUtils.localDateTimeToStringYear(contract.getStartTime())); |
| | | templateParam.put("${endTime}", DateUtils.localDateTimeToStringYear(contract.getEndTime())); |
| | | templateParam.put("${monthRent}", "¥"+contract.getMonthRent()+"元"); |
| | | templateParam.put("${monthRentString}", "人民币"+NumberToChineseUtils.numberToChinese(contract.getMonthRent().setScale(2, BigDecimal.ROUND_DOWN).doubleValue())); |
| | | String totalYear = Objects.nonNull(contract.getTotalYear())?contract.getTotalYear().toString():""; |
| | | templateParam.put("${totalYear}", "¥"+totalYear+"元"); |
| | | String totalYearString = StringUtils.isNotEmpty(totalYear)?NumberToChineseUtils.numberToChinese(contract.getTotalYear().setScale(2, BigDecimal.ROUND_DOWN).doubleValue()):""; |
| | | templateParam.put("${totalYearString}", "人民币"+totalYearString); |
| | | templateParam.put("${payType}", contract.getPayType().equals("1")?"月":contract.getPayType().equals("2")?"季":"年"); |
| | | if(firstBill!=null){ |
| | | templateParam.put("${firstRent}", "¥"+(firstBill.getPayableFeesMoney())+"元"); |
| | | }else{ |
| | | templateParam.put("${firstRent}", ""); |
| | | |
| | | } |
| | | templateParam.put("${firstRentString}", "人民币"+NumberToChineseUtils.numberToChinese((contract.getPayType().equals("1")?contract.getMonthRent():contract.getPayType().equals("2")?contract.getMonthRent().multiply(new BigDecimal("3")):contract.getMonthRent().multiply(new BigDecimal("12")).setScale(2,BigDecimal.ROUND_DOWN)).doubleValue())); |
| | | templateParam.put("${nextPayTime}", contract.getPayType().equals("1")?"月":contract.getPayType().equals("2")?"季":"年"); |
| | | templateParam.put("${deposit}", "¥"+contract.getDeposit()+"元"); |
| | | templateParam.put("${depositString}", NumberToChineseUtils.numberToChinese(contract.getDeposit().setScale(2, BigDecimal.ROUND_DOWN).doubleValue())); |
| | | templateParam.put("${partyOnePerson}", contract.getPartyOnePerson()); |
| | | templateParam.put("${partyOnePhone}", contract.getPartyOnePhone()); |
| | | templateParam.put("${partyTwoPerson}", contract.getPartyTwoPerson()); |
| | | templateParam.put("${partyTwoPhone}", contract.getPartyTwoPhone()); |
| | | // 验收时间 |
| | | TCheckAcceptRecord tCheckAcceptRecord = checkAcceptRecordService.lambdaQuery().eq(TCheckAcceptRecord::getContractId, contract.getId()).last("limit 1").one(); |
| | | if (tCheckAcceptRecord!=null &&tCheckAcceptRecord.getCheckTime()!=null ){ |
| | | templateParam.put("${checkTime}", DateUtils.localDateTimeToStringYear(tCheckAcceptRecord.getCheckTime())); |
| | | }else{ |
| | | templateParam.put("${checkTime}", ""); |
| | | |
| | | } |
| | | String url = wordUtil.generatePdf("/usr/local/project/file/", "1_yzj_租赁合同.docx", templateParam, "租赁合同", "/usr/local/project/file/"); |
| | | res.add(url); |
| | | } |
| | | |
| | | return R.ok(res); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | | @ApiOperation(value = "导出") |
| | | @PreAuthorize("@ss.hasPermi('contract:list:export')") |
| | | @Log(title = "导出", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void exportOpticalInspection(@RequestBody TContractQuery query) |
| | | { |
| | | List<ContractExport> contractExports = new ArrayList<>(); |
| | | List<TContract> exportList = contractService.contractExportList(query); |
| | | for (TContract contract : exportList) { |
| | | ContractExport contractExport = new ContractExport(); |
| | | contractExport.setContractNumber(contract.getContractNumber()); |
| | | contractExport.setContractName(contract.getContractName()); |
| | | contractExport.setPartyOneName(contract.getPartyOneName()); |
| | | contractExport.setPartyTwoName(contract.getPartyTwoName()); |
| | | contractExport.setCreateTime(DateUtils.localDateTimeToStringYear(contract.getCreateTime())); |
| | | contractExport.setStartTime(DateUtils.localDateTimeToStringYear(contract.getStartTime())); |
| | | contractExport.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime())); |
| | | contractExport.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE,contract.getPayType())); |
| | | contractExport.setDeposit(contract.getDeposit()+""); |
| | | contractExport.setStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_STATUS,contract.getStatus())); |
| | | contractExports.add(contractExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ContractExport.class, contractExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("合同列表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 租金递增递减方式 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-contract-rent-type") |
| | | public class TContractRentTypeController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.TDeptUpAndDownDTO; |
| | | import com.ruoyi.system.model.TDept; |
| | | import com.ruoyi.system.model.TDeptToUser; |
| | | import com.ruoyi.system.query.TDeptQuery; |
| | | import com.ruoyi.system.service.TDeptService; |
| | | import com.ruoyi.system.service.TDeptToUserService; |
| | | import com.ruoyi.system.vo.DeptVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-06 |
| | | */ |
| | | @Api(tags = "部门管理") |
| | | @RestController |
| | | @RequestMapping("/t-dept") |
| | | public class TDeptController { |
| | | |
| | | private final TDeptService deptService; |
| | | private final TDeptToUserService deptToUserService; |
| | | private final TokenService tokenService; |
| | | @Autowired |
| | | public TDeptController(TDeptService deptService, TDeptToUserService deptToUserService, TokenService tokenService) { |
| | | this.deptService = deptService; |
| | | this.deptToUserService = deptToUserService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | | * 获取部门管理管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:department:list')") |
| | | @ApiOperation(value = "获取部门管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<DeptVO>> pageList(@RequestBody TDeptQuery query) { |
| | | return R.ok(deptService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取部门管理列表-启用状态") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TDept>> list() { |
| | | return R.ok(deptService.list(Wrappers.lambdaQuery(TDept.class) |
| | | .eq(TDept::getStatus, 1))); |
| | | } |
| | | /** |
| | | * 获取部门管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取部门管理列表-所有状态") |
| | | @PostMapping(value = "/listAll") |
| | | public R<List<TDept>> listAll() { |
| | | return R.ok(deptService.list(Wrappers.lambdaQuery(TDept.class))); |
| | | } |
| | | |
| | | /** |
| | | * 添加部门管理管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:department:add')") |
| | | @Log(title = "部门管理信息-新增部门管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加部门管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TDept dto) { |
| | | // 判断部门id是否存在 |
| | | boolean flag = deptService.isExit(dto); |
| | | if (flag){ |
| | | return R.fail("部门ID已存在"); |
| | | } |
| | | return R.ok(deptService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改部门管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:department:edit')") |
| | | @Log(title = "部门管理信息-修改部门管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改部门管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TDept dto) { |
| | | // 判断部门id是否存在 |
| | | boolean flag = deptService.isExit(dto); |
| | | if (flag){ |
| | | return R.fail("部门ID已存在"); |
| | | } |
| | | return R.ok(deptService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看部门管理详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:department:edit')") |
| | | @ApiOperation(value = "查看部门管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TDept> getDetailById(@RequestParam String id) { |
| | | return R.ok(deptService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除部门管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:department:delete')") |
| | | @Log(title = "部门管理信息-删除部门管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除部门管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | // 删除部门用户关联信息 |
| | | deptToUserService.remove(Wrappers.lambdaQuery(TDeptToUser.class) |
| | | .eq(TDeptToUser::getDeptId, id)); |
| | | return R.ok(deptService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除部门管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:department:delete')") |
| | | @Log(title = "部门管理信息-删除部门管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除部门管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | // 删除部门用户关联信息 |
| | | deptToUserService.remove(Wrappers.lambdaQuery(TDeptToUser.class) |
| | | .in(TDeptToUser::getDeptId, ids)); |
| | | return R.ok(deptService.removeByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 轮播图上下架 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:department:open')") |
| | | @ApiOperation(value = "部门管理上下架",notes = "true:上架,false:下架") |
| | | @PostMapping(value = "/upAndDown") |
| | | public R upAndDown(@RequestBody TDeptUpAndDownDTO dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | TDept dept = deptService.getById(dto.getId()); |
| | | dept.setStatus(dto.getStatus()); |
| | | dept.setDisableRemark(dto.getDisableRemark()); |
| | | dept.setOperatingTime(LocalDateTime.now()); |
| | | dept.setOperatingPerson(user.getNickName()+"("+user.getUserName()+")"); |
| | | return R.ok(deptService.updateById(dept)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门用户中间表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-dept-to-user") |
| | | public class TDeptToUserController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TFaultAreaDic; |
| | | import com.ruoyi.system.model.TFaultDescribeDic; |
| | | import com.ruoyi.system.model.TItem; |
| | | import com.ruoyi.system.model.TItemType; |
| | | import com.ruoyi.system.query.TFaultAreaDicQuery; |
| | | import com.ruoyi.system.service.TFaultAreaDicService; |
| | | import com.ruoyi.system.service.TFaultDescribeDicService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 故障区域 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "故障区域") |
| | | @RestController |
| | | @RequestMapping("/t-fault-area-dic") |
| | | public class TFaultAreaDicController { |
| | | |
| | | private final TFaultAreaDicService faultAreaDicService; |
| | | private final TFaultDescribeDicService faultDescribeDicService; |
| | | @Autowired |
| | | public TFaultAreaDicController(TFaultAreaDicService faultAreaDicService, TFaultDescribeDicService faultDescribeDicService) { |
| | | this.faultAreaDicService = faultAreaDicService; |
| | | this.faultDescribeDicService = faultDescribeDicService; |
| | | } |
| | | |
| | | /** |
| | | * 获取故障区域管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:faultArea:list')") |
| | | @ApiOperation(value = "获取故障区域分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TFaultAreaDic>> pageList(@RequestBody TFaultAreaDicQuery query) { |
| | | return R.ok(faultAreaDicService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取故障区域列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TFaultAreaDic>> list() { |
| | | return R.ok(faultAreaDicService.list(Wrappers.lambdaQuery(TFaultAreaDic.class).orderByDesc(TFaultAreaDic::getSortBy).orderByDesc(TFaultAreaDic::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 添加故障区域管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:faultArea:add')") |
| | | @Log(title = "故障区域信息-新增故障区域", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加故障区域") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TFaultAreaDic dto) { |
| | | if (faultAreaDicService.isExit(dto)) { |
| | | return R.fail("故障区域名称已存在"); |
| | | } |
| | | return R.ok(faultAreaDicService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改故障区域 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:faultArea:edit')") |
| | | @Log(title = "故障区域信息-修改故障区域", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改故障区域") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TFaultAreaDic dto) { |
| | | if (faultAreaDicService.isExit(dto)) { |
| | | return R.fail("故障区域名称已存在"); |
| | | } |
| | | return R.ok(faultAreaDicService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看故障区域详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:faultArea:edit')") |
| | | @ApiOperation(value = "查看故障区域详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TFaultAreaDic> getDetailById(@RequestParam String id) { |
| | | return R.ok(faultAreaDicService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除故障区域 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:faultArea:delete')") |
| | | @Log(title = "故障区域信息-删除故障区域", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除故障区域") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | long count = faultDescribeDicService.count(Wrappers.lambdaQuery(TFaultDescribeDic.class).eq(TFaultDescribeDic::getFaultId, id)); |
| | | if (count>0) { |
| | | return R.fail("该区域下有故障描述,无法删除"); |
| | | } |
| | | return R.ok(faultAreaDicService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除故障区域 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:faultArea:delete')") |
| | | @Log(title = "故障区域信息-删除故障区域", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除故障区域") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | List<TFaultDescribeDic> items = faultDescribeDicService.list(Wrappers.lambdaQuery(TFaultDescribeDic.class).in(TFaultDescribeDic::getFaultId, ids)); |
| | | for (String id : ids) { |
| | | if (items.stream().anyMatch(t -> t.getFaultId().equals(id))) { |
| | | TFaultAreaDic faultAreaDic = faultAreaDicService.getById(id); |
| | | return R.fail("该区域["+faultAreaDic.getFaultAreaName()+"]下有故障描述,无法删除"); |
| | | } |
| | | } |
| | | return R.ok(faultAreaDicService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TFaultDescribeDic; |
| | | import com.ruoyi.system.query.TFaultDescribeDicQuery; |
| | | import com.ruoyi.system.service.TFaultDescribeDicService; |
| | | import com.ruoyi.system.vo.TFaultDescribeDicVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 故障描述 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "故障描述") |
| | | @RestController |
| | | @RequestMapping("/t-fault-describe-dic") |
| | | public class TFaultDescribeDicController { |
| | | |
| | | |
| | | private final TFaultDescribeDicService faultDescribeDicService; |
| | | @Autowired |
| | | public TFaultDescribeDicController(TFaultDescribeDicService faultDescribeDicService) { |
| | | this.faultDescribeDicService = faultDescribeDicService; |
| | | } |
| | | |
| | | /** |
| | | * 获取故障描述管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tag:list')") |
| | | @ApiOperation(value = "获取故障描述分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TFaultDescribeDicVO>> pageList(@RequestBody TFaultDescribeDicQuery query) { |
| | | return R.ok(faultDescribeDicService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加故障描述管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tag:add')") |
| | | @Log(title = "故障描述信息-新增故障描述", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加故障描述") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TFaultDescribeDic dto) { |
| | | return R.ok(faultDescribeDicService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改故障描述 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tag:edit')") |
| | | @Log(title = "故障描述信息-修改故障描述", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改故障描述") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TFaultDescribeDic dto) { |
| | | dto.setUpdateTime(LocalDateTime.now()); |
| | | return R.ok(faultDescribeDicService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看故障描述详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tag:edit')") |
| | | @ApiOperation(value = "查看故障描述详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TFaultDescribeDic> getDetailById(@RequestParam String id) { |
| | | return R.ok(faultDescribeDicService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除故障描述 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tag:delete')") |
| | | @Log(title = "故障描述信息-删除故障描述", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除故障描述") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(faultDescribeDicService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除故障描述 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tag:delete')") |
| | | @Log(title = "故障描述信息-删除故障描述", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除故障描述") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(faultDescribeDicService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TFaultRepairMessage; |
| | | import com.ruoyi.system.query.TFaultRepairMessageQuery; |
| | | import com.ruoyi.system.service.TFaultRepairMessageService; |
| | | import com.ruoyi.system.vo.TFaultRepairMessageVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 报修管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "报修管理") |
| | | @RestController |
| | | @RequestMapping("/t-fault-repair-message") |
| | | public class TFaultRepairMessageController { |
| | | |
| | | private final TFaultRepairMessageService tFaultRepairMessageService; |
| | | |
| | | @Autowired |
| | | public TFaultRepairMessageController(TFaultRepairMessageService tFaultRepairMessageService) { |
| | | this.tFaultRepairMessageService = tFaultRepairMessageService; |
| | | } |
| | | |
| | | /** |
| | | * 获取报修管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:acceptance:list')") |
| | | @ApiOperation(value = "获取报修分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TFaultRepairMessageVO>> pageList(@RequestBody TFaultRepairMessageQuery query) { |
| | | return R.ok(tFaultRepairMessageService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 处理维修 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:acceptance:dispose')") |
| | | @Log(title = "报修信息-处理维修", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "处理维修") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TFaultRepairMessage faultRepairMessage) { |
| | | faultRepairMessage.setStatus(2); |
| | | return R.ok(tFaultRepairMessageService.updateById(faultRepairMessage)); |
| | | } |
| | | |
| | | /** |
| | | * 查看报修详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:acceptance:detail')") |
| | | @ApiOperation(value = "查看报修详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TFaultRepairMessageVO> getDetailById(@RequestParam String id) { |
| | | TFaultRepairMessageVO faultRepairMessageVO = tFaultRepairMessageService.getDetailById(id); |
| | | return R.ok(faultRepairMessageVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除报修 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:acceptance:delete')") |
| | | @Log(title = "报修信息-删除报修", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除报修") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(tFaultRepairMessageService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除报修 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:acceptance:delete')") |
| | | @Log(title = "报修信息-删除报修", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除报修") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(tFaultRepairMessageService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.model.TFlowManagement; |
| | | import com.ruoyi.system.query.TFlowManagementQuery; |
| | | import com.ruoyi.system.service.TFlowManagementService; |
| | | import com.ruoyi.system.vo.TFlowManagementStatisticsVo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流水管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-flow-management") |
| | | public class TFlowManagementController { |
| | | @Autowired |
| | | private TFlowManagementService flowService; |
| | | /** |
| | | * 获取流水列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('flow:sys:detail:list')") |
| | | @ApiOperation(value = "获取流水列表") |
| | | @PostMapping("/list") |
| | | public R<PageInfo<TFlowManagement>> list(@RequestBody TFlowManagementQuery query) { |
| | | return R.ok(flowService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据支付方式统计流水金额") |
| | | @PostMapping("/getPaymentStats") |
| | | public R<TFlowManagementStatisticsVo> getPaymentStats(@RequestBody TFlowManagementQuery query){ |
| | | return R.ok(flowService.getPaymentStats(query)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.system.dto.THouseDTO; |
| | | import com.ruoyi.system.dto.TTenantDTO; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.model.THouse; |
| | | import com.ruoyi.system.model.TTenant; |
| | | import com.ruoyi.system.query.THouseQuery; |
| | | import com.ruoyi.system.query.TTenantQuery; |
| | | import com.ruoyi.system.query.TUserHistoryQuery; |
| | | import com.ruoyi.system.service.TContractService; |
| | | import com.ruoyi.system.service.THouseService; |
| | | import com.ruoyi.system.vo.HouseVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | | * 房屋管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "房屋基础信息管理") |
| | | @RestController |
| | | @RequestMapping("/t-house") |
| | | public class THouseController { |
| | | @Autowired |
| | | private THouseService tHouseService; |
| | | @Log(title = "房屋基础信息管理-新增房屋", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "新增房屋") |
| | | @PostMapping(value = "/addHouse") |
| | | @PreAuthorize("@ss.hasPermi('house:list:add')") |
| | | public R<Boolean> addHouse(@Validated @RequestBody THouseDTO dto) { |
| | | return R.ok(tHouseService.save(dto)); |
| | | } |
| | | @Log(title = "房屋基础信息管理-编辑房屋", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "编辑房屋") |
| | | @PostMapping(value = "/updateHouse") |
| | | @PreAuthorize("@ss.hasPermi('house:list:edit')") |
| | | public R<Boolean> updateHouse(@Validated @RequestBody THouseDTO dto) { |
| | | return R.ok(tHouseService.updateById(dto)); |
| | | } |
| | | @ApiOperation(value = "查询房屋信息") |
| | | @GetMapping(value = "/getHouseById") |
| | | @PreAuthorize("@ss.hasPermi('house:list:detail')") |
| | | public R<THouse> getHouseById(@RequestParam String id) { |
| | | THouse tHouse = tHouseService.getById(id); |
| | | // tHouse.setLeaseStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tHouse.getLeaseStatus())); |
| | | // tHouse.setBusinessAttributes(DictUtils.getDictLabel(DictConstants.DICT_TYPE_BUSINESS_ATTRIBUTES,tHouse.getBusinessAttributes())); |
| | | return R.ok(tHouse); |
| | | } |
| | | @Log(title = "房屋基础信息管理-删除房屋", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除房屋") |
| | | @DeleteMapping(value = "/deleteHouseById") |
| | | @PreAuthorize("@ss.hasPermi('house:list:delete')") |
| | | |
| | | public R<Boolean> deleteHouseById(@RequestParam String id) { |
| | | return R.ok(tHouseService.removeById(id)); |
| | | } |
| | | @ApiOperation(value = "获取房屋分页列表") |
| | | @PostMapping(value = "/houseList") |
| | | @PreAuthorize("@ss.hasPermi('house:list')") |
| | | public R<PageInfo<THouse>> houseList(@RequestBody THouseQuery query) { |
| | | return R.ok(tHouseService.houseList(query)); |
| | | } |
| | | @ApiOperation(value = "历史租户列表") |
| | | @PostMapping(value = "/userHistoryList") |
| | | public R<PageInfo<HouseVO>> userHistoryList(@RequestBody TUserHistoryQuery query) { |
| | | return R.ok(tHouseService.userHistoryList(query)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TInformation; |
| | | import com.ruoyi.system.query.TInformationQuery; |
| | | import com.ruoyi.system.service.TInformationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "资讯管理") |
| | | @RestController |
| | | @RequestMapping("/t-information") |
| | | public class TInformationController { |
| | | |
| | | private final TInformationService informationService; |
| | | @Autowired |
| | | public TInformationController(TInformationService informationService) { |
| | | this.informationService = informationService; |
| | | } |
| | | |
| | | /** |
| | | * 获取资讯管理管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('dynamic:list')") |
| | | @ApiOperation(value = "获取资讯管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TInformation>> pageList(@RequestBody TInformationQuery query) { |
| | | return R.ok(informationService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加资讯管理管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('dynamic:list:add')") |
| | | @Log(title = "资讯管理信息-新增资讯管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加资讯管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TInformation dto) { |
| | | return R.ok(informationService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改资讯管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('dynamic:list:edit')") |
| | | @Log(title = "资讯管理信息-修改资讯管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改资讯管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TInformation dto) { |
| | | return R.ok(informationService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看资讯管理详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('dynamic:list:detail')") |
| | | @ApiOperation(value = "查看资讯管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TInformation> getDetailById(@RequestParam String id) { |
| | | return R.ok(informationService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除资讯管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('dynamic:list:delete')") |
| | | @Log(title = "资讯管理信息-删除资讯管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除资讯管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(informationService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除资讯管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('dynamic:list:delete')") |
| | | @Log(title = "资讯管理信息-删除资讯管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除资讯管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(informationService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.TencentMailUtil; |
| | | import com.ruoyi.system.dto.TBillDto; |
| | | import com.ruoyi.system.model.TBill; |
| | | import com.ruoyi.system.model.TInvoice; |
| | | import com.ruoyi.system.query.TInvoiceQuery; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.ruoyi.system.service.TInvoiceService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 开票管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-invoice") |
| | | public class TInvoiceController { |
| | | @Autowired |
| | | private TInvoiceService invoiceService; |
| | | @Autowired |
| | | TBillService tBillService; |
| | | @PreAuthorize("@ss.hasPermi('invoice:list')") |
| | | @ApiOperation(value = "获取开票列表") |
| | | @PostMapping("/list") |
| | | public R<PageInfo<TInvoice>> list(@RequestBody TInvoiceQuery query) { |
| | | return R.ok(invoiceService.pageList(query)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('invoice:list:del')") |
| | | @Log(title = "开票信息-删除开票", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除开票") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(invoiceService.removeById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "关联账单信息") |
| | | @GetMapping(value = "/getBillByInvoiceId/{invoiceId}") |
| | | public R<PageInfo<TBillDto>> getBillByInvoiceId(@PathVariable String invoiceId){ |
| | | return R.ok(tBillService.getBillByInvoiceId(invoiceId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "上传开票凭证") |
| | | @PostMapping("/uploadVoucher") |
| | | @PreAuthorize("@ss.hasPermi('invoice:list:payment')") |
| | | public R<Boolean> uploadVoucher(@RequestBody TInvoiceQuery query) { |
| | | return R.ok(invoiceService.uploadVoucher(query)); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 账单开票中间表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-invoice-to-bill") |
| | | public class TInvoiceToBillController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TItem; |
| | | import com.ruoyi.system.query.TItemQuery; |
| | | import com.ruoyi.system.service.TItemService; |
| | | import com.ruoyi.system.vo.TItemVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 维修物品 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "维修物品管理") |
| | | @RestController |
| | | @RequestMapping("/t-item") |
| | | public class TItemController { |
| | | |
| | | private final TItemService itemService; |
| | | @Autowired |
| | | public TItemController(TItemService itemService) { |
| | | this.itemService = itemService; |
| | | } |
| | | |
| | | /** |
| | | * 获取维修物品管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:list:list')") |
| | | @ApiOperation(value = "获取维修物品分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TItemVO>> pageList(@RequestBody TItemQuery query) { |
| | | return R.ok(itemService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加维修物品管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:list:add')") |
| | | @Log(title = "维修物品信息-新增维修物品", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加维修物品") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TItem dto) { |
| | | return R.ok(itemService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改维修物品 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:list:edit')") |
| | | @Log(title = "维修物品信息-修改维修物品", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改维修物品") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TItem dto) { |
| | | return R.ok(itemService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看维修物品详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:item:detail')") |
| | | @ApiOperation(value = "查看维修物品详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TItem> getDetailById(@RequestParam String id) { |
| | | return R.ok(itemService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除维修物品 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:list:delete')") |
| | | @Log(title = "维修物品信息-删除维修物品", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除维修物品") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(itemService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除维修物品 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:list:delete')") |
| | | @Log(title = "维修物品信息-删除维修物品", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除维修物品") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(itemService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TItem; |
| | | import com.ruoyi.system.model.TItemType; |
| | | import com.ruoyi.system.query.TItemTypeQuery; |
| | | import com.ruoyi.system.service.TItemService; |
| | | import com.ruoyi.system.service.TItemTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 维修物品分类 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "维修物品分类管理") |
| | | @RestController |
| | | @RequestMapping("/t-item-type") |
| | | public class TItemTypeController { |
| | | |
| | | private final TItemTypeService itemTypeService; |
| | | private final TItemService itemService; |
| | | @Autowired |
| | | public TItemTypeController(TItemTypeService itemTypeService, TItemService itemService) { |
| | | this.itemTypeService = itemTypeService; |
| | | this.itemService = itemService; |
| | | } |
| | | |
| | | /** |
| | | * 获取维修物品分类管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:class_list')") |
| | | @ApiOperation(value = "获取维修物品分类分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TItemType>> pageList(@RequestBody TItemTypeQuery query) { |
| | | return R.ok(itemTypeService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取维修物品分类管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取维修物品分类列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TItemType>> list() { |
| | | return R.ok(itemTypeService.list(Wrappers.lambdaQuery(TItemType.class).orderByDesc(TItemType::getSortBy).orderByDesc(TItemType::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 添加维修物品分类管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:class:add')") |
| | | @Log(title = "维修物品分类信息-新增维修物品分类", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加维修物品分类") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TItemType dto) { |
| | | if (itemTypeService.isExit(dto)) { |
| | | return R.fail("维修物品分类名称已存在"); |
| | | } |
| | | return R.ok(itemTypeService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改维修物品分类 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:class:edit')") |
| | | @Log(title = "维修物品分类信息-修改维修物品分类", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改维修物品分类") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TItemType dto) { |
| | | if (itemTypeService.isExit(dto)) { |
| | | return R.fail("维修物品分类名称已存在"); |
| | | } |
| | | return R.ok(itemTypeService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看维修物品分类详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:class:edit')") |
| | | @ApiOperation(value = "查看维修物品分类详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TItemType> getDetailById(@RequestParam String id) { |
| | | return R.ok(itemTypeService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除维修物品分类 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:class:delete')") |
| | | @Log(title = "维修物品分类信息-删除维修物品分类", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除维修物品分类") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | long count = itemService.count(Wrappers.lambdaQuery(TItem.class).eq(TItem::getTypeId, id)); |
| | | if (count>0) { |
| | | return R.fail("该分类下有维修物品,无法删除"); |
| | | } |
| | | return R.ok(itemTypeService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除维修物品分类 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('houseManage:class:delete')") |
| | | @Log(title = "维修物品分类信息-删除维修物品分类", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除维修物品分类") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | List<TItem> items = itemService.list(Wrappers.lambdaQuery(TItem.class).in(TItem::getTypeId, ids)); |
| | | for (String id : ids) { |
| | | if (items.stream().anyMatch(t -> t.getTypeId().equals(id))) { |
| | | TItemType itemType = itemTypeService.getById(id); |
| | | return R.fail("该分类["+itemType.getTypeName()+"]下有维修物品,无法删除"); |
| | | } |
| | | } |
| | | return R.ok(itemTypeService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.TTenantDTO; |
| | | import com.ruoyi.system.model.TSysConfig; |
| | | import com.ruoyi.system.model.TTenant; |
| | | import com.ruoyi.system.query.TTenantQuery; |
| | | import com.ruoyi.system.service.TSysConfigService; |
| | | import com.ruoyi.system.service.TTenantService; |
| | | import com.ruoyi.system.vo.TenantVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统公共参数设置 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "系统公共参数设置") |
| | | @RestController |
| | | @RequestMapping("/t-sys-config") |
| | | public class TSysConfigController { |
| | | |
| | | |
| | | private final TSysConfigService sysConfigService; |
| | | @Autowired |
| | | public TSysConfigController(TSysConfigService sysConfigService) { |
| | | this.sysConfigService = sysConfigService; |
| | | } |
| | | |
| | | /** |
| | | * 系统公共参数设置详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:commonParameter')") |
| | | @ApiOperation(value = "查看系统公共参数设置详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysConfig> getDetailById() { |
| | | return R.ok(sysConfigService.getById(1)); |
| | | } |
| | | |
| | | /** |
| | | * 修改系统公共参数设置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:commonParameter:save')") |
| | | @Log(title = "租户信息-修改系统公共参数设置", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改系统公共参数设置") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@RequestBody TSysConfig sysConfig) { |
| | | return R.ok(sysConfigService.updateById(sysConfig)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.system.dto.TTenantDTO; |
| | | import com.ruoyi.system.export.ContractExport; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.model.TTenant; |
| | | import com.ruoyi.system.query.TContractQuery; |
| | | import com.ruoyi.system.query.TTenantQuery; |
| | | import com.ruoyi.system.service.TContractService; |
| | | import com.ruoyi.system.service.TTenantService; |
| | | import com.ruoyi.system.vo.TenantVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 租户 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "租户管理") |
| | | @RestController |
| | | @RequestMapping("/t-tenant") |
| | | public class TTenantController { |
| | | |
| | | private final TTenantService tenantService; |
| | | private final TContractService contractService; |
| | | @Autowired |
| | | public TTenantController(TTenantService tenantService, TContractService contractService) { |
| | | this.tenantService = tenantService; |
| | | this.contractService = contractService; |
| | | } |
| | | |
| | | /** |
| | | * 获取租户管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tenant:list')") |
| | | @ApiOperation(value = "获取租户分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TenantVO>> pageList(@RequestBody TTenantQuery query) { |
| | | return R.ok(tenantService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加租户管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tenant:list:add')") |
| | | @Log(title = "租户信息-新增租户", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加租户") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TTenantDTO dto) { |
| | | if(tenantService.isExit(dto)){ |
| | | return R.fail("该账号已存在"); |
| | | } |
| | | // 密码加密 |
| | | dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | return R.ok(tenantService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改租户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tenant:list:edit')") |
| | | @Log(title = "租户信息-修改租户", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改租户") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TTenantDTO dto) { |
| | | if(tenantService.isExit(dto)){ |
| | | return R.fail("该账号已存在"); |
| | | } |
| | | // 密码加密 |
| | | if(StringUtils.isNotBlank(dto.getPassword())){ |
| | | dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | } |
| | | return R.ok(tenantService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看租户详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tenant:list:detail')") |
| | | @ApiOperation(value = "查看租户详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TTenant> getDetailById(@RequestParam String id) { |
| | | TTenant tenant = tenantService.getById(id); |
| | | // tenant.setTenantAttributes(StringUtils.isNotEmpty(tenant.getTenantAttributes())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_ATTRIBUTE,tenant.getTenantAttributes()):""); |
| | | // tenant.setTenantType(StringUtils.isNotEmpty(tenant.getTenantType())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_TYPE,tenant.getTenantType()):""); |
| | | return R.ok(tenant); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取合同分页列表") |
| | | @GetMapping(value = "/contractListByTenantId") |
| | | public R<List<TContract>> contractListByTenantId(@RequestParam String tenantId) { |
| | | return R.ok(contractService.list(Wrappers.lambdaQuery(TContract.class).eq(TContract::getTenantId, tenantId))); |
| | | } |
| | | |
| | | /** |
| | | * 删除租户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tenant:list:edit')") |
| | | @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除租户") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(tenantService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除租户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tenant:list:edit')") |
| | | @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除租户") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(tenantService.removeByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | | @ApiOperation(value = "导出") |
| | | @Log(title = "导出", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void exportOpticalInspection(@Validated @RequestBody TContractQuery query) |
| | | { |
| | | List<ContractExport> contractExports = new ArrayList<>(); |
| | | List<TContract> exportList = contractService.list(Wrappers.lambdaQuery(TContract.class).eq(TContract::getTenantId, query.getTenantId())); |
| | | for (TContract contract : exportList) { |
| | | ContractExport contractExport = new ContractExport(); |
| | | contractExport.setContractNumber(contract.getContractNumber()); |
| | | contractExport.setContractName(contract.getContractName()); |
| | | contractExport.setPartyOneName(contract.getPartyOneName()); |
| | | contractExport.setPartyTwoName(contract.getPartyTwoName()); |
| | | contractExport.setCreateTime(DateUtils.localDateTimeToStringYear(contract.getCreateTime())); |
| | | contractExport.setStartTime(DateUtils.localDateTimeToStringYear(contract.getStartTime())); |
| | | contractExport.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime())); |
| | | contractExport.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE,contract.getPayType())); |
| | | contractExport.setDeposit(contract.getDeposit()+""); |
| | | contractExport.setStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_STATUS,contract.getStatus())); |
| | | contractExports.add(contractExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ContractExport.class, contractExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("合同列表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | System.err.println("合同列表信息导出失败"); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.sign.Base64; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 验证码操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class CaptchaController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | | private Producer captchaProducer; |
| | | |
| | | @Resource(name = "captchaProducerMath") |
| | | private Producer captchaProducerMath; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | | @GetMapping("/captchaImage") |
| | | public AjaxResult getCode(HttpServletResponse response) throws IOException |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | boolean captchaEnabled = configService.selectCaptchaEnabled(); |
| | | ajax.put("captchaEnabled", captchaEnabled); |
| | | if (!captchaEnabled) |
| | | { |
| | | return ajax; |
| | | } |
| | | |
| | | // 保存验证码信息 |
| | | String uuid = IdUtils.simpleUUID(); |
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; |
| | | |
| | | String capStr = null, code = null; |
| | | BufferedImage image = null; |
| | | |
| | | // 生成验证码 |
| | | String captchaType = RuoYiConfig.getCaptchaType(); |
| | | if ("math".equals(captchaType)) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |
| | | capStr = capText.substring(0, capText.lastIndexOf("@")); |
| | | code = capText.substring(capText.lastIndexOf("@") + 1); |
| | | image = captchaProducerMath.createImage(capStr); |
| | | } |
| | | else if ("char".equals(captchaType)) |
| | | { |
| | | capStr = code = captchaProducer.createText(); |
| | | image = captchaProducer.createImage(capStr); |
| | | } |
| | | |
| | | redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | // 转换流信息写出 |
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream(); |
| | | try |
| | | { |
| | | ImageIO.write(image, "jpg", os); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | ajax.put("uuid", uuid); |
| | | ajax.put("img", Base64.encode(os.toByteArray())); |
| | | return ajax; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | 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 com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.framework.config.ServerConfig; |
| | | |
| | | /** |
| | | * 通用请求处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/common") |
| | | public class CommonController |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(CommonController.class); |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | private static final String FILE_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 通用下载请求 |
| | | * |
| | | * @param fileName 文件名称 |
| | | * @param delete 是否删除 |
| | | */ |
| | | @GetMapping("/download") |
| | | public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(fileName)) |
| | | { |
| | | throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); |
| | | } |
| | | String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); |
| | | String filePath = RuoYiConfig.getDownloadPath() + fileName; |
| | | |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, realFileName); |
| | | FileUtils.writeBytes(filePath, response.getOutputStream()); |
| | | if (delete) |
| | | { |
| | | FileUtils.deleteFile(filePath); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通用上传请求(单个) |
| | | */ |
| | | @PostMapping("/upload") |
| | | public AjaxResult uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // 上传文件路径 |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("url", url); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("newFileName", FileUtils.getName(fileName)); |
| | | ajax.put("originalFilename", file.getOriginalFilename()); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通用上传请求(多个) |
| | | */ |
| | | @PostMapping("/uploads") |
| | | public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // 上传文件路径 |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | List<String> urls = new ArrayList<String>(); |
| | | List<String> fileNames = new ArrayList<String>(); |
| | | List<String> newFileNames = new ArrayList<String>(); |
| | | List<String> originalFilenames = new ArrayList<String>(); |
| | | for (MultipartFile file : files) |
| | | { |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | urls.add(url); |
| | | fileNames.add(fileName); |
| | | newFileNames.add(FileUtils.getName(fileName)); |
| | | originalFilenames.add(file.getOriginalFilename()); |
| | | } |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); |
| | | ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); |
| | | ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); |
| | | ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 本地资源通用下载 |
| | | */ |
| | | @GetMapping("/download/resource") |
| | | public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) |
| | | throws Exception |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(resource)) |
| | | { |
| | | throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); |
| | | } |
| | | // 本地资源路径 |
| | | String localPath = RuoYiConfig.getProfile(); |
| | | // 数据库资源地址 |
| | | String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); |
| | | // 下载名称 |
| | | String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, downloadName); |
| | | FileUtils.writeBytes(downloadPath, response.getOutputStream()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | //package com.ruoyi.web.controller.interceptor; |
| | | // |
| | | //import org.springframework.context.annotation.Bean; |
| | | //import org.springframework.context.annotation.Configuration; |
| | | // |
| | | //@Configuration |
| | | //public class MybatisConfiguration { |
| | | // |
| | | // /** |
| | | // * 注册拦截器 |
| | | // */ |
| | | // @Bean |
| | | // public MybatisInterceptor getMybatisInterceptor() { |
| | | // return new MybatisInterceptor(); |
| | | // } |
| | | // |
| | | //} |
New file |
| | |
| | | //package com.ruoyi.web.controller.interceptor; |
| | | // |
| | | //import com.ruoyi.framework.web.service.TokenService; |
| | | //import lombok.extern.slf4j.Slf4j; |
| | | //import org.apache.ibatis.executor.Executor; |
| | | //import org.apache.ibatis.mapping.MappedStatement; |
| | | //import org.apache.ibatis.mapping.SqlCommandType; |
| | | //import org.apache.ibatis.plugin.*; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import java.lang.reflect.Field; |
| | | //import java.time.LocalDateTime; |
| | | //import java.util.*; |
| | | // |
| | | //@Slf4j |
| | | //@Component |
| | | //@Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) }) |
| | | //public class MybatisInterceptor implements Interceptor { |
| | | // |
| | | // @Autowired |
| | | // private TokenService tokenService; |
| | | // |
| | | // @Override |
| | | // public Object intercept(Invocation invocation) throws Throwable { |
| | | // MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; |
| | | // if("com.ruoyi.system.mapper.SysLogininforMapper.insertLogininfor".equals(mappedStatement.getId())){ |
| | | // return invocation.proceed(); |
| | | // } |
| | | // // sql类型:insert、update、select、delete |
| | | // SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType(); |
| | | // Object parameter = invocation.getArgs()[1]; |
| | | // |
| | | // if (parameter == null) { |
| | | // return invocation.proceed(); |
| | | // } |
| | | // |
| | | // // 当sql为新增或更新类型时,自动填充操作人相关信息 |
| | | // if (SqlCommandType.INSERT == sqlCommandType) { |
| | | // |
| | | // Field[] fields = getAllFields(parameter); |
| | | // for (Field field : fields) { |
| | | // try { |
| | | // // 注入创建人 |
| | | // if ("createBy".equals(field.getName())) { |
| | | // // 获取当前登录用户信息 |
| | | // if(Objects.nonNull(tokenService.getLoginUser())){ |
| | | // String userName = tokenService.getLoginUser().getUser().getUserName(); |
| | | // field.setAccessible(true); |
| | | // field.set(parameter, userName); |
| | | // field.setAccessible(false); |
| | | // } |
| | | // } |
| | | // //注入创建时间 |
| | | // if ("createTime".equals(field.getName())) { |
| | | // field.setAccessible(true); |
| | | //// field.set(parameter, LocalDateTime.now()); |
| | | // field.setAccessible(false); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.error("failed to insert data, exception = ", e); |
| | | // } |
| | | // } |
| | | // } |
| | | // if (SqlCommandType.UPDATE == sqlCommandType) { |
| | | // Field[] fields = getAllFields(parameter); |
| | | // for (Field field : fields) { |
| | | // try { |
| | | // if ("updateBy".equals(field.getName())) { |
| | | // // 获取当前登录用户信息 |
| | | // if(Objects.nonNull(tokenService.getLoginUser())){ |
| | | // String userName = tokenService.getLoginUser().getUser().getUserName(); |
| | | // field.setAccessible(true); |
| | | // field.set(parameter, userName); |
| | | // field.setAccessible(false); |
| | | // } |
| | | // } |
| | | // if ("updateTime".equals(field.getName())) { |
| | | // field.setAccessible(true); |
| | | //// field.set(parameter, new Date()); |
| | | // field.setAccessible(false); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.error("failed to update data, exception = ", e); |
| | | // } |
| | | // } |
| | | // } |
| | | // return invocation.proceed(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Object plugin(Object target) { |
| | | // return Plugin.wrap(target, this); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void setProperties(Properties properties) { |
| | | // // TODO Auto-generated method stub |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取类的所有属性,包括父类 |
| | | // * |
| | | // * @param object |
| | | // * @return |
| | | // */ |
| | | // private Field[] getAllFields(Object object) { |
| | | // Class<?> clazz = object.getClass(); |
| | | // List<Field> fieldList = new ArrayList<>(); |
| | | // while (clazz != null) { |
| | | // fieldList.addAll(new ArrayList<>(Arrays.asList(clazz.getDeclaredFields()))); |
| | | // clazz = clazz.getSuperclass(); |
| | | // } |
| | | // Field[] fields = new Field[fieldList.size()]; |
| | | // fieldList.toArray(fields); |
| | | // return fields; |
| | | // } |
| | | // |
| | | //} |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Properties; |
| | | import java.util.Set; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisCallback; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysCache; |
| | | |
| | | /** |
| | | * 缓存监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | | public class CacheController |
| | | { |
| | | @Autowired |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private final static List<SysCache> caches = new ArrayList<SysCache>(); |
| | | { |
| | | caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); |
| | | caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息")); |
| | | caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典")); |
| | | caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); |
| | | caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); |
| | | caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); |
| | | caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping() |
| | | public AjaxResult getInfo() throws Exception |
| | | { |
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); |
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); |
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); |
| | | |
| | | Map<String, Object> result = new HashMap<>(3); |
| | | result.put("info", info); |
| | | result.put("dbSize", dbSize); |
| | | |
| | | List<Map<String, String>> pieList = new ArrayList<>(); |
| | | commandStats.stringPropertyNames().forEach(key -> { |
| | | Map<String, String> data = new HashMap<>(2); |
| | | String property = commandStats.getProperty(key); |
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_")); |
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); |
| | | pieList.add(data); |
| | | }); |
| | | result.put("commandStats", pieList); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getNames") |
| | | public AjaxResult cache() |
| | | { |
| | | return AjaxResult.success(caches); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getKeys/{cacheName}") |
| | | public AjaxResult getCacheKeys(@PathVariable String cacheName) |
| | | { |
| | | Set<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | return AjaxResult.success(cacheKeys); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}") |
| | | public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) |
| | | { |
| | | String cacheValue = redisTemplate.opsForValue().get(cacheKey); |
| | | SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); |
| | | return AjaxResult.success(sysCache); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheName/{cacheName}") |
| | | public AjaxResult clearCacheName(@PathVariable String cacheName) |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheKey/{cacheKey}") |
| | | public AjaxResult clearCacheKey(@PathVariable String cacheKey) |
| | | { |
| | | redisTemplate.delete(cacheKey); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheAll") |
| | | public AjaxResult clearCacheAll() |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys("*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | 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 com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.Server; |
| | | |
| | | /** |
| | | * 服务器监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/server") |
| | | public class ServerController |
| | | { |
| | | @PreAuthorize("@ss.hasPermi('monitor:server:list')") |
| | | @GetMapping() |
| | | public AjaxResult getInfo() throws Exception |
| | | { |
| | | Server server = new Server(); |
| | | server.copyTo(); |
| | | return AjaxResult.success(server); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.service.SysPasswordService; |
| | | import com.ruoyi.system.domain.SysLogininfor; |
| | | import com.ruoyi.system.service.ISysLogininforService; |
| | | |
| | | /** |
| | | * 系统访问记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/logininfor") |
| | | public class SysLogininforController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysLogininforService logininforService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysLogininfor logininfor) |
| | | { |
| | | // startPage(); |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "登录日志", businessType = BusinessType.EXPORT) |
| | | // @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysLogininfor logininfor) |
| | | // { |
| | | // List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | // ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); |
| | | // util.exportExcel(response, list, "登录日志"); |
| | | // } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "登录日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{infoIds}") |
| | | public AjaxResult remove(@PathVariable Long[] infoIds) |
| | | { |
| | | return toAjax(logininforService.deleteLogininforByIds(infoIds)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "登录日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | logininforService.cleanLogininfor(); |
| | | return success(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") |
| | | @Log(title = "账户解锁", businessType = BusinessType.OTHER) |
| | | @GetMapping("/unlock/{userName}") |
| | | public AjaxResult unlock(@PathVariable("userName") String userName) |
| | | { |
| | | passwordService.clearLoginRecordCache(userName); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.query.SysOperLogQuery; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import com.ruoyi.system.vo.SysOperLogVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "操作日志记录") |
| | | @RestController |
| | | @RequestMapping("/monitor/operlog") |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | |
| | | @ApiOperation(value = "操作日志分页列表") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysOperLogQuery query) |
| | | { |
| | | PageInfo<SysOperLogVO> list = operLogService.selectOperLogPageList(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @Log(title = "删除操作日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/deleteById/{operIds}") |
| | | public AjaxResult remove(@PathVariable String operIds) |
| | | { |
| | | String[] split = operIds.split(","); |
| | | List<Long> id = new ArrayList<>(); |
| | | for (String s : split) { |
| | | id.add(Long.valueOf(s)); |
| | | } |
| | | return AjaxResult.success(operLogService.deleteOperLogByIds(id)); |
| | | } |
| | | |
| | | @Log(title = "清除操作日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | operLogService.cleanOperLog(); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysUserOnline; |
| | | import com.ruoyi.system.service.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * 在线用户监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/online") |
| | | public class SysUserOnlineController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserOnlineService userOnlineService; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(String ipaddr, String userName) |
| | | { |
| | | Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); |
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); |
| | | for (String key : keys) |
| | | { |
| | | LoginUser user = redisCache.getCacheObject(key); |
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(ipaddr)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); |
| | | } |
| | | else |
| | | { |
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); |
| | | } |
| | | } |
| | | Collections.reverse(userOnlineList); |
| | | userOnlineList.removeAll(Collections.singleton(null)); |
| | | return getDataTable(userOnlineList); |
| | | } |
| | | |
| | | /** |
| | | * 强退用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") |
| | | @Log(title = "在线用户", businessType = BusinessType.FORCE) |
| | | @DeleteMapping("/{tokenId}") |
| | | public AjaxResult forceLogout(@PathVariable String tokenId) |
| | | { |
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | // @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | // @PreAuthorize("@ss.hasPermi('system:config:export')") |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysConfig config) |
| | | // { |
| | | // List<SysConfig> list = configService.selectConfigList(config); |
| | | // ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | // util.exportExcel(response, list, "参数数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:query')") |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) |
| | | { |
| | | return success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:add')") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(getUsername()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(getUsername()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) |
| | | { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | |
| | | /** |
| | | * 部门信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | public class SysDeptController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | /** |
| | | * 获取部门列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysDept dept) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return AjaxResult.success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 查询部门列表(排除节点) |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return AjaxResult.success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门编号获取详细信息 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| | | @GetMapping(value = "/{deptId}") |
| | | public AjaxResult getInfo(@PathVariable Long deptId) |
| | | { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return AjaxResult.success(deptService.selectDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增部门 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:dept:add')") |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(getUsername()); |
| | | return AjaxResult.success(deptService.insertDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 修改部门 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:dept:edit')") |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) |
| | | { |
| | | return error("该部门包含未停用的子部门!"); |
| | | } |
| | | dept.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(deptService.updateDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 删除部门 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:dept:remove')") |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | return warn("存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return warn("部门存在用户,不允许删除"); |
| | | } |
| | | deptService.checkDeptDataScope(deptId); |
| | | return AjaxResult.success(deptService.deleteDeptById(deptId)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "数据字典信息") |
| | | @RestController |
| | | @RequestMapping("/system/dict/data") |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictDataService dictDataService; |
| | | |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | // startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "字典数据", businessType = BusinessType.EXPORT) |
| | | // @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysDictData dictData) |
| | | // { |
| | | // List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | // ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); |
| | | // util.exportExcel(response, list, "字典数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 查询字典数据详细 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictCode}") |
| | | public AjaxResult getInfo(@PathVariable Long dictCode) |
| | | { |
| | | return success(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型查询字典数据信息 |
| | | */ |
| | | @ApiOperation(value = "根据字典类型查询字典数据信息") |
| | | @GetMapping(value = "/type/{dictType}") |
| | | public AjaxResult dictType(@PathVariable String dictType) |
| | | { |
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |
| | | if (StringUtils.isNull(data)) |
| | | { |
| | | data = new ArrayList<SysDictData>(); |
| | | } |
| | | return success(data); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "字典数据", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictDataService.insertDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "字典数据", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictDataService.updateDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public AjaxResult remove(@PathVariable Long[] dictCodes) |
| | | { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictType; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/type") |
| | | public class SysDictTypeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictType dictType) |
| | | { |
| | | // startPage(); |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| | | // @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysDictType dictType) |
| | | // { |
| | | // List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | // ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); |
| | | // util.exportExcel(response, list, "字典类型"); |
| | | // } |
| | | |
| | | /** |
| | | * 查询字典类型详细 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictId}") |
| | | public AjaxResult getInfo(@PathVariable Long dictId) |
| | | { |
| | | return success(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictTypeService.insertDictType(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 修改字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictTypeService.updateDictType(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public AjaxResult remove(@PathVariable Long[] dictIds) |
| | | { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新字典缓存 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | dictTypeService.resetDictCache(); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取字典选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |
| | | return success(dictTypes); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 首页 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysIndexController |
| | | { |
| | | /** 系统基础配置 */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** |
| | | * 访问首页,提示语 |
| | | */ |
| | | @RequestMapping("/") |
| | | public String index() |
| | | { |
| | | return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.web.controller.tool.MsgUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.SysLoginService; |
| | | import com.ruoyi.framework.web.service.SysPermissionService; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "登录") |
| | | @RestController |
| | | public class SysLoginController |
| | | { |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | @Autowired |
| | | private MsgUtils msgUtils; |
| | | |
| | | /** |
| | | * 账号密码登录 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "账号密码登录",notes = "账号密码登录") |
| | | @PostMapping("/login") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | LoginUser loginUser = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | List<SysRole> roles = loginUser.getUser().getRoles(); |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return AjaxResult.error("请关联角色!"); |
| | | } |
| | | if(roles.get(0).getStatus() == 1){ |
| | | return AjaxResult.error("该账号角色已被禁用!"); |
| | | } |
| | | |
| | | List<SysMenu> menus = roleService.roleInfoFromUserId(loginUser.getUserId()); |
| | | |
| | | ajax.put("menus",menus); |
| | | ajax.put("roleName",roles.get(0).getRoleName()); |
| | | ajax.put("userInfo",loginUser); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 账号密码登录 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "短信登录",notes = "短信登录") |
| | | @PostMapping("/loginCode") |
| | | public AjaxResult loginCode(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | LoginUser loginUser = loginService.loginCode(loginBody.getUsername(), loginBody.getCode()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | List<SysRole> roles = loginUser.getUser().getRoles(); |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return AjaxResult.error("请关联角色!"); |
| | | } |
| | | List<SysMenu> menus = roleService.roleInfoFromUserId(loginUser.getUserId()); |
| | | |
| | | ajax.put("menus",menus); |
| | | ajax.put("roleName",roles.get(0).getRoleName()); |
| | | ajax.put("userInfo",loginUser); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取验证码 |
| | | * |
| | | * @param phone 手机号 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码") |
| | | @GetMapping("/getCode") |
| | | public AjaxResult getCode(@RequestParam String phone) |
| | | { |
| | | // 发送验证码并存储到redis |
| | | if (StringUtils.hasLength(phone)) { |
| | | String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | redisCache.setCacheObject(phone, code,5*60,TimeUnit.SECONDS); |
| | | try { |
| | | msgUtils.sendMsg(phone, code); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return AjaxResult.success("发送短信验证码成功!5分钟内有效"); |
| | | } |
| | | return AjaxResult.error(500, "发送短信验证码失败,请确认手机号码!"); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | @GetMapping("getInfo") |
| | | public AjaxResult getInfo() |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取路由信息 |
| | | * |
| | | * @return 路由信息 |
| | | */ |
| | | @GetMapping("getRouters") |
| | | public AjaxResult getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return AjaxResult.success(menuService.buildMenus(menus)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * 菜单信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "菜单信息") |
| | | @RestController |
| | | @RequestMapping("/system/menu") |
| | | public class SysMenuController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @ApiOperation("菜单权限(有层级)") |
| | | @GetMapping("/levelList") |
| | | public AjaxResult levelList() |
| | | { |
| | | // 获取当前角色的菜单列表 |
| | | List<SysMenu> menus = menuService.selectList(); |
| | | if(menus.size()==0){ |
| | | return AjaxResult.success(new ArrayList<>()); |
| | | } |
| | | // 第三级 |
| | | List<SysMenu> s3 = menus.stream().filter(e -> e.getMenuType().equals("F")).collect(Collectors.toList()); |
| | | // 第二级 |
| | | List<SysMenu> s2 = menus.stream().filter(e -> e.getMenuType().equals("C")).collect(Collectors.toList()); |
| | | // 第一级 |
| | | List<SysMenu> s1 = menus.stream().filter(e -> e.getMenuType().equals("M")).collect(Collectors.toList()); |
| | | |
| | | for (SysMenu menu : s2) { |
| | | List<SysMenu> collect = s3.stream().filter(e -> e.getParentId().equals(menu.getMenuId())).collect(Collectors.toList()); |
| | | menu.setChildren(collect); |
| | | } |
| | | for (SysMenu menu : s1) { |
| | | List<SysMenu> collect = s2.stream().filter(e -> e.getParentId().equals(menu.getMenuId())).collect(Collectors.toList()); |
| | | menu.setChildren(collect); |
| | | } |
| | | |
| | | return AjaxResult.success(s1); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:menu:list')") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return AjaxResult.success(menus); |
| | | } |
| | | |
| | | /** |
| | | * 根据菜单编号获取详细信息 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:menu:query')") |
| | | @GetMapping(value = "/{menuId}") |
| | | public AjaxResult getInfo(@PathVariable Long menuId) |
| | | { |
| | | return AjaxResult.success(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单下拉树列表 |
| | | */ |
| | | @GetMapping("/treeselect") |
| | | public AjaxResult treeselect(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); |
| | | } |
| | | |
| | | /** |
| | | * 加载对应角色菜单列表树 |
| | | */ |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 新增菜单 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:menu:add')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | menu.setCreateBy(getUsername()); |
| | | return AjaxResult.success(menuService.insertMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * 修改菜单 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:menu:edit')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | else if (menu.getMenuId().equals(menu.getParentId())) |
| | | { |
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); |
| | | } |
| | | menu.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(menuService.updateMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * 删除菜单 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:menu:remove')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{menuId}") |
| | | public AjaxResult remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |
| | | { |
| | | return warn("存在子菜单,不允许删除"); |
| | | } |
| | | if (menuService.checkMenuExistRole(menuId)) |
| | | { |
| | | return warn("菜单已分配,不允许删除"); |
| | | } |
| | | return AjaxResult.success(menuService.deleteMenuById(menuId)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.domain.SysNotice; |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | | |
| | | /** |
| | | * 公告 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/notice") |
| | | public class SysNoticeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysNoticeService noticeService; |
| | | |
| | | /** |
| | | * 获取通知公告列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysNotice notice) |
| | | { |
| | | // startPage(); |
| | | List<SysNotice> list = noticeService.selectNoticeList(notice); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 根据通知公告编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:query')") |
| | | @GetMapping(value = "/{noticeId}") |
| | | public AjaxResult getInfo(@PathVariable Long noticeId) |
| | | { |
| | | return success(noticeService.selectNoticeById(noticeId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增通知公告 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:add')") |
| | | @Log(title = "通知公告", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | notice.setCreateBy(getUsername()); |
| | | return toAjax(noticeService.insertNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * 修改通知公告 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:edit')") |
| | | @Log(title = "通知公告", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | notice.setUpdateBy(getUsername()); |
| | | return toAjax(noticeService.updateNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * 删除通知公告 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:remove')") |
| | | @Log(title = "通知公告", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{noticeIds}") |
| | | public AjaxResult remove(@PathVariable Long[] noticeIds) |
| | | { |
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | |
| | | /** |
| | | * 岗位信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/post") |
| | | public class SysPostController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | /** |
| | | * 获取岗位列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | // startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | // @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysPost post) |
| | | // { |
| | | // List<SysPost> list = postService.selectPostList(post); |
| | | // ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); |
| | | // util.exportExcel(response, list, "岗位数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 根据岗位编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public AjaxResult getInfo(@PathVariable Long postId) |
| | | { |
| | | return success(postService.selectPostById(postId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增岗位 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:add')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | | return toAjax(postService.insertPost(post)); |
| | | } |
| | | |
| | | /** |
| | | * 修改岗位 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:edit')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | | return toAjax(postService.updatePost(post)); |
| | | } |
| | | |
| | | /** |
| | | * 删除岗位 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public AjaxResult remove(@PathVariable Long[] postIds) |
| | | { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取岗位选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return success(posts); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user/profile") |
| | | public class SysProfileController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 个人信息 |
| | | */ |
| | | @GetMapping |
| | | public AjaxResult profile() |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | AjaxResult ajax = AjaxResult.success(user); |
| | | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); |
| | | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult updateProfile(@RequestBody SysUser user) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser currentUser = loginUser.getUser(); |
| | | currentUser.setNickName(user.getNickName()); |
| | | currentUser.setEmail(user.getEmail()); |
| | | currentUser.setPhonenumber(user.getPhonenumber()); |
| | | currentUser.setSex(user.getSex()); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | if (userService.updateUserProfile(currentUser) > 0) |
| | | { |
| | | // 更新缓存用户信息 |
| | | tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | return error("修改个人信息异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public AjaxResult updatePwd(String oldPassword, String newPassword) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String userName = loginUser.getUsername(); |
| | | String password = loginUser.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | | return error("修改密码失败,旧密码错误"); |
| | | } |
| | | if (SecurityUtils.matchesPassword(newPassword, password)) |
| | | { |
| | | return error("新密码不能与旧密码相同"); |
| | | } |
| | | if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) |
| | | { |
| | | // 更新缓存用户密码 |
| | | loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); |
| | | tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | return error("修改密码异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 头像上传 |
| | | */ |
| | | @Log(title = "用户头像", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/avatar") |
| | | public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception |
| | | { |
| | | if (!file.isEmpty()) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); |
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("imgUrl", avatar); |
| | | // 更新缓存用户头像 |
| | | loginUser.getUser().setAvatar(avatar); |
| | | tokenService.setLoginUser(loginUser); |
| | | return ajax; |
| | | } |
| | | } |
| | | return error("上传图片异常,请联系管理员"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.RegisterBody; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.SysRegisterService; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 注册验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysRegisterController extends BaseController |
| | | { |
| | | @Autowired |
| | | private SysRegisterService registerService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @PostMapping("/register") |
| | | public AjaxResult register(@RequestBody RegisterBody user) |
| | | { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) |
| | | { |
| | | return error("当前系统没有开启注册功能!"); |
| | | } |
| | | String msg = registerService.register(user); |
| | | return StringUtils.isEmpty(msg) ? success() : error(msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.system.dto.SysRoleDTO; |
| | | import com.ruoyi.system.query.SysRoleQuery; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import com.ruoyi.system.vo.RoleInfoVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.SysPermissionService; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 角色信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "角色信息") |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @ApiOperation(value = "角色列表") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysRoleQuery query) |
| | | { |
| | | PageInfo<SysRole> list = roleService.selectPageList(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @ApiOperation(value = "角色列表不分页") |
| | | @PostMapping("/listNotPage") |
| | | public AjaxResult list() |
| | | { |
| | | List<SysRole> list = roleService.selectRoleList(new SysRole()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | @PreAuthorize("@ss.hasPermi('system:role:count')") |
| | | @ApiOperation(value = "角色数量统计") |
| | | @PostMapping("/roleCount") |
| | | public AjaxResult roleCount() |
| | | { |
| | | int all = roleService.selectCount(null); |
| | | int normal = roleService.selectCount(0); |
| | | int stop = roleService.selectCount(1); |
| | | |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | map.put("all",all); |
| | | map.put("normal",normal); |
| | | map.put("stop",stop); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | // @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | // // @PreAuthorize("@ss.hasPermi('system:role:export')") |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysRole role) |
| | | // { |
| | | // List<SysRole> list = roleService.selectRoleList(role); |
| | | // ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | // util.exportExcel(response, list, "角色数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 根据角色编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/{roleId}") |
| | | public AjaxResult getInfo(@PathVariable Long roleId) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return AjaxResult.success(roleService.selectRoleById(roleId)); |
| | | } |
| | | |
| | | // @PreAuthorize("@ss.hasPermi('system:role:detail')") |
| | | @ApiOperation("角色详情") |
| | | @GetMapping("/roleInfo") |
| | | public AjaxResult roleInfo(@RequestParam Long roleId) |
| | | { |
| | | SysRole role = roleService.selectRoleById(roleId); |
| | | RoleInfoVO roleInfoVo = new RoleInfoVO(); |
| | | roleInfoVo.setRoleId(role.getRoleId()); |
| | | roleInfoVo.setRoleName(role.getRoleName()); |
| | | |
| | | // 获取当前角色的菜单列表 |
| | | List<SysMenu> menus = menuService.selectListByRoleId(roleId); |
| | | if(menus.size()==0){ |
| | | return AjaxResult.success(new ArrayList<>()); |
| | | } |
| | | List<Long> menusId = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList()); |
| | | |
| | | // 获取当前的权限菜单(有层级) |
| | | List<SysMenu> levelMenus = roleService.getMenuLevelList(menusId); |
| | | |
| | | roleInfoVo.setMenus(menusId); |
| | | return AjaxResult.success(roleInfoVo); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("用户获取权限菜单") |
| | | @GetMapping("/roleInfoFromUserId") |
| | | public AjaxResult roleInfoFromUserId(@RequestParam Long userId) |
| | | { |
| | | return AjaxResult.success(roleService.roleInfoFromUserId(userId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:add')") |
| | | @ApiOperation(value = "新增角色") |
| | | @Log(title = "角色信息-新增角色", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@Validated @RequestBody SysRoleDTO dto) |
| | | { |
| | | Boolean flag= roleService.isExit(dto.getRoleId(),dto.getRoleName()); |
| | | if(flag){ |
| | | return error("新增角色'" + dto.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | roleService.saveRole(dto); |
| | | return AjaxResult.success(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改保存角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @ApiOperation(value = "编辑角色") |
| | | @Log(title = "角色信息-编辑角色", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysRoleDTO dto) |
| | | { |
| | | Boolean flag= roleService.isExit(dto.getRoleId(),dto.getRoleName()); |
| | | if (flag){ |
| | | return error("修改角色'" + dto.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | if (roleService.editRole(dto) > 0) |
| | | { |
| | | // 更新缓存用户权限 |
| | | LoginUser loginUser = getLoginUser(); |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) |
| | | { |
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); |
| | | tokenService.setLoginUser(loginUser); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return error("修改角色'" + dto.getRoleName() + "'失败,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存数据权限 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public AjaxResult dataScope(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | return AjaxResult.success(roleService.authDataScope(role)); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @ApiOperation(value = "状态修改") |
| | | @Log(title = "角色信息-角色状态修改", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysRole role) |
| | | { |
| | | role.setUpdateBy(getUsername()); |
| | | roleService.updateStatus(role); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 删除角色 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:remove')") |
| | | @ApiOperation(value = "删除角色") |
| | | @Log(title = "角色信息-角色删除角色", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/deleteById/{ids}") |
| | | public AjaxResult remove(@PathVariable String ids) |
| | | { |
| | | String[] split = ids.split(","); |
| | | List<Long> id = new ArrayList<>(); |
| | | for (String s : split) { |
| | | id.add(Long.valueOf(s)); |
| | | } |
| | | return AjaxResult.success(roleService.deleteRoleByIds(id)); |
| | | } |
| | | |
| | | /** |
| | | * 获取角色选择框列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | return AjaxResult.success(roleService.selectRoleAll()); |
| | | } |
| | | |
| | | /** |
| | | * 查询已分配用户角色列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | // startPage(); |
| | | List<SysUser> list = userService.selectAllocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询未分配用户角色列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | // startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权用户 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | return AjaxResult.success(roleService.deleteAuthUser(userRole)); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | return AjaxResult.success(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择用户授权 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return AjaxResult.success(roleService.insertAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取对应角色部门树列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/deptTree/{roleId}") |
| | | public AjaxResult deptTree(@PathVariable("roleId") Long roleId) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | | ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); |
| | | return ajax; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.SysUserUpdateStatusDTO; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | import com.ruoyi.system.vo.UserAddListVO; |
| | | import com.ruoyi.system.vo.UserLevelVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "用户信息") |
| | | @RestController |
| | | @RequestMapping("/system/user") |
| | | public class SysUserController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @ApiOperation(value = "获取用户列表") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysUserQuery query) |
| | | { |
| | | PageInfo<SysUserVO> list = userService.pageList(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取用户列表-不分页") |
| | | @PostMapping("/listNotPage") |
| | | public AjaxResult listNotPage() |
| | | { |
| | | List<SysUser> list = userService.selectList(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户黑名单列表 |
| | | */ |
| | | // @ApiOperation(value = "获取用户黑名单列表") |
| | | // @PostMapping("/blacklist") |
| | | // public AjaxResult blacklist(@RequestBody SysUserQuery query) |
| | | // { |
| | | // startPage(query.getPageNum(), query.getPageSize()); |
| | | // List<SysUserVO> list = userService.selectBlackPageList(query); |
| | | // return AjaxResult.success(getDataTable(list)); |
| | | // } |
| | | |
| | | /** |
| | | * 获取用户详情 |
| | | */ |
| | | @ApiOperation(value = "获取用户详情") |
| | | @GetMapping("/getDetail") |
| | | public AjaxResult getDetail(@RequestParam Long userId) |
| | | { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | SysUserVO sysUserVO = new SysUserVO(); |
| | | BeanUtils.copyProperties(sysUser,sysUserVO); |
| | | |
| | | return AjaxResult.success(sysUser); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户详情 |
| | | */ |
| | | @ApiOperation(value = "获取用户详情") |
| | | @GetMapping("/queryDetail") |
| | | public AjaxResult queryDetail() |
| | | { |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | SysUserVO sysUserVO = new SysUserVO(); |
| | | BeanUtils.copyProperties(sysUser,sysUserVO); |
| | | |
| | | return AjaxResult.success(sysUser); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户数量统计 |
| | | */ |
| | | @ApiOperation(value = "获取用户数量统计") |
| | | @PostMapping("/getUserCount") |
| | | public AjaxResult getUserCount() |
| | | { |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | |
| | | Integer userCountSum = userService.selectCount(null); |
| | | Integer normalCount = userService.selectCount(0);// 正常 |
| | | Integer stopCount = userService.selectCount(1);// 停用 |
| | | |
| | | map.put("all",userCountSum); |
| | | map.put("normal",normalCount); |
| | | map.put("stop",stopCount); |
| | | |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | /** |
| | | * 移除黑名单 |
| | | */ |
| | | @GetMapping("/removeBlackList") |
| | | public AjaxResult removeBlackList(@RequestParam String ids) |
| | | { |
| | | String[] split = ids.split(","); |
| | | List<Long> id = new ArrayList<>(); |
| | | for (String s : split) { |
| | | id.add(Long.valueOf(s)); |
| | | } |
| | | userService.updateUserIfBlack(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @ApiOperation(value = "新增用户管理") |
| | | @Log(title = "用户信息-新增用户", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) |
| | | { |
| | | user.setUserName(user.getUserName()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("123456")); |
| | | userService.insertUser(user); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @ApiOperation(value = "修改用户管理") |
| | | @Log(title = "用户信息-修改用户", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) |
| | | { |
| | | user.setUserName(user.getPhonenumber()); |
| | | // userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getUserId()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | |
| | | user.setUpdateBy(getUsername()); |
| | | if(StringUtils.isNotEmpty(user.getPassword())){ |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | } |
| | | return AjaxResult.success(userService.updateUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | @ApiOperation(value = "批量删除用户") |
| | | @Log(title = "用户信息-批量删除用户", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/deleteById/{ids}") |
| | | public AjaxResult remove(@PathVariable String ids) |
| | | { |
| | | String[] split = ids.split(","); |
| | | List<Long> userIds = new ArrayList<>(); |
| | | for (String s : split) { |
| | | userIds.add(Long.valueOf(s)); |
| | | } |
| | | if (userIds.contains(getUserId())) |
| | | { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return AjaxResult.success(userService.deleteUserByIds(userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | @ApiOperation(value = "重置密码") |
| | | @Log(title = "用户信息-重置密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(userService.resetPwd(user)); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @ApiOperation(value = "状态修改") |
| | | @Log(title = "用户信息-状态修改", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysUserUpdateStatusDTO dto) |
| | | { |
| | | SysUser loginUser = tokenService.getLoginUser().getUser(); |
| | | SysUser user = new SysUser(); |
| | | user.setUserId(dto.getUserId()); |
| | | user.setStatus(String.valueOf(dto.getStatus())); |
| | | // user.setRemark(dto.getRemark()); |
| | | user.setUpdateBy(getUsername()); |
| | | user.setDisableRemark(dto.getRemark()); |
| | | user.setOperatingTime(LocalDateTime.now()); |
| | | user.setOperatingPerson(loginUser.getNickName()+"("+loginUser.getUserName()+")"); |
| | | return AjaxResult.success(userService.updateUserStatus(user)); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户编号获取授权角色 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/authRole/{userId}") |
| | | public AjaxResult authRole(@PathVariable("userId") Long userId) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 用户授权角色 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | userService.insertUserAuth(userId, roleIds); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/deptTree") |
| | | public AjaxResult deptTree(SysDept dept) |
| | | { |
| | | return AjaxResult.success(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | } |
New file |
| | |
| | | //package com.ruoyi.web.controller.task; |
| | | // |
| | | // |
| | | //import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | //import com.ruoyi.common.utils.SmsUtil; |
| | | //import com.ruoyi.system.mapper.TBillMapper; |
| | | //import com.ruoyi.system.model.TBill; |
| | | //import com.ruoyi.system.model.TContract; |
| | | //import com.ruoyi.system.model.TContractRentType; |
| | | //import com.ruoyi.system.service.TBillService; |
| | | //import com.ruoyi.system.service.TContractRentTypeService; |
| | | //import com.ruoyi.system.service.TContractService; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.scheduling.annotation.Scheduled; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import javax.annotation.Resource; |
| | | //import java.math.BigDecimal; |
| | | //import java.time.LocalDate; |
| | | //import java.time.LocalDateTime; |
| | | //import java.time.LocalTime; |
| | | //import java.time.ZoneId; |
| | | //import java.time.temporal.ChronoUnit; |
| | | //import java.time.temporal.TemporalAdjusters; |
| | | //import java.util.ArrayList; |
| | | //import java.util.Date; |
| | | //import java.util.List; |
| | | //import java.util.Random; |
| | | //import java.util.stream.Collectors; |
| | | // |
| | | ///** |
| | | // * @author zhibing.pu |
| | | // * @date 2023/7/11 8:39 |
| | | // */ |
| | | //@Component |
| | | //public class TaskUtil { |
| | | // @Autowired |
| | | // private TContractService contractService; |
| | | // @Autowired |
| | | // private TBillMapper billMapper; |
| | | // // 用于更新违约金账单 |
| | | // // 每分钟执行一次的定时任务 |
| | | // |
| | | // @Scheduled(cron = "0 * * * * ?") |
| | | // public void dayOfProportionBill() { |
| | | // try { |
| | | // // 查询所有未缴费账单 |
| | | // List<TBill> list = billMapper.selectList(new LambdaQueryWrapper<TBill>().eq(TBill::getPayFeesStatus, 1) |
| | | // .le(TBill::getPayableFeesTime,LocalDate.now())); |
| | | // for (TBill tBill : list) { |
| | | // tBill.setPayFeesStatus("4"); |
| | | // TContract contract = contractService.getById(tBill.getContractId()); |
| | | // LocalDate payableFeesTime = tBill.getPayableFeesTime(); |
| | | // // 将LocalDate转化为LocalDateTime |
| | | // LocalDateTime payableFeesTime1 = LocalDateTime.of(payableFeesTime, LocalTime.of(0, 0, 0)); |
| | | // LocalDateTime now = LocalDateTime.now(); |
| | | // // 计算两个时间相差多少个小时 |
| | | // long hours = ChronoUnit.HOURS.between(payableFeesTime1, now); |
| | | // long l = hours / 24; |
| | | // if (l>=3){ |
| | | // // 违约金比例 |
| | | // BigDecimal proportion = contract.getProportion(); |
| | | // // 按每天 待缴费金额 * XX% 增加违约金费用 |
| | | // if (tBill.getOutstandingMoney().compareTo(new BigDecimal("0"))==0){ |
| | | // tBill.setPayFeesStatus("3"); |
| | | // billMapper.updateById(tBill); |
| | | // continue; |
| | | // } |
| | | // BigDecimal money = tBill.getOutstandingMoney().multiply(new BigDecimal(100).add(proportion)).divide(new BigDecimal(100),2, BigDecimal.ROUND_DOWN); |
| | | // tBill.setOverDays((int) l); |
| | | // tBill.setPayableFeesPenalty((tBill.getPayableFeesPenalty()!=null?tBill.getPayableFeesPenalty():BigDecimal.ZERO).add(money)); |
| | | // tBill.setOutstandingMoney(money); |
| | | // billMapper.updateById(tBill); |
| | | // |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | //} |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import okhttp3.*; |
| | | |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.util.Base64; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 百度文字识别 |
| | | */ |
| | | @Slf4j |
| | | public class BaiDuApi { |
| | | |
| | | static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build(); |
| | | |
| | | public static void main(String []args) throws IOException{ |
| | | // String url = "C:\\Users\\Admin\\Desktop\\picture\\6fd629ac-3327-4bdc-9459-fcb5295384bc.jpg"; |
| | | String url = "C:\\Users\\Admin\\Desktop\\picture\\6fd629ac-3327-4bdc-9459-fcb5295384bc.jpg"; |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | |
| | | // System.err.println(response.body().string()); |
| | | |
| | | Map<String,Object> map = new HashMap<>(); |
| | | String string = response.body().string(); |
| | | String idCard = string.substring(string.lastIndexOf("单号:") + 3, string.lastIndexOf("单号:") + 27); |
| | | String time = string.substring(string.lastIndexOf("零时起") + 3, string.lastIndexOf("二十四时")-1); |
| | | time = time.replace(".","-"); |
| | | map.put("idCard",idCard); |
| | | map.put("time",time); |
| | | System.err.println(map); |
| | | } |
| | | |
| | | /** |
| | | * 资质证明证件识别 |
| | | * @param url |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static Map<String,Object> qualification(String url) throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | try{ |
| | | String string = response.body().string(); |
| | | String idCard = string.substring(string.lastIndexOf("号:") + 2, string.lastIndexOf("号:") + 21); |
| | | String time = string.substring(string.lastIndexOf("至") + 1, string.lastIndexOf("至") + 11); |
| | | time = time.replace(".","-"); |
| | | map.put("idCard",idCard); |
| | | map.put("time",time); |
| | | }catch (Exception e){ |
| | | log.error("资质证明证件识别错误!"); |
| | | throw new ServiceException("资质证明证件识别错误!"); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 身份证识别 |
| | | * @param url |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static Map<String,Object> idCard(String url) throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | try{ |
| | | JSONObject jsonObject = JSONObject.parseObject(response.body().string()); |
| | | JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("words_result")); |
| | | JSONObject obj1 = JSONObject.parseObject(jsonArray.get(0).toString()); |
| | | String name = obj1.getString("words"); |
| | | name = name.substring(2); |
| | | |
| | | JSONObject obj2 = JSONObject.parseObject(jsonArray.get(1).toString()); |
| | | String sexStr = obj2.getString("words"); |
| | | sexStr = sexStr.substring(2, 3); |
| | | int sex = "男".equals(sexStr)?0:1; |
| | | |
| | | JSONObject obj3 = JSONObject.parseObject(jsonArray.get(3).toString()); |
| | | JSONObject obj4 = JSONObject.parseObject(jsonArray.get(4).toString()); |
| | | String address = obj3.getString("words") + obj4.getString("words"); |
| | | address = address.substring(2); |
| | | |
| | | JSONObject obj5 = JSONObject.parseObject(jsonArray.get(5).toString()); |
| | | String idCard = obj5.getString("words"); |
| | | idCard = idCard.substring(6); |
| | | |
| | | map.put("name",name); |
| | | map.put("sex",sex); |
| | | map.put("address",address); |
| | | map.put("idCard",idCard); |
| | | }catch (Exception e){ |
| | | log.error("身份证件识别错误!"); |
| | | throw new ServiceException("身份证件识别错误!"); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 通用文字识别(标准版) |
| | | * @param url |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static JSONObject pictureOcr(String url) throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | return JSONObject.parseObject(response.body().string()); |
| | | } |
| | | |
| | | public static String getAccessToken() throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/json"); |
| | | RequestBody body = RequestBody.create(mediaType, ""); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/oauth/2.0/token?client_id=2RkKEqd0ltIHPvnIf3G0VpHE&client_secret=RBpPt3O64e3e4BK7pG3lP0o8I6SGgiUy&grant_type=client_credentials") |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/json") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | JSONObject jsonObject = JSONObject.parseObject(response.body().string()); |
| | | return jsonObject.getString("access_token"); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件base64编码 |
| | | * |
| | | * @param path 文件路径 |
| | | * @param urlEncode 如果Content-Type是application/x-www-form-urlencoded时,传true |
| | | * @return base64编码信息,不带文件头 |
| | | * @throws IOException IO异常 |
| | | */ |
| | | static String getFileContentAsBase64(String path, boolean urlEncode) throws IOException { |
| | | byte[] b = Files.readAllBytes(Paths.get(path)); |
| | | String base64 = Base64.getEncoder().encodeToString(b); |
| | | if (urlEncode) { |
| | | base64 = URLEncoder.encode(base64, "utf-8"); |
| | | } |
| | | return base64; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.InputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | |
| | | /** |
| | | * @author zhy |
| | | * @title: HttpClientUtil |
| | | * @projectName car_park |
| | | * @description: http连接工具类 |
| | | * @date 2019/10/2219:23 |
| | | */ |
| | | public class HttpClientUtil { |
| | | |
| | | |
| | | /** |
| | | * @param strUrl |
| | | * @return byte[] |
| | | * @throws |
| | | * @description: 获取网络图片转成字节流 |
| | | * @author zhy |
| | | * @date 2019/10/23 8:59 |
| | | */ |
| | | public static byte[] getImageFromNetByUrl(String strUrl) { |
| | | if (!isURL(strUrl)){ |
| | | return null; |
| | | } |
| | | try { |
| | | URL url = new URL(strUrl); |
| | | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
| | | conn.setRequestMethod("GET"); |
| | | conn.setConnectTimeout(2 * 1000); |
| | | InputStream inStream = conn.getInputStream();// 通过输入流获取图片数据 |
| | | byte[] btImg = readInputStream(inStream);// 得到图片的二进制数据 |
| | | return btImg; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 从输入流中获取字节流数据 |
| | | * |
| | | * @param inStream 输入流 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static byte[] readInputStream(InputStream inStream) throws Exception { |
| | | ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[10240]; |
| | | int len = 0; |
| | | while ((len = inStream.read(buffer)) != -1) { |
| | | outStream.write(buffer, 0, len); |
| | | } |
| | | inStream.close(); |
| | | return outStream.toByteArray(); |
| | | } |
| | | |
| | | public static boolean isURL(String str) { |
| | | str = str.toLowerCase(); |
| | | String regex = "^((https|http|ftp|rtsp|mms)?://)" |
| | | + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" |
| | | + "(([0-9]{1,3}\\.){3}[0-9]{1,3}" |
| | | + "|" |
| | | + "([0-9a-z_!~*'()-]+\\.)*" |
| | | + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\." |
| | | + "[a-z]{2,6})" |
| | | + "(:[0-9]{1,5})?" |
| | | + "((/?)|" |
| | | + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; |
| | | return str.matches(regex); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 导出返回信息 |
| | | */ |
| | | @Slf4j |
| | | public class ImportExcelUtil { |
| | | |
| | | /** |
| | | * @param errorLines 错误行数 |
| | | * @param successLines 成功行数 |
| | | * @param errorMessage 错误信息 |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static R<String> importReturnMsg(int errorLines, int successLines, List<String> errorMessage) throws IOException { |
| | | if (errorLines == 0) { |
| | | return R.ok("共" + successLines + "行数据全部导入成功!"); |
| | | } else { |
| | | JSONObject result = new JSONObject(5); |
| | | int totalCount = successLines + errorLines; |
| | | result.put("totalCount", totalCount); |
| | | result.put("errorCount", errorLines); |
| | | result.put("errorMessage", errorMessage); |
| | | result.put("successCount", successLines); |
| | | result.put("msg", "总上传行数:" + totalCount + ",已导入行数:" + successLines + ",错误行数:" + errorLines); |
| | | return R.ok(JSON.toJSONString(result)); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.system.code.SubmitTemplateReg; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.apache.commons.codec.binary.Hex; |
| | | |
| | | import java.io.Serializable; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * 短信工具类 |
| | | */ |
| | | public class MsgCodeUtil implements Serializable { |
| | | |
| | | /**接口账号用户名*/ |
| | | private static final String AP_ID = ""; |
| | | /**企业名称*/ |
| | | private static final String EC_NAME = ""; |
| | | /**签名*/ |
| | | private static final String SECRET_KEY = ""; |
| | | /**签名编码*/ |
| | | private static final String SIGN = ""; |
| | | /**模板ID*/ |
| | | private static final String TEMPLATE_ID = ""; |
| | | |
| | | |
| | | /** |
| | | * 实体封装 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static SubmitTemplateReg getSubmitTemplateReg(String code,String mobiles) { |
| | | SubmitTemplateReg submitReg =new SubmitTemplateReg(); |
| | | String[] paramss = {code}; |
| | | submitReg.setApId(AP_ID); |
| | | submitReg.setEcName(EC_NAME); |
| | | submitReg.setSecretKey(SECRET_KEY); |
| | | submitReg.setParams(JSONObject.toJSONString(paramss)); |
| | | submitReg.setMobiles(mobiles); |
| | | submitReg.setAddSerial(""); |
| | | submitReg.setSign(SIGN); |
| | | submitReg.setTemplateId(TEMPLATE_ID); |
| | | submitReg.setMac(TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReg.getEcName( ));stringBuffer.append(submitReg.getApId()); |
| | | stringBuffer.append(submitReg.getSecretKey());stringBuffer.append(submitReg.getTemplateId());stringBuffer.append(submitReg.getMobiles()); |
| | | stringBuffer.append(submitReg.getParams());stringBuffer.append(submitReg.getSign());stringBuffer.append(submitReg.getAddSerial()); |
| | | submitReg.setMac(Hex.encodeHexString(stringBuffer.toString().getBytes(StandardCharsets.UTF_8))); |
| | | String regText = JSONObject.toJSONString(submitReg); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(regText.getBytes()); |
| | | System.err.println(encode); |
| | | return submitReg; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | getSubmitTemplateReg("123456","18398968484"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsRequest; |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsResponse; |
| | | import com.aliyun.tea.TeaException; |
| | | import com.aliyun.teaopenapi.models.Config; |
| | | import com.aliyun.teautil.models.RuntimeOptions; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MsgUtils { |
| | | |
| | | @Value("${code.config.accessKeyId}") |
| | | private String accessKeyId; |
| | | @Value("${code.config.accessKeySecret}") |
| | | private String accessKeySecret; |
| | | @Value("${code.config.signName}") |
| | | private String signName; |
| | | @Value("${code.config.templateCode}") |
| | | private String templateCode; |
| | | @Value("${code.config.signNameTest}") |
| | | private String signNameTest; |
| | | @Value("${code.config.templateCodeTest}") |
| | | private String templateCodeTest; |
| | | |
| | | /** |
| | | * 使用AK&SK初始化账号Client |
| | | * @param accessKeyId |
| | | * @param accessKeySecret |
| | | * @return Client |
| | | * @throws Exception |
| | | */ |
| | | public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception { |
| | | Config config = new Config() |
| | | // 您的 AccessKey ID |
| | | .setAccessKeyId(accessKeyId) |
| | | // 您的 AccessKey Secret |
| | | .setAccessKeySecret(accessKeySecret); |
| | | // 访问的域名 |
| | | config.endpoint = "dysmsapi.aliyuncs.com"; |
| | | return new com.aliyun.dysmsapi20170525.Client(config); |
| | | } |
| | | |
| | | public void sendMsg(String phone,String code) throws Exception { |
| | | com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret); |
| | | SendSmsRequest sendSmsRequest = new SendSmsRequest() |
| | | .setSignName(signName) |
| | | .setTemplateCode(templateCode) |
| | | .setPhoneNumbers(phone) |
| | | .setTemplateParam("{\"code\":\""+code+"\"}"); |
| | | RuntimeOptions runtime = new RuntimeOptions(); |
| | | try { |
| | | // 复制代码运行请自行打印 API 的返回值 |
| | | SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); |
| | | log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode()); |
| | | } catch (TeaException error) { |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } catch (Exception _error) { |
| | | TeaException error = new TeaException(_error.getMessage(), _error); |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | public class NumberToChineseUtils { |
| | | |
| | | // 中文数字字符 |
| | | private static final char[] CHINESE_NUMBERS = {'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'}; |
| | | // 单位字符 |
| | | private static final String[] UNITS = {"", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿"}; |
| | | |
| | | /** |
| | | * 数字转大写中文 |
| | | * |
| | | * @param num 需要转换的数字 |
| | | * @return 转换后的大写中文字符串 |
| | | */ |
| | | public static String numberToChinese(long num) { |
| | | if (num == 0) { |
| | | return "零"; |
| | | } |
| | | |
| | | StringBuilder result = new StringBuilder(); |
| | | String numStr = String.valueOf(num); |
| | | int unitIndex = 0; // 单位索引 |
| | | boolean zeroFlag = false; // 标记上一个字符是否为0 |
| | | |
| | | for (int i = numStr.length() - 1; i >= 0; i--) { |
| | | int digit = numStr.charAt(i) - '0'; |
| | | String part = toChinesePart(digit, unitIndex, zeroFlag); |
| | | result.insert(0, part); |
| | | |
| | | // 更新上一个字符是否为零的标记 |
| | | zeroFlag = digit == 0; |
| | | |
| | | // 更新单位索引 |
| | | if (unitIndex == 4 || unitIndex == 8) { |
| | | unitIndex = 1; // 万和亿后单位重置 |
| | | } else { |
| | | unitIndex++; |
| | | } |
| | | } |
| | | |
| | | // 去除结果字符串末尾的'零' |
| | | while (result.length() > 1 && result.charAt(result.length() - 1) == '零') { |
| | | result.deleteCharAt(result.length() - 1); |
| | | } |
| | | |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 转换数字部分并添加单位 |
| | | * |
| | | * @param digit 当前数字 |
| | | * @param unitIndex 单位索引 |
| | | * @param zeroFlag 上一个字符是否为零 |
| | | * @return 转换后的字符串 |
| | | */ |
| | | private static String toChinesePart(int digit, int unitIndex, boolean zeroFlag) { |
| | | if (digit == 0) { |
| | | return zeroFlag ? "" : "零"; |
| | | } |
| | | |
| | | String part = CHINESE_NUMBERS[digit] + UNITS[unitIndex]; |
| | | |
| | | // 连续两个'零'只保留一个 |
| | | if (part.equals("零零") || part.equals("零拾")) { |
| | | return "零"; |
| | | } |
| | | |
| | | // 去除'零拾'、'零佰'、'零仟' |
| | | if (part.startsWith("零")) { |
| | | part = part.substring(1); |
| | | } |
| | | |
| | | return part; |
| | | } |
| | | |
| | | /** |
| | | * 数字转大写中文(支持小数) |
| | | * |
| | | * @param number 需要转换的数字 |
| | | * @return 转换后的大写中文字符串 |
| | | */ |
| | | public static String numberToChinese(double number) { |
| | | if (number == 0) { |
| | | return "零"; |
| | | } |
| | | |
| | | StringBuilder result = new StringBuilder(); |
| | | String numStr = String.format("%.2f", number); // 保留两位小数 |
| | | String[] parts = numStr.split("\\."); |
| | | |
| | | // 整数部分 |
| | | if (!parts[0].equals("0")) { |
| | | result.append(numberToChinese(Long.parseLong(parts[0]))); |
| | | } |
| | | |
| | | // 小数部分 |
| | | if (parts.length > 1) { |
| | | String decimalPart = parts[1]; |
| | | if (!decimalPart.equals("00")) { |
| | | result.append("元"); |
| | | if (decimalPart.charAt(0) != '0') { |
| | | result.append(CHINESE_NUMBERS[decimalPart.charAt(0) - '0']).append("角"); |
| | | } |
| | | if (decimalPart.charAt(1) != '0') { |
| | | result.append(CHINESE_NUMBERS[decimalPart.charAt(1) - '0']).append("分"); |
| | | } |
| | | } else { |
| | | result.append("元整"); |
| | | } |
| | | } else { |
| | | result.append("元整"); |
| | | } |
| | | |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(numberToChinese(123456)); // 输出: 壹拾贰万叁仟肆佰伍拾陆元整 |
| | | System.out.println(numberToChinese(10010)); // 输出: 壹万零壹拾元整 |
| | | System.out.println(numberToChinese(100000001)); // 输出: 壹亿零壹元整 |
| | | System.out.println(numberToChinese(68435)); // 输出: 陆万捌仟肆佰叁拾伍元整 |
| | | System.out.println(numberToChinese(24000)); // 输出: 捌仟伍佰肆拾叁元整 |
| | | System.out.println(numberToChinese(123.45)); // 输出: 壹佰贰拾叁元肆角伍分 |
| | | System.out.println(numberToChinese(0.67)); // 输出: 零元陆角柒分 |
| | | System.out.println(numberToChinese(100.00)); // 输出: 壹佰元整 |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.documents4j.api.DocumentType; |
| | | import com.documents4j.api.IConverter; |
| | | import com.documents4j.job.LocalConverter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class PdfUtils { |
| | | @Autowired |
| | | private TencentCosUtil tencentCosUtil; |
| | | /** |
| | | * word 转 pdf |
| | | * |
| | | */ |
| | | // public String wordToPdf(String url,String filePath, String fileName) { |
| | | // try { |
| | | // DocumentType documentType = DocumentType.DOC; |
| | | // if(url.contains(".docx")){ |
| | | // documentType = DocumentType.DOCX; |
| | | // } |
| | | // if(url.contains(".doc")){ |
| | | // documentType = DocumentType.DOC; |
| | | // } |
| | | // if(url.contains(".xlsx")){ |
| | | // documentType = DocumentType.XLSX; |
| | | // }else { |
| | | // if(url.contains(".xls")){ |
| | | // documentType = DocumentType.XLS; |
| | | // } |
| | | // } |
| | | // InputStream inputStream = new URL(url).openStream(); |
| | | // ByteArrayOutputStream stream = new ByteArrayOutputStream(); |
| | | // IConverter converter = LocalConverter.builder().build(); |
| | | // converter.convert(inputStream) |
| | | // .as(documentType) |
| | | // .to(stream) |
| | | // .as(DocumentType.PDF).execute(); |
| | | // |
| | | // //上传图片 |
| | | // byte2File(stream.toByteArray(),filePath + "/pdf",fileName.substring(0,fileName.lastIndexOf(".")) + ".pdf"); |
| | | // MultipartFile multipartFile = convertToMultipartFile(stream,fileName.substring(0,fileName.lastIndexOf(".")) ); |
| | | // String s = tencentCosUtil.upLoadFile(multipartFile,"/wordToPdf"); |
| | | // |
| | | // stream.close(); |
| | | // inputStream.close(); |
| | | // return s; |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | |
| | | public String wordToPdf(String filePath, String fileName) { |
| | | try { |
| | | // 确保路径正确性 |
| | | String inputFile = new File(filePath, fileName).getAbsolutePath(); |
| | | String outputDir = new File(filePath, "pdf").getAbsolutePath(); |
| | | |
| | | // 创建输出目录 |
| | | new File(outputDir).mkdirs(); |
| | | |
| | | // 使用完整的转换参数 |
| | | List<String> command = Arrays.asList( |
| | | "/usr/bin/libreoffice", // 使用完整路径 |
| | | "--headless", |
| | | "--norestore", |
| | | "--convert-to", |
| | | "pdf:writer_pdf_Export:PDFExport{" + |
| | | "EmbedStandardFonts=1;" + |
| | | "EmbedFonts=1;" + |
| | | "EmbedOnlyUsedFonts=0;" + |
| | | "UseTaggedPDF=1" + |
| | | "}", |
| | | "--outdir", |
| | | outputDir, |
| | | inputFile |
| | | ); |
| | | |
| | | // 创建进程构建器 |
| | | ProcessBuilder pb = new ProcessBuilder(command); |
| | | |
| | | // 设置环境变量 |
| | | Map<String, String> env = pb.environment(); |
| | | env.put("LC_ALL", "zh_CN.UTF-8"); |
| | | env.put("LANG", "zh_CN.UTF-8"); |
| | | env.put("LANGUAGE", "zh_CN.UTF-8"); |
| | | |
| | | // 重定向错误流到标准输出 |
| | | pb.redirectErrorStream(true); |
| | | |
| | | // 启动进程 |
| | | Process process = pb.start(); |
| | | |
| | | // 读取输出 |
| | | StringBuilder output = new StringBuilder(); |
| | | try (BufferedReader reader = new BufferedReader( |
| | | new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) { |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | output.append(line).append("\n"); |
| | | System.out.println(line); |
| | | } |
| | | } |
| | | |
| | | // 等待进程完成,设置超时 |
| | | if (!process.waitFor(120, TimeUnit.SECONDS)) { |
| | | process.destroyForcibly(); |
| | | throw new RuntimeException("转换超时"); |
| | | } |
| | | |
| | | int exitCode = process.exitValue(); |
| | | if (exitCode != 0) { |
| | | throw new RuntimeException("转换失败,退出码:" + exitCode + "\n输出:" + output); |
| | | } |
| | | |
| | | // 检查生成的PDF文件 |
| | | String pdfFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".pdf"; |
| | | File pdfFile = new File(outputDir, pdfFileName); |
| | | |
| | | if (!pdfFile.exists() || pdfFile.length() == 0) { |
| | | throw new RuntimeException("PDF文件未生成或为空"); |
| | | } |
| | | String absolutePath = pdfFile.getAbsolutePath(); |
| | | |
| | | MultipartFile multipartFile = convertFileToMultipartFile(pdfFile); |
| | | String s = tencentCosUtil.upLoadFile(multipartFile,"/wordToPdf"); |
| | | return s; |
| | | |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("PDF转换失败: " + e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | public MultipartFile convertFileToMultipartFile(File file) throws IOException { |
| | | // 读取文件内容到字节数组 |
| | | byte[] fileContent = Files.readAllBytes(file.toPath()); |
| | | |
| | | // 创建 MultipartFile 对象 |
| | | MultipartFile multipartFile = new MockMultipartFile( |
| | | file.getName(), // 文件名 |
| | | file.getName(), // 原始文件名 |
| | | "application/pdf", // 内容类型,根据实际情况调整 |
| | | fileContent // 文件内容 |
| | | ); |
| | | |
| | | return multipartFile; |
| | | } |
| | | |
| | | // 在使用前检查和配置环境 |
| | | public static void setupEnvironment() { |
| | | try { |
| | | // 1. 检查LibreOffice安装 |
| | | checkLibreOffice(); |
| | | |
| | | // 2. 检查和安装字体 |
| | | installFonts(); |
| | | |
| | | // 3. 配置字体 |
| | | configureFonts(); |
| | | |
| | | // 4. 验证环境变量 |
| | | checkEnvironment(); |
| | | |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("环境设置失败: " + e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | private static void checkLibreOffice() throws IOException, InterruptedException { |
| | | Process process = Runtime.getRuntime().exec("which libreoffice"); |
| | | if (process.waitFor() != 0) { |
| | | throw new RuntimeException("LibreOffice未安装"); |
| | | } |
| | | } |
| | | |
| | | private static void installFonts() throws IOException, InterruptedException { |
| | | // 创建字体安装脚本 |
| | | String scriptContent = |
| | | "#!/bin/bash\n" + |
| | | "apt-get update\n" + |
| | | "apt-get install -y fonts-wqy-zenhei fonts-wqy-microhei fonts-arphic-ukai fonts-arphic-uming\n" + |
| | | "fc-cache -fv\n"; |
| | | |
| | | File script = new File("/tmp/install_fonts.sh"); |
| | | Files.write(script.toPath(), scriptContent.getBytes()); |
| | | script.setExecutable(true); |
| | | |
| | | // 执行脚本 |
| | | Process process = Runtime.getRuntime().exec("sudo /tmp/install_fonts.sh"); |
| | | process.waitFor(); |
| | | |
| | | // 清理脚本 |
| | | script.delete(); |
| | | } |
| | | |
| | | private static void configureFonts() throws IOException { |
| | | // 创建字体配置文件 |
| | | String fontConfig = |
| | | "<?xml version=\"1.0\"?>\n" + |
| | | "<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n" + |
| | | "<fontconfig>\n" + |
| | | " <match target=\"pattern\">\n" + |
| | | " <test name=\"family\"><string>serif</string></test>\n" + |
| | | " <edit name=\"family\" mode=\"prepend\">\n" + |
| | | " <string>WenQuanYi Zen Hei</string>\n" + |
| | | " </edit>\n" + |
| | | " </match>\n" + |
| | | " <match target=\"pattern\">\n" + |
| | | " <test name=\"family\"><string>sans-serif</string></test>\n" + |
| | | " <edit name=\"family\" mode=\"prepend\">\n" + |
| | | " <string>WenQuanYi Zen Hei</string>\n" + |
| | | " </edit>\n" + |
| | | " </match>\n" + |
| | | "</fontconfig>"; |
| | | |
| | | // 写入配置文件 |
| | | File configFile = new File(System.getProperty("user.home") + "/.fonts.conf"); |
| | | Files.write(configFile.toPath(), fontConfig.getBytes()); |
| | | } |
| | | |
| | | private static void checkEnvironment() { |
| | | // 检查环境变量 |
| | | String[] requiredVars = {"LANG", "LC_ALL", "LANGUAGE"}; |
| | | for (String var : requiredVars) { |
| | | String value = System.getenv(var); |
| | | if (value == null || !value.contains("zh_CN")) { |
| | | System.err.println("警告: " + var + " 环境变量未正确设置"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static MultipartFile convertToMultipartFile(ByteArrayOutputStream baos, String fileName) throws IOException { |
| | | // 创建一个临时文件 |
| | | File tempFile = File.createTempFile(fileName, ".pdf"); |
| | | |
| | | // 将ByteArrayOutputStream中的数据写入临时文件 |
| | | try (FileOutputStream fos = new FileOutputStream(tempFile)) { |
| | | baos.writeTo(fos); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // 创建一个MultipartFile对象 |
| | | return new MockMultipartFile( |
| | | fileName + ".pdf", // 参数名称 |
| | | fileName + ".pdf", // 文件名 |
| | | "application/pdf", // 内容类型 |
| | | Files.readAllBytes(tempFile.toPath()) // 文件内容 |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * file转byte |
| | | */ |
| | | public static byte[] file2byte(File file){ |
| | | byte[] buffer = null; |
| | | try{ |
| | | FileInputStream fis = new FileInputStream(file); |
| | | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
| | | byte[] b = new byte[1024]; |
| | | int n; |
| | | while ((n = fis.read(b)) != -1) |
| | | { |
| | | bos.write(b, 0, n); |
| | | } |
| | | fis.close(); |
| | | bos.close(); |
| | | buffer = bos.toByteArray(); |
| | | }catch (FileNotFoundException e){ |
| | | e.printStackTrace(); |
| | | } |
| | | catch (IOException e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return buffer; |
| | | } |
| | | |
| | | /** |
| | | * byte 转file |
| | | */ |
| | | public static File byte2File(byte[] buf, String filePath, String fileName){ |
| | | BufferedOutputStream bos = null; |
| | | FileOutputStream fos = null; |
| | | OutputStreamWriter osw = null; |
| | | File file = null; |
| | | try{ |
| | | File dir = new File(filePath+"/"); |
| | | if (!dir.exists()){ |
| | | dir.mkdirs(); |
| | | } |
| | | file = new File(filePath +File.separator + fileName); |
| | | fos = new FileOutputStream(file); |
| | | bos = new BufferedOutputStream(fos); |
| | | // osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); |
| | | bos.write(buf); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | finally{ |
| | | if (bos != null){ |
| | | try{ |
| | | bos.close(); |
| | | }catch (IOException e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (fos != null){ |
| | | try{ |
| | | fos.close(); |
| | | }catch (IOException e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return file; |
| | | } |
| | | /** |
| | | * multipartFile转File |
| | | **/ |
| | | public static File multipartFile2File(MultipartFile multipartFile){ |
| | | File file = null; |
| | | if (multipartFile != null){ |
| | | try { |
| | | file= File.createTempFile("tmp", null); |
| | | multipartFile.transferTo(file); |
| | | System.gc(); |
| | | file.deleteOnExit(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | log.warn("multipartFile转File发生异常:"+e); |
| | | } |
| | | } |
| | | return file; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // String url = "file:///E:\\qiyeweixin\\WXWork\\1688855207501340\\Cache\\File\\2024-09\\专业技术工作总结.docx"; |
| | | // String filePath = "E:\\qiyeweixin\\WXWork\\1688855207501340\\Cache\\File\\2024-09"; |
| | | // String fileName = "专业技术工作总结.docx"; |
| | | // String s = wordToPdf(url, filePath, fileName); |
| | | // System.err.println(s); |
| | | |
| | | // String url = "file:///F:\\测试动态列表Word.doc"; |
| | | //// String filePath = "E:\\qiyeweixin\\WXWork\\1688855207501340\\Cache\\File\\2024-09"; |
| | | //// String fileName = "专业技术工作总结.docx";4 |
| | | // String filePath = "F:\\"; |
| | | // |
| | | // String s = wordToPdf(url, filePath, "测试动态列表Word.doc"); |
| | | // System.err.println(s); |
| | | |
| | | |
| | | |
| | | // TODO Auto-generated method stub |
| | | |
| | | |
| | | // HashMap<String, Object> paramMap = new HashMap<>(); |
| | | // paramMap.put("CorpID", "SCZT006959"); |
| | | // paramMap.put("Pwd", "123456"); |
| | | // paramMap.put("Mobile", "19522115070"); |
| | | // paramMap.put("Cell", ""); |
| | | // paramMap.put("SendTime", ""); |
| | | // paramMap.put("Content", java.net.URLEncoder.encode("你好,这是测试短信发送。【职评网】")); |
| | | // String result3 = HttpUtil.post("http://sdk2.028lk.com/sdk2/BatchSend2.aspx", paramMap); |
| | | // if (result3 == null) { |
| | | // result3 = ""; |
| | | // } |
| | | // result3 = StrUtil.trim(result3); |
| | | // log.info("返回结果:" + result3); |
| | | // |
| | | // if (result3.matches("^\\d+$") && !result3.equals("0")) { |
| | | // return; |
| | | // } |
| | | |
| | | } |
| | | |
| | | public String test(String fileName){ |
| | | // String url = "file:///usr/local/project/file/"+fileName; |
| | | // String filePath = "E:\\qiyeweixin\\WXWork\\1688855207501340\\Cache\\File\\2024-09"; |
| | | // String fileName = "专业技术工作总结.docx";4 |
| | | String filePath = "/usr/local/project/file/"; |
| | | |
| | | String s = wordToPdf(filePath, fileName); |
| | | System.err.println(s); |
| | | |
| | | return s; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.swing.filechooser.FileSystemView; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.OutputStream; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 二维码工具 |
| | | * @Author:debug (SteadyJack) |
| | | * @Link: weixin-> debug0868 qq-> 1948831260 |
| | | * @Date: 2020/11/16 22:38 |
| | | **/ |
| | | public class QRCodeUtil { |
| | | private static final Logger log= LoggerFactory.getLogger(QRCodeUtil.class); |
| | | |
| | | //CODE_WIDTH:二维码宽度,单位像素 |
| | | private static final int CODE_WIDTH = 400; |
| | | //CODE_HEIGHT:二维码高度,单位像素 |
| | | private static final int CODE_HEIGHT = 400; |
| | | //FRONT_COLOR:二维码前景色,0x000000 表示黑色 |
| | | private static final int FRONT_COLOR = 0x000000; |
| | | //BACKGROUND_COLOR:二维码背景色,0xFFFFFF 表示白色 |
| | | //演示用 16 进制表示,和前端页面 CSS 的取色是一样的,注意前后景颜色应该对比明显,如常见的黑白 |
| | | private static final int BACKGROUND_COLOR = 0xFFFFFF; |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | createCodeToFile("5261548530",new File("C:\\Users\\Admin\\Desktop\\qrcode"),"5261548530.png"); |
| | | } |
| | | |
| | | public static void createCodeToFile(String content, File codeImgFileSaveDir, String fileName) { |
| | | try { |
| | | if (StringUtils.isBlank(content) || StringUtils.isBlank(fileName)) { |
| | | return; |
| | | } |
| | | content = content.trim(); |
| | | if (codeImgFileSaveDir==null || codeImgFileSaveDir.isFile()) { |
| | | //二维码图片存在目录为空,默认放在桌面... |
| | | codeImgFileSaveDir = FileSystemView.getFileSystemView().getHomeDirectory(); |
| | | } |
| | | if (!codeImgFileSaveDir.exists()) { |
| | | //二维码图片存在目录不存在,开始创建... |
| | | codeImgFileSaveDir.mkdirs(); |
| | | } |
| | | |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | |
| | | File codeImgFile = new File(codeImgFileSaveDir, fileName); |
| | | ImageIO.write(bufferedImage, "png", codeImgFile); |
| | | |
| | | log.info("二维码图片生成成功:" + codeImgFile.getPath()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码并输出到输出流, 通常用于输出到网页上进行显示,输出到网页与输出到磁盘上的文件中,区别在于最后一句 ImageIO.write |
| | | * write(RenderedImage im,String formatName,File output):写到文件中 |
| | | * write(RenderedImage im,String formatName,OutputStream output):输出到输出流中 |
| | | * @param content :二维码内容 |
| | | * @param outputStream :输出流,比如 HttpServletResponse 的 getOutputStream |
| | | */ |
| | | public static void createCodeToOutputStream(String content, OutputStream outputStream) { |
| | | try { |
| | | if (StringUtils.isBlank(content)) { |
| | | return; |
| | | } |
| | | content = content.trim(); |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | |
| | | //区别就是这一句,输出到输出流中,如果第三个参数是 File,则输出到文件中 |
| | | ImageIO.write(bufferedImage, "png", outputStream); |
| | | |
| | | log.info("二维码图片生成到输出流成功..."); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | //核心代码-生成二维码 |
| | | private static BufferedImage getBufferedImage(String content) throws WriterException { |
| | | |
| | | //com.google.zxing.EncodeHintType:编码提示类型,枚举类型 |
| | | Map<EncodeHintType, Object> hints = new HashMap(); |
| | | |
| | | //EncodeHintType.CHARACTER_SET:设置字符编码类型 |
| | | hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| | | |
| | | //EncodeHintType.ERROR_CORRECTION:设置误差校正 |
| | | //ErrorCorrectionLevel:误差校正等级,L = ~7% correction、M = ~15% correction、Q = ~25% correction、H = ~30% correction |
| | | //不设置时,默认为 L 等级,等级不一样,生成的图案不同,但扫描的结果是一样的 |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); |
| | | |
| | | //EncodeHintType.MARGIN:设置二维码边距,单位像素,值越小,二维码距离四周越近 |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | |
| | | MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); |
| | | BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hints); |
| | | BufferedImage bufferedImage = new BufferedImage(CODE_WIDTH, CODE_HEIGHT, BufferedImage.TYPE_INT_BGR); |
| | | for (int x = 0; x < CODE_WIDTH; x++) { |
| | | for (int y = 0; y < CODE_HEIGHT; y++) { |
| | | bufferedImage.setRGB(x, y, bitMatrix.get(x, y) ? FRONT_COLOR : BACKGROUND_COLOR); |
| | | } |
| | | } |
| | | return bufferedImage; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.qcloud.cos.COSClient; |
| | | import com.qcloud.cos.ClientConfig; |
| | | import com.qcloud.cos.auth.BasicCOSCredentials; |
| | | import com.qcloud.cos.auth.COSCredentials; |
| | | import com.qcloud.cos.http.HttpProtocol; |
| | | import com.qcloud.cos.model.COSObject; |
| | | import com.qcloud.cos.model.ObjectMetadata; |
| | | import com.qcloud.cos.model.PutObjectResult; |
| | | import com.qcloud.cos.region.Region; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.system.model.TFile; |
| | | import com.ruoyi.system.service.SysFileService; |
| | | import com.ruoyi.system.service.impl.SysFileServiceImpl; |
| | | import com.ruoyi.web.core.config.FileUploaderConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.util.Base64; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | import static cn.hutool.core.date.DatePattern.NORM_DATE_FORMAT; |
| | | |
| | | /** |
| | | * @author HJL |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class TencentCosUtil { |
| | | |
| | | /** |
| | | * 1.调用静态方法getCosClient()就会获得COSClient实例 |
| | | * 2.本方法根据永久密钥初始化 COSClient的,官方是不推荐,官方推荐使用临时密钥,是可以限制密钥使用权限,创建cred时有些区别 |
| | | * |
| | | * @return COSClient实例 |
| | | */ |
| | | |
| | | @Autowired |
| | | COSClient cosClient; |
| | | |
| | | @Autowired |
| | | FileUploaderConfig cosConfig; |
| | | |
| | | @Autowired |
| | | SysFileService sysFileService; |
| | | |
| | | |
| | | /** |
| | | * 上传文件,并存入sys_file,返回文件的主键ID |
| | | * @param file |
| | | * @param folder 格式:/xxxxx,/xxxx/xxxx ,最后不用加斜杠 |
| | | * @return |
| | | */ |
| | | public TFile upload(MultipartFile file, String folder){ |
| | | try { |
| | | // 获取上传的文件的输入流 |
| | | InputStream inputStream = file.getInputStream(); |
| | | // 避免文件覆盖,获取文件的原始名称,如123.jpg,然后通过截取获得文件的后缀,也就是文件的类型 |
| | | |
| | | String originalFilename = file.getOriginalFilename(); |
| | | |
| | | //获取文件的类型 |
| | | String fileType = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | //使用UUID工具 创建唯一名称,放置文件重名被覆盖,在拼接上上命令获取的文件类型 |
| | | String fileName = UUID.randomUUID() + fileType; |
| | | String filePath = (StringUtils.isNotEmpty(folder)? |
| | | folder+"/" |
| | | :"/default/") + DateUtil.format(new Date(),NORM_DATE_FORMAT)+"/"+fileName; |
| | | // 指定文件上传到 COS 上的路径,即对象键。最终文件会传到存储桶名字中的images文件夹下的fileName名字 |
| | | filePath = cosConfig.getLocation() + filePath; |
| | | // 创建上传Object的Metadata |
| | | ObjectMetadata objectMetadata = new ObjectMetadata(); |
| | | // - 使用输入流存储,需要设置请求长度 |
| | | objectMetadata.setContentLength(inputStream.available()); |
| | | // - 设置缓存 |
| | | objectMetadata.setCacheControl("no-cache"); |
| | | // - 设置Content-Type |
| | | objectMetadata.setContentType(fileType); |
| | | //上传文件 |
| | | cosClient.putObject(cosConfig.getBucketName(), filePath, inputStream, objectMetadata); |
| | | TFile tFile = new TFile(); |
| | | tFile.setFileName(filePath); |
| | | tFile.setRealName(originalFilename); |
| | | tFile.setFileType(fileType); |
| | | tFile.setUrl(cosConfig.getRootSrc()+filePath); |
| | | tFile.setContentType(file.getContentType()); |
| | | tFile.setFileSize(file.getSize()); |
| | | sysFileService.save(tFile); |
| | | return tFile; |
| | | } catch (Exception e) { |
| | | log.error("上传文件发生异常",e); |
| | | // 发生IO异常、COS连接异常等,返回空 |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 只要调用静态方法upLoadFile(MultipartFile multipartFile)就可以获取上传后文件的全路径 |
| | | * |
| | | * @param file |
| | | * @return 返回文件的浏览全路径 |
| | | */ |
| | | public String upLoadFile(MultipartFile file,String folder) { |
| | | try { |
| | | // 获取上传的文件的输入流 |
| | | InputStream inputStream = file.getInputStream(); |
| | | // 避免文件覆盖,获取文件的原始名称,如123.jpg,然后通过截取获得文件的后缀,也就是文件的类型 |
| | | String originalFilename = file.getOriginalFilename(); |
| | | //获取文件的类型 |
| | | String fileType = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | //使用UUID工具 创建唯一名称,放置文件重名被覆盖,在拼接上上命令获取的文件类型 |
| | | String fileName = UUID.randomUUID() + fileType; |
| | | // 指定文件上传到 COS 上的路径,即对象键。最终文件会传到存储桶名字中的images文件夹下的fileName名字 |
| | | String filePath = (StringUtils.isNotEmpty(folder)? |
| | | folder+"/" |
| | | :"/default/") + DateUtil.format(new Date(),NORM_DATE_FORMAT)+"/"+fileName; |
| | | |
| | | filePath = cosConfig.getLocation()+"/" + filePath; |
| | | // 创建上传Object的Metadata |
| | | ObjectMetadata objectMetadata = new ObjectMetadata(); |
| | | // - 使用输入流存储,需要设置请求长度 |
| | | objectMetadata.setContentLength(inputStream.available()); |
| | | // - 设置缓存 |
| | | objectMetadata.setCacheControl("no-cache"); |
| | | // - 设置Content-Type |
| | | objectMetadata.setContentType(fileType); |
| | | //上传文件 |
| | | PutObjectResult putResult = cosClient.putObject(cosConfig.getBucketName(), filePath, inputStream, objectMetadata); |
| | | TFile tFile = new TFile(); |
| | | tFile.setFileName(filePath); |
| | | tFile.setRealName(originalFilename); |
| | | tFile.setFileType(fileType); |
| | | tFile.setUrl(cosConfig.getRootSrc()+filePath); |
| | | tFile.setContentType(file.getContentType()); |
| | | tFile.setFileSize(file.getSize()); |
| | | sysFileService.save(tFile); |
| | | // 创建文件的网络访问路径 |
| | | String url = cosConfig.getRootSrc() + filePath; |
| | | return url; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("上传文件发生异常",e); |
| | | // 发生IO异常、COS连接异常等,返回空 |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | * @param file |
| | | * @return |
| | | */ |
| | | public void downLoadFile(String file) { |
| | | HttpServletResponse response = WebUtils.response(); |
| | | String replace = file.replace(cosConfig.getRootSrc(), ""); |
| | | response.setHeader("Access-Control-Expose-Headers","File-Type"); |
| | | try { |
| | | // 5. 下载文件并获取输入流 |
| | | InputStream inputStream = cosClient.getObject(cosConfig.getBucketName(), replace).getObjectContent(); |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | // 6. 处理输入流,例如读取内容或保存到本地文件 |
| | | // 这里仅作示例,实际应用中需要根据需求处理输入流 |
| | | byte[] buffer = new byte[1024]; |
| | | int len; |
| | | while ((len = inputStream.read(buffer)) != -1) { |
| | | // 处理读取到的数据 |
| | | outputStream.write(buffer, 0, len); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("下载文件发生异常",e); |
| | | } |
| | | } |
| | | public String downLoadFileImg(String file) { |
| | | byte[] data = null; |
| | | String replace = file.replace(cosConfig.getRootSrc(), ""); |
| | | try { |
| | | // 5. 下载文件并获取输入流 |
| | | InputStream inputStream = cosClient.getObject(cosConfig.getBucketName(), replace).getObjectContent(); |
| | | ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); |
| | | // 6. 处理输入流,例如读取内容或保存到本地文件 |
| | | byte[] buffer = new byte[1024]; |
| | | int len; |
| | | while ((len = inputStream.read(buffer)) != -1) { |
| | | // 处理读取到的数据 |
| | | swapStream.write(buffer, 0, len); |
| | | } |
| | | data = swapStream.toByteArray(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("下载图片发生异常",e); |
| | | } finally { |
| | | } |
| | | return Base64.getEncoder().encodeToString(data); |
| | | } |
| | | |
| | | public void download(String fileUrl) { |
| | | HttpServletResponse response = WebUtils.response(); |
| | | fileUrl = fileUrl.replace(cosConfig.getRootSrc(), ""); |
| | | |
| | | // 5. 下载文件并获取输入流 |
| | | COSObject object = cosClient.getObject(cosConfig.getBucketName(),fileUrl); |
| | | try ( |
| | | InputStream is = object.getObjectContent(); |
| | | OutputStream os = response.getOutputStream() |
| | | ) { |
| | | String fileName = fileUrl.substring(fileUrl.lastIndexOf("/")); |
| | | response.setContentType(object.getObjectMetadata().getContentType() + ";charset=utf-8"); |
| | | String filename = new String(fileName.getBytes("UTF-8"), "ISO-8859-1"); |
| | | response.addHeader("Content-Disposition", "attachment;filename=" + filename); |
| | | response.addHeader("Content-Length", "" + object.getObjectMetadata().getContentLength()); |
| | | int len = 0; |
| | | byte[] buffer = new byte[2048]; |
| | | while ((len = is.read(buffer)) > 0) { |
| | | os.write(buffer, 0, len); |
| | | } |
| | | os.flush(); |
| | | } catch (IOException e) { |
| | | log.error("读取cos图片发生异常", e); |
| | | } |
| | | } |
| | | |
| | | public void download(TFile file) { |
| | | HttpServletResponse response = WebUtils.response(); |
| | | // 5. 下载文件并获取输入流 |
| | | COSObject object = cosClient.getObject(cosConfig.getBucketName(), file.getFileName()); |
| | | try ( |
| | | InputStream is = object.getObjectContent(); |
| | | OutputStream os = response.getOutputStream() |
| | | ) { |
| | | response.setContentType(file.getContentType() + ";charset=utf-8"); |
| | | String filename = new String(file.getRealName().getBytes("UTF-8"), "ISO-8859-1"); |
| | | response.addHeader("Content-Disposition", "attachment;filename=" + filename); |
| | | response.addHeader("Content-Length", "" + file.getFileSize()); |
| | | int len = 0; |
| | | byte[] buffer = new byte[2048]; |
| | | while ((len = is.read(buffer)) > 0) { |
| | | os.write(buffer, 0, len); |
| | | } |
| | | os.flush(); |
| | | } catch (IOException e) { |
| | | log.error("读取cos图片发生异常", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | 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.RestController; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | | * swagger 用户测试方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/test/user") |
| | | public class TestController extends BaseController |
| | | { |
| | | private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>(); |
| | | { |
| | | users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); |
| | | users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public R<List<UserEntity>> userList() |
| | | { |
| | | List<UserEntity> userList = new ArrayList<UserEntity>(users.values()); |
| | | return R.ok(userList); |
| | | } |
| | | |
| | | @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) |
| | | @GetMapping("/{userId}") |
| | | public R<UserEntity> getUser(@PathVariable Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | return R.ok(users.get(userId)); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | } |
| | | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) |
| | | }) |
| | | @PostMapping("/save") |
| | | public R<String> save(UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("用户ID不能为空"); |
| | | } |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | public R<String> update(@RequestBody UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("用户ID不能为空"); |
| | | } |
| | | if (users.isEmpty() || !users.containsKey(user.getUserId())) |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | users.remove(user.getUserId()); |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) |
| | | @DeleteMapping("/{userId}") |
| | | public R<String> delete(@PathVariable Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | users.remove(userId); |
| | | return R.ok(); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @ApiModel(value = "UserEntity", description = "用户实体") |
| | | class UserEntity |
| | | { |
| | | @ApiModelProperty("用户ID") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty("用户名称") |
| | | private String username; |
| | | |
| | | @ApiModelProperty("用户密码") |
| | | private String password; |
| | | |
| | | @ApiModelProperty("用户手机") |
| | | private String mobile; |
| | | |
| | | public UserEntity() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserEntity(Integer userId, String username, String password, String mobile) |
| | | { |
| | | this.userId = userId; |
| | | this.username = username; |
| | | this.password = password; |
| | | this.mobile = mobile; |
| | | } |
| | | |
| | | public Integer getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUsername() |
| | | { |
| | | return username; |
| | | } |
| | | |
| | | public void setUsername(String username) |
| | | { |
| | | this.username = username; |
| | | } |
| | | |
| | | public String getPassword() |
| | | { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) |
| | | { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getMobile() |
| | | { |
| | | return mobile; |
| | | } |
| | | |
| | | public void setMobile(String mobile) |
| | | { |
| | | this.mobile = mobile; |
| | | } |
| | | } |
New file |
| | |
| | | //package com.ruoyi.web.controller.tool; |
| | | // |
| | | //import org.apache.poi.xwpf.usermodel.*; |
| | | //import java.io.*; |
| | | //import java.time.LocalDateTime; |
| | | //import java.time.format.DateTimeFormatter; |
| | | // |
| | | //public class WordPdfGenerator { |
| | | // |
| | | // // 示例数据类 |
| | | // public static class UserData { |
| | | // private String name; |
| | | // private String id; |
| | | // private String department; |
| | | // private LocalDateTime createTime; |
| | | // |
| | | // public UserData(String name, String id, String department) { |
| | | // this.name = name; |
| | | // this.id = id; |
| | | // this.department = department; |
| | | // this.createTime = LocalDateTime.now(); |
| | | // } |
| | | // |
| | | // // getter方法省略 |
| | | // } |
| | | // |
| | | // public static void generateDocument(UserData userData, String outputPath) { |
| | | // try (XWPFDocument document = new XWPFDocument()) { |
| | | // // 创建标题 |
| | | // XWPFParagraph title = document.createParagraph(); |
| | | // title.setAlignment(ParagraphAlignment.CENTER); |
| | | // XWPFRun titleRun = title.createRun(); |
| | | // titleRun.setText("用户信息表"); |
| | | // titleRun.setBold(true); |
| | | // titleRun.setFontSize(20); |
| | | // titleRun.setFontFamily("宋体"); |
| | | // |
| | | // // 添加空行 |
| | | // document.createParagraph(); |
| | | // |
| | | // // 创建表格 |
| | | // XWPFTable table = document.createTable(5, 2); |
| | | // table.setWidth("100%"); |
| | | // |
| | | // // 设置表格数据 |
| | | // setCellText(table, 0, "姓名", userData.name); |
| | | // setCellText(table, 1, "ID", userData.id); |
| | | // setCellText(table, 2, "部门", userData.department); |
| | | // setCellText(table, 3, "创建时间", |
| | | // userData.createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // |
| | | // // 保存Word文档 |
| | | // String wordFile = outputPath + ".docx"; |
| | | // try (FileOutputStream out = new FileOutputStream(wordFile)) { |
| | | // document.write(out); |
| | | // } |
| | | // |
| | | // // 转换为PDF |
| | | // convertToPdf(wordFile, outputPath + ".pdf"); |
| | | // |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // |
| | | // private static void setCellText(XWPFTable table, int row, String label, String value) { |
| | | // XWPFTableRow tableRow = table.getRow(row); |
| | | // tableRow.getCell(0).setText(label); |
| | | // tableRow.getCell(1).setText(value); |
| | | // } |
| | | // |
| | | // private static void convertToPdf(String wordPath, String pdfPath) { |
| | | // try { |
| | | // // 使用LibreOffice进行转换 |
| | | // ProcessBuilder pb = new ProcessBuilder( |
| | | // "soffice", |
| | | // "--headless", |
| | | // "--convert-to", "pdf", |
| | | // "--outdir", new File(pdfPath).getParent(), |
| | | // wordPath |
| | | // ); |
| | | // Process process = pb.start(); |
| | | // |
| | | // // 等待转换完成 |
| | | // int exitCode = process.waitFor(); |
| | | // if (exitCode == 0) { |
| | | // System.out.println("PDF转换成功!"); |
| | | // } else { |
| | | // System.out.println("PDF转换失败!"); |
| | | // } |
| | | // |
| | | // // 删除临时Word文件 |
| | | // new File(wordPath).delete(); |
| | | // |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // // 示例使用 |
| | | // UserData userData = new UserData("张三", "EMP001", "技术部"); |
| | | // String outputPath = "E:\\"; |
| | | // generateDocument(userData, outputPath); |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | |
| | | public class WordTemplateProcessor { |
| | | |
| | | public static void fillTemplate(String templatePath, String outputPath,Map<String, String> dataMap) { |
| | | try { |
| | | // 读取模板文件 |
| | | FileInputStream fis = new FileInputStream(templatePath); |
| | | XWPFDocument document = new XWPFDocument(fis); |
| | | |
| | | // 替换段落中的标记 |
| | | for (XWPFParagraph paragraph : document.getParagraphs()) { |
| | | replaceParagraph(paragraph, dataMap); |
| | | } |
| | | |
| | | // 替换表格中的标记 |
| | | for (XWPFTable table : document.getTables()) { |
| | | for (XWPFTableRow row : table.getRows()) { |
| | | for (XWPFTableCell cell : row.getTableCells()) { |
| | | for (XWPFParagraph paragraph : cell.getParagraphs()) { |
| | | replaceParagraph(paragraph, dataMap); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 保存文件 |
| | | FileOutputStream fos = new FileOutputStream(outputPath); |
| | | document.write(fos); |
| | | |
| | | // 关闭资源 |
| | | fos.close(); |
| | | fis.close(); |
| | | document.close(); |
| | | |
| | | System.out.println("模板填充完成!文件保存在: " + outputPath); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private static void replaceParagraph(XWPFParagraph paragraph, Map<String, String> dataMap) { |
| | | String paragraphText = paragraph.getText(); |
| | | for (Map.Entry<String, String> entry : dataMap.entrySet()) { |
| | | if (paragraphText.contains(entry.getKey())) { |
| | | List<XWPFRun> runs = paragraph.getRuns(); |
| | | TextSegment found = paragraph.searchText(entry.getKey(), new PositionInParagraph()); |
| | | if (found != null) { |
| | | // 替换文本 |
| | | int beginRun = found.getBeginRun(); |
| | | int endRun = found.getEndRun(); |
| | | |
| | | if (beginRun >= 0 && endRun >= 0) { |
| | | // 删除原有runs |
| | | for (int runPos = beginRun; runPos <= endRun; runPos++) { |
| | | paragraph.removeRun(runPos); |
| | | } |
| | | // 创建新run |
| | | XWPFRun newRun = paragraph.insertNewRun(beginRun); |
| | | newRun.setText(entry.getValue()); |
| | | // 复制原有格式 |
| | | if (runs.size() > 0 && runs.get(0) != null) { |
| | | XWPFRun styleRun = runs.get(0); |
| | | newRun.setFontFamily(styleRun.getFontFamily()); |
| | | newRun.setFontSize(styleRun.getFontSize()); |
| | | newRun.setBold(styleRun.isBold()); |
| | | newRun.setItalic(styleRun.isItalic()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | String templatePath = "/path/to/template.docx"; |
| | | String outputPath = "/path/to/output.docx"; |
| | | |
| | | // fillTemplate(templatePath, outputPath, user); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import freemarker.cache.ClassTemplateLoader; |
| | | import freemarker.template.Configuration; |
| | | import freemarker.template.Template; |
| | | import freemarker.template.TemplateException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class WordUtil { |
| | | |
| | | /** |
| | | * 基于模板生成 Word 文档 |
| | | * |
| | | * @param basePackagePath resources 目录下模板所在包路径 |
| | | * @param templateFileName 模板文件名 |
| | | * @param templateParam 模板参数 |
| | | * @param fileName 文件名 |
| | | */ |
| | | // public void generate(HttpServletResponse response, String basePackagePath, String templateFileName, Object templateParam, String fileName) { |
| | | // try { |
| | | // // 设置 HTTP 响应的内容类型为 Microsoft Word 文档 |
| | | // response.setContentType("application/msword"); |
| | | // // 设置响应字符编码为 UTF-8 |
| | | // response.setCharacterEncoding("utf-8"); |
| | | // // 使用 URLEncoder 对文件名进行编码,以防止中文文件名在不同浏览器和操作系统下出现乱码问题 |
| | | // String filename = URLEncoder.encode(fileName + "_" + System.currentTimeMillis(), "utf-8"); |
| | | // // 设置响应头,指定文档将以附件的形式下载,并定义文件名 |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + filename + ".doc"); |
| | | // // 创建 Freemarker 的 Configuration 对象,设置默认的不兼容改进选项 |
| | | // Configuration configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); |
| | | // configuration.setDefaultEncoding("utf-8"); |
| | | // // 设置模板加载器,加载模板文件 |
| | | // configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), basePackagePath)); |
| | | // Template t = configuration.getTemplate(templateFileName, "utf-8"); |
| | | // // 创建 Writer 对象,用于将生成的文档写到输出流中,缓存区大小设为 10KB |
| | | // Writer out = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8), 10240); |
| | | // // 将模型数据与模板结合生成 Word 文档,写入到 Writer 对象中 |
| | | // t.process(templateParam, out); |
| | | // out.close(); |
| | | // } catch (Exception e) { |
| | | // log.info("基于模板{}生成Word文档异常,异常原因:{}", templateFileName, e.getMessage(), e); |
| | | // throw new RuntimeException("生成Word文档异常,异常原因:" + e.getMessage()); |
| | | // } |
| | | // } |
| | | @Resource |
| | | private TencentCosUtil tencentCosUtil; |
| | | @Resource |
| | | private PdfUtils pdfUtils; |
| | | public String generate(String basePackagePath, String templateFileName, Object templateParam, String fileName, String saveDirectory) { |
| | | try { |
| | | // 创建 Freemarker 的 Configuration 对象,设置默认的不兼容改进选项 |
| | | Configuration configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); |
| | | configuration.setDefaultEncoding("utf-8"); |
| | | // 设置模板加载器,加载模板文件 |
| | | configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), basePackagePath)); |
| | | Template t = configuration.getTemplate(templateFileName, "utf-8"); |
| | | |
| | | // 使用 URLEncoder 对文件名进行编码,以防止中文文件名在不同浏览器和操作系统下出现乱码问题 |
| | | // String encodedFileName = URLEncoder.encode(fileName + "_" + System.currentTimeMillis(), "utf-8"); |
| | | String encodedFileName =fileName ; |
| | | |
| | | // 定义保存文件的路径 |
| | | File saveDir = new File(saveDirectory); |
| | | if (!saveDir.exists()) { |
| | | saveDir.mkdirs(); |
| | | } |
| | | |
| | | // 定义文件名 |
| | | String filePath = saveDir.getAbsolutePath() + File.separator + encodedFileName + ".doc"; |
| | | |
| | | // 创建 Writer 对象,用于将生成的文档写到文件中,缓存区大小设为 10KB |
| | | Writer out = new BufferedWriter(new FileWriter(filePath), 10240); |
| | | |
| | | // 将模型数据与模板结合生成 Word 文档,写入到 Writer 对象中 |
| | | t.process(templateParam, out); |
| | | out.close(); |
| | | |
| | | File file = new File(filePath); |
| | | |
| | | // 检查文件是否存在 |
| | | if (!file.exists()) { |
| | | throw new FileNotFoundException("文件不存在: " + filePath); |
| | | } |
| | | |
| | | // 读取文件内容 |
| | | byte[] fileContent = new byte[(int) file.length()]; |
| | | try (FileInputStream fis = new FileInputStream(file)) { |
| | | fis.read(fileContent); |
| | | } |
| | | MultipartFile mockMultipartFile = new MockMultipartFile(encodedFileName+".doc", fileContent); |
| | | String s = tencentCosUtil.upLoadFile(mockMultipartFile,"/wordGenerate"); |
| | | return s; |
| | | } catch (IOException | TemplateException e) { |
| | | log.error("生成Word文档异常,异常原因:{}", e.getMessage(), e); |
| | | throw new RuntimeException("生成Word文档异常,异常原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | public String generatePdf(String basePackagePath, String templateFileName, Map<String,Object> templateParam, String fileName, String saveDirectory) { |
| | | try { |
| | | |
| | | fillTemplate(basePackagePath+templateFileName, saveDirectory+fileName+".docx", templateParam); |
| | | |
| | | // 创建 Freemarker 的 Configuration 对象,设置默认的不兼容改进选项 |
| | | // Configuration configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); |
| | | // configuration.setDefaultEncoding("utf-8"); |
| | | // // 设置模板加载器,加载模板文件 |
| | | // configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), basePackagePath)); |
| | | // Template t = configuration.getTemplate(templateFileName, "utf-8"); |
| | | // |
| | | // // 使用 URLEncoder 对文件名进行编码,以防止中文文件名在不同浏览器和操作系统下出现乱码问题 |
| | | //// String encodedFileName = URLEncoder.encode(fileName + "_" + System.currentTimeMillis(), "utf-8"); |
| | | // String encodedFileName =fileName ; |
| | | // |
| | | // // 定义保存文件的路径 |
| | | // File saveDir = new File(saveDirectory); |
| | | // if (!saveDir.exists()) { |
| | | // saveDir.mkdirs(); |
| | | // } |
| | | // |
| | | // // 定义文件名 |
| | | // String filePath = saveDir.getAbsolutePath() + File.separator + encodedFileName + ".doc"; |
| | | // |
| | | // // 创建 Writer 对象,用于将生成的文档写到文件中,缓存区大小设为 10KB |
| | | // Writer out = new BufferedWriter(new FileWriter(filePath), 10240); |
| | | // |
| | | // // 将模型数据与模板结合生成 Word 文档,写入到 Writer 对象中 |
| | | // t.process(templateParam, out); |
| | | // out.close(); |
| | | String filePath = saveDirectory + File.separator + fileName + ".docx"; |
| | | File file = new File(filePath); |
| | | |
| | | // 检查文件是否存在 |
| | | if (!file.exists()) { |
| | | throw new FileNotFoundException("文件不存在: " + filePath); |
| | | } |
| | | |
| | | // 读取文件内容 |
| | | byte[] fileContent = new byte[(int) file.length()]; |
| | | try (FileInputStream fis = new FileInputStream(file)) { |
| | | fis.read(fileContent); |
| | | } |
| | | |
| | | String test = pdfUtils.test(fileName + ".docx"); |
| | | // MultipartFile mockMultipartFile = new MockMultipartFile(encodedFileName+".doc", fileContent); |
| | | // String s = ObsUploadUtil.obsUpload(mockMultipartFile); |
| | | return test; |
| | | } catch (IOException e) { |
| | | log.error("生成pdf异常,异常原因:{}", e.getMessage(), e); |
| | | throw new RuntimeException("生成pdf异常,异常原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | public static void fillTemplate(String templatePath, String outputPath,Map<String, Object> dataMap) { |
| | | try (FileInputStream fis = new FileInputStream(templatePath)) { |
| | | // 设置默认编码为UTF-8 |
| | | System.setProperty("file.encoding", "UTF-8"); |
| | | |
| | | XWPFDocument document = new XWPFDocument(fis); |
| | | |
| | | // 处理段落 |
| | | for (XWPFParagraph paragraph : document.getParagraphs()) { |
| | | replaceParagraph(paragraph, dataMap); |
| | | } |
| | | |
| | | // 处理表格 |
| | | for (XWPFTable table : document.getTables()) { |
| | | for (XWPFTableRow row : table.getRows()) { |
| | | for (XWPFTableCell cell : row.getTableCells()) { |
| | | for (XWPFParagraph paragraph : cell.getParagraphs()) { |
| | | replaceParagraph(paragraph, dataMap); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 使用UTF-8编码保存文件 |
| | | try (FileOutputStream fos = new FileOutputStream(outputPath)) { |
| | | document.write(fos); |
| | | } |
| | | |
| | | System.out.println("模板填充完成!文件保存在: " + outputPath); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private static void replaceParagraph(XWPFParagraph paragraph, Map<String, Object> dataMap) { |
| | | // 获取段落中所有runs |
| | | List<XWPFRun> runs = paragraph.getRuns(); |
| | | if (runs == null || runs.isEmpty()) return; |
| | | |
| | | // 首先合并所有runs的文本,以便正确识别占位符 |
| | | StringBuilder fullText = new StringBuilder(); |
| | | for (XWPFRun run : runs) { |
| | | String text = run.getText(0); |
| | | if (text != null) { |
| | | fullText.append(text); |
| | | } |
| | | } |
| | | |
| | | String paragraphText = fullText.toString(); |
| | | |
| | | // 使用正则表达式查找所有占位符,包括括号内的 |
| | | Pattern pattern = Pattern.compile("\\$\\{[^}]+\\}|\\([^)]*\\$\\{[^}]+\\}[^)]*\\)"); |
| | | Matcher matcher = pattern.matcher(paragraphText); |
| | | |
| | | List<ReplacementInfo> replacements = new ArrayList<>(); |
| | | |
| | | // 收集所有需要替换的信息 |
| | | while (matcher.find()) { |
| | | String matched = matcher.group(); |
| | | int start = matcher.start(); |
| | | int end = matcher.end(); |
| | | |
| | | // 找出涉及到的runs |
| | | int startRun = -1; |
| | | int endRun = -1; |
| | | int currentPos = 0; |
| | | |
| | | for (int i = 0; i < runs.size(); i++) { |
| | | XWPFRun run = runs.get(i); |
| | | String runText = run.getText(0); |
| | | if (runText == null) continue; |
| | | |
| | | int runLength = runText.length(); |
| | | if (startRun == -1 && currentPos + runLength > start) { |
| | | startRun = i; |
| | | } |
| | | if (currentPos + runLength >= end) { |
| | | endRun = i; |
| | | break; |
| | | } |
| | | currentPos += runLength; |
| | | } |
| | | |
| | | if (startRun != -1 && endRun != -1) { |
| | | // 处理括号内的占位符 |
| | | String replacement = processPlaceholder(matched, dataMap); |
| | | replacements.add(new ReplacementInfo(startRun, endRun, matched, replacement)); |
| | | } |
| | | } |
| | | |
| | | // 从后向前替换,避免位置变化影响 |
| | | Collections.sort(replacements, (a, b) -> b.startRun - a.startRun); |
| | | |
| | | for (ReplacementInfo info : replacements) { |
| | | replaceRunRange(paragraph, info); |
| | | } |
| | | } |
| | | |
| | | private static String processPlaceholder(String text, Map<String, Object> dataMap) { |
| | | // 处理括号内的占位符 |
| | | Pattern placeholderPattern = Pattern.compile("\\$\\{([^}]+)\\}"); |
| | | Matcher matcher = placeholderPattern.matcher(text); |
| | | |
| | | StringBuffer result = new StringBuffer(); |
| | | while (matcher.find()) { |
| | | String placeholder = matcher.group(0); // 完整的占位符 |
| | | String key = matcher.group(1); // 占位符中的键 |
| | | String replacement = Objects.nonNull(dataMap.get("${" + key + "}"))?String.valueOf(dataMap.get("${" + key + "}")):""; |
| | | |
| | | if (replacement != null) { |
| | | // 如果在括号内,保留括号 |
| | | if (text.startsWith("(") && text.endsWith(")")) { |
| | | matcher.appendReplacement(result, replacement); |
| | | } else { |
| | | matcher.appendReplacement(result, Matcher.quoteReplacement(replacement)); |
| | | } |
| | | } |
| | | } |
| | | matcher.appendTail(result); |
| | | |
| | | return result.toString(); |
| | | } |
| | | |
| | | private static class ReplacementInfo { |
| | | int startRun; |
| | | int endRun; |
| | | String originalText; |
| | | String replacementText; |
| | | |
| | | ReplacementInfo(int startRun, int endRun, String originalText, String replacementText) { |
| | | this.startRun = startRun; |
| | | this.endRun = endRun; |
| | | this.originalText = originalText; |
| | | this.replacementText = replacementText; |
| | | } |
| | | } |
| | | |
| | | private static void replaceRunRange(XWPFParagraph paragraph, ReplacementInfo info) { |
| | | List<XWPFRun> runs = paragraph.getRuns(); |
| | | |
| | | // 保存第一个run的样式 |
| | | XWPFRun styleRun = runs.get(info.startRun); |
| | | RunStyle style = new RunStyle(styleRun); |
| | | |
| | | // 删除范围内的所有runs |
| | | for (int i = info.endRun; i >= info.startRun; i--) { |
| | | paragraph.removeRun(i); |
| | | } |
| | | |
| | | // 创建新的run并设置文本 |
| | | XWPFRun newRun = paragraph.insertNewRun(info.startRun); |
| | | newRun.setText(info.replacementText); |
| | | |
| | | // 应用样式 |
| | | style.applyStyle(newRun); |
| | | } |
| | | |
| | | // 用于保存和恢复运行样式的辅助类 |
| | | private static class RunStyle { |
| | | String fontFamily; |
| | | int fontSize; |
| | | boolean bold; |
| | | boolean italic; |
| | | String color; |
| | | UnderlinePatterns underline; |
| | | |
| | | RunStyle(XWPFRun run) { |
| | | this.fontFamily = run.getFontFamily(); |
| | | this.fontSize = run.getFontSize(); |
| | | this.bold = run.isBold(); |
| | | this.italic = run.isItalic(); |
| | | this.color = run.getColor(); |
| | | this.underline = run.getUnderline(); |
| | | } |
| | | |
| | | void applyStyle(XWPFRun run) { |
| | | if (fontFamily != null) { |
| | | run.setFontFamily(fontFamily); |
| | | run.setFontFamily(fontFamily, XWPFRun.FontCharRange.eastAsia); |
| | | } |
| | | if (fontSize != -1) { |
| | | run.setFontSize(fontSize); |
| | | } |
| | | run.setBold(bold); |
| | | run.setItalic(italic); |
| | | if (color != null) { |
| | | run.setColor(color); |
| | | } |
| | | if (underline != null) { |
| | | run.setUnderline(underline); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // public String generatePdf(String basePackagePath, String templateFileName, Object templateParam, String fileName, String saveDirectory) { |
| | | // try { |
| | | // // 创建 Freemarker 的 Configuration 对象,设置默认的不兼容改进选项 |
| | | // Configuration configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); |
| | | // configuration.setDefaultEncoding("utf-8"); |
| | | // // 设置模板加载器,加载模板文件 |
| | | // configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), basePackagePath)); |
| | | // Template t = configuration.getTemplate(templateFileName, "utf-8"); |
| | | // |
| | | // // 使用 URLEncoder 对文件名进行编码,以防止中文文件名在不同浏览器和操作系统下出现乱码问题 |
| | | //// String encodedFileName = URLEncoder.encode(fileName + "_" + System.currentTimeMillis(), "utf-8"); |
| | | // String encodedFileName =fileName ; |
| | | // |
| | | // // 定义保存文件的路径 |
| | | // File saveDir = new File(saveDirectory); |
| | | // if (!saveDir.exists()) { |
| | | // saveDir.mkdirs(); |
| | | // } |
| | | // |
| | | // // 定义文件名 |
| | | // String filePath = saveDir.getAbsolutePath() + File.separator + encodedFileName + ".doc"; |
| | | // |
| | | // // 创建 Writer 对象,用于将生成的文档写到文件中,缓存区大小设为 10KB |
| | | // Writer out = new BufferedWriter(new FileWriter(filePath), 10240); |
| | | // |
| | | // // 将模型数据与模板结合生成 Word 文档,写入到 Writer 对象中 |
| | | // t.process(templateParam, out); |
| | | // out.close(); |
| | | // |
| | | // File file = new File(filePath); |
| | | // |
| | | // // 检查文件是否存在 |
| | | // if (!file.exists()) { |
| | | // throw new FileNotFoundException("文件不存在: " + filePath); |
| | | // } |
| | | // |
| | | // // 读取文件内容 |
| | | // byte[] fileContent = new byte[(int) file.length()]; |
| | | // try (FileInputStream fis = new FileInputStream(file)) { |
| | | // fis.read(fileContent); |
| | | // } |
| | | // |
| | | // String test = pdfUtils.test(encodedFileName + ".doc"); |
| | | //// MultipartFile mockMultipartFile = new MockMultipartFile(encodedFileName+".doc", fileContent); |
| | | //// String s = ObsUploadUtil.obsUpload(mockMultipartFile); |
| | | // return test; |
| | | // } catch (IOException | TemplateException e) { |
| | | // log.error("生成pdf异常,异常原因:{}", e.getMessage(), e); |
| | | // throw new RuntimeException("生成pdf异常,异常原因:" + e.getMessage()); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName DataUpdateInterceptor |
| | | * @Description 数据更新操作处理 |
| | | * @date 2021-12-15 |
| | | * <p> |
| | | * 注意,之前在此处注入了 JwtTokenUtils |
| | | * <p> |
| | | * 造成spring循环依赖,项目支棱不起来 |
| | | */ |
| | | @Slf4j |
| | | @Configuration |
| | | public class DataUpdateHandlerConfig implements MetaObjectHandler { |
| | | |
| | | /** |
| | | * 新增数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | String userName = SecurityUtils.getUsername(); |
| | | if (StringUtils.isNotBlank(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | String userName = SecurityUtils.getUsername(); |
| | | if (StringUtils.isNotBlank(userName)){ |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import com.qcloud.cos.COSClient; |
| | | import com.qcloud.cos.ClientConfig; |
| | | import com.qcloud.cos.auth.BasicCOSCredentials; |
| | | import com.qcloud.cos.auth.COSCredentials; |
| | | import com.qcloud.cos.http.HttpProtocol; |
| | | import com.qcloud.cos.region.Region; |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | @Data |
| | | public class FileUploaderConfig { |
| | | |
| | | /** |
| | | * COS的SecretId |
| | | */ |
| | | @Value("${cos.client.accessKey}") |
| | | private String secretId; |
| | | /** |
| | | * COS的SecretKey |
| | | */ |
| | | @Value("${cos.client.secretKey}") |
| | | private String secretKey; |
| | | /** |
| | | * 文件上传后访问路径的根路径,后面要最佳文件名字与类型 |
| | | */ |
| | | @Value("${cos.client.rootSrc}") |
| | | private String rootSrc; |
| | | /** |
| | | * 上传的存储桶的地域 |
| | | */ |
| | | @Value("${cos.client.bucketAddr}") |
| | | private String bucketAddr; |
| | | /** |
| | | * 存储桶的名字,是自己在存储空间自己创建的,我创建的名字是:qq-test-1303****** |
| | | */ |
| | | @Value("${cos.client.bucket}") |
| | | private String bucketName; |
| | | /** |
| | | * 文件存放位置 |
| | | */ |
| | | @Value("${cos.client.location}") |
| | | private String location; |
| | | |
| | | @Value("${file.url.prefix}") |
| | | private String fileUrlPrefix; |
| | | |
| | | |
| | | @Bean |
| | | public COSClient cosClient() { |
| | | // 1 初始化用户身份信息(secretId, secretKey)。 |
| | | COSCredentials cred = new BasicCOSCredentials(secretId, secretKey); |
| | | // 2.1 设置存储桶的地域(上文获得) |
| | | Region region = new Region(bucketAddr); |
| | | ClientConfig clientConfig = new ClientConfig(region); |
| | | // 2.2 使用https协议传输 |
| | | clientConfig.setHttpProtocol(HttpProtocol.https); |
| | | // 生成 cos 客户端 |
| | | return new COSClient(cred, clientConfig); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.core.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author liheng |
| | | * @ClassName MybatisPlusConfig |
| | | * @Description MybatisPlus相关配置 |
| | | * @date 2020-09-22 11:22、 |
| | | * 直接以实现类作为bean的注入(有事务管理的类) |
| | | * @EnableTransactionManagement(proxyTargetClass = true) |
| | | */ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | private final DataUpdateHandlerConfig dataUpdateHandler; |
| | | |
| | | @Autowired |
| | | public MybatisPlusConfig(DataUpdateHandlerConfig dataUpdateHandler) { |
| | | this.dataUpdateHandler = dataUpdateHandler; |
| | | } |
| | | |
| | | /** |
| | | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题 |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * 自动填充功能 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public GlobalConfig globalConfig() { |
| | | GlobalConfig globalConfig = new GlobalConfig(); |
| | | globalConfig.setMetaObjectHandler(dataUpdateHandler); |
| | | return globalConfig; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.ApiKey; |
| | | import springfox.documentation.service.AuthorizationScope; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.service.SecurityReference; |
| | | import springfox.documentation.service.SecurityScheme; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spi.service.contexts.SecurityContext; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | /** |
| | | * Swagger2的接口配置 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | public class SwaggerConfig |
| | | { |
| | | /** 系统基础配置 */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** 是否开启swagger */ |
| | | @Value("${swagger.enabled}") |
| | | private boolean enabled; |
| | | |
| | | /** 设置请求的统一前缀 */ |
| | | @Value("${swagger.pathMapping}") |
| | | private String pathMapping; |
| | | |
| | | /** |
| | | * 创建API |
| | | */ |
| | | @Bean |
| | | public Docket createRestApi() |
| | | { |
| | | return new Docket(DocumentationType.OAS_30) |
| | | // 是否启用Swagger |
| | | .enable(enabled) |
| | | // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) |
| | | .apiInfo(apiInfo()) |
| | | // 设置哪些接口暴露给Swagger展示 |
| | | .select() |
| | | // 扫描所有有注解的api,用这种方式更灵活 |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | // 扫描指定包中的swagger注解 |
| | | // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) |
| | | // 扫描所有 .apis(RequestHandlerSelectors.any()) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | /* 设置安全模式,swagger可以设置访问token */ |
| | | .securitySchemes(securitySchemes()) |
| | | .securityContexts(securityContexts()) |
| | | .pathMapping(pathMapping); |
| | | } |
| | | |
| | | /** |
| | | * 安全模式,这里指定token通过Authorization头请求头传递 |
| | | */ |
| | | private List<SecurityScheme> securitySchemes() |
| | | { |
| | | List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>(); |
| | | apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); |
| | | return apiKeyList; |
| | | } |
| | | |
| | | /** |
| | | * 安全上下文 |
| | | */ |
| | | private List<SecurityContext> securityContexts() |
| | | { |
| | | List<SecurityContext> securityContexts = new ArrayList<>(); |
| | | securityContexts.add( |
| | | SecurityContext.builder() |
| | | .securityReferences(defaultAuth()) |
| | | .operationSelector(o -> o.requestMappingPattern().matches("/.*")) |
| | | .build()); |
| | | return securityContexts; |
| | | } |
| | | |
| | | /** |
| | | * 默认的安全上引用 |
| | | */ |
| | | private List<SecurityReference> defaultAuth() |
| | | { |
| | | AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); |
| | | AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; |
| | | authorizationScopes[0] = authorizationScope; |
| | | List<SecurityReference> securityReferences = new ArrayList<>(); |
| | | securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); |
| | | return securityReferences; |
| | | } |
| | | |
| | | /** |
| | | * 添加摘要信息 |
| | | */ |
| | | private ApiInfo apiInfo() |
| | | { |
| | | // 用ApiInfoBuilder进行定制 |
| | | return new ApiInfoBuilder() |
| | | // 设置标题 |
| | | .title("标题:西藏国投管理系统_接口文档") |
| | | // 描述 |
| | | .description("西藏国投接口文档") |
| | | // 作者信息 |
| | | .contact(new Contact(ruoyiConfig.getName(), null, null)) |
| | | // 版本 |
| | | .version("版本号:" + ruoyiConfig.getVersion()) |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.task; |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.dto.TBillDto; |
| | | import com.ruoyi.system.model.TBill; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.query.TBillQuery; |
| | | import com.ruoyi.system.query.TContractQuery; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.ruoyi.system.service.TContractService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | |
| | | @Slf4j |
| | | @Component("billTask") |
| | | public class TbillTask { |
| | | |
| | | @Autowired |
| | | TBillService tBillService; |
| | | |
| | | @Autowired |
| | | TContractService tContractService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | restart.include.json=/com.alibaba.fastjson.*.jar |
New file |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 3.8.6 |
| | | # 版权年份 |
| | | copyrightYear: 2023 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8080 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: i18n/messages |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 500MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 2000MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | # host: 127.0.0.1 |
| | | # # 端口,默认为6379 |
| | | # port: 6379 |
| | | # # 数据库索引 |
| | | # database: 0 |
| | | # # 密码 |
| | | # password: 123456 |
| | | host: 127.0.0.1 |
| | | # 端口,默认为6379 |
| | | port: 16379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 8f5z9g52gx4bg |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | # 数据源配置 |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://172.27.0.13:3306/xizang?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: xzgt |
| | | password: changyun!6f2gshj6h3j |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo,com.ruoyi.**.model |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: / |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | # file upload |
| | | file: |
| | | upload: |
| | | location: /file/ |
| | | qrLocation: /file/qrCode/ |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | url: |
| | | prefix: https://xzgt.test.591taxi.cn:${server.port}${server.servlet.context-path} |
| | | wx: |
| | | conf: |
| | | appId: wxe91f1af7638aa5dd |
| | | secretId: a787e1a462715604e0c9528b6d8960d1 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | | cos: |
| | | client: |
| | | accessKey: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretKey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | bucket: xzgttest-1305134071 |
| | | bucketAddr: ap-chengdu |
| | | rootSrc: https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/ |
| | | location: /xizang |
| | | sms: |
| | | enable: true |
| | | appId: 1400957506 |
| | | secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | sign: 畅云出行 |
| | | com: |
| | | taxi591: |
| | | bank: |
| | | cer-path: /usr/local/bank/TrustPay.cer |
| | | base-url: http://hello.enjoy.abchina.com |
| | | enable: true |
| | | keystore-password: gggs6666 |
| | | pfx-path: /usr/local/bank/103882597000441.pfx |
New file |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 3.8.6 |
| | | # 版权年份 |
| | | copyrightYear: 2023 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8081 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: i18n/messages |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 500MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 2000MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | # host: 127.0.0.1 |
| | | # # 端口,默认为6379 |
| | | # port: 6379 |
| | | # # 数据库索引 |
| | | # database: 0 |
| | | # # 密码 |
| | | # password: 123456 |
| | | host: xzgt.test.591taxi.cn |
| | | # 端口,默认为6379 |
| | | port: 16379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 8f5z9g52gx4bg |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | # 数据源配置 |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://xzgt.test.591taxi.cn:13306/xizang?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: 8f5z9g52gx4bg |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 1 |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo,com.ruoyi.**.model |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: / |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | # file upload |
| | | file: |
| | | upload: |
| | | location: /file/ |
| | | qrLocation: /file/qrCode/ |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | url: |
| | | # prefix: http://localhost:${server.port}${server.servlet.context-path} |
| | | prefix: https://xzgt.test.591taxi.cn:${server.port}${server.servlet.context-path} |
| | | wx: |
| | | conf: |
| | | appId: wxe91f1af7638aa5dd |
| | | secretId: a787e1a462715604e0c9528b6d8960d1 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | | cos: |
| | | client: |
| | | accessKey: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretKey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | bucket: xzgttest-1305134071 |
| | | bucketAddr: ap-chengdu |
| | | rootSrc: https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/ |
| | | location: /xizang |
| | | sms: |
| | | enable: true |
| | | appId: 1400957506 |
| | | secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | sign: 畅云出行 |
| | | com: |
| | | taxi591: |
| | | bank: |
| | | cer-path: D:\workspaces\工作文件\畅云\农业银行\正式\TrustPay.cer |
| | | base-url: http://hello.enjoy.abchina.com |
| | | enable: true |
| | | keystore-password: gggs6666 |
| | | pfx-path: D:\workspaces\工作文件\畅云\农业银行\正式\103882597000441.pfx |
New file |
| | |
| | | # 项目相关配置 |
| | | spring: |
| | | profiles: |
| | | active: prod |
New file |
| | |
| | | Application Version: ${ruoyi.version} |
| | | Spring Boot Version: ${spring-boot.version} |
| | | //////////////////////////////////////////////////////////////////// |
| | | // _ooOoo_ // |
| | | // o8888888o // |
| | | // 88" . "88 // |
| | | // (| ^_^ |) // |
| | | // O\ = /O // |
| | | // ____/`---'\____ // |
| | | // .' \\| |// `. // |
| | | // / \\||| : |||// \ // |
| | | // / _||||| -:- |||||- \ // |
| | | // | | \\\ - /// | | // |
| | | // | \_| ''\---/'' | | // |
| | | // \ .-\__ `-` ___/-. / // |
| | | // ___`. .' /--.--\ `. . ___ // |
| | | // ."" '< `.___\_<|>_/___.' >'"". // |
| | | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // |
| | | // \ \ `-. \_ __\ /__ _/ .-` / / // |
| | | // ========`-.____`-.___\_____/___.-`____.-'======== // |
| | | // `=---=' // |
| | | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // |
| | | // 佛祖保佑 永不宕机 永无BUG // |
| | | //////////////////////////////////////////////////////////////////// |
New file |
| | |
| | | #错误消息 |
| | | not.null=* 必须填写 |
| | | user.jcaptcha.error=验证码错误 |
| | | user.jcaptcha.expire=验证码已失效 |
| | | user.not.exists=用户不存在/密码错误 |
| | | user.password.not.match=用户不存在/密码错误 |
| | | user.password.retry.limit.count=密码输入错误{0}次 |
| | | user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 |
| | | user.password.delete=对不起,您的账号已被删除 |
| | | user.blocked=用户已封禁,请联系管理员 |
| | | role.blocked=角色已封禁,请联系管理员 |
| | | login.blocked=很遗憾,访问IP已被列入系统黑名单 |
| | | user.logout.success=退出成功 |
| | | |
| | | length.not.valid=长度必须在{min}到{max}个字符之间 |
| | | |
| | | user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 |
| | | user.password.not.valid=* 5-50个字符 |
| | | |
| | | user.email.not.valid=邮箱格式错误 |
| | | user.mobile.phone.number.not.valid=手机号格式错误 |
| | | user.login.success=登录成功 |
| | | user.register.success=注册成功 |
| | | user.notfound=请重新登录 |
| | | user.forcelogout=管理员强制退出,请重新登录 |
| | | user.unknown.error=未知错误,请重新登录 |
| | | |
| | | ##文件上传消息 |
| | | upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! |
| | | upload.filename.exceed.length=上传的文件名最长{0}个字符 |
| | | |
| | | ##权限 |
| | | no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] |
| | | no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] |
| | | no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] |
| | | no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] |
| | | no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] |
| | | no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration> |
| | | <!-- 日志存放路径 --> |
| | | <property name="log.path" value="/home/ruoyi/logs" /> |
| | | <!-- 日志输出格式 --> |
| | | <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
| | | |
| | | <!-- 控制台输出 --> |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统日志输出 --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-info.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>INFO</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-error.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>ERROR</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 用户访问日志输出 --> |
| | | <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-user.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 按天回滚 daily --> |
| | | <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.ruoyi" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!--系统操作日志--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | |
| | | <!--系统用户操作日志--> |
| | | <logger name="sys-user" level="info"> |
| | | <appender-ref ref="sys-user"/> |
| | | </logger> |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> |
| | | <configuration> |
| | | |
| | | <settings> |
| | | <!-- 打印查询语句 不会写入到日志文件中--> |
| | | <setting name="logImpl" value="STDOUT_LOGGING"/> |
| | | <!--<setting name="logImpl" value="LOG4J" />--> |
| | | <!-- 控制全局缓存(二级缓存),按美团技术团队的说法,尽量别用缓存机制 emmmm.... --> |
| | | <setting name="cacheEnabled" value="true"/> |
| | | <!-- 延迟加载的全局开关。当开启时,所有关联对象都会延迟加载。默认 false --> |
| | | <!-- <setting name="lazyLoadingEnabled" value="true"/> --> |
| | | <setting name="mapUnderscoreToCamelCase" value="true"/><!--是否将map下划线方式转为驼峰式命名--> |
| | | <!-- 当开启时,任何方法的调用都会加载该对象的所有属性。默认 false,可通过select标签的 fetchType来覆盖--> |
| | | <!-- <setting name="aggressiveLazyLoading" value="false"/>--> |
| | | <!-- Mybatis 创建具有延迟加载能力的对象所用到的代理工具,默认JAVASSIST --> |
| | | <!--<setting name="proxyFactory" value="CGLIB" />--> |
| | | <!-- 关于mybatis的一二级缓存 请参照:https://tech.meituan.com/2018/01/19/mybatis-cache.html --> |
| | | <!-- 一级缓存范围默认:SESSION ,此范围在复杂应用场景中可能会出现脏读数据--> |
| | | <!-- STATEMENT级别的缓存,使一级缓存,只针对当前执行的这一statement有效 --> |
| | | <!--<setting name="localCacheScope" value="STATEMENT"/>--> |
| | | <setting name="localCacheScope" value="STATEMENT"/> |
| | | </settings> |
| | | |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE configuration |
| | | PUBLIC "-//mybatis.org//DTD Config 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-config.dtd"> |
| | | <configuration> |
| | | <!-- 全局参数 --> |
| | | <settings> |
| | | <!-- 使全局的映射器启用或禁用缓存 --> |
| | | <setting name="cacheEnabled" value="true" /> |
| | | <!-- 允许JDBC 支持自动生成主键 --> |
| | | <setting name="useGeneratedKeys" value="true" /> |
| | | <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 --> |
| | | <setting name="defaultExecutorType" value="SIMPLE" /> |
| | | <!-- 指定 MyBatis 所用日志的具体实现 --> |
| | | <setting name="logImpl" value="SLF4J" /> |
| | | <!-- 使用驼峰命名法转换字段 --> |
| | | <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> |
| | | </settings> |
| | | |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.6</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>ruoyi-applet</artifactId> |
| | | |
| | | <description> |
| | | web服务入口 |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.taxi591</groupId> |
| | | <artifactId>bankapi</artifactId> |
| | | <version>1.0.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.8.0</version> |
| | | </dependency> |
| | | <!-- spring-boot-devtools --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> <!-- 表示依赖不会传递 --> |
| | | </dependency> |
| | | |
| | | <!-- swagger3--> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.xiaoymin</groupId>--> |
| | | <!-- <artifactId>swagger-bootstrap-ui</artifactId>--> |
| | | <!-- <version>1.9.6</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | |
| | | <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 --> |
| | | <dependency> |
| | | <groupId>io.swagger</groupId> |
| | | <artifactId>swagger-models</artifactId> |
| | | <version>1.6.2</version> |
| | | </dependency> |
| | | |
| | | <!-- Mysql驱动包 --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.github.pagehelper</groupId>--> |
| | | <!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | </dependency> |
| | | |
| | | <!-- 定时任务--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.github.pagehelper</groupId>--> |
| | | <!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | </dependency> |
| | | |
| | | <!-- 代码生成--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.github.pagehelper</groupId>--> |
| | | <!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | </dependency> |
| | | |
| | | <!-- zxing生成二维码 --> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-test</artifactId> |
| | | <version>5.1.3.RELEASE</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.httpcomponents</groupId>--> |
| | | <!-- <artifactId>httpcore</artifactId>--> |
| | | <!-- <version>4.3.2</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>4.9.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.78</version> |
| | | </dependency> |
| | | |
| | | <!-- easypoi --> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-base</artifactId> |
| | | <version>3.0.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-web</artifactId> |
| | | <version>3.0.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-annotation</artifactId> |
| | | <version>3.0.3</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里云短信 --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>dysmsapi20170525</artifactId> |
| | | <version>2.0.10</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>2.5.15</version> |
| | | <configuration> |
| | | <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> |
| | | </configuration> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>3.1.0</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <warName>${project.artifactId}</warName> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.ruoyi; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | |
| | | /** |
| | | * 启动程序 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Slf4j |
| | | @EnableScheduling//开启定时任务 |
| | | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) |
| | | public class RuoYiAppletApplication |
| | | { |
| | | public static void main(String[] args) { |
| | | |
| | | |
| | | ConfigurableApplicationContext application = SpringApplication.run(RuoYiAppletApplication.class, args); |
| | | try { |
| | | |
| | | Environment env = application.getEnvironment(); |
| | | log.info("\n----------------------------------------------------------\n\t" + |
| | | "应用 '{}' 运行成功! 访问连接:\n\t" + |
| | | "Swagger文档: \t\thttp://{}:{}/doc.html\n" + |
| | | "----------------------------------------------------------", |
| | | env.getProperty("spring.application.name", "后台"), |
| | | InetAddress.getLocalHost().getHostAddress(), |
| | | env.getProperty("server.port", "8081")); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 当不存在此 wxRestTemplate 使用此方法的bean注入 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | @ConditionalOnMissingBean(name = "restTemplate") |
| | | public RestTemplate wxRestTemplate() { |
| | | //复杂构造函数的使用 |
| | | SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); |
| | | // 设置超时 |
| | | requestFactory.setConnectTimeout(6000); |
| | | requestFactory.setReadTimeout(6000); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | restTemplate.setRequestFactory(requestFactory); |
| | | return restTemplate; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi; |
| | | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | |
| | | /** |
| | | * web容器中进行部署 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RuoYiServletInitializer extends SpringBootServletInitializer |
| | | { |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) |
| | | { |
| | | return application.sources(RuoYiAppletApplication.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.aspect; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | @Aspect |
| | | @Component |
| | | |
| | | public class StateAspect { |
| | | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | @Pointcut("execution(* com.ruoyi.web.controller.manage.*.*(..)) && !execution( * com.ruoyi.web.controller.manage.LoginController.*.*(..))") |
| | | public void state(){} |
| | | |
| | | @Before("state()") |
| | | public void isfrozen(){ |
| | | System.err.println("进入切面"); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SysUser sysUser = sysUserService.selectUserById(loginUser.getUserId()); |
| | | if (sysUser.getStatus().equals("1")){ |
| | | throw new ServiceException("当前账号已停用"); |
| | | } |
| | | if (roleService.selectRoleByUserId(sysUser.getUserId()).getStatus()==1){ |
| | | throw new ServiceException("当前角色已停用"); |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.web.controller.tool.TencentCosUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-05-30 9:27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/cos") |
| | | @Api(tags = "公共-文件上传") |
| | | public class COSController { |
| | | |
| | | @Resource |
| | | private TencentCosUtil tencentCosUtil; |
| | | |
| | | @PostMapping("/upload") |
| | | @ApiOperation(value = "文件上传", tags = "公共-文件上传") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件", name = "file", dataType = "MultipartFile", required = true) |
| | | }) |
| | | public R<String> upload(@RequestParam("file") MultipartFile file) { |
| | | String url = tencentCosUtil.upLoadFile(file); |
| | | return R.ok(url, url); |
| | | } |
| | | @PostMapping("/downloadImg") |
| | | @ApiOperation(value = "文件下载", tags = "公共-文件下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件url", name = "url", dataType = "String", required = true) |
| | | }) |
| | | public String downloadImg(@RequestParam("url") String url) { |
| | | return tencentCosUtil.downLoadFileImg(url); |
| | | } |
| | | @PostMapping("/download") |
| | | @ApiOperation(value = "文件下载", tags = "公共-文件下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件url", name = "url", dataType = "String", required = true) |
| | | }) |
| | | public void download(@RequestParam("url") String url) { |
| | | tencentCosUtil.downLoadFile(url); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUserApplet; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.bo.ProcessTaskListBO; |
| | | import com.ruoyi.system.dto.TBillDto; |
| | | import com.ruoyi.system.dto.TInvoiceDTO; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import com.ruoyi.web.controller.tool.MyFileUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import jdk.nashorn.internal.parser.Token; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 租金账单 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "首页") |
| | | @RestController |
| | | @RequestMapping("/t-index") |
| | | public class IndexController { |
| | | |
| | | @Autowired |
| | | private TBannerService bannerService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TContractService contractService; |
| | | @Autowired |
| | | private TBillService billService; |
| | | @Autowired |
| | | private THouseService houseService; |
| | | @Autowired |
| | | private TFaultRepairMessageService tFaultRepairMessageService; |
| | | @Autowired |
| | | private TCheckAcceptRecordService checkAcceptRecordService; |
| | | @Autowired |
| | | private TTenantService tenantService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | @Autowired |
| | | private TContractRentTypeService contractRentTypeService; |
| | | @Autowired |
| | | private StateProcessTemplateService processTemplateService; |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | File file = new File("D:\\wechatFiles\\WeChat Files\\wxid_25nztsudcon722\\FileStorage\\File\\2025-03\\2.mp3"); |
| | | MultipartFile multipartFile = MyFileUtil.fileToMultipartFile(file, "3333"); |
| | | } |
| | | /** |
| | | * 获取轮播图管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取轮播图列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TBanner>> list(@RequestBody TBannerQuery query) { |
| | | return R.ok(bannerService.list(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取轮播图管理列表 |
| | | */ |
| | | @ApiOperation(value = "租户-我的待办") |
| | | @PostMapping(value = "/tenant/myToDo") |
| | | public R<MyToDoVO> tenantMyToDo() { |
| | | MyToDoVO myToDoVO = new MyToDoVO(); |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | if (loginUserApplet != null) { |
| | | long contractCount = contractService.count(new LambdaQueryWrapper<TContract>() |
| | | .eq(TContract::getStatus, 3).eq(TContract::getTenantId, loginUserApplet.getUserId())); |
| | | myToDoVO.setContractCount((int) contractCount); |
| | | List<String> contractIds = contractService.lambdaQuery().eq(TContract::getTenantId, loginUserApplet.getUserId()).list() |
| | | .stream().map(TContract::getId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(contractIds)) { |
| | | myToDoVO.setBillCount(0); |
| | | myToDoVO.setContractCount(0); |
| | | return R.ok(myToDoVO); |
| | | } |
| | | int billCount = billService.lambdaQuery().in(TBill::getContractId, contractIds).eq(TBill::getPayFeesStatus, 1).list().size(); |
| | | myToDoVO.setBillCount(billCount); |
| | | } else { |
| | | myToDoVO.setBillCount(0); |
| | | myToDoVO.setContractCount(0); |
| | | } |
| | | return R.ok(myToDoVO); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "租户-当前在租房源") |
| | | @PostMapping(value = "/tenant/myHouse") |
| | | public R<List<MyHouseVO>> myHouse() { |
| | | List<MyHouseVO> myHouseVOS = new ArrayList<>(); |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | |
| | | if (loginUserApplet != null) { |
| | | List<TContract> contractList = contractService.lambdaQuery().eq(TContract::getTenantId, loginUserApplet.getUserId()) |
| | | .eq(TContract::getStatus, 4).list(); |
| | | List<THouse> houseList = houseService.list(); |
| | | List<TBill> bills = billService.lambdaQuery().orderByDesc(TBill::getPayableFeesTime).list(); |
| | | for (TContract contract : contractList) { |
| | | THouse tHouse = houseList.stream().filter(e -> e.getId().equals(contract.getHouseId())).findFirst().orElse(null); |
| | | TBill bill = bills.stream().filter(e -> e.getContractId().equals(contract.getId()) && e.getPayFeesStatus().equals("3")).findFirst().orElse(null); |
| | | if (bill == null) { |
| | | bill = bills.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null); |
| | | } |
| | | if (tHouse != null && bill != null) { |
| | | MyHouseVO myToDoVO = new MyHouseVO(); |
| | | myToDoVO.setId(contract.getId()); |
| | | myToDoVO.setHouseAddress(tHouse.getHouseAddress()); |
| | | myToDoVO.setMonthRent(contract.getMonthRent()); |
| | | myToDoVO.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE, contract.getPayType())); |
| | | myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth().getValue() + "月" : bill.getPayFeesTime().getMonth().getValue() + "月"); |
| | | myToDoVO.setHouseArea(tHouse.getHouseArea()); |
| | | myToDoVO.setHouseType(tHouse.getHouseType()); |
| | | myToDoVO.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime())); |
| | | myToDoVO.setStartTime(DateUtils.localDateTimeToStringYear(contract.getStartTime())); |
| | | myToDoVO.setPropertyRightPerson(tHouse.getPropertyRightPerson()); |
| | | myToDoVO.setPhone(tHouse.getPhone()); |
| | | List<TBill> billList = bills.stream().filter(e -> e.getContractId().equals(contract.getId())).collect(Collectors.toList()); |
| | | List<PayListVO> payList = new ArrayList<>(); |
| | | for (TBill tBill : billList) { |
| | | if (tBill.getPayFeesTime()==null){ |
| | | continue; |
| | | } |
| | | PayListVO payListVO = new PayListVO(); |
| | | payListVO.setPayFeesTime(DateUtils.localDateTimeToStringYear(tBill.getPayFeesTime())); |
| | | payListVO.setPayFeesMoney("-" + tBill.getPayFeesMoney() + "元"); |
| | | payList.add(payListVO); |
| | | } |
| | | myToDoVO.setPayList(payList); |
| | | myHouseVOS.add(myToDoVO); |
| | | } |
| | | |
| | | } |
| | | return R.ok(myHouseVOS); |
| | | } else { |
| | | return R.ok(myHouseVOS); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "租户-当前在租房源-租赁详情") |
| | | @GetMapping(value = "/tenant/myHouseDetail") |
| | | public R<MyHouseVO> myHouseDetail(String id) { |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | |
| | | if (loginUserApplet != null) { |
| | | MyHouseVO myToDoVO = new MyHouseVO(); |
| | | TContract contract = contractService.getById(id); |
| | | List<TBill> bills = billService.lambdaQuery().orderByDesc(TBill::getPayableFeesTime).list(); |
| | | THouse tHouse = houseService.getById(contract.getHouseId()); |
| | | TBill bill = bills.stream().filter(e -> e.getContractId().equals(contract.getId()) && e.getPayFeesStatus().equals("3")).findFirst().orElse(null); |
| | | if (bill == null) { |
| | | bill = bills.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null); |
| | | } |
| | | if (tHouse != null && bill != null) { |
| | | myToDoVO.setId(contract.getId()); |
| | | myToDoVO.setHouseAddress(tHouse.getHouseAddress()); |
| | | myToDoVO.setMonthRent(contract.getMonthRent()); |
| | | myToDoVO.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE, contract.getPayType())); |
| | | myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth().getValue() + "月" : bill.getPayFeesTime().getMonth().getValue() + "月"); |
| | | myToDoVO.setHouseArea(tHouse.getHouseArea()); |
| | | myToDoVO.setHouseType(tHouse.getHouseType()); |
| | | myToDoVO.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime())); |
| | | myToDoVO.setStartTime(DateUtils.localDateTimeToStringYear(contract.getStartTime())); |
| | | myToDoVO.setPropertyRightPerson(tHouse.getPropertyRightPerson()); |
| | | myToDoVO.setPhone(tHouse.getPhone()); |
| | | List<TBill> billList = bills.stream().filter(e -> e.getContractId().equals(contract.getId())).collect(Collectors.toList()); |
| | | List<PayListVO> payList = new ArrayList<>(); |
| | | for (TBill tBill : billList) { |
| | | if (tBill.getPayFeesTime()==null){ |
| | | continue; |
| | | } |
| | | PayListVO payListVO = new PayListVO(); |
| | | payListVO.setPayFeesTime(DateUtils.localDateTimeToStringYear(tBill.getPayFeesTime())); |
| | | payListVO.setPayFeesMoney("-" + tBill.getPayFeesMoney() + "元"); |
| | | payList.add(payListVO); |
| | | } |
| | | myToDoVO.setPayList(payList); |
| | | } |
| | | |
| | | return R.ok(myToDoVO); |
| | | } else { |
| | | return R.ok(new MyHouseVO()); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "管理员-我的待办") |
| | | @PostMapping(value = "/admin/myToDo") |
| | | public R<MyToDoVO> adminMyToDo() { |
| | | MyToDoVO myToDoVO = new MyToDoVO(); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser != null) { |
| | | // long examineCount = contractService.count(new LambdaQueryWrapper<TContract>() |
| | | // .eq(TContract::getStatus, 2)); |
| | | ProcessTaskListBO processTaskListBO = new ProcessTaskListBO(); |
| | | PageInfo<ProcessTaskListVO> processTaskListVOPageInfo = processTemplateService.waitTaskPage(processTaskListBO); |
| | | myToDoVO.setExamineCount((int) processTaskListVOPageInfo.getTotal()); |
| | | List<String> contractIds = billService.lambdaQuery().eq(TBill::getPayFeesStatus, 4).list() |
| | | .stream().map(TBill::getContractId).collect(Collectors.toList()); |
| | | if(contractIds.isEmpty()){ |
| | | myToDoVO.setOverdueCount(0); |
| | | |
| | | }else{ |
| | | int overdueCount = contractService.lambdaQuery().in(TContract::getId, contractIds).list() |
| | | .stream().map(TContract::getTenantId).distinct().collect(Collectors.toList()).size(); |
| | | myToDoVO.setOverdueCount(overdueCount); |
| | | } |
| | | |
| | | } else { |
| | | myToDoVO.setExamineCount(0); |
| | | myToDoVO.setOverdueCount(0); |
| | | } |
| | | return R.ok(myToDoVO); |
| | | } |
| | | |
| | | /** |
| | | * 获取验收记录管理列表 |
| | | */ |
| | | @ApiOperation(value = "管理员-房屋验收单列表") |
| | | @PostMapping(value = "/admin/houseCheck") |
| | | public R<PageInfo<TCheckAcceptRecordVO>> houseCheck(@RequestBody TCheckAcceptRecordAppletQuery query) { |
| | | return R.ok(checkAcceptRecordService.pageListApplet(query)); |
| | | } |
| | | |
| | | /** |
| | | * 查看验收记录详情 |
| | | */ |
| | | @ApiOperation(value = "管理员-查看验收记录详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TCheckAcceptRecordVO> getDetailById(@RequestParam String id) { |
| | | TCheckAcceptRecord checkAcceptRecord = checkAcceptRecordService.getById(id); |
| | | // checkAcceptRecord.setCleanSituation(checkAcceptRecord.getCleanSituation()); |
| | | // checkAcceptRecord.setOverallSituation(StringUtils.hasLength(checkAcceptRecord.getOverallSituation())?(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CHECK_SITUATION,checkAcceptRecord.getOverallSituation())):""); |
| | | // checkAcceptRecord.setDeviceSituation(StringUtils.hasLength(checkAcceptRecord.getDeviceSituation())?(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CHECK_SITUATION,checkAcceptRecord.getDeviceSituation())):""); |
| | | // checkAcceptRecord.setFurnitureSituation(StringUtils.hasLength(checkAcceptRecord.getDeviceSituation())?(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CHECK_SITUATION,checkAcceptRecord.getFurnitureSituation())):""); |
| | | |
| | | TCheckAcceptRecordVO checkAcceptRecordVO = new TCheckAcceptRecordVO(); |
| | | BeanUtils.copyProperties(checkAcceptRecord, checkAcceptRecordVO); |
| | | // 查询合同信息 |
| | | checkAcceptRecordVO.setContract(contractService.getById(checkAcceptRecord.getContractId())); |
| | | // 查询房屋信息 |
| | | checkAcceptRecordVO.setHouse(houseService.getById(checkAcceptRecord.getHouseId())); |
| | | return R.ok(checkAcceptRecordVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "管理员-新增验收") |
| | | @PostMapping(value = "/addRecord") |
| | | public R<TCheckAcceptRecordVO> addRecord(@Validated @RequestBody TCheckAcceptRecord dto) { |
| | | dto.setAcceptanceTime(LocalDateTime.now()); |
| | | dto.setCheckTime(LocalDateTime.now()); |
| | | LocalDate now = LocalDate.now(); |
| | | String replace = (now + "").replace("-", ""); |
| | | int size = checkAcceptRecordService.list(new LambdaQueryWrapper<TCheckAcceptRecord>() |
| | | .likeRight(TCheckAcceptRecord::getAcceptanceTime, LocalDate.now())).size(); |
| | | dto.setCode(replace.substring(2)+String.format("%03d", size+1)); |
| | | dto.setStatus(true); |
| | | // 添加验收记录 |
| | | dto.setCheckPerson(tokenService.getLoginUser().getUser().getNickName()); |
| | | checkAcceptRecordService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 获取报修管理列表 |
| | | */ |
| | | @ApiOperation(value = "管理员-房屋维修分页列表") |
| | | @PostMapping(value = "/housePageList") |
| | | public R<PageInfo<TFaultRepairMessageVO>> pageList(@RequestBody TFaultRepairMessageAppletQuery query) { |
| | | return R.ok(tFaultRepairMessageService.pageListApplet(query)); |
| | | } |
| | | /** |
| | | * 查看报修详情 |
| | | */ |
| | | @ApiOperation(value = "管理员-房屋维修查看详情") |
| | | @GetMapping(value = "/getDetailByIdRepair") |
| | | public R<TFaultRepairMessageVO> getDetailByIdRepair(@RequestParam String id) { |
| | | TFaultRepairMessageVO faultRepairMessageVO = tFaultRepairMessageService.getDetailById(id); |
| | | return R.ok(faultRepairMessageVO); |
| | | } |
| | | |
| | | /** |
| | | * 处理维修 |
| | | */ |
| | | @Log(title = "报修信息-处理维修", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "管理员-维修处理") |
| | | @PostMapping(value = "/handle") |
| | | public R<Boolean> handle(@Validated @RequestBody TFaultRepairMessage faultRepairMessage) { |
| | | faultRepairMessage.setStatus(2); |
| | | return R.ok(tFaultRepairMessageService.updateById(faultRepairMessage)); |
| | | } |
| | | |
| | | /** |
| | | * 获取租户管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取租户分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TenantVO>> pageList(@RequestBody TTenantAppletQuery query) { |
| | | return R.ok(tenantService.pageListApplet(query)); |
| | | } |
| | | /** |
| | | * 获取租户管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取租户详情") |
| | | @GetMapping(value = "/getTenantDetailById") |
| | | public R<TTenant> getTenantDetailById(@RequestParam String id) { |
| | | return R.ok(tenantService.getById(id)); |
| | | } |
| | | /** |
| | | * 租户详情-租房信息 |
| | | */ |
| | | @ApiOperation(value = "租户详情-租房信息列表") |
| | | @GetMapping(value = "/listHouse") |
| | | public R<List<THouse>> listHouse(@RequestParam String id) { |
| | | List<THouse> res = tenantService.listHouse(id); |
| | | return R.ok(res); |
| | | } |
| | | /** |
| | | * 租户详情-租房信息 |
| | | */ |
| | | @ApiOperation(value = "租户详情-合同列表") |
| | | @GetMapping(value = "/listContract") |
| | | public R<List<TContract>> listContract(@RequestParam String id) { |
| | | List<TContract> res = tenantService.listContract(id); |
| | | return R.ok(res); |
| | | } |
| | | @ApiOperation(value = "租户详情-缴费账单列表") |
| | | @PostMapping("/listBill") |
| | | public R<PageInfo<TBillVO>> listBill(@RequestBody TBillAppletQuery query){ |
| | | PageInfo<TBillVO> pageInfo = tenantService.listBill(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | @ApiOperation(value = "租户详情-缴费账单-账单详情") |
| | | @PostMapping("/billDetail") |
| | | public R<TBillVO> billDetail(String id){ |
| | | TBillVO res = new TBillVO(); |
| | | TBill bill = billService.getById(id); |
| | | BeanUtils.copyProperties(bill, res); |
| | | TContract contract = contractService.getById(bill.getContractId()); |
| | | THouse tHouse = houseService.getById(contract.getHouseId()); |
| | | res.setHouse(tHouse); |
| | | res.setConcatStartTime(contract.getStartTime()); |
| | | res.setConcatEndTime(contract.getEndTime()); |
| | | res.setPartyOnePhone(contract.getPartyOnePhone()); |
| | | res.setPartyOnePerson(contract.getPartyTwoPerson()); |
| | | res.setMonthRent(bill.getPayableFeesMoney()); |
| | | res.setPayType(contract.getPayType()); |
| | | return R.ok(res); |
| | | } |
| | | @ApiOperation(value = "管理员-我的审批分页列表") |
| | | @PostMapping("/listExamine") |
| | | public R<PageInfo<ExamineVO>> examineList(@RequestBody TExamineAppletQuery dto){ |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.fail(401,"登录失效"); |
| | | } |
| | | SysUser sysUser = sysUserService.selectUserById(loginUser.getUserId()); |
| | | dto.setUserName(sysUser.getUserName()); |
| | | PageInfo<ExamineVO> pageInfo = tenantService.examineList(dto); |
| | | return R.ok(pageInfo); |
| | | } |
| | | @ApiOperation(value = "管理员-审批详情") |
| | | @GetMapping("/examineDetail") |
| | | public R<TContractVO> examineDetail(@RequestParam String id){ |
| | | TContractVO res = new TContractVO(); |
| | | TContract contract = contractService.getById(id); |
| | | BeanUtils.copyProperties(contract,res); |
| | | res.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE,res.getPayType())); |
| | | res.setStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_STATUS,res.getStatus())); |
| | | TContractRentType contractRentType = contractRentTypeService.lambdaQuery().eq(TContractRentType::getContractId, id).one(); |
| | | if (contractRentType!=null){ |
| | | BeanUtils.copyProperties(contractRentType,res); |
| | | } |
| | | TContract oldContract = contractService.getOne(new LambdaQueryWrapper<TContract>() |
| | | .eq(TContract::getHouseId,contract.getHouseId()) |
| | | .eq(TContract::getStatus, 4) |
| | | .le(TContract::getStartTime, LocalDateTime.now()) |
| | | .ge(TContract::getEndTime, LocalDateTime.now())); |
| | | THouse house = houseService.getById(contract.getHouseId()); |
| | | if (oldContract!=null){ |
| | | house.setTenantType(oldContract.getPayType()); |
| | | } |
| | | res.setHouse(house); |
| | | List<TBill> list = billService.lambdaQuery() |
| | | .eq(TBill::getContractId, id) |
| | | .in(TBill::getPayFeesStatus, Arrays.asList("1,4")) |
| | | .list(); |
| | | BigDecimal payMoney = new BigDecimal("0"); |
| | | for (TBill tBill : list) { |
| | | payMoney = payMoney.add(tBill.getPayFeesMoney()).add(tBill.getPayableFeesPenalty()); |
| | | } |
| | | TCheckAcceptRecord tCheckAcceptRecord = checkAcceptRecordService.lambdaQuery().eq(TCheckAcceptRecord::getContractId, id).one(); |
| | | res.setCheckResult(Objects.nonNull(tCheckAcceptRecord)?tCheckAcceptRecord.getCheckResult():false); |
| | | res.setPayMoney(payMoney); |
| | | |
| | | return R.ok(res); |
| | | } |
| | | @ApiOperation(value = "管理员-我的审批-撤销") |
| | | @GetMapping("/cancel") |
| | | public R cancel(@RequestParam String id){ |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "管理员-我的审批-审批") |
| | | @GetMapping("/examine") |
| | | public R examine(@RequestParam String id){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.aliyun.oss.OSSClient; |
| | | import com.aliyun.oss.model.ObjectMetadata; |
| | | import com.aliyun.oss.model.PutObjectRequest; |
| | | import com.aliyun.oss.model.PutObjectResult; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/base/oss") |
| | | class OssController { |
| | | |
| | | private static final String endpoint = "oss-cn-chengdu.aliyuncs.com"; |
| | | private static final String accessKeyId = "LTAI5tCQHjSsP7TXuyjSG1PJ"; |
| | | private static final String accessKeySecret = "RIDXxzOrdMS0V8vQDT53MGvAgsegRV"; |
| | | private static final String bucketName = "inspectionbucket"; |
| | | |
| | | @PostMapping("/upload") |
| | | @ApiOperation(value = "文件上传",tags = "文件上传") |
| | | public ResponseEntity<String> upload(@RequestParam("file") MultipartFile file) throws IOException { |
| | | // 创建 OSSClient 实例 |
| | | OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret); |
| | | |
| | | |
| | | // 创建 PutObjectRequest 对象 |
| | | PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, file.getOriginalFilename(), file.getInputStream()); |
| | | |
| | | ObjectMetadata metadata = new ObjectMetadata(); |
| | | // 取消文件缓存,文件每次都会从OSS服务器获取 |
| | | metadata.setHeader("Cache-Control", "no-cache"); |
| | | metadata.setHeader("Expires", "0"); |
| | | |
| | | |
| | | // 上传文件 |
| | | PutObjectResult putObjectResult = ossClient.putObject(putObjectRequest); |
| | | |
| | | // 关闭 OSSClient 实例 |
| | | ossClient.shutdown(); |
| | | |
| | | String fileUrl = "https://" + bucketName + "." + endpoint + "/" + file.getOriginalFilename(); |
| | | return ResponseEntity.ok(fileUrl); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.ruoyi.common.constant.AmountConstant; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.dto.MakeOrderDto; |
| | | import com.ruoyi.system.dto.MakeOrderResp; |
| | | import com.ruoyi.system.dto.OfflinePayDto; |
| | | import com.ruoyi.system.model.TBill; |
| | | import com.ruoyi.system.model.TBillConfirm; |
| | | import com.ruoyi.system.service.TBillConfirmService; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.ruoyi.system.service.TPayOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Api(value = "支付订单") |
| | | @RestController |
| | | @RequestMapping("/t-pay") |
| | | public class PayController { |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | TPayOrderService tPayOrderService; |
| | | |
| | | @Autowired |
| | | TBillService tBillService; |
| | | |
| | | @Autowired |
| | | TBillConfirmService tBillConfirmService; |
| | | |
| | | @ApiOperation(value = "创建支付订单") |
| | | @PostMapping("makeOrder") |
| | | public R<MakeOrderResp> makeOrder(@Validated @RequestBody MakeOrderDto dto){ |
| | | MakeOrderResp resp = tPayOrderService.makeOrder(dto); |
| | | return R.ok(resp); |
| | | } |
| | | |
| | | @ApiOperation(value = "线下支付") |
| | | @PostMapping("offlinePay") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R offlinePay(@Validated @RequestBody OfflinePayDto dto){ |
| | | List<TBill> tBills = tBillService.listByIds(dto.getBillIds()); |
| | | TBillConfirm confirm = new TBillConfirm(); |
| | | confirm.setBillId(CollectionUtil.join(dto.getBillIds(),",")); |
| | | confirm.setVoucher(dto.getVoucher()); |
| | | confirm.setPayFeesMoney(new BigDecimal(dto.getAmount()).divide(AmountConstant.b100).setScale(2, RoundingMode.HALF_DOWN).doubleValue()); |
| | | confirm.setPayTime(dto.getPayTime()); |
| | | tBillConfirmService.save(confirm); |
| | | for (TBill tBill : tBills) { |
| | | TBill save = new TBill(); |
| | | save.setId(tBill.getId()); |
| | | save.setPayFeesType(2); |
| | | save.setVoucher(dto.getVoucher()); |
| | | save.setPayFeesStatus("2"); |
| | | save.setConfirmId(confirm.getId()); |
| | | tBillService.lockAndUpdateInfo(save,1); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.exception.GlobalException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.bo.*; |
| | | import com.ruoyi.system.model.StateProcessModule; |
| | | import com.ruoyi.system.model.StateProcessTemplate; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.StateProcessModuleService; |
| | | import com.ruoyi.system.service.StateProcessTemplateService; |
| | | import com.ruoyi.system.vo.ProcessDetailVO; |
| | | import com.ruoyi.system.vo.ProcessTaskListVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api(tags = "审批流程管理") |
| | | @RequestMapping("/state-process") |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateProcessController { |
| | | |
| | | private final StateProcessTemplateService processTemplateService; |
| | | private final StateProcessModuleService processModuleService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | //应用流程分页列表 |
| | | @ApiOperation("应用流程分页列表") |
| | | @PostMapping("/module/page") |
| | | public AjaxResult<List<StateProcessModule>> modulePage(@RequestBody BasePage basePage) { |
| | | LambdaQueryWrapper<StateProcessModule> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.orderByAsc(StateProcessModule::getCategory); |
| | | //查询应用流程列表 |
| | | List<StateProcessModule> result = processModuleService.list(queryWrapper); |
| | | List<String> updateUserId = result.stream().map(BaseModel::getUpdateBy).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(updateUserId)){ |
| | | //根据用户id查询用户信息 |
| | | List<SysUser> sysUsers = sysUserService.selectUserByUserNameList(updateUserId); |
| | | Map<Long, SysUser> sysUserMap; |
| | | if (!CollectionUtils.isEmpty(sysUsers)){ |
| | | sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); |
| | | } else { |
| | | sysUserMap = new HashMap<>(); |
| | | } |
| | | //遍历列表,设置更新人名称 |
| | | result.forEach(e -> { |
| | | SysUser sysUser = sysUserMap.get(e.getUpdateBy()); |
| | | if (Objects.nonNull(sysUser)){ |
| | | e.setUpdateBy(sysUser.getNickName()); |
| | | } |
| | | }); |
| | | } |
| | | return AjaxResult.success(result); |
| | | } |
| | | //修改应用流程 |
| | | @Log(title = "审批流程管理-修改应用流程", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("修改应用流程") |
| | | @PostMapping("/module/update") |
| | | public AjaxResult<PageInfo<StateProcessModule>> moduleUpdate(@RequestBody ProcessModuleUpdateBO processModuleUpdateBO) { |
| | | StateProcessTemplate stateProcessTemplate = processTemplateService.getById(processModuleUpdateBO.getTemplateId()); |
| | | if (Objects.isNull(stateProcessTemplate)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | StateProcessModule stateProcessModule = new StateProcessModule(); |
| | | stateProcessModule.setId(processModuleUpdateBO.getId()); |
| | | stateProcessModule.setTemplateId(processModuleUpdateBO.getTemplateId()); |
| | | stateProcessModule.setTemplateName(stateProcessTemplate.getTemplateName()); |
| | | stateProcessModule.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | stateProcessModule.setCreateTime(LocalDateTime.now()); |
| | | stateProcessModule.setUpdateTime(LocalDateTime.now()); |
| | | stateProcessModule.setRemark(processModuleUpdateBO.getRemark()); |
| | | processModuleService.updateById(stateProcessModule); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //流程模版分页 |
| | | @ApiOperation("流程模版分页") |
| | | @PostMapping("/template/page") |
| | | public AjaxResult<Page<StateProcessTemplate>> page(ProcessTemplatePageBO request) { |
| | | Page<StateProcessTemplate> templatePage = processTemplateService.page(request); |
| | | return AjaxResult.success(templatePage); |
| | | } |
| | | |
| | | //查询流程模版 |
| | | @ApiOperation("查询流程模版") |
| | | @GetMapping("/template/getById") |
| | | public AjaxResult<StateProcessTemplate> selectById(@RequestParam String id) { |
| | | return AjaxResult.success(processTemplateService.getById(id)); |
| | | } |
| | | |
| | | //修改并部署模版 |
| | | @Log(title = "审批流程管理-修改并部署模版", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("修改并部署模版") |
| | | @PostMapping("/template/update") |
| | | public AjaxResult<Boolean> update(@RequestBody ProcessUpdateBO processUpdateBO) { |
| | | return AjaxResult.success(processTemplateService.update(processUpdateBO)); |
| | | } |
| | | |
| | | //删除模版 |
| | | @Log(title = "审批流程管理-删除模版", businessType = BusinessType.DELETE) |
| | | @ApiOperation("删除模版") |
| | | @GetMapping("/template/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam String id) { |
| | | StateProcessTemplate template = processTemplateService.getById(id); |
| | | //查询是否存在使用的 |
| | | LambdaUpdateWrapper<StateProcessModule> moduleLambdaUpdateWrapper = new LambdaUpdateWrapper<>();; |
| | | moduleLambdaUpdateWrapper.eq(StateProcessModule::getTemplateId, template.getId()); |
| | | if (processModuleService.getBaseMapper().exists(moduleLambdaUpdateWrapper)) { |
| | | throw new GlobalException("该模版在应用流程中已使用!"); |
| | | } |
| | | //根据key修改所有版本为已删除 |
| | | boolean result = processTemplateService.remove(Wrappers.lambdaQuery(StateProcessTemplate.class) |
| | | .eq(StateProcessTemplate::getTemplateKey, template.getTemplateKey())); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | //创建并部署模版 |
| | | @Log(title = "审批流程管理-创建并部署模版", businessType = BusinessType.INSERT) |
| | | @ApiOperation("创建并部署模版") |
| | | @PostMapping("/template/create") |
| | | public AjaxResult<Boolean> create(@RequestBody ProcessCreateBO processCreateBO) { |
| | | return AjaxResult.success(processTemplateService.create(processCreateBO)); |
| | | } |
| | | |
| | | //流程发起 |
| | | @Log(title = "审批流程管理-流程发起", businessType = BusinessType.INSERT) |
| | | @ApiOperation("流程发起") |
| | | @PostMapping("/start") |
| | | public AjaxResult<Boolean> start(@RequestBody ProcessStartBO processStartBO) { |
| | | return AjaxResult.success(processTemplateService.start(processStartBO)); |
| | | } |
| | | |
| | | //待办 |
| | | @ApiOperation("待办列表") |
| | | @PostMapping("/wait/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> waitTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.waitTaskPageApplet(processTemplatePageBO)); |
| | | } |
| | | |
| | | //已办 |
| | | @ApiOperation("已办列表") |
| | | @PostMapping("/deal/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> dealTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.dealTaskPageApplet(processTemplatePageBO)); |
| | | } |
| | | |
| | | //我发起的 |
| | | @ApiOperation("我发起的列表") |
| | | @PostMapping("/initiate/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> initiateTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.initiateTaskPage(processTemplatePageBO)); |
| | | } |
| | | |
| | | //抄送 |
| | | @ApiOperation("抄送列表") |
| | | @PostMapping("/copy/task/page") |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> copyTaskPage(@RequestBody ProcessTaskListBO processTaskListBO){ |
| | | return AjaxResult.success(processTemplateService.copyTaskPage(processTaskListBO)); |
| | | } |
| | | |
| | | //审核通过 |
| | | @Log(title = "审批流程管理-审核通过", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("审核通过") |
| | | @PostMapping("/agree") |
| | | public AjaxResult<Object> agree(@RequestBody ProcessAgreeBO processAgreeBO) { |
| | | processTemplateService.agree(processAgreeBO); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //审核拒绝 |
| | | @Log(title = "审批流程管理-审核拒绝", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("审核拒绝") |
| | | @PostMapping("/refuse") |
| | | public AjaxResult<Object> refuse(@RequestBody ProcessRefuseBO processRefuseBO) { |
| | | processTemplateService.refuse(processRefuseBO); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //审核详情 |
| | | @ApiOperation("审核详情") |
| | | @GetMapping("/detail") |
| | | public AjaxResult<ProcessDetailVO> detail(@RequestParam String taskId) { |
| | | ProcessDetailVO detail = processTemplateService.detail(taskId); |
| | | return AjaxResult.success(detail); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 账单线下缴费关联表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-bill-confirm") |
| | | public class TBillConfirmController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.CodeGenerateUtils; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.BatchBillDTO; |
| | | import com.ruoyi.system.dto.TBillDto; |
| | | import com.ruoyi.system.dto.TInvoiceDTO; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TBillQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.TBillVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 租金账单 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "缴费账单") |
| | | @RestController |
| | | @RequestMapping("/t-bill") |
| | | public class TBillController { |
| | | |
| | | @Autowired |
| | | TBillService tBillService; |
| | | @Autowired |
| | | TBillDetailService billDetailService; |
| | | @Autowired |
| | | TContractService contractService; |
| | | @Autowired |
| | | THouseService houseService; |
| | | @Autowired |
| | | TInvoiceService invoiceService; |
| | | @Autowired |
| | | TInvoiceToBillService invoiceToBillService; |
| | | @Autowired |
| | | TokenService tokenService; |
| | | @Autowired |
| | | TTenantService tenantService; |
| | | |
| | | @ApiOperation(value = "缴费账单查询分页列表") |
| | | @PostMapping("list") |
| | | public R<PageInfo<TBillDto>> list(@RequestBody TBillQuery query){ |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | query.setUserId(userId); |
| | | PageInfo<TBillDto> pageInfo = tBillService.queryPage(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | LocalDateTime localDateTime1 = LocalDateTime.now().withYear(2025).withMonth(11).withDayOfMonth(1); |
| | | LocalDateTime localDateTime2 = LocalDateTime.now().withYear(2025).withMonth(11).withDayOfMonth(28); |
| | | long allDays = ChronoUnit.DAYS.between(localDateTime1, localDateTime2); |
| | | System.err.println(allDays); |
| | | } |
| | | |
| | | @ApiOperation(value = "缴费账单查询列表") |
| | | @PostMapping("/getBillIds") |
| | | public R<List<String>> getBillIds(@RequestBody TBillQuery query){ |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | query.setUserId(userId); |
| | | List<String> billIds = tBillService.getBillIds(query); |
| | | return R.ok(billIds); |
| | | } |
| | | |
| | | @ApiOperation(value = "跳转批量缴费") |
| | | @PostMapping("/batchBill") |
| | | public R<String> batchBill(@RequestBody BatchBillDTO dto){ |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<String> billIds = dto.getBillIds(); |
| | | Integer count = tBillService.batchBillCount(userId, billIds); |
| | | if(count>0){ |
| | | return R.fail("请优先缴纳水电费"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "查看缴费账单详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TBillVO> getDetailById(@RequestParam String id) { |
| | | TBill bill = tBillService.getById(id); |
| | | TBillVO billVO = new TBillVO(); |
| | | BeanUtils.copyProperties(bill, billVO); |
| | | // 查询水电费列表 |
| | | if("3".equals(bill.getBillType())){ |
| | | List<TBillDetail> list = billDetailService.list(Wrappers.lambdaQuery(TBillDetail.class) |
| | | .eq(TBillDetail::getBillId, id)); |
| | | billVO.setBillDetailList(list); |
| | | } |
| | | // 查询合同信息 |
| | | contractService.lambdaQuery().eq(TContract::getId, bill.getContractId()).oneOpt().ifPresent(contract -> { |
| | | // 查询房屋信息 |
| | | billVO.setHouse(houseService.getById(contract.getHouseId())); |
| | | billVO.setMonthRent(contract.getMonthRent()); |
| | | billVO.setPayType(contract.getPayType()); |
| | | billVO.setDeposit(contract.getDeposit()); |
| | | billVO.setPartyOnePerson(contract.getPartyOnePerson()); |
| | | billVO.setPartyOnePhone(contract.getPartyOnePhone()); |
| | | billVO.setConcatStartTime(contract.getStartTime()); |
| | | billVO.setConcatEndTime(contract.getEndTime()); |
| | | }); |
| | | billVO.setBillType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_BILL_TYPE,billVO.getBillType())); |
| | | // billVO.setPayFeesStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_PAY_FEES_STATUS,billVO.getPayFeesStatus())); |
| | | return R.ok(billVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "缴费账单开票") |
| | | @PostMapping(value = "/invoice") |
| | | public R<String> invoice(@RequestBody TInvoiceDTO dto) { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | dto.setApplyName(tenantService.getById(userId).getResidentName()); |
| | | String code; |
| | | do { |
| | | code = CodeGenerateUtils.generateVolumeSn(); |
| | | } while (invoiceService.count(Wrappers.lambdaQuery(TInvoice.class).eq(TInvoice::getInvoiceNumber, code)) > 0); |
| | | dto.setInvoiceNumber(CodeGenerateUtils.generateVolumeSn()); |
| | | // 添加开票信息 |
| | | invoiceService.save(dto); |
| | | |
| | | // 添加开票信息中间表信息 |
| | | List<String> billIds = dto.getBillIds(); |
| | | List<TInvoiceToBill> sysInvoiceToBills = new ArrayList<>(); |
| | | for (String billId : billIds) { |
| | | TInvoiceToBill tInvoiceToBill = new TInvoiceToBill(); |
| | | tInvoiceToBill.setInvoiceId(dto.getId()); |
| | | tInvoiceToBill.setBillId(billId); |
| | | sysInvoiceToBills.add(tInvoiceToBill); |
| | | } |
| | | invoiceToBillService.saveBatch(sysInvoiceToBills); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "缴费账单开票列表") |
| | | @PostMapping(value = "/invoiceList") |
| | | public R<PageInfo<TBillDto>> invoiceList(@RequestBody TBillQuery query) { |
| | | |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | query.setUserId(userId); |
| | | PageInfo<TBillDto> pageInfo = tBillService.invoiceList(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验收记录 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-check-accept-record") |
| | | public class TCheckAcceptRecordController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUserApplet; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.RevokeDTO; |
| | | import com.ruoyi.system.dto.SignContractDTO; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.model.TContractRentType; |
| | | import com.ruoyi.system.model.THouse; |
| | | import com.ruoyi.system.model.TTenant; |
| | | import com.ruoyi.system.query.TContractAppletQuery; |
| | | import com.ruoyi.system.query.TContractQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.TContractAppletVO; |
| | | import com.ruoyi.system.vo.TContractVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 合同管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "我的合同") |
| | | |
| | | @RequestMapping("/t-contract") |
| | | public class TContractController { |
| | | @Autowired |
| | | private TContractService contractService; |
| | | @Autowired |
| | | private TContractRentTypeService contractRentTypeService; |
| | | @Autowired |
| | | private THouseService houseService; |
| | | @Autowired |
| | | private TBillService billService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TTenantService tTenantService; |
| | | @Autowired |
| | | private StateProcessTemplateService stateProcessTemplateService; |
| | | @ApiOperation(value = " 签订合同") |
| | | @PostMapping(value = "/signContract") |
| | | public R signContract(@RequestBody SignContractDTO dto) { |
| | | return contractService.signContract(dto); |
| | | } |
| | | @ApiOperation(value = "我的合同分页列表") |
| | | @PostMapping(value = "/contractList") |
| | | public R<PageInfo<TContract>> contractList(@RequestBody TContractAppletQuery query) { |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | if (loginUserApplet==null){ |
| | | return R.fail(401,"登录失效"); |
| | | } |
| | | query.setTenantId(loginUserApplet.getUserId()); |
| | | return R.ok(contractService.contractAppletList(query)); |
| | | } |
| | | |
| | | @Log(title = "合同管理-撤销审批", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "撤销审批") |
| | | @PostMapping(value = "/updateContractStatus") |
| | | public R<Boolean> updateContractStatus(@RequestBody RevokeDTO dto) { |
| | | TContract contract = contractService.getById(dto.getContractId()); |
| | | contract.setStatus("1"); |
| | | contractService.updateById(contract); |
| | | // 撤销审批实例 |
| | | stateProcessTemplateService.revoke(dto.getInstanceId()); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "查询合同信息信息") |
| | | @GetMapping(value = "/getContractById") |
| | | public R<TContractAppletVO> getContractById(@RequestParam String id) { |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | if (loginUserApplet==null){ |
| | | return R.fail(401,"登录失效"); |
| | | } |
| | | TContractAppletVO res = new TContractAppletVO(); |
| | | TContract contract = contractService.getById(id); |
| | | BeanUtils.copyProperties(contract,res); |
| | | res.setStartTimeString(DateUtils.localDateTimeToStringYear(contract.getStartTime())); |
| | | res.setEndTimeString(DateUtils.localDateTimeToStringYear(contract.getEndTime())); |
| | | res.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE,res.getPayType())); |
| | | res.setStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_STATUS,res.getStatus())); |
| | | TContractRentType contractRentType = contractRentTypeService.lambdaQuery().eq(TContractRentType::getContractId, id).one(); |
| | | if (contractRentType!=null){ |
| | | BeanUtils.copyProperties(contractRentType,res); |
| | | } |
| | | TTenant tTenant = tTenantService.getById(contract.getTenantId()); |
| | | res.setTenant(tTenant); |
| | | TContract oldContract = contractService.getOne(new LambdaQueryWrapper<TContract>() |
| | | .eq(TContract::getHouseId,contract.getHouseId()) |
| | | .eq(TContract::getTenantId,loginUserApplet.getUserId()) |
| | | .eq(TContract::getStatus, 4) |
| | | .le(TContract::getStartTime, LocalDateTime.now()) |
| | | .ge(TContract::getEndTime, LocalDateTime.now())); |
| | | THouse house = houseService.getById(contract.getHouseId()); |
| | | if (oldContract!=null){ |
| | | house.setTenantType(oldContract.getPayType()); |
| | | } |
| | | res.setHouse(house); |
| | | return R.ok(res); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 租金递增递减方式 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-contract-rent-type") |
| | | public class TContractRentTypeController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-dept") |
| | | public class TDeptController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门用户中间表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-dept-to-user") |
| | | public class TDeptToUserController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 故障区域 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-fault-area-dic") |
| | | public class TFaultAreaDicController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 故障描述 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-fault-describe-dic") |
| | | public class TFaultDescribeDicController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SmsUtil; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.TFaultRepairMessageDTO; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.TFaultAreaDicVO; |
| | | import com.ruoyi.system.vo.TItemTypeVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 报修管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "报修管理") |
| | | @RestController |
| | | @RequestMapping("/t-fault-repair-message") |
| | | public class TFaultRepairMessageController { |
| | | |
| | | private final TFaultRepairMessageService tFaultRepairMessageService; |
| | | private final TItemService itemService; |
| | | private final TItemTypeService itemTypeService; |
| | | private final TFaultAreaDicService faultAreaDicService; |
| | | private final TFaultDescribeDicService faultDescribeDicService; |
| | | private final TokenService tokenService; |
| | | private final TContractService contractService; |
| | | private final THouseService houseService; |
| | | private final SmsUtil smsUtil; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | |
| | | @Autowired |
| | | public TFaultRepairMessageController(TFaultRepairMessageService tFaultRepairMessageService, TItemService itemService, TItemTypeService itemTypeService, TFaultAreaDicService faultAreaDicService, TFaultDescribeDicService faultDescribeDicService, TokenService tokenService, TContractService contractService, THouseService houseService,SmsUtil smsUtil |
| | | ,ISysUserService sysUserService) { |
| | | this.tFaultRepairMessageService = tFaultRepairMessageService; |
| | | this.itemService = itemService; |
| | | this.itemTypeService = itemTypeService; |
| | | this.faultAreaDicService = faultAreaDicService; |
| | | this.faultDescribeDicService = faultDescribeDicService; |
| | | this.tokenService = tokenService; |
| | | this.contractService = contractService; |
| | | this.houseService = houseService; |
| | | this.smsUtil = smsUtil; |
| | | this.sysUserService = sysUserService; |
| | | } |
| | | |
| | | /** |
| | | * 获取维修物品二级结构 |
| | | */ |
| | | @ApiOperation(value = "获取维修物品二级结构") |
| | | @GetMapping(value = "/getItemList") |
| | | public R<List<TItemTypeVO>> getItemList(@RequestParam(required = false) String itemName) { |
| | | List<TItemTypeVO> itemTypes = itemTypeService.getItemList(itemName); |
| | | List<TItem> items = itemService.list(); |
| | | itemTypes.forEach(itemType -> { |
| | | itemType.setItemList(items.stream().filter(item -> itemType.getId().equals(item.getTypeId()) && item.getItemName().contains(itemName)).collect(Collectors.toList())); |
| | | }); |
| | | return R.ok(itemTypes); |
| | | } |
| | | |
| | | /** |
| | | * 获取故障区域列表 |
| | | */ |
| | | @ApiOperation(value = "获取故障区域二级结构") |
| | | @PostMapping(value = "/getAreaDicList") |
| | | public R<List<TFaultAreaDicVO>> getAreaDicList() { |
| | | List<TFaultAreaDicVO> faultAreaDicVOS = faultAreaDicService.getAreaDicList(); |
| | | List<TFaultDescribeDic> faultDescribeDicList = faultDescribeDicService.list(); |
| | | faultAreaDicVOS.forEach(areaDicVO -> { |
| | | areaDicVO.setFaultDescribeDicList(faultDescribeDicList.stream().filter(item -> areaDicVO.getId().equals(item.getFaultId())).collect(Collectors.toList())); |
| | | }); |
| | | return R.ok(faultAreaDicVOS); |
| | | } |
| | | |
| | | /** |
| | | * 通过当前租户查询合同房源信息 |
| | | */ |
| | | @ApiOperation(value = "通过当前租户查询合同房源信息") |
| | | @PostMapping(value = "/getConcatByTenantId") |
| | | public R<List<TContract>> getConcatByTenantId() { |
| | | |
| | | String tenantId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 查询合同信息 |
| | | List<TContract> list = contractService.list(Wrappers.lambdaQuery(TContract.class) |
| | | .eq(TContract::getTenantId, tenantId) |
| | | .eq(TContract::getStatus, 4)); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return R.ok(list); |
| | | } |
| | | List<String> houseIds = list.stream().map(TContract::getHouseId).collect(Collectors.toList()); |
| | | List<THouse> houseList = houseService.list(Wrappers.lambdaQuery(THouse.class) |
| | | .in(THouse::getId, houseIds)); |
| | | list.forEach(item -> { |
| | | item.setHouseName(houseList.stream().filter(house -> house.getId().equals(item.getHouseId())).findFirst().orElse(new THouse()).getHouseName()); |
| | | item.setHouseAddress(houseList.stream().filter(house -> house.getId().equals(item.getHouseId())).findFirst().orElse(new THouse()).getHouseAddress()); |
| | | }); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 添加报修信息 |
| | | */ |
| | | @ApiOperation(value = "添加报修信息") |
| | | @PostMapping(value = "/addFault") |
| | | public R<String> addFault(@RequestBody TFaultRepairMessageDTO dto) { |
| | | dto.setTenantId(tokenService.getLoginUserApplet().getUserId()); |
| | | LocalDate now = LocalDate.now(); |
| | | String replace = (now + "").replace("-", ""); |
| | | int size = tFaultRepairMessageService.list(new LambdaQueryWrapper<TFaultRepairMessage>() |
| | | .likeRight(TFaultRepairMessage::getCreateTime, LocalDate.now())).size(); |
| | | dto.setCode(replace.substring(2)+String.format("%03d", size+1)); |
| | | tFaultRepairMessageService.save(dto); |
| | | List<SysUser> sysUsers = sysUserService.selectList(); |
| | | if (dto.getRepairType()==2){ |
| | | for (SysUser sysUser : sysUsers) { |
| | | if (StringUtils.hasLength(sysUser.getPhonenumber())){ |
| | | System.err.println("发送短信"); |
| | | smsUtil.sendSms(sysUser.getPhonenumber(),"2375194",new String[]{}); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 流水管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-flow-management") |
| | | public class TFlowManagementController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.system.model.THouse; |
| | | import com.ruoyi.system.service.THouseService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 房屋管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "房屋管理") |
| | | @RestController |
| | | @RequestMapping("/t-house") |
| | | public class THouseController { |
| | | @Autowired |
| | | private THouseService tHouseService; |
| | | @ApiOperation(value = "查询房屋信息") |
| | | @GetMapping(value = "/getHouseById") |
| | | public R<THouse> getHouseById(@RequestParam String id) { |
| | | THouse tHouse = tHouseService.getById(id); |
| | | tHouse.setLeaseStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tHouse.getLeaseStatus())); |
| | | tHouse.setBusinessAttributes(DictUtils.getDictLabel(DictConstants.DICT_TYPE_BUSINESS_ATTRIBUTES,tHouse.getBusinessAttributes())); |
| | | return R.ok(tHouse); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.system.model.TInformation; |
| | | import com.ruoyi.system.query.TInformationQuery; |
| | | import com.ruoyi.system.service.TInformationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "资讯管理") |
| | | @RestController |
| | | @RequestMapping("/t-information") |
| | | public class TInformationController { |
| | | |
| | | private final TInformationService informationService; |
| | | private final RedisCache redisCache; |
| | | @Autowired |
| | | public TInformationController(TInformationService informationService, RedisCache redisCache) { |
| | | this.informationService = informationService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | /** |
| | | * 获取资讯管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取资讯管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TInformation>> pageList(@RequestBody TInformationQuery query) { |
| | | return R.ok(informationService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取资讯管理详情 |
| | | */ |
| | | @ApiOperation(value = "获取资讯管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TInformation> getDetailById(@RequestParam String id) { |
| | | // 处理查看次数 |
| | | redisCache.increment(Constants.INFORMATION_VIEW + id); |
| | | TInformation information = informationService.getById(id); |
| | | information.setViewCount(redisCache.getCacheObject(Constants.INFORMATION_VIEW + information.getId())); |
| | | return R.ok(information); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 开票管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-invoice") |
| | | public class TInvoiceController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 维修物品 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-item") |
| | | public class TItemController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 维修物品分类 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-item-type") |
| | | public class TItemTypeController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统公共参数设置 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-sys-config") |
| | | public class TSysConfigController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 租户 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-tenant") |
| | | public class TTenantController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.TTenantResp; |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUserApplet; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.SysLoginService; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TTenant; |
| | | import com.ruoyi.system.service.TTenantService; |
| | | import com.ruoyi.system.utils.wx.body.resp.Code2SessionRespBody; |
| | | import com.ruoyi.system.utils.wx.body.resq.Code2SessionResqBody; |
| | | import com.ruoyi.system.utils.wx.model.WeixinProperties; |
| | | import com.ruoyi.system.utils.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.system.utils.wx.pojo.AppletUserEncrypteData; |
| | | import com.ruoyi.system.utils.wx.tools.WxAppletTools; |
| | | import com.ruoyi.system.utils.wx.tools.WxUtils; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 微信小程序登录 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-06 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/wxLogin") |
| | | public class WxLoginController { |
| | | |
| | | @Autowired |
| | | private WeixinProperties wxConfig; |
| | | @Autowired |
| | | private RestTemplate wxRestTemplate; |
| | | @Resource |
| | | private RedisService redisService; |
| | | @Resource |
| | | private TTenantService tTenantService; |
| | | |
| | | /** |
| | | * 上传文件存储在本地的根路径 |
| | | */ |
| | | // @Value("${file.upload.location}") |
| | | // private String localFilePath; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | /** |
| | | * 账号密码登录 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "账号密码登录",notes = "管理员账号密码登录") |
| | | @PostMapping("/login") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | LoginUser loginUser = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | List<SysRole> roles = loginUser.getUser().getRoles(); |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return AjaxResult.error("请关联角色!"); |
| | | } |
| | | if(roles.get(0).getStatus() == 1){ |
| | | return AjaxResult.error("该账号角色已被禁用!"); |
| | | } |
| | | return ajax; |
| | | } |
| | | |
| | | @ApiOperation(value = "通过code获得openid,获取用户信息",tags = {"微信小程序登录"}) |
| | | @PostMapping("/openIdByJsCode") |
| | | public R<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserEncrypteData data) { |
| | | log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", data.getCode()); |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); |
| | | Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(data.getCode())); |
| | | String openid = body.getOpenid(); |
| | | String sessionKey = body.getSessionKey(); |
| | | // 用户信息解密 数据验签 |
| | | // if (StringUtils.isNotBlank(data.getSignature())) { |
| | | // WxUtils.verifySignature(data.getRawData(), sessionKey, data.getSignature()); |
| | | // } |
| | | if(StringUtils.isEmpty(data.getEncryptedData()) || StringUtils.isEmpty(data.getIv())){ |
| | | return R.fail("已拒绝授权"); |
| | | } |
| | | AppletUserDecodeData appletUserDecodeData = WxUtils.encryptedData(data.getEncryptedData(), sessionKey, data.getIv()); |
| | | appletUserDecodeData.setOpenId(openid); |
| | | // 先使用openId和当前手机号进行查询 |
| | | TTenant tenant = tTenantService.getOne(Wrappers.lambdaQuery(TTenant.class) |
| | | .and(e->e.eq(TTenant::getOpenId, appletUserDecodeData.getOpenId()).or() |
| | | .eq(TTenant::getPhone, appletUserDecodeData.getPhoneNumber()))); |
| | | if (tenant==null){ |
| | | // appUser.setTenantAttributes(); |
| | | // appUser.setTenantType(); |
| | | tenant = new TTenant(); |
| | | tenant.setPhone(appletUserDecodeData.getPhoneNumber()); |
| | | tenant.setAccount(appletUserDecodeData.getPhoneNumber()); |
| | | tenant.setPassword(SecurityUtils.encryptPassword(appletUserDecodeData.getPhoneNumber().substring(5))); |
| | | tenant.setOpenId(appletUserDecodeData.getOpenId()); |
| | | // 手机号中间四位替换为* |
| | | tenant.setResidentName(appletUserDecodeData.getPhoneNumber().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")); |
| | | tTenantService.save(tenant); |
| | | } |
| | | LoginUserApplet loginUserApplet = new LoginUserApplet(); |
| | | TTenantResp tTenantResp = new TTenantResp(); |
| | | BeanUtils.copyProperties(tenant, tTenantResp); |
| | | tTenantResp.setResidentName(appletUserDecodeData.getPhoneNumber()); |
| | | loginUserApplet.setUser(tTenantResp); |
| | | loginUserApplet.setUserId(tenant.getId()); |
| | | Map<String, Object> tokenInfos = new HashMap<>(); |
| | | tokenInfos.put("token",tokenService.createTokenApplet(loginUserApplet)); |
| | | tokenInfos.put("info",loginUserApplet); |
| | | return R.ok(tokenInfos); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // @ApiOperation(value = "获取微信小程序二维码",tags = {"获取微信小程序二维码"}) |
| | | // @PostMapping("/getQRCode") |
| | | // public AjaxResult getQRCode() { |
| | | // InputStream inputStream = null; |
| | | // OutputStream outputStream = null; |
| | | // WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); |
| | | // String accessToken = appletTools.getAccessToken(""); |
| | | // try { |
| | | // String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; |
| | | // Map<String, Object> param = new HashMap<>(); |
| | | //// param.put("page", "pageA/houseDetail"); |
| | | // param.put("check_path", false); |
| | | // param.put("env_version", "trial"); |
| | | // param.put("width", 200); //二维码尺寸 |
| | | // param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效 |
| | | // param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效 |
| | | // Map<String, Object> line_color = new HashMap<>(); |
| | | // line_color.put("r", 0); |
| | | // line_color.put("g", 0); |
| | | // line_color.put("b", 0); |
| | | // param.put("line_color", line_color); |
| | | // System.err.println("调用生成微信URL接口传参:" + param); |
| | | // MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | // HttpEntity requestEntity = new HttpEntity(param, headers); |
| | | // ResponseEntity<byte[]> entity = wxRestTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
| | | // System.err.println("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody()); |
| | | // byte[] result = entity.getBody(); |
| | | // System.err.println(Base64.encodeBase64String(result)); |
| | | // inputStream = new ByteArrayInputStream(result); |
| | | // String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpeg"; |
| | | //// MultipartFile multipartFile = convertInputStreamToMultipartFile(inputStream, finalFileName, "image/jpeg"); |
| | | //// String name = FileUploadUtils.upload(localFilePath, multipartFile); |
| | | //// System.err.println(name); |
| | | // return AjaxResult.success(null); |
| | | // } catch (Exception e) { |
| | | // System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e); |
| | | // } finally { |
| | | // if (inputStream != null) { |
| | | // try { |
| | | // inputStream.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // if (outputStream != null) { |
| | | // try { |
| | | // outputStream.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // } |
| | | // return AjaxResult.success(); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 获取微信token |
| | | * @return |
| | | */ |
| | | @PostMapping("/getWXToken") |
| | | public R<String> getWXToken(){ |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | return R.ok(accessToken); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 敏感词检测 |
| | | * @param content |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | @PostMapping("/sensitiveWordDetection") |
| | | public R<Boolean> sensitiveWordDetection (@RequestParam("content") String content, @RequestParam("openid") String openid){ |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("content", content); |
| | | jsonObject.put("version", 2); |
| | | jsonObject.put("scene", 2); |
| | | jsonObject.put("openid", openid); |
| | | String post = HttpUtils.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + accessToken, jsonObject.toString()); |
| | | JSONObject object = JSONObject.parseObject(post); |
| | | Integer errcode = object.getInteger("errcode"); |
| | | if(0 != errcode){ |
| | | throw new RuntimeException(object.getString("errmsg")); |
| | | } |
| | | JSONArray detail = object.getJSONArray("detail"); |
| | | for (int i = 0; i < detail.size(); i++) { |
| | | JSONObject jsonObject1 = detail.getJSONObject(i); |
| | | Integer errcode1 = jsonObject1.getInteger("errcode"); |
| | | if(0 == errcode1){ |
| | | String suggest = jsonObject1.getString("suggest"); |
| | | Integer label = jsonObject1.getInteger("label"); |
| | | String keyword = jsonObject1.getString("keyword"); |
| | | Integer prob = jsonObject1.getInteger("prob"); |
| | | if(("risky".equals(suggest) || "review".equals(suggest)) && 100 != label && com.ruoyi.common.utils.StringUtils.isNotEmpty(keyword) && 80 <= prob){ |
| | | return R.ok(true); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(false); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.sign.Base64; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 验证码操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class CaptchaController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | | private Producer captchaProducer; |
| | | |
| | | @Resource(name = "captchaProducerMath") |
| | | private Producer captchaProducerMath; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | | @GetMapping("/captchaImage") |
| | | public AjaxResult getCode(HttpServletResponse response) throws IOException |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | boolean captchaEnabled = configService.selectCaptchaEnabled(); |
| | | ajax.put("captchaEnabled", captchaEnabled); |
| | | if (!captchaEnabled) |
| | | { |
| | | return ajax; |
| | | } |
| | | |
| | | // 保存验证码信息 |
| | | String uuid = IdUtils.simpleUUID(); |
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; |
| | | |
| | | String capStr = null, code = null; |
| | | BufferedImage image = null; |
| | | |
| | | // 生成验证码 |
| | | String captchaType = RuoYiConfig.getCaptchaType(); |
| | | if ("math".equals(captchaType)) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |
| | | capStr = capText.substring(0, capText.lastIndexOf("@")); |
| | | code = capText.substring(capText.lastIndexOf("@") + 1); |
| | | image = captchaProducerMath.createImage(capStr); |
| | | } |
| | | else if ("char".equals(captchaType)) |
| | | { |
| | | capStr = code = captchaProducer.createText(); |
| | | image = captchaProducer.createImage(capStr); |
| | | } |
| | | |
| | | redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | // 转换流信息写出 |
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream(); |
| | | try |
| | | { |
| | | ImageIO.write(image, "jpg", os); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | ajax.put("uuid", uuid); |
| | | ajax.put("img", Base64.encode(os.toByteArray())); |
| | | return ajax; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | 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 com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.framework.config.ServerConfig; |
| | | |
| | | /** |
| | | * 通用请求处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/common") |
| | | public class CommonController |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(CommonController.class); |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | private static final String FILE_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 通用下载请求 |
| | | * |
| | | * @param fileName 文件名称 |
| | | * @param delete 是否删除 |
| | | */ |
| | | @GetMapping("/download") |
| | | public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(fileName)) |
| | | { |
| | | throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); |
| | | } |
| | | String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); |
| | | String filePath = RuoYiConfig.getDownloadPath() + fileName; |
| | | |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, realFileName); |
| | | FileUtils.writeBytes(filePath, response.getOutputStream()); |
| | | if (delete) |
| | | { |
| | | FileUtils.deleteFile(filePath); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通用上传请求(单个) |
| | | */ |
| | | @PostMapping("/upload") |
| | | public AjaxResult uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // 上传文件路径 |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("url", url); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("newFileName", FileUtils.getName(fileName)); |
| | | ajax.put("originalFilename", file.getOriginalFilename()); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通用上传请求(多个) |
| | | */ |
| | | @PostMapping("/uploads") |
| | | public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // 上传文件路径 |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | List<String> urls = new ArrayList<String>(); |
| | | List<String> fileNames = new ArrayList<String>(); |
| | | List<String> newFileNames = new ArrayList<String>(); |
| | | List<String> originalFilenames = new ArrayList<String>(); |
| | | for (MultipartFile file : files) |
| | | { |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | urls.add(url); |
| | | fileNames.add(fileName); |
| | | newFileNames.add(FileUtils.getName(fileName)); |
| | | originalFilenames.add(file.getOriginalFilename()); |
| | | } |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); |
| | | ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); |
| | | ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); |
| | | ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 本地资源通用下载 |
| | | */ |
| | | @GetMapping("/download/resource") |
| | | public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) |
| | | throws Exception |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(resource)) |
| | | { |
| | | throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); |
| | | } |
| | | // 本地资源路径 |
| | | String localPath = RuoYiConfig.getProfile(); |
| | | // 数据库资源地址 |
| | | String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); |
| | | // 下载名称 |
| | | String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, downloadName); |
| | | FileUtils.writeBytes(downloadPath, response.getOutputStream()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.interceptor; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class MybatisConfiguration { |
| | | |
| | | /** |
| | | * 注册拦截器 |
| | | */ |
| | | @Bean |
| | | public MybatisInterceptor getMybatisInterceptor() { |
| | | return new MybatisInterceptor(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.interceptor; |
| | | |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.executor.Executor; |
| | | import org.apache.ibatis.mapping.MappedStatement; |
| | | import org.apache.ibatis.mapping.SqlCommandType; |
| | | import org.apache.ibatis.plugin.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) }) |
| | | public class MybatisInterceptor implements Interceptor { |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Override |
| | | public Object intercept(Invocation invocation) throws Throwable { |
| | | MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; |
| | | log.debug("{}:"+mappedStatement); |
| | | log.debug("------sqlId------" + mappedStatement.getId()); |
| | | if("com.ruoyi.system.mapper.SysLogininforMapper.insertLogininfor".equals(mappedStatement.getId())){ |
| | | return invocation.proceed(); |
| | | } |
| | | // sql类型:insert、update、select、delete |
| | | SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType(); |
| | | Object parameter = invocation.getArgs()[1]; |
| | | log.debug("------sqlCommandType------" + sqlCommandType); |
| | | |
| | | if (parameter == null) { |
| | | return invocation.proceed(); |
| | | } |
| | | |
| | | // 当sql为新增或更新类型时,自动填充操作人相关信息 |
| | | if (SqlCommandType.INSERT == sqlCommandType) { |
| | | |
| | | Field[] fields = getAllFields(parameter); |
| | | for (Field field : fields) { |
| | | try { |
| | | // 注入创建人 |
| | | if ("createBy".equals(field.getName())) { |
| | | // 获取当前登录用户信息 |
| | | if(Objects.nonNull(tokenService.getLoginUser())){ |
| | | String userName = tokenService.getLoginUser().getUser().getUserName(); |
| | | field.setAccessible(true); |
| | | field.set(parameter, userName); |
| | | field.setAccessible(false); |
| | | } |
| | | } |
| | | //注入创建时间 |
| | | if ("createTime".equals(field.getName())) { |
| | | field.setAccessible(true); |
| | | // field.set(parameter, new Date()); |
| | | field.setAccessible(false); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("failed to insert data, exception = ", e); |
| | | } |
| | | } |
| | | } |
| | | if (SqlCommandType.UPDATE == sqlCommandType) { |
| | | Field[] fields = getAllFields(parameter); |
| | | for (Field field : fields) { |
| | | try { |
| | | if ("updateBy".equals(field.getName())) { |
| | | // 获取当前登录用户信息 |
| | | if(Objects.nonNull(tokenService.getLoginUser())){ |
| | | String userName = tokenService.getLoginUser().getUser().getUserName(); |
| | | field.setAccessible(true); |
| | | field.set(parameter, userName); |
| | | field.setAccessible(false); |
| | | } |
| | | } |
| | | if ("updateTime".equals(field.getName())) { |
| | | field.setAccessible(true); |
| | | // field.set(parameter, new Date()); |
| | | field.setAccessible(false); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("failed to update data, exception = ", e); |
| | | } |
| | | } |
| | | } |
| | | return invocation.proceed(); |
| | | } |
| | | |
| | | @Override |
| | | public Object plugin(Object target) { |
| | | return Plugin.wrap(target, this); |
| | | } |
| | | |
| | | @Override |
| | | public void setProperties(Properties properties) { |
| | | // TODO Auto-generated method stub |
| | | } |
| | | |
| | | /** |
| | | * 获取类的所有属性,包括父类 |
| | | * |
| | | * @param object |
| | | * @return |
| | | */ |
| | | private Field[] getAllFields(Object object) { |
| | | Class<?> clazz = object.getClass(); |
| | | List<Field> fieldList = new ArrayList<>(); |
| | | while (clazz != null) { |
| | | fieldList.addAll(new ArrayList<>(Arrays.asList(clazz.getDeclaredFields()))); |
| | | clazz = clazz.getSuperclass(); |
| | | } |
| | | Field[] fields = new Field[fieldList.size()]; |
| | | fieldList.toArray(fields); |
| | | return fields; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Properties; |
| | | import java.util.Set; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisCallback; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysCache; |
| | | |
| | | /** |
| | | * 缓存监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | | public class CacheController |
| | | { |
| | | @Autowired |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private final static List<SysCache> caches = new ArrayList<SysCache>(); |
| | | { |
| | | caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); |
| | | caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息")); |
| | | caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典")); |
| | | caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); |
| | | caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); |
| | | caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); |
| | | caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); |
| | | } |
| | | |
| | | @GetMapping() |
| | | public AjaxResult getInfo() throws Exception |
| | | { |
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); |
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); |
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); |
| | | |
| | | Map<String, Object> result = new HashMap<>(3); |
| | | result.put("info", info); |
| | | result.put("dbSize", dbSize); |
| | | |
| | | List<Map<String, String>> pieList = new ArrayList<>(); |
| | | commandStats.stringPropertyNames().forEach(key -> { |
| | | Map<String, String> data = new HashMap<>(2); |
| | | String property = commandStats.getProperty(key); |
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_")); |
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); |
| | | pieList.add(data); |
| | | }); |
| | | result.put("commandStats", pieList); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/getNames") |
| | | public AjaxResult cache() |
| | | { |
| | | return AjaxResult.success(caches); |
| | | } |
| | | |
| | | @GetMapping("/getKeys/{cacheName}") |
| | | public AjaxResult getCacheKeys(@PathVariable String cacheName) |
| | | { |
| | | Set<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | return AjaxResult.success(cacheKeys); |
| | | } |
| | | |
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}") |
| | | public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) |
| | | { |
| | | String cacheValue = redisTemplate.opsForValue().get(cacheKey); |
| | | SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); |
| | | return AjaxResult.success(sysCache); |
| | | } |
| | | |
| | | @DeleteMapping("/clearCacheName/{cacheName}") |
| | | public AjaxResult clearCacheName(@PathVariable String cacheName) |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @DeleteMapping("/clearCacheKey/{cacheKey}") |
| | | public AjaxResult clearCacheKey(@PathVariable String cacheKey) |
| | | { |
| | | redisTemplate.delete(cacheKey); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @DeleteMapping("/clearCacheAll") |
| | | public AjaxResult clearCacheAll() |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys("*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | 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 com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.Server; |
| | | |
| | | /** |
| | | * 服务器监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/server") |
| | | public class ServerController |
| | | { |
| | | @GetMapping() |
| | | public AjaxResult getInfo() throws Exception |
| | | { |
| | | Server server = new Server(); |
| | | server.copyTo(); |
| | | return AjaxResult.success(server); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.service.SysPasswordService; |
| | | import com.ruoyi.system.domain.SysLogininfor; |
| | | import com.ruoyi.system.service.ISysLogininforService; |
| | | |
| | | /** |
| | | * 系统访问记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/logininfor") |
| | | public class SysLogininforController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysLogininforService logininforService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysLogininfor logininfor) |
| | | { |
| | | // startPage(); |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "登录日志", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysLogininfor logininfor) |
| | | // { |
| | | // List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | // ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); |
| | | // util.exportExcel(response, list, "登录日志"); |
| | | // } |
| | | |
| | | @Log(title = "登录日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{infoIds}") |
| | | public AjaxResult remove(@PathVariable Long[] infoIds) |
| | | { |
| | | return toAjax(logininforService.deleteLogininforByIds(infoIds)); |
| | | } |
| | | |
| | | @Log(title = "登录日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | logininforService.cleanLogininfor(); |
| | | return success(); |
| | | } |
| | | |
| | | @Log(title = "账户解锁", businessType = BusinessType.OTHER) |
| | | @GetMapping("/unlock/{userName}") |
| | | public AjaxResult unlock(@PathVariable("userName") String userName) |
| | | { |
| | | passwordService.clearLoginRecordCache(userName); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "操作日志记录") |
| | | @RestController |
| | | @RequestMapping("/monitor/operlog") |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | |
| | | // @ApiOperation(value = "操作日志分页列表") |
| | | // @PostMapping("/list") |
| | | // public AjaxResult list(@RequestBody SysOperLogQuery query) |
| | | // { |
| | | // startPage(query.getPageNum(), query.getPageSize()); |
| | | // List<SysOperLogVO> list = operLogService.selectOperLogPageList(query); |
| | | // operLogService.getLogDetail(list); |
| | | // return AjaxResult.success(getDataTable(list)); |
| | | // } |
| | | |
| | | /** |
| | | * 查询操作日志列表导出 |
| | | */ |
| | | // @ApiOperation(value = "查询操作日志列表导出") |
| | | // @Log(title = "操作日志-查询操作日志列表导出", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/exportOperLog") |
| | | // public void exportOperLog(@RequestBody SysOperLogQuery query) |
| | | // { |
| | | // List<SysOperLogVO> list = operLogService.selectOperLogPageList(query); |
| | | // List<TOperLogExport> operLogExports = new ArrayList<>(); |
| | | // for (SysOperLogVO sysOperLogVO : list) { |
| | | // TOperLogExport operLogExport = new TOperLogExport(); |
| | | // BeanUtils.copyProperties(sysOperLogVO,operLogExport); |
| | | // operLogService.getLogDetail(list); |
| | | // operLogExports.add(operLogExport); |
| | | // } |
| | | // Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TOperLogExport.class, operLogExports); |
| | | // HttpServletResponse response = WebUtils.response(); |
| | | // response.setContentType("application/vnd.ms-excel"); |
| | | // response.setCharacterEncoding("utf-8"); |
| | | // ServletOutputStream outputStream = null; |
| | | // try { |
| | | // String fileName = URLEncoder.encode("操作日志信息.xls", "utf-8"); |
| | | // response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | // response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | // response.setHeader("Pragma", "no-cache"); |
| | | // response.setHeader("Cache-Control", "no-cache"); |
| | | // outputStream = response.getOutputStream(); |
| | | // workbook.write(outputStream); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // log.error("操作日志导出信息导出失败!"); |
| | | // } finally { |
| | | // try { |
| | | // outputStream.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysOperLog operLog) |
| | | // { |
| | | // List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | // ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); |
| | | // util.exportExcel(response, list, "操作日志"); |
| | | // } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/deleteById/{operIds}") |
| | | public AjaxResult remove(@PathVariable String operIds) |
| | | { |
| | | String[] split = operIds.split(","); |
| | | List<Long> id = new ArrayList<>(); |
| | | for (String s : split) { |
| | | id.add(Long.valueOf(s)); |
| | | } |
| | | return AjaxResult.success(operLogService.deleteOperLogByIds(id)); |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | operLogService.cleanOperLog(); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysUserOnline; |
| | | import com.ruoyi.system.service.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * 在线用户监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/online") |
| | | public class SysUserOnlineController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserOnlineService userOnlineService; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(String ipaddr, String userName) |
| | | { |
| | | Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); |
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); |
| | | for (String key : keys) |
| | | { |
| | | LoginUser user = redisCache.getCacheObject(key); |
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(ipaddr)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); |
| | | } |
| | | else |
| | | { |
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); |
| | | } |
| | | } |
| | | Collections.reverse(userOnlineList); |
| | | userOnlineList.removeAll(Collections.singleton(null)); |
| | | return getDataTable(userOnlineList); |
| | | } |
| | | |
| | | /** |
| | | * 强退用户 |
| | | */ |
| | | @Log(title = "在线用户", businessType = BusinessType.FORCE) |
| | | @DeleteMapping("/{tokenId}") |
| | | public AjaxResult forceLogout(@PathVariable String tokenId) |
| | | { |
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | // @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysConfig config) |
| | | // { |
| | | // List<SysConfig> list = configService.selectConfigList(config); |
| | | // ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | // util.exportExcel(response, list, "参数数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) |
| | | { |
| | | return success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(getUsername()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(getUsername()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) |
| | | { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | |
| | | /** |
| | | * 部门信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | public class SysDeptController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | /** |
| | | * 获取部门列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysDept dept) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return AjaxResult.success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 查询部门列表(排除节点) |
| | | */ |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return AjaxResult.success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{deptId}") |
| | | public AjaxResult getInfo(@PathVariable Long deptId) |
| | | { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return AjaxResult.success(deptService.selectDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(getUsername()); |
| | | return AjaxResult.success(deptService.insertDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 修改部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) |
| | | { |
| | | return error("该部门包含未停用的子部门!"); |
| | | } |
| | | dept.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(deptService.updateDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 删除部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | return warn("存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return warn("部门存在用户,不允许删除"); |
| | | } |
| | | deptService.checkDeptDataScope(deptId); |
| | | return AjaxResult.success(deptService.deleteDeptById(deptId)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/data") |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictDataService dictDataService; |
| | | |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | // startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "字典数据", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysDictData dictData) |
| | | // { |
| | | // List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | // ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); |
| | | // util.exportExcel(response, list, "字典数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 查询字典数据详细 |
| | | */ |
| | | @GetMapping(value = "/{dictCode}") |
| | | public AjaxResult getInfo(@PathVariable Long dictCode) |
| | | { |
| | | return success(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型查询字典数据信息 |
| | | */ |
| | | @GetMapping(value = "/type/{dictType}") |
| | | public AjaxResult dictType(@PathVariable String dictType) |
| | | { |
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |
| | | if (StringUtils.isNull(data)) |
| | | { |
| | | data = new ArrayList<SysDictData>(); |
| | | } |
| | | return success(data); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @Log(title = "字典数据", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictDataService.insertDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存字典类型 |
| | | */ |
| | | @Log(title = "字典数据", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictDataService.updateDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public AjaxResult remove(@PathVariable Long[] dictCodes) |
| | | { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictType; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/type") |
| | | public class SysDictTypeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictType dictType) |
| | | { |
| | | // startPage(); |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysDictType dictType) |
| | | // { |
| | | // List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | // ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); |
| | | // util.exportExcel(response, list, "字典类型"); |
| | | // } |
| | | |
| | | /** |
| | | * 查询字典类型详细 |
| | | */ |
| | | @GetMapping(value = "/{dictId}") |
| | | public AjaxResult getInfo(@PathVariable Long dictId) |
| | | { |
| | | return success(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictTypeService.insertDictType(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 修改字典类型 |
| | | */ |
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictTypeService.updateDictType(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public AjaxResult remove(@PathVariable Long[] dictIds) |
| | | { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新字典缓存 |
| | | */ |
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | dictTypeService.resetDictCache(); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取字典选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |
| | | return success(dictTypes); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 首页 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysIndexController |
| | | { |
| | | /** 系统基础配置 */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** |
| | | * 访问首页,提示语 |
| | | */ |
| | | @RequestMapping("/") |
| | | public String index() |
| | | { |
| | | return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUserApplet; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.SmsUtil; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.web.controller.tool.MsgUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.SysLoginService; |
| | | import com.ruoyi.framework.web.service.SysPermissionService; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "登录") |
| | | @RestController |
| | | public class SysLoginController |
| | | { |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | @Autowired |
| | | private MsgUtils msgUtils; |
| | | @Autowired |
| | | private SmsUtil smsUtil; |
| | | |
| | | /** |
| | | * 账号密码登录 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "账号密码登录",notes = "账号密码登录") |
| | | @PostMapping("/login") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | LoginUser loginUser = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | List<SysRole> roles = loginUser.getUser().getRoles(); |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return AjaxResult.error("请关联角色!"); |
| | | } |
| | | if(roles.get(0).getStatus() == 1){ |
| | | return AjaxResult.error("该账号角色已被禁用!"); |
| | | } |
| | | |
| | | List<SysMenu> menus = roleService.roleInfoFromUserId(loginUser.getUserId()); |
| | | |
| | | ajax.put("menus",menus); |
| | | ajax.put("roleName",roles.get(0).getRoleName()); |
| | | ajax.put("userInfo",loginUser); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 账号密码登录 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "短信登录",notes = "短信登录") |
| | | @PostMapping("/loginCode") |
| | | public AjaxResult loginCode(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | LoginUserApplet loginUser = loginService.loginCodeApplet(loginBody.getUsername(), loginBody.getCode()); |
| | | ajax.put(Constants.TOKEN, tokenService.createTokenApplet(loginUser)); |
| | | ajax.put("userInfo",loginUser); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取验证码 |
| | | * |
| | | * @param phone 手机号 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码") |
| | | @GetMapping("/getCode") |
| | | public AjaxResult getCode(@RequestParam String phone) |
| | | { |
| | | // 发送验证码并存储到redis |
| | | if (StringUtils.hasLength(phone)) { |
| | | String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | redisCache.setCacheObject(phone, code,5*60,TimeUnit.SECONDS); |
| | | try { |
| | | smsUtil.sendSms(phone, "2369926", new String[]{code}); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return AjaxResult.success("发送短信验证码成功!5分钟内有效"); |
| | | } |
| | | return AjaxResult.error(500, "发送短信验证码失败,请确认手机号码!"); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | @GetMapping("getInfo") |
| | | public AjaxResult getInfo() |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取路由信息 |
| | | * |
| | | * @return 路由信息 |
| | | */ |
| | | @GetMapping("getRouters") |
| | | public AjaxResult getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return AjaxResult.success(menuService.buildMenus(menus)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * 菜单信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "菜单信息") |
| | | @RestController |
| | | @RequestMapping("/system/menu") |
| | | public class SysMenuController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @ApiOperation("菜单权限(有层级)") |
| | | @GetMapping("/levelList") |
| | | public AjaxResult levelList() |
| | | { |
| | | // 获取当前角色的菜单列表 |
| | | List<SysMenu> menus = menuService.selectList(); |
| | | if(menus.size()==0){ |
| | | return AjaxResult.success(new ArrayList<>()); |
| | | } |
| | | // 第三级 |
| | | List<SysMenu> s3 = menus.stream().filter(e -> e.getMenuType().equals("F")).collect(Collectors.toList()); |
| | | // 第二级 |
| | | List<SysMenu> s2 = menus.stream().filter(e -> e.getMenuType().equals("C")).collect(Collectors.toList()); |
| | | // 第一级 |
| | | List<SysMenu> s1 = menus.stream().filter(e -> e.getMenuType().equals("M")).collect(Collectors.toList()); |
| | | |
| | | for (SysMenu menu : s2) { |
| | | List<SysMenu> collect = s3.stream().filter(e -> e.getParentId().equals(menu.getMenuId())).collect(Collectors.toList()); |
| | | menu.setChildren(collect); |
| | | } |
| | | for (SysMenu menu : s1) { |
| | | List<SysMenu> collect = s2.stream().filter(e -> e.getParentId().equals(menu.getMenuId())).collect(Collectors.toList()); |
| | | menu.setChildren(collect); |
| | | } |
| | | |
| | | return AjaxResult.success(s1); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return AjaxResult.success(menus); |
| | | } |
| | | |
| | | /** |
| | | * 根据菜单编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{menuId}") |
| | | public AjaxResult getInfo(@PathVariable Long menuId) |
| | | { |
| | | return AjaxResult.success(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单下拉树列表 |
| | | */ |
| | | @GetMapping("/treeselect") |
| | | public AjaxResult treeselect(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); |
| | | } |
| | | |
| | | /** |
| | | * 加载对应角色菜单列表树 |
| | | */ |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 新增菜单 |
| | | */ |
| | | @Log(title = "菜单管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | menu.setCreateBy(getUsername()); |
| | | return AjaxResult.success(menuService.insertMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * 修改菜单 |
| | | */ |
| | | @Log(title = "菜单管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | else if (menu.getMenuId().equals(menu.getParentId())) |
| | | { |
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); |
| | | } |
| | | menu.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(menuService.updateMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * 删除菜单 |
| | | */ |
| | | @Log(title = "菜单管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{menuId}") |
| | | public AjaxResult remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |
| | | { |
| | | return warn("存在子菜单,不允许删除"); |
| | | } |
| | | if (menuService.checkMenuExistRole(menuId)) |
| | | { |
| | | return warn("菜单已分配,不允许删除"); |
| | | } |
| | | return AjaxResult.success(menuService.deleteMenuById(menuId)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.domain.SysNotice; |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | | |
| | | /** |
| | | * 公告 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/notice") |
| | | public class SysNoticeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysNoticeService noticeService; |
| | | |
| | | /** |
| | | * 获取通知公告列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysNotice notice) |
| | | { |
| | | // startPage(); |
| | | List<SysNotice> list = noticeService.selectNoticeList(notice); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 根据通知公告编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{noticeId}") |
| | | public AjaxResult getInfo(@PathVariable Long noticeId) |
| | | { |
| | | return success(noticeService.selectNoticeById(noticeId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增通知公告 |
| | | */ |
| | | @Log(title = "通知公告", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | notice.setCreateBy(getUsername()); |
| | | return toAjax(noticeService.insertNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * 修改通知公告 |
| | | */ |
| | | @Log(title = "通知公告", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | notice.setUpdateBy(getUsername()); |
| | | return toAjax(noticeService.updateNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * 删除通知公告 |
| | | */ |
| | | @Log(title = "通知公告", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{noticeIds}") |
| | | public AjaxResult remove(@PathVariable Long[] noticeIds) |
| | | { |
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | |
| | | /** |
| | | * 岗位信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/post") |
| | | public class SysPostController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | /** |
| | | * 获取岗位列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | // startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysPost post) |
| | | // { |
| | | // List<SysPost> list = postService.selectPostList(post); |
| | | // ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); |
| | | // util.exportExcel(response, list, "岗位数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 根据岗位编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{postId}") |
| | | public AjaxResult getInfo(@PathVariable Long postId) |
| | | { |
| | | return success(postService.selectPostById(postId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增岗位 |
| | | */ |
| | | @Log(title = "岗位管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | | return toAjax(postService.insertPost(post)); |
| | | } |
| | | |
| | | /** |
| | | * 修改岗位 |
| | | */ |
| | | @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | | return toAjax(postService.updatePost(post)); |
| | | } |
| | | |
| | | /** |
| | | * 删除岗位 |
| | | */ |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public AjaxResult remove(@PathVariable Long[] postIds) |
| | | { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取岗位选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return success(posts); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user/profile") |
| | | public class SysProfileController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 个人信息 |
| | | */ |
| | | @GetMapping |
| | | public AjaxResult profile() |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | AjaxResult ajax = AjaxResult.success(user); |
| | | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); |
| | | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult updateProfile(@RequestBody SysUser user) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser currentUser = loginUser.getUser(); |
| | | currentUser.setNickName(user.getNickName()); |
| | | currentUser.setEmail(user.getEmail()); |
| | | currentUser.setPhonenumber(user.getPhonenumber()); |
| | | currentUser.setSex(user.getSex()); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | if (userService.updateUserProfile(currentUser) > 0) |
| | | { |
| | | // 更新缓存用户信息 |
| | | tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | return error("修改个人信息异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public AjaxResult updatePwd(String oldPassword, String newPassword) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String userName = loginUser.getUsername(); |
| | | String password = loginUser.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | | return error("修改密码失败,旧密码错误"); |
| | | } |
| | | if (SecurityUtils.matchesPassword(newPassword, password)) |
| | | { |
| | | return error("新密码不能与旧密码相同"); |
| | | } |
| | | if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) |
| | | { |
| | | // 更新缓存用户密码 |
| | | loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); |
| | | tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | return error("修改密码异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 头像上传 |
| | | */ |
| | | @Log(title = "用户头像", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/avatar") |
| | | public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception |
| | | { |
| | | if (!file.isEmpty()) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); |
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("imgUrl", avatar); |
| | | // 更新缓存用户头像 |
| | | loginUser.getUser().setAvatar(avatar); |
| | | tokenService.setLoginUser(loginUser); |
| | | return ajax; |
| | | } |
| | | } |
| | | return error("上传图片异常,请联系管理员"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.RegisterBody; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.SysRegisterService; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 注册验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysRegisterController extends BaseController |
| | | { |
| | | @Autowired |
| | | private SysRegisterService registerService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @PostMapping("/register") |
| | | public AjaxResult register(@RequestBody RegisterBody user) |
| | | { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) |
| | | { |
| | | return error("当前系统没有开启注册功能!"); |
| | | } |
| | | String msg = registerService.register(user); |
| | | return StringUtils.isEmpty(msg) ? success() : error(msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.system.dto.SysRoleDTO; |
| | | import com.ruoyi.system.query.SysRoleQuery; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import com.ruoyi.system.vo.RoleInfoVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.SysPermissionService; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 角色信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "角色信息") |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @ApiOperation(value = "角色列表") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysRoleQuery query) |
| | | { |
| | | PageInfo<SysRole> list = roleService.selectPageList(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "角色列表不分页") |
| | | @PostMapping("/listNotPage") |
| | | public AjaxResult list() |
| | | { |
| | | List<SysRole> list = roleService.selectRoleList(new SysRole()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "角色数量统计") |
| | | @PostMapping("/roleCount") |
| | | public AjaxResult roleCount() |
| | | { |
| | | int all = roleService.selectCount(null); |
| | | int normal = roleService.selectCount(0); |
| | | int stop = roleService.selectCount(1); |
| | | |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | map.put("all",all); |
| | | map.put("normal",normal); |
| | | map.put("stop",stop); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | // @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysRole role) |
| | | // { |
| | | // List<SysRole> list = roleService.selectRoleList(role); |
| | | // ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | // util.exportExcel(response, list, "角色数据"); |
| | | // } |
| | | |
| | | /** |
| | | * 根据角色编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{roleId}") |
| | | public AjaxResult getInfo(@PathVariable Long roleId) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return AjaxResult.success(roleService.selectRoleById(roleId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("角色详情") |
| | | @GetMapping("/roleInfo") |
| | | public AjaxResult roleInfo(@RequestParam Long roleId) |
| | | { |
| | | SysRole role = roleService.selectRoleById(roleId); |
| | | RoleInfoVO roleInfoVo = new RoleInfoVO(); |
| | | roleInfoVo.setRoleId(role.getRoleId()); |
| | | roleInfoVo.setRoleName(role.getRoleName()); |
| | | |
| | | // 获取当前角色的菜单列表 |
| | | List<SysMenu> menus = menuService.selectListByRoleId(roleId); |
| | | if(menus.size()==0){ |
| | | return AjaxResult.success(new ArrayList<>()); |
| | | } |
| | | List<Long> menusId = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList()); |
| | | |
| | | // 获取当前的权限菜单(有层级) |
| | | List<SysMenu> levelMenus = roleService.getMenuLevelList(menusId); |
| | | |
| | | roleInfoVo.setMenus(menusId); |
| | | return AjaxResult.success(roleInfoVo); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("用户获取权限菜单") |
| | | @GetMapping("/roleInfoFromUserId") |
| | | public AjaxResult roleInfoFromUserId(@RequestParam Long userId) |
| | | { |
| | | return AjaxResult.success(roleService.roleInfoFromUserId(userId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增角色 |
| | | */ |
| | | @ApiOperation(value = "新增角色") |
| | | @Log(title = "角色信息-新增角色", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@Validated @RequestBody SysRoleDTO dto) |
| | | { |
| | | Boolean flag= roleService.isExit(dto.getRoleId(),dto.getRoleName()); |
| | | if(flag){ |
| | | return error("新增角色'" + dto.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | roleService.saveRole(dto); |
| | | return AjaxResult.success(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改保存角色 |
| | | */ |
| | | @ApiOperation(value = "编辑角色") |
| | | @Log(title = "角色信息-编辑角色", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysRoleDTO dto) |
| | | { |
| | | Boolean flag= roleService.isExit(dto.getRoleId(),dto.getRoleName()); |
| | | if (flag){ |
| | | return error("修改角色'" + dto.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | if (roleService.editRole(dto) > 0) |
| | | { |
| | | // 更新缓存用户权限 |
| | | LoginUser loginUser = getLoginUser(); |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) |
| | | { |
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); |
| | | tokenService.setLoginUser(loginUser); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return error("修改角色'" + dto.getRoleName() + "'失败,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存数据权限 |
| | | */ |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public AjaxResult dataScope(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | return AjaxResult.success(roleService.authDataScope(role)); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @ApiOperation(value = "状态修改") |
| | | @Log(title = "角色信息-角色状态修改", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysRole role) |
| | | { |
| | | role.setUpdateBy(getUsername()); |
| | | roleService.updateStatus(role); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 删除角色 |
| | | */ |
| | | @ApiOperation(value = "删除角色") |
| | | @Log(title = "角色信息-角色删除角色", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/deleteById/{ids}") |
| | | public AjaxResult remove(@PathVariable String ids) |
| | | { |
| | | String[] split = ids.split(","); |
| | | List<Long> id = new ArrayList<>(); |
| | | for (String s : split) { |
| | | id.add(Long.valueOf(s)); |
| | | } |
| | | return AjaxResult.success(roleService.deleteRoleByIds(id)); |
| | | } |
| | | |
| | | /** |
| | | * 获取角色选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | return AjaxResult.success(roleService.selectRoleAll()); |
| | | } |
| | | |
| | | /** |
| | | * 查询已分配用户角色列表 |
| | | */ |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | // startPage(); |
| | | List<SysUser> list = userService.selectAllocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询未分配用户角色列表 |
| | | */ |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | // startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权用户 |
| | | */ |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | return AjaxResult.success(roleService.deleteAuthUser(userRole)); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户 |
| | | */ |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | return AjaxResult.success(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择用户授权 |
| | | */ |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return AjaxResult.success(roleService.insertAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取对应角色部门树列表 |
| | | */ |
| | | @GetMapping(value = "/deptTree/{roleId}") |
| | | public AjaxResult deptTree(@PathVariable("roleId") Long roleId) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | | ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); |
| | | return ajax; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.SysUserUpdateStatusDTO; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | import com.ruoyi.system.vo.UserAddListVO; |
| | | import com.ruoyi.system.vo.UserLevelVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "用户信息") |
| | | @RestController |
| | | @RequestMapping("/system/user") |
| | | public class SysUserController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @ApiOperation(value = "获取用户列表") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysUserQuery query) |
| | | { |
| | | PageInfo<SysUserVO> list = userService.pageList(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取用户列表-不分页") |
| | | @PostMapping("/listNotPage") |
| | | public AjaxResult listNotPage() |
| | | { |
| | | List<SysUser> list = userService.selectList(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户黑名单列表 |
| | | */ |
| | | // @ApiOperation(value = "获取用户黑名单列表") |
| | | // @PostMapping("/blacklist") |
| | | // public AjaxResult blacklist(@RequestBody SysUserQuery query) |
| | | // { |
| | | // startPage(query.getPageNum(), query.getPageSize()); |
| | | // List<SysUserVO> list = userService.selectBlackPageList(query); |
| | | // return AjaxResult.success(getDataTable(list)); |
| | | // } |
| | | |
| | | /** |
| | | * 人员借用列表 |
| | | */ |
| | | // @ApiOperation(value = "人员借用列表") |
| | | // @GetMapping("/userBorrowList") |
| | | // public AjaxResult userBorrowList(@RequestParam(required = false) String name, |
| | | // @RequestParam(required = false) Integer type) |
| | | // { |
| | | // |
| | | // UserAddListVO userAddListVO = new UserAddListVO(); |
| | | // |
| | | // Long companyId = tokenService.getLoginUser().getUser().getCompanyId(); |
| | | // |
| | | // List<TCompany> companyList = new ArrayList<>(); |
| | | // List<TDept> deptList = new ArrayList<>(); |
| | | // List<SysUser> userList = new ArrayList<>(); |
| | | // // 查询公司 |
| | | // if(Objects.nonNull(type) && type == 1){ |
| | | // companyList = companyService.userAddListByCompanyName(name); |
| | | // } |
| | | // // 查询部门 |
| | | // if(Objects.nonNull(type) && type == 2){ |
| | | // deptList = tDeptService.userAddListByDeptName(name); |
| | | // } |
| | | // // 查询用户 |
| | | // if(Objects.nonNull(type) && type == 3){ |
| | | // userList = userService.selectListByNamePhone(name); |
| | | // } |
| | | // |
| | | // if(Objects.isNull(type)){ |
| | | // companyList = companyService.userAddListByCompanyName(name); |
| | | // deptList = tDeptService.userAddListByDeptName(name); |
| | | // userList = userService.selectListByNamePhone(name); |
| | | // } |
| | | // |
| | | // List<Long> companyIds = companyList.stream().map(TCompany::getId).collect(Collectors.toList()); |
| | | // List<Long> deptCompanyIds = deptList.stream().map(TDept::getCompanyId).collect(Collectors.toList()); |
| | | // List<Long> userCompanyIds = userList.stream().map(SysUser::getCompanyId).collect(Collectors.toList()); |
| | | // companyIds.addAll(deptCompanyIds); |
| | | // companyIds.addAll(userCompanyIds); |
| | | // |
| | | // companyIds = companyIds.stream().distinct().collect(Collectors.toList()); |
| | | // |
| | | // if(CollectionUtils.isEmpty(companyIds)){ |
| | | // return AjaxResult.success(userAddListVO); |
| | | // } |
| | | // SysUser user1 = tokenService.getLoginUser().getUser(); |
| | | // if(!user1.isAdmin()){ |
| | | // companyIds = companyIds.stream().filter(e->!e.equals(companyId)).collect(Collectors.toList()); |
| | | // } |
| | | // |
| | | // // 查询符合要求的公司 |
| | | // List<UserLevelVO> parent = companyService.userAddListByCompanyIds(companyIds); |
| | | // |
| | | // List<TDept> depts = tDeptService.selectList(); |
| | | // |
| | | // List<SysUser> sysUsers = userService.selectList(); |
| | | // |
| | | // for (UserLevelVO userLevelVO : parent) { |
| | | // |
| | | // // 找到公司下的部门 |
| | | // List<TDept> tDepts = depts.stream().filter(e -> userLevelVO.getKey().equals(e.getCompanyId())).collect(Collectors.toList()); |
| | | // List<UserLevelVO> children = new ArrayList<>(); |
| | | // // 封装部门 |
| | | // for (TDept dept : tDepts) { |
| | | // userLevelVO.setChildren(children); |
| | | // UserLevelVO userLevelVO1 = new UserLevelVO(); |
| | | // userLevelVO1.setKey(dept.getId()); |
| | | // userLevelVO1.setTitle(dept.getDeptName()); |
| | | // // 找到部门下的人员 |
| | | // List<SysUser> users; |
| | | // if(StringUtils.isNotEmpty(name) && type == 3){ |
| | | // users = sysUsers.stream().filter(e -> userLevelVO1.getKey().equals(e.getDeptId()) |
| | | // && ((StringUtils.isNotEmpty(e.getNickName()) && e.getNickName().contains(name))) |
| | | // || (StringUtils.isNotEmpty(e.getPhonenumber()) && e.getPhonenumber().contains(name))).collect(Collectors.toList()); |
| | | // }else { |
| | | // users = sysUsers.stream().filter(e -> userLevelVO1.getKey().equals(e.getDeptId())).collect(Collectors.toList()); |
| | | // } |
| | | // List<UserLevelVO> children1 = new ArrayList<>(); |
| | | // // 封装人员 |
| | | // for (SysUser user : users) { |
| | | // UserLevelVO userLevelVO2 = new UserLevelVO(); |
| | | // userLevelVO2.setKey(user.getUserId()); |
| | | // userLevelVO2.setTitle(user.getNickName()); |
| | | // userLevelVO2.setAvatar(user.getAvatar()); |
| | | // userLevelVO2.setFlag(true); |
| | | // children1.add(userLevelVO2); |
| | | // } |
| | | // userLevelVO1.setChildren(children1); |
| | | // |
| | | // children.add(userLevelVO1); |
| | | // } |
| | | // userLevelVO.setChildren(children); |
| | | // } |
| | | // userAddListVO.setUserLevelVOS(parent); |
| | | // userAddListVO.setUserList(sysUsers); |
| | | // return AjaxResult.success(userAddListVO); |
| | | // } |
| | | |
| | | /** |
| | | * 获取用户详情 |
| | | */ |
| | | @ApiOperation(value = "获取用户详情") |
| | | @GetMapping("/getDetail") |
| | | public AjaxResult getDetail(@RequestParam Long userId) |
| | | { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | SysUserVO sysUserVO = new SysUserVO(); |
| | | BeanUtils.copyProperties(sysUser,sysUserVO); |
| | | |
| | | return AjaxResult.success(sysUser); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户数量统计 |
| | | */ |
| | | @ApiOperation(value = "获取用户数量统计") |
| | | @PostMapping("/getUserCount") |
| | | public AjaxResult getUserCount() |
| | | { |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | |
| | | Integer userCountSum = userService.selectCount(null); |
| | | Integer normalCount = userService.selectCount(0);// 正常 |
| | | Integer stopCount = userService.selectCount(1);// 停用 |
| | | |
| | | map.put("all",userCountSum); |
| | | map.put("normal",normalCount); |
| | | map.put("stop",stopCount); |
| | | |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | /** |
| | | * 移除黑名单 |
| | | */ |
| | | @GetMapping("/removeBlackList") |
| | | public AjaxResult removeBlackList(@RequestParam String ids) |
| | | { |
| | | String[] split = ids.split(","); |
| | | List<Long> id = new ArrayList<>(); |
| | | for (String s : split) { |
| | | id.add(Long.valueOf(s)); |
| | | } |
| | | userService.updateUserIfBlack(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | // @Log(title = "用户管理", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SysUser user) |
| | | // { |
| | | // List<SysUser> list = userService.selectUserList(user); |
| | | // ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | // util.exportExcel(response, list, "用户数据"); |
| | | // } |
| | | |
| | | // @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | // @PostMapping("/importData") |
| | | // public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception |
| | | // { |
| | | // ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | // List<SysUser> userList = util.importExcel(file.getInputStream()); |
| | | // String operName = getUsername(); |
| | | // String message = userService.importUser(userList, updateSupport, operName); |
| | | // return AjaxResult.success(message); |
| | | // } |
| | | |
| | | // @PostMapping("/importTemplate") |
| | | // public void importTemplate(HttpServletResponse response) |
| | | // { |
| | | // ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | // util.importTemplateExcel(response, "用户数据"); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @ApiOperation(value = "新增用户管理") |
| | | @Log(title = "用户信息-新增用户", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) |
| | | { |
| | | user.setUserName(user.getPhonenumber()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | userService.insertUser(user); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @ApiOperation(value = "修改用户管理") |
| | | @Log(title = "用户信息-修改用户", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) |
| | | { |
| | | user.setUserName(user.getPhonenumber()); |
| | | // userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getUserId()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | |
| | | user.setUpdateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | return AjaxResult.success(userService.updateUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @ApiOperation(value = "批量删除用户") |
| | | @Log(title = "用户信息-批量删除用户", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/deleteById/{ids}") |
| | | public AjaxResult remove(@PathVariable String ids) |
| | | { |
| | | String[] split = ids.split(","); |
| | | List<Long> userIds = new ArrayList<>(); |
| | | for (String s : split) { |
| | | userIds.add(Long.valueOf(s)); |
| | | } |
| | | if (userIds.contains(getUserId())) |
| | | { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return AjaxResult.success(userService.deleteUserByIds(userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @ApiOperation(value = "重置密码") |
| | | @Log(title = "用户信息-重置密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(userService.resetPwd(user)); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @ApiOperation(value = "状态修改") |
| | | @Log(title = "用户信息-状态修改", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysUserUpdateStatusDTO dto) |
| | | { |
| | | SysUser user = new SysUser(); |
| | | user.setUserId(dto.getUserId()); |
| | | user.setStatus(String.valueOf(dto.getStatus())); |
| | | user.setRemark(dto.getRemark()); |
| | | user.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(userService.updateUserStatus(user)); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户编号获取授权角色 |
| | | */ |
| | | @GetMapping("/authRole/{userId}") |
| | | public AjaxResult authRole(@PathVariable("userId") Long userId) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 用户授权角色 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | userService.insertUserAuth(userId, roleIds); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | @GetMapping("/deptTree") |
| | | public AjaxResult deptTree(SysDept dept) |
| | | { |
| | | return AjaxResult.success(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import okhttp3.*; |
| | | |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.util.Base64; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 百度文字识别 |
| | | */ |
| | | @Slf4j |
| | | public class BaiDuApi { |
| | | |
| | | static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build(); |
| | | |
| | | public static void main(String []args) throws IOException{ |
| | | // String url = "C:\\Users\\Admin\\Desktop\\picture\\6fd629ac-3327-4bdc-9459-fcb5295384bc.jpg"; |
| | | String url = "C:\\Users\\Admin\\Desktop\\picture\\6fd629ac-3327-4bdc-9459-fcb5295384bc.jpg"; |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | |
| | | // System.err.println(response.body().string()); |
| | | |
| | | Map<String,Object> map = new HashMap<>(); |
| | | String string = response.body().string(); |
| | | String idCard = string.substring(string.lastIndexOf("单号:") + 3, string.lastIndexOf("单号:") + 27); |
| | | String time = string.substring(string.lastIndexOf("零时起") + 3, string.lastIndexOf("二十四时")-1); |
| | | time = time.replace(".","-"); |
| | | map.put("idCard",idCard); |
| | | map.put("time",time); |
| | | System.err.println(map); |
| | | } |
| | | |
| | | /** |
| | | * 资质证明证件识别 |
| | | * @param url |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static Map<String,Object> qualification(String url) throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | try{ |
| | | String string = response.body().string(); |
| | | String idCard = string.substring(string.lastIndexOf("号:") + 2, string.lastIndexOf("号:") + 21); |
| | | String time = string.substring(string.lastIndexOf("至") + 1, string.lastIndexOf("至") + 11); |
| | | time = time.replace(".","-"); |
| | | map.put("idCard",idCard); |
| | | map.put("time",time); |
| | | }catch (Exception e){ |
| | | log.error("资质证明证件识别错误!"); |
| | | throw new ServiceException("资质证明证件识别错误!"); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 身份证识别 |
| | | * @param url |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static Map<String,Object> idCard(String url) throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | try{ |
| | | JSONObject jsonObject = JSONObject.parseObject(response.body().string()); |
| | | JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("words_result")); |
| | | JSONObject obj1 = JSONObject.parseObject(jsonArray.get(0).toString()); |
| | | String name = obj1.getString("words"); |
| | | name = name.substring(2); |
| | | |
| | | JSONObject obj2 = JSONObject.parseObject(jsonArray.get(1).toString()); |
| | | String sexStr = obj2.getString("words"); |
| | | sexStr = sexStr.substring(2, 3); |
| | | int sex = "男".equals(sexStr)?0:1; |
| | | |
| | | JSONObject obj3 = JSONObject.parseObject(jsonArray.get(3).toString()); |
| | | JSONObject obj4 = JSONObject.parseObject(jsonArray.get(4).toString()); |
| | | String address = obj3.getString("words") + obj4.getString("words"); |
| | | address = address.substring(2); |
| | | |
| | | JSONObject obj5 = JSONObject.parseObject(jsonArray.get(5).toString()); |
| | | String idCard = obj5.getString("words"); |
| | | idCard = idCard.substring(6); |
| | | |
| | | map.put("name",name); |
| | | map.put("sex",sex); |
| | | map.put("address",address); |
| | | map.put("idCard",idCard); |
| | | }catch (Exception e){ |
| | | log.error("身份证件识别错误!"); |
| | | throw new ServiceException("身份证件识别错误!"); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 通用文字识别(标准版) |
| | | * @param url |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static JSONObject pictureOcr(String url) throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "image="+getFileContentAsBase64(url,true)); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token="+getAccessToken()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | return JSONObject.parseObject(response.body().string()); |
| | | } |
| | | |
| | | public static String getAccessToken() throws IOException { |
| | | MediaType mediaType = MediaType.parse("application/json"); |
| | | RequestBody body = RequestBody.create(mediaType, ""); |
| | | Request request = new Request.Builder() |
| | | .url("https://aip.baidubce.com/oauth/2.0/token?client_id=2RkKEqd0ltIHPvnIf3G0VpHE&client_secret=RBpPt3O64e3e4BK7pG3lP0o8I6SGgiUy&grant_type=client_credentials") |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/json") |
| | | .addHeader("Accept", "application/json") |
| | | .build(); |
| | | Response response = HTTP_CLIENT.newCall(request).execute(); |
| | | JSONObject jsonObject = JSONObject.parseObject(response.body().string()); |
| | | return jsonObject.getString("access_token"); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件base64编码 |
| | | * |
| | | * @param path 文件路径 |
| | | * @param urlEncode 如果Content-Type是application/x-www-form-urlencoded时,传true |
| | | * @return base64编码信息,不带文件头 |
| | | * @throws IOException IO异常 |
| | | */ |
| | | static String getFileContentAsBase64(String path, boolean urlEncode) throws IOException { |
| | | byte[] b = Files.readAllBytes(Paths.get(path)); |
| | | String base64 = Base64.getEncoder().encodeToString(b); |
| | | if (urlEncode) { |
| | | base64 = URLEncoder.encode(base64, "utf-8"); |
| | | } |
| | | return base64; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.InputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | |
| | | /** |
| | | * @author zhy |
| | | * @title: HttpClientUtil |
| | | * @projectName car_park |
| | | * @description: http连接工具类 |
| | | * @date 2019/10/2219:23 |
| | | */ |
| | | public class HttpClientUtil { |
| | | |
| | | |
| | | /** |
| | | * @param strUrl |
| | | * @return byte[] |
| | | * @throws |
| | | * @description: 获取网络图片转成字节流 |
| | | * @author zhy |
| | | * @date 2019/10/23 8:59 |
| | | */ |
| | | public static byte[] getImageFromNetByUrl(String strUrl) { |
| | | if (!isURL(strUrl)){ |
| | | return null; |
| | | } |
| | | try { |
| | | URL url = new URL(strUrl); |
| | | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
| | | conn.setRequestMethod("GET"); |
| | | conn.setConnectTimeout(2 * 1000); |
| | | InputStream inStream = conn.getInputStream();// 通过输入流获取图片数据 |
| | | byte[] btImg = readInputStream(inStream);// 得到图片的二进制数据 |
| | | return btImg; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 从输入流中获取字节流数据 |
| | | * |
| | | * @param inStream 输入流 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static byte[] readInputStream(InputStream inStream) throws Exception { |
| | | ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[10240]; |
| | | int len = 0; |
| | | while ((len = inStream.read(buffer)) != -1) { |
| | | outStream.write(buffer, 0, len); |
| | | } |
| | | inStream.close(); |
| | | return outStream.toByteArray(); |
| | | } |
| | | |
| | | public static boolean isURL(String str) { |
| | | str = str.toLowerCase(); |
| | | String regex = "^((https|http|ftp|rtsp|mms)?://)" |
| | | + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" |
| | | + "(([0-9]{1,3}\\.){3}[0-9]{1,3}" |
| | | + "|" |
| | | + "([0-9a-z_!~*'()-]+\\.)*" |
| | | + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\." |
| | | + "[a-z]{2,6})" |
| | | + "(:[0-9]{1,5})?" |
| | | + "((/?)|" |
| | | + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; |
| | | return str.matches(regex); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 导出返回信息 |
| | | */ |
| | | @Slf4j |
| | | public class ImportExcelUtil { |
| | | |
| | | /** |
| | | * @param errorLines 错误行数 |
| | | * @param successLines 成功行数 |
| | | * @param errorMessage 错误信息 |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static R<String> importReturnMsg(int errorLines, int successLines, List<String> errorMessage) throws IOException { |
| | | if (errorLines == 0) { |
| | | return R.ok("共" + successLines + "行数据全部导入成功!"); |
| | | } else { |
| | | JSONObject result = new JSONObject(5); |
| | | int totalCount = successLines + errorLines; |
| | | result.put("totalCount", totalCount); |
| | | result.put("errorCount", errorLines); |
| | | result.put("errorMessage", errorMessage); |
| | | result.put("successCount", successLines); |
| | | result.put("msg", "总上传行数:" + totalCount + ",已导入行数:" + successLines + ",错误行数:" + errorLines); |
| | | return R.ok(JSON.toJSONString(result)); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.system.code.SubmitTemplateReg; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.apache.commons.codec.binary.Hex; |
| | | |
| | | import java.io.Serializable; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * 短信工具类 |
| | | */ |
| | | public class MsgCodeUtil implements Serializable { |
| | | |
| | | /**接口账号用户名*/ |
| | | private static final String AP_ID = ""; |
| | | /**企业名称*/ |
| | | private static final String EC_NAME = ""; |
| | | /**签名*/ |
| | | private static final String SECRET_KEY = ""; |
| | | /**签名编码*/ |
| | | private static final String SIGN = ""; |
| | | /**模板ID*/ |
| | | private static final String TEMPLATE_ID = ""; |
| | | |
| | | |
| | | /** |
| | | * 实体封装 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static SubmitTemplateReg getSubmitTemplateReg(String code,String mobiles) { |
| | | SubmitTemplateReg submitReg =new SubmitTemplateReg(); |
| | | String[] paramss = {code}; |
| | | submitReg.setApId(AP_ID); |
| | | submitReg.setEcName(EC_NAME); |
| | | submitReg.setSecretKey(SECRET_KEY); |
| | | submitReg.setParams(JSONObject.toJSONString(paramss)); |
| | | submitReg.setMobiles(mobiles); |
| | | submitReg.setAddSerial(""); |
| | | submitReg.setSign(SIGN); |
| | | submitReg.setTemplateId(TEMPLATE_ID); |
| | | submitReg.setMac(TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReg.getEcName( ));stringBuffer.append(submitReg.getApId()); |
| | | stringBuffer.append(submitReg.getSecretKey());stringBuffer.append(submitReg.getTemplateId());stringBuffer.append(submitReg.getMobiles()); |
| | | stringBuffer.append(submitReg.getParams());stringBuffer.append(submitReg.getSign());stringBuffer.append(submitReg.getAddSerial()); |
| | | submitReg.setMac(Hex.encodeHexString(stringBuffer.toString().getBytes(StandardCharsets.UTF_8))); |
| | | String regText = JSONObject.toJSONString(submitReg); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(regText.getBytes()); |
| | | System.err.println(encode); |
| | | return submitReg; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | getSubmitTemplateReg("123456","18398968484"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsRequest; |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsResponse; |
| | | import com.aliyun.tea.TeaException; |
| | | import com.aliyun.teaopenapi.models.Config; |
| | | import com.aliyun.teautil.models.RuntimeOptions; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MsgUtils { |
| | | |
| | | @Value("${code.config.accessKeyId}") |
| | | private String accessKeyId; |
| | | @Value("${code.config.accessKeySecret}") |
| | | private String accessKeySecret; |
| | | @Value("${code.config.signName}") |
| | | private String signName; |
| | | @Value("${code.config.templateCode}") |
| | | private String templateCode; |
| | | @Value("${code.config.signNameTest}") |
| | | private String signNameTest; |
| | | @Value("${code.config.templateCodeTest}") |
| | | private String templateCodeTest; |
| | | |
| | | /** |
| | | * 使用AK&SK初始化账号Client |
| | | * @param accessKeyId |
| | | * @param accessKeySecret |
| | | * @return Client |
| | | * @throws Exception |
| | | */ |
| | | public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception { |
| | | Config config = new Config() |
| | | // 您的 AccessKey ID |
| | | .setAccessKeyId(accessKeyId) |
| | | // 您的 AccessKey Secret |
| | | .setAccessKeySecret(accessKeySecret); |
| | | // 访问的域名 |
| | | config.endpoint = "dysmsapi.aliyuncs.com"; |
| | | return new com.aliyun.dysmsapi20170525.Client(config); |
| | | } |
| | | |
| | | public void sendMsg(String phone,String code) throws Exception { |
| | | com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret); |
| | | SendSmsRequest sendSmsRequest = new SendSmsRequest() |
| | | .setSignName(signName) |
| | | .setTemplateCode(templateCode) |
| | | .setPhoneNumbers(phone) |
| | | .setTemplateParam("{\"code\":\""+code+"\"}"); |
| | | RuntimeOptions runtime = new RuntimeOptions(); |
| | | try { |
| | | // 复制代码运行请自行打印 API 的返回值 |
| | | SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); |
| | | log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode()); |
| | | } catch (TeaException error) { |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } catch (Exception _error) { |
| | | TeaException error = new TeaException(_error.getMessage(), _error); |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import java.io.*; |
| | | import java.nio.file.Files; |
| | | |
| | | |
| | | /** |
| | | * @author RainbowCloud |
| | | */ |
| | | public class MyFileUtil { |
| | | |
| | | /** |
| | | * 将 File 转换为 MultipartFile。 |
| | | * |
| | | * @param file 要转换的文件 |
| | | * @param fieldName 字段名,通常用于表单中的文件字段名 |
| | | * @return 转换后的 MultipartFile |
| | | * @throws IOException 如果发生I/O错误 |
| | | */ |
| | | public static MultipartFile fileToMultipartFile(File file, String fieldName) throws IOException { |
| | | try { |
| | | if (file == null || !file.exists()) { |
| | | throw new FileNotFoundException("文件未找到:" + file); |
| | | } |
| | | byte[] content = Files.readAllBytes(file.toPath()); |
| | | return new ByteArrayMultipartFile(content, file.getName(), fieldName, Files.probeContentType(file.toPath())); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } finally { |
| | | // 删除临时文件 |
| | | file.delete(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将 MultipartFile 转换为 File。 |
| | | * |
| | | * @param multipartFile 要转换的 MultipartFile |
| | | * @return 转换后的 File |
| | | * @throws IOException 如果发生I/O错误 |
| | | */ |
| | | public static File multipartFileToFile(MultipartFile multipartFile) throws IOException { |
| | | if (multipartFile.isEmpty()) { |
| | | throw new IOException("传入的MultipartFile为空"); |
| | | } |
| | | String originalFilename = multipartFile.getOriginalFilename(); |
| | | String tempFileSuffix = originalFilename != null ? originalFilename.substring(originalFilename.lastIndexOf('.')) : ".tmp"; |
| | | File tempFile = File.createTempFile("temp", tempFileSuffix); |
| | | try (InputStream ins = multipartFile.getInputStream(); |
| | | OutputStream os = new FileOutputStream(tempFile)) { |
| | | byte[] buffer = new byte[8192]; |
| | | int bytesRead; |
| | | while ((bytesRead = ins.read(buffer)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | } |
| | | return tempFile; |
| | | } |
| | | |
| | | /** |
| | | * 内置一个简单的 MultipartFile 实现类,用于File转换 |
| | | */ |
| | | private static class ByteArrayMultipartFile implements MultipartFile { |
| | | private final byte[] content; |
| | | private final String name; |
| | | private final String originalFilename; |
| | | private final String contentType; |
| | | |
| | | /** |
| | | * 构造函数 |
| | | * |
| | | * @param content 文件内容 |
| | | * @param originalFilename 文件原始名字 |
| | | * @param name 字段名 |
| | | * @param contentType 文件类型 |
| | | */ |
| | | public ByteArrayMultipartFile(byte[] content, String originalFilename, String name, String contentType) { |
| | | this.content = content; |
| | | this.originalFilename = originalFilename; |
| | | this.name = name; |
| | | this.contentType = contentType; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | @Override |
| | | public String getOriginalFilename() { |
| | | return this.originalFilename; |
| | | } |
| | | |
| | | @Override |
| | | public String getContentType() { |
| | | return this.contentType; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isEmpty() { |
| | | return (this.content == null || this.content.length == 0); |
| | | } |
| | | |
| | | @Override |
| | | public long getSize() { |
| | | return this.content.length; |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getBytes() { |
| | | return this.content; |
| | | } |
| | | |
| | | @Override |
| | | public InputStream getInputStream() { |
| | | return new ByteArrayInputStream(this.content); |
| | | } |
| | | |
| | | @Override |
| | | public void transferTo(File dest) throws IOException, IllegalStateException { |
| | | try (OutputStream os = new FileOutputStream(dest)) { |
| | | os.write(this.content); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.swing.filechooser.FileSystemView; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.OutputStream; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 二维码工具 |
| | | * @Author:debug (SteadyJack) |
| | | * @Link: weixin-> debug0868 qq-> 1948831260 |
| | | * @Date: 2020/11/16 22:38 |
| | | **/ |
| | | public class QRCodeUtil { |
| | | private static final Logger log= LoggerFactory.getLogger(QRCodeUtil.class); |
| | | |
| | | //CODE_WIDTH:二维码宽度,单位像素 |
| | | private static final int CODE_WIDTH = 400; |
| | | //CODE_HEIGHT:二维码高度,单位像素 |
| | | private static final int CODE_HEIGHT = 400; |
| | | //FRONT_COLOR:二维码前景色,0x000000 表示黑色 |
| | | private static final int FRONT_COLOR = 0x000000; |
| | | //BACKGROUND_COLOR:二维码背景色,0xFFFFFF 表示白色 |
| | | //演示用 16 进制表示,和前端页面 CSS 的取色是一样的,注意前后景颜色应该对比明显,如常见的黑白 |
| | | private static final int BACKGROUND_COLOR = 0xFFFFFF; |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | createCodeToFile("5261548530",new File("C:\\Users\\Admin\\Desktop\\qrcode"),"5261548530.png"); |
| | | } |
| | | |
| | | public static void createCodeToFile(String content, File codeImgFileSaveDir, String fileName) { |
| | | try { |
| | | if (StringUtils.isBlank(content) || StringUtils.isBlank(fileName)) { |
| | | return; |
| | | } |
| | | content = content.trim(); |
| | | if (codeImgFileSaveDir==null || codeImgFileSaveDir.isFile()) { |
| | | //二维码图片存在目录为空,默认放在桌面... |
| | | codeImgFileSaveDir = FileSystemView.getFileSystemView().getHomeDirectory(); |
| | | } |
| | | if (!codeImgFileSaveDir.exists()) { |
| | | //二维码图片存在目录不存在,开始创建... |
| | | codeImgFileSaveDir.mkdirs(); |
| | | } |
| | | |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | |
| | | File codeImgFile = new File(codeImgFileSaveDir, fileName); |
| | | ImageIO.write(bufferedImage, "png", codeImgFile); |
| | | |
| | | log.info("二维码图片生成成功:" + codeImgFile.getPath()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码并输出到输出流, 通常用于输出到网页上进行显示,输出到网页与输出到磁盘上的文件中,区别在于最后一句 ImageIO.write |
| | | * write(RenderedImage im,String formatName,File output):写到文件中 |
| | | * write(RenderedImage im,String formatName,OutputStream output):输出到输出流中 |
| | | * @param content :二维码内容 |
| | | * @param outputStream :输出流,比如 HttpServletResponse 的 getOutputStream |
| | | */ |
| | | public static void createCodeToOutputStream(String content, OutputStream outputStream) { |
| | | try { |
| | | if (StringUtils.isBlank(content)) { |
| | | return; |
| | | } |
| | | content = content.trim(); |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | |
| | | //区别就是这一句,输出到输出流中,如果第三个参数是 File,则输出到文件中 |
| | | ImageIO.write(bufferedImage, "png", outputStream); |
| | | |
| | | log.info("二维码图片生成到输出流成功..."); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | //核心代码-生成二维码 |
| | | private static BufferedImage getBufferedImage(String content) throws WriterException { |
| | | |
| | | //com.google.zxing.EncodeHintType:编码提示类型,枚举类型 |
| | | Map<EncodeHintType, Object> hints = new HashMap(); |
| | | |
| | | //EncodeHintType.CHARACTER_SET:设置字符编码类型 |
| | | hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| | | |
| | | //EncodeHintType.ERROR_CORRECTION:设置误差校正 |
| | | //ErrorCorrectionLevel:误差校正等级,L = ~7% correction、M = ~15% correction、Q = ~25% correction、H = ~30% correction |
| | | //不设置时,默认为 L 等级,等级不一样,生成的图案不同,但扫描的结果是一样的 |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); |
| | | |
| | | //EncodeHintType.MARGIN:设置二维码边距,单位像素,值越小,二维码距离四周越近 |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | |
| | | MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); |
| | | BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hints); |
| | | BufferedImage bufferedImage = new BufferedImage(CODE_WIDTH, CODE_HEIGHT, BufferedImage.TYPE_INT_BGR); |
| | | for (int x = 0; x < CODE_WIDTH; x++) { |
| | | for (int y = 0; y < CODE_HEIGHT; y++) { |
| | | bufferedImage.setRGB(x, y, bitMatrix.get(x, y) ? FRONT_COLOR : BACKGROUND_COLOR); |
| | | } |
| | | } |
| | | return bufferedImage; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.qcloud.cos.COSClient; |
| | | import com.qcloud.cos.ClientConfig; |
| | | import com.qcloud.cos.auth.BasicCOSCredentials; |
| | | import com.qcloud.cos.auth.COSCredentials; |
| | | import com.qcloud.cos.http.HttpProtocol; |
| | | import com.qcloud.cos.model.ObjectMetadata; |
| | | import com.qcloud.cos.model.PutObjectResult; |
| | | import com.qcloud.cos.region.Region; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.InputStream; |
| | | import java.util.Base64; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author HJL |
| | | */ |
| | | @Component |
| | | public class TencentCosUtil { |
| | | |
| | | /** |
| | | * COS的SecretId |
| | | */ |
| | | @Value("${cos.client.accessKey}") |
| | | private String secretId; |
| | | /** |
| | | * COS的SecretKey |
| | | */ |
| | | @Value("${cos.client.secretKey}") |
| | | private String secretKey; |
| | | /** |
| | | * 文件上传后访问路径的根路径,后面要最佳文件名字与类型 |
| | | */ |
| | | @Value("${cos.client.rootSrc}") |
| | | private String rootSrc; |
| | | /** |
| | | * 上传的存储桶的地域 |
| | | */ |
| | | @Value("${cos.client.bucketAddr}") |
| | | private String bucketAddr; |
| | | /** |
| | | * 存储桶的名字,是自己在存储空间自己创建的,我创建的名字是:qq-test-1303****** |
| | | */ |
| | | @Value("${cos.client.bucket}") |
| | | private String bucketName; |
| | | /** |
| | | * 文件存放位置 |
| | | */ |
| | | @Value("${cos.client.location}") |
| | | private String location; |
| | | |
| | | /** |
| | | * 1.调用静态方法getCosClient()就会获得COSClient实例 |
| | | * 2.本方法根据永久密钥初始化 COSClient的,官方是不推荐,官方推荐使用临时密钥,是可以限制密钥使用权限,创建cred时有些区别 |
| | | * |
| | | * @return COSClient实例 |
| | | */ |
| | | private COSClient getCosClient() { |
| | | // 1 初始化用户身份信息(secretId, secretKey)。 |
| | | COSCredentials cred = new BasicCOSCredentials(secretId, secretKey); |
| | | // 2.1 设置存储桶的地域(上文获得) |
| | | Region region = new Region(bucketAddr); |
| | | ClientConfig clientConfig = new ClientConfig(region); |
| | | // 2.2 使用https协议传输 |
| | | clientConfig.setHttpProtocol(HttpProtocol.https); |
| | | // 生成 cos 客户端 |
| | | return new COSClient(cred, clientConfig); |
| | | } |
| | | |
| | | /** |
| | | * 只要调用静态方法upLoadFile(MultipartFile multipartFile)就可以获取上传后文件的全路径 |
| | | * |
| | | * @param file |
| | | * @return 返回文件的浏览全路径 |
| | | */ |
| | | public String upLoadFile(MultipartFile file) { |
| | | try { |
| | | // 获取上传的文件的输入流 |
| | | InputStream inputStream = file.getInputStream(); |
| | | // 避免文件覆盖,获取文件的原始名称,如123.jpg,然后通过截取获得文件的后缀,也就是文件的类型 |
| | | String originalFilename = file.getOriginalFilename(); |
| | | //获取文件的类型 |
| | | String fileType = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | //使用UUID工具 创建唯一名称,放置文件重名被覆盖,在拼接上上命令获取的文件类型 |
| | | String fileName = UUID.randomUUID() + fileType; |
| | | // 指定文件上传到 COS 上的路径,即对象键。最终文件会传到存储桶名字中的images文件夹下的fileName名字 |
| | | String key = location+"/" + fileName; |
| | | // 创建上传Object的Metadata |
| | | ObjectMetadata objectMetadata = new ObjectMetadata(); |
| | | // - 使用输入流存储,需要设置请求长度 |
| | | objectMetadata.setContentLength(inputStream.available()); |
| | | // - 设置缓存 |
| | | objectMetadata.setCacheControl("no-cache"); |
| | | // - 设置Content-Type |
| | | objectMetadata.setContentType(fileType); |
| | | //上传文件 |
| | | PutObjectResult putResult = getCosClient().putObject(bucketName, key, inputStream, objectMetadata); |
| | | // 创建文件的网络访问路径 |
| | | String url = rootSrc + key; |
| | | //关闭 cosClient,并释放 HTTP 连接的后台管理线程 |
| | | getCosClient().shutdown(); |
| | | return url; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | // 发生IO异常、COS连接异常等,返回空 |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | * @param file |
| | | * @return |
| | | */ |
| | | public void downLoadFile(String file) { |
| | | HttpServletResponse response = WebUtils.response(); |
| | | String replace = file.replace(rootSrc, ""); |
| | | response.setHeader("Access-Control-Expose-Headers","File-Type"); |
| | | COSCredentials cred = new BasicCOSCredentials( |
| | | secretId, |
| | | secretKey); |
| | | // 2.1 设置存储桶的地域(上文获得) |
| | | Region region = new Region(bucketAddr); |
| | | ClientConfig clientConfig = new ClientConfig(region); |
| | | // 2.2 使用https协议传输 |
| | | clientConfig.setHttpProtocol(HttpProtocol.https); |
| | | COSClient cosClient = new COSClient(cred, clientConfig); |
| | | try { |
| | | // 5. 下载文件并获取输入流 |
| | | InputStream inputStream = cosClient.getObject(bucketName, replace).getObjectContent(); |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | // 6. 处理输入流,例如读取内容或保存到本地文件 |
| | | // 这里仅作示例,实际应用中需要根据需求处理输入流 |
| | | byte[] buffer = new byte[1024]; |
| | | int len; |
| | | while ((len = inputStream.read(buffer)) != -1) { |
| | | // 处理读取到的数据 |
| | | outputStream.write(buffer, 0, len); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 7. 关闭输入流 |
| | | cosClient.shutdown(); |
| | | } |
| | | } |
| | | public String downLoadFileImg(String file) { |
| | | byte[] data = null; |
| | | String replace = file.replace(rootSrc, ""); |
| | | COSCredentials cred = new BasicCOSCredentials( |
| | | secretId, |
| | | secretKey); |
| | | // 2.1 设置存储桶的地域(上文获得) |
| | | Region region = new Region(bucketAddr); |
| | | ClientConfig clientConfig = new ClientConfig(region); |
| | | // 2.2 使用https协议传输 |
| | | clientConfig.setHttpProtocol(HttpProtocol.https); |
| | | COSClient cosClient = new COSClient(cred, clientConfig); |
| | | try { |
| | | // 5. 下载文件并获取输入流 |
| | | InputStream inputStream = cosClient.getObject(bucketName, replace).getObjectContent(); |
| | | ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); |
| | | // 6. 处理输入流,例如读取内容或保存到本地文件 |
| | | byte[] buffer = new byte[1024]; |
| | | int len; |
| | | while ((len = inputStream.read(buffer)) != -1) { |
| | | // 处理读取到的数据 |
| | | swapStream.write(buffer, 0, len); |
| | | } |
| | | data = swapStream.toByteArray(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 7. 关闭输入流 |
| | | cosClient.shutdown(); |
| | | } |
| | | return Base64.getEncoder().encodeToString(data); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | 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.RestController; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | | * swagger 用户测试方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/test/user") |
| | | public class TestController extends BaseController |
| | | { |
| | | private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>(); |
| | | { |
| | | users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); |
| | | users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public R<List<UserEntity>> userList() |
| | | { |
| | | List<UserEntity> userList = new ArrayList<UserEntity>(users.values()); |
| | | return R.ok(userList); |
| | | } |
| | | |
| | | @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) |
| | | @GetMapping("/{userId}") |
| | | public R<UserEntity> getUser(@PathVariable Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | return R.ok(users.get(userId)); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | } |
| | | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) |
| | | }) |
| | | @PostMapping("/save") |
| | | public R<String> save(UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("用户ID不能为空"); |
| | | } |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | public R<String> update(@RequestBody UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("用户ID不能为空"); |
| | | } |
| | | if (users.isEmpty() || !users.containsKey(user.getUserId())) |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | users.remove(user.getUserId()); |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) |
| | | @DeleteMapping("/{userId}") |
| | | public R<String> delete(@PathVariable Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | users.remove(userId); |
| | | return R.ok(); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @ApiModel(value = "UserEntity", description = "用户实体") |
| | | class UserEntity |
| | | { |
| | | @ApiModelProperty("用户ID") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty("用户名称") |
| | | private String username; |
| | | |
| | | @ApiModelProperty("用户密码") |
| | | private String password; |
| | | |
| | | @ApiModelProperty("用户手机") |
| | | private String mobile; |
| | | |
| | | public UserEntity() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserEntity(Integer userId, String username, String password, String mobile) |
| | | { |
| | | this.userId = userId; |
| | | this.username = username; |
| | | this.password = password; |
| | | this.mobile = mobile; |
| | | } |
| | | |
| | | public Integer getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUsername() |
| | | { |
| | | return username; |
| | | } |
| | | |
| | | public void setUsername(String username) |
| | | { |
| | | this.username = username; |
| | | } |
| | | |
| | | public String getPassword() |
| | | { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) |
| | | { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getMobile() |
| | | { |
| | | return mobile; |
| | | } |
| | | |
| | | public void setMobile(String mobile) |
| | | { |
| | | this.mobile = mobile; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName DataUpdateInterceptor |
| | | * @Description 数据更新操作处理 |
| | | * @date 2021-12-15 |
| | | * <p> |
| | | * 注意,之前在此处注入了 JwtTokenUtils |
| | | * <p> |
| | | * 造成spring循环依赖,项目支棱不起来 |
| | | */ |
| | | @Slf4j |
| | | @Configuration |
| | | public class DataUpdateHandlerConfig implements MetaObjectHandler { |
| | | |
| | | /** |
| | | * 新增数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | // String userName = SecurityUtils.getUsernameApplet(); |
| | | // if (StringUtils.isNotBlank(userName)) { |
| | | // this.setFieldValByName("createBy", userName, metaObject); |
| | | // this.setFieldValByName("updateBy", userName, metaObject); |
| | | // } else { |
| | | // this.setFieldValByName("createBy", userName, metaObject); |
| | | // this.setFieldValByName("updateBy", userName, metaObject); |
| | | // } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | // String userName = SecurityUtils.getUsernameApplet(); |
| | | // if (StringUtils.isNotBlank(userName)){ |
| | | // this.setFieldValByName("createBy", userName, metaObject); |
| | | // this.setFieldValByName("updateBy", userName, metaObject); |
| | | // } else { |
| | | // this.setFieldValByName("createBy", userName, metaObject); |
| | | // this.setFieldValByName("updateBy", userName, metaObject); |
| | | // } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.core.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author liheng |
| | | * @ClassName MybatisPlusConfig |
| | | * @Description MybatisPlus相关配置 |
| | | * @date 2020-09-22 11:22、 |
| | | * 直接以实现类作为bean的注入(有事务管理的类) |
| | | * @EnableTransactionManagement(proxyTargetClass = true) |
| | | */ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | private final DataUpdateHandlerConfig dataUpdateHandler; |
| | | |
| | | @Autowired |
| | | public MybatisPlusConfig(DataUpdateHandlerConfig dataUpdateHandler) { |
| | | this.dataUpdateHandler = dataUpdateHandler; |
| | | } |
| | | |
| | | /** |
| | | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题 |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * 自动填充功能 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public GlobalConfig globalConfig() { |
| | | GlobalConfig globalConfig = new GlobalConfig(); |
| | | globalConfig.setMetaObjectHandler(dataUpdateHandler); |
| | | return globalConfig; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.ApiKey; |
| | | import springfox.documentation.service.AuthorizationScope; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.service.SecurityReference; |
| | | import springfox.documentation.service.SecurityScheme; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spi.service.contexts.SecurityContext; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | /** |
| | | * Swagger2的接口配置 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | public class SwaggerConfig |
| | | { |
| | | /** 系统基础配置 */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** 是否开启swagger */ |
| | | @Value("${swagger.enabled}") |
| | | private boolean enabled; |
| | | |
| | | /** 设置请求的统一前缀 */ |
| | | @Value("${swagger.pathMapping}") |
| | | private String pathMapping; |
| | | |
| | | /** |
| | | * 创建API |
| | | */ |
| | | @Bean |
| | | public Docket createRestApi() |
| | | { |
| | | return new Docket(DocumentationType.OAS_30) |
| | | // 是否启用Swagger |
| | | .enable(enabled) |
| | | // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) |
| | | .apiInfo(apiInfo()) |
| | | // 设置哪些接口暴露给Swagger展示 |
| | | .select() |
| | | // 扫描所有有注解的api,用这种方式更灵活 |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | // 扫描指定包中的swagger注解 |
| | | // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) |
| | | // 扫描所有 .apis(RequestHandlerSelectors.any()) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | /* 设置安全模式,swagger可以设置访问token */ |
| | | .securitySchemes(securitySchemes()) |
| | | .securityContexts(securityContexts()) |
| | | .pathMapping(pathMapping); |
| | | } |
| | | |
| | | /** |
| | | * 安全模式,这里指定token通过Authorization头请求头传递 |
| | | */ |
| | | private List<SecurityScheme> securitySchemes() |
| | | { |
| | | List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>(); |
| | | apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); |
| | | return apiKeyList; |
| | | } |
| | | |
| | | /** |
| | | * 安全上下文 |
| | | */ |
| | | private List<SecurityContext> securityContexts() |
| | | { |
| | | List<SecurityContext> securityContexts = new ArrayList<>(); |
| | | securityContexts.add( |
| | | SecurityContext.builder() |
| | | .securityReferences(defaultAuth()) |
| | | .operationSelector(o -> o.requestMappingPattern().matches("/.*")) |
| | | .build()); |
| | | return securityContexts; |
| | | } |
| | | |
| | | /** |
| | | * 默认的安全上引用 |
| | | */ |
| | | private List<SecurityReference> defaultAuth() |
| | | { |
| | | AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); |
| | | AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; |
| | | authorizationScopes[0] = authorizationScope; |
| | | List<SecurityReference> securityReferences = new ArrayList<>(); |
| | | securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); |
| | | return securityReferences; |
| | | } |
| | | |
| | | /** |
| | | * 添加摘要信息 |
| | | */ |
| | | private ApiInfo apiInfo() |
| | | { |
| | | // 用ApiInfoBuilder进行定制 |
| | | return new ApiInfoBuilder() |
| | | // 设置标题 |
| | | .title("标题:西藏国投管理系统_接口文档") |
| | | // 描述 |
| | | .description("西藏国投接口文档") |
| | | // 作者信息 |
| | | .contact(new Contact(ruoyiConfig.getName(), null, null)) |
| | | // 版本 |
| | | .version("版本号:" + ruoyiConfig.getVersion()) |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | restart.include.json=/com.alibaba.fastjson.*.jar |
New file |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 3.8.6 |
| | | # 版权年份 |
| | | copyrightYear: 2023 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8082 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: i18n/messages |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 500MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 2000MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | # host: 127.0.0.1 |
| | | # # 端口,默认为6379 |
| | | # port: 6379 |
| | | # # 数据库索引 |
| | | # database: 0 |
| | | # # 密码 |
| | | # password: 123456 |
| | | host: 127.0.0.1 |
| | | # 端口,默认为6379 |
| | | port: 16379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 8f5z9g52gx4bg |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | # 数据源配置 |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://172.27.0.13:3306/xizang?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: xzgt |
| | | password: changyun!6f2gshj6h3j |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo,com.ruoyi.**.model |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: / |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | # file upload |
| | | file: |
| | | upload: |
| | | location: /file/ |
| | | qrLocation: /file/qrCode/ |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | url: |
| | | prefix: https://xzgt.test.591taxi.cn:${server.port}${server.servlet.context-path} |
| | | wx: |
| | | conf: |
| | | appId: wxe91f1af7638aa5dd |
| | | secretId: a787e1a462715604e0c9528b6d8960d1 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | | cos: |
| | | client: |
| | | accessKey: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretKey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | bucket: xzgttest-1305134071 |
| | | bucketAddr: ap-chengdu |
| | | rootSrc: https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/ |
| | | location: xizang |
| | | sms: |
| | | enable: true |
| | | appId: 1400957506 |
| | | secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | sign: 畅云出行 |
New file |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 3.8.6 |
| | | # 版权年份 |
| | | copyrightYear: 2023 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8082 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: i18n/messages |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 500MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 2000MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | # host: 127.0.0.1 |
| | | # # 端口,默认为6379 |
| | | # port: 6379 |
| | | # # 数据库索引 |
| | | # database: 0 |
| | | # # 密码 |
| | | # password: 123456 |
| | | host: xzgt.test.591taxi.cn |
| | | # 端口,默认为6379 |
| | | port: 16379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 8f5z9g52gx4bg |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | # 数据源配置 |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://xzgt.test.591taxi.cn:13306/xizang?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: 8f5z9g52gx4bg |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo,com.ruoyi.**.model |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: / |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | # file upload |
| | | file: |
| | | upload: |
| | | location: /file/ |
| | | qrLocation: /file/qrCode/ |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | url: |
| | | # prefix: http://localhost:${server.port}${server.servlet.context-path} |
| | | prefix: https://xzgt.test.591taxi.cn:${server.port}${server.servlet.context-path} |
| | | wx: |
| | | conf: |
| | | appId: wxe91f1af7638aa5dd |
| | | secretId: a787e1a462715604e0c9528b6d8960d1 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | | cos: |
| | | client: |
| | | accessKey: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretKey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | bucket: xzgttest-1305134071 |
| | | bucketAddr: ap-chengdu |
| | | rootSrc: https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/ |
| | | location: xizang |
| | | sms: |
| | | enable: true |
| | | appId: 1400957506 |
| | | secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | sign: 畅云出行 |
New file |
| | |
| | | # 项目相关配置 |
| | | spring: |
| | | profiles: |
| | | active: prod |
New file |
| | |
| | | Application Version: ${ruoyi.version} |
| | | Spring Boot Version: ${spring-boot.version} |
| | | //////////////////////////////////////////////////////////////////// |
| | | // _ooOoo_ // |
| | | // o8888888o // |
| | | // 88" . "88 // |
| | | // (| ^_^ |) // |
| | | // O\ = /O // |
| | | // ____/`---'\____ // |
| | | // .' \\| |// `. // |
| | | // / \\||| : |||// \ // |
| | | // / _||||| -:- |||||- \ // |
| | | // | | \\\ - /// | | // |
| | | // | \_| ''\---/'' | | // |
| | | // \ .-\__ `-` ___/-. / // |
| | | // ___`. .' /--.--\ `. . ___ // |
| | | // ."" '< `.___\_<|>_/___.' >'"". // |
| | | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // |
| | | // \ \ `-. \_ __\ /__ _/ .-` / / // |
| | | // ========`-.____`-.___\_____/___.-`____.-'======== // |
| | | // `=---=' // |
| | | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // |
| | | // 佛祖保佑 永不宕机 永无BUG // |
| | | //////////////////////////////////////////////////////////////////// |
New file |
| | |
| | | #错误消息 |
| | | not.null=* 必须填写 |
| | | user.jcaptcha.error=验证码错误 |
| | | user.jcaptcha.expire=验证码已失效 |
| | | user.not.exists=用户不存在/密码错误 |
| | | user.password.not.match=用户不存在/密码错误 |
| | | user.password.retry.limit.count=密码输入错误{0}次 |
| | | user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 |
| | | user.password.delete=对不起,您的账号已被删除 |
| | | user.blocked=用户已封禁,请联系管理员 |
| | | role.blocked=角色已封禁,请联系管理员 |
| | | login.blocked=很遗憾,访问IP已被列入系统黑名单 |
| | | user.logout.success=退出成功 |
| | | |
| | | length.not.valid=长度必须在{min}到{max}个字符之间 |
| | | |
| | | user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 |
| | | user.password.not.valid=* 5-50个字符 |
| | | |
| | | user.email.not.valid=邮箱格式错误 |
| | | user.mobile.phone.number.not.valid=手机号格式错误 |
| | | user.login.success=登录成功 |
| | | user.register.success=注册成功 |
| | | user.notfound=请重新登录 |
| | | user.forcelogout=管理员强制退出,请重新登录 |
| | | user.unknown.error=未知错误,请重新登录 |
| | | |
| | | ##文件上传消息 |
| | | upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! |
| | | upload.filename.exceed.length=上传的文件名最长{0}个字符 |
| | | |
| | | ##权限 |
| | | no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] |
| | | no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] |
| | | no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] |
| | | no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] |
| | | no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] |
| | | no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration> |
| | | <!-- 日志存放路径 --> |
| | | <property name="log.path" value="/home/ruoyi/logs" /> |
| | | <!-- 日志输出格式 --> |
| | | <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
| | | |
| | | <!-- 控制台输出 --> |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统日志输出 --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-info.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>INFO</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-error.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>ERROR</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 用户访问日志输出 --> |
| | | <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-user.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 按天回滚 daily --> |
| | | <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.ruoyi" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!--系统操作日志--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | |
| | | <!--系统用户操作日志--> |
| | | <logger name="sys-user" level="info"> |
| | | <appender-ref ref="sys-user"/> |
| | | </logger> |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> |
| | | <configuration> |
| | | |
| | | <settings> |
| | | <!-- 打印查询语句 不会写入到日志文件中--> |
| | | <setting name="logImpl" value="STDOUT_LOGGING"/> |
| | | <!--<setting name="logImpl" value="LOG4J" />--> |
| | | <!-- 控制全局缓存(二级缓存),按美团技术团队的说法,尽量别用缓存机制 emmmm.... --> |
| | | <setting name="cacheEnabled" value="true"/> |
| | | <!-- 延迟加载的全局开关。当开启时,所有关联对象都会延迟加载。默认 false --> |
| | | <!-- <setting name="lazyLoadingEnabled" value="true"/> --> |
| | | <setting name="mapUnderscoreToCamelCase" value="true"/><!--是否将map下划线方式转为驼峰式命名--> |
| | | <!-- 当开启时,任何方法的调用都会加载该对象的所有属性。默认 false,可通过select标签的 fetchType来覆盖--> |
| | | <!-- <setting name="aggressiveLazyLoading" value="false"/>--> |
| | | <!-- Mybatis 创建具有延迟加载能力的对象所用到的代理工具,默认JAVASSIST --> |
| | | <!--<setting name="proxyFactory" value="CGLIB" />--> |
| | | <!-- 关于mybatis的一二级缓存 请参照:https://tech.meituan.com/2018/01/19/mybatis-cache.html --> |
| | | <!-- 一级缓存范围默认:SESSION ,此范围在复杂应用场景中可能会出现脏读数据--> |
| | | <!-- STATEMENT级别的缓存,使一级缓存,只针对当前执行的这一statement有效 --> |
| | | <!--<setting name="localCacheScope" value="STATEMENT"/>--> |
| | | <setting name="localCacheScope" value="STATEMENT"/> |
| | | </settings> |
| | | |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE configuration |
| | | PUBLIC "-//mybatis.org//DTD Config 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-config.dtd"> |
| | | <configuration> |
| | | <!-- 全局参数 --> |
| | | <settings> |
| | | <!-- 使全局的映射器启用或禁用缓存 --> |
| | | <setting name="cacheEnabled" value="true" /> |
| | | <!-- 允许JDBC 支持自动生成主键 --> |
| | | <setting name="useGeneratedKeys" value="true" /> |
| | | <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 --> |
| | | <setting name="defaultExecutorType" value="SIMPLE" /> |
| | | <!-- 指定 MyBatis 所用日志的具体实现 --> |
| | | <setting name="logImpl" value="SLF4J" /> |
| | | <!-- 使用驼峰命名法转换字段 --> |
| | | <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> |
| | | </settings> |
| | | |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.6</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>ruoyi-common</artifactId> |
| | | |
| | | <description> |
| | | common通用工具 |
| | | </description> |
| | | <properties> |
| | | <swagger.fox.version>3.0.0</swagger.fox.version> |
| | | <swagger.core.version>1.6.2</swagger.core.version> |
| | | </properties> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.documents4j</groupId> |
| | | <artifactId>documents4j-local</artifactId> |
| | | <version>1.0.3</version> |
| | | |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.documents4j</groupId> |
| | | <artifactId>documents4j-transformer-msoffice-word</artifactId> |
| | | <version>1.0.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.freemarker</groupId> |
| | | <artifactId>freemarker</artifactId> |
| | | <version>2.3.33</version> |
| | | </dependency> |
| | | <!-- Spring框架基本的核心工具 --> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-context-support</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringWeb模块 --> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-web</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- spring security 安全认证 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-security</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- pagehelper 分页插件 --> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.pagehelper</groupId>--> |
| | | <!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- 自定义验证注解 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-validation</artifactId> |
| | | </dependency> |
| | | |
| | | <!--常用工具类 --> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-lang3</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- JSON工具类 --> |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | <artifactId>jackson-databind</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 动态数据源 --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>dynamic-datasource-spring-boot-starter</artifactId> |
| | | <version>3.5.2</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里JSON解析器 --> |
| | | <dependency> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- io常用工具类 --> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- excel工具 --> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.poi</groupId>--> |
| | | <!-- <artifactId>poi-ooxml</artifactId>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- yml解析器 --> |
| | | <dependency> |
| | | <groupId>org.yaml</groupId> |
| | | <artifactId>snakeyaml</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Token生成与解析--> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Jaxb --> |
| | | <dependency> |
| | | <groupId>javax.xml.bind</groupId> |
| | | <artifactId>jaxb-api</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- redis 缓存操作 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- pool 对象池 --> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-pool2</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 解析客户端操作系统、浏览器等 --> |
| | | <dependency> |
| | | <groupId>eu.bitwalker</groupId> |
| | | <artifactId>UserAgentUtils</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- servlet包 --> |
| | | <dependency> |
| | | <groupId>javax.servlet</groupId> |
| | | <artifactId>javax.servlet-api</artifactId> |
| | | </dependency> |
| | | <!--mybatis-plus--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.5.2</version> |
| | | </dependency> |
| | | <!--lombok--> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>3.0.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>knife4j-spring-boot-starter</artifactId> |
| | | <version>3.0.3</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>io.swagger</groupId>--> |
| | | <!-- <artifactId>swagger-models</artifactId>--> |
| | | <!-- <version>${swagger.core.version}</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>io.swagger</groupId>--> |
| | | <!-- <artifactId>swagger-annotations</artifactId>--> |
| | | <!-- <version>${swagger.core.version}</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>ws.schild</groupId> |
| | | <artifactId>jave-all-deps</artifactId> |
| | | <version>2.5.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.tencentcloudapi</groupId> |
| | | <artifactId>tencentcloud-sdk-java</artifactId> |
| | | <version>4.0.11</version> |
| | | </dependency> |
| | | |
| | | <!-- 工作流--> |
| | | <dependency> |
| | | <groupId>com.aizuda</groupId> |
| | | <artifactId>flowlong-spring-boot-starter</artifactId> |
| | | <version>1.0.4</version> |
| | | </dependency> |
| | | |
| | | <!-- hutool--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.8.4</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.sun.mail</groupId> |
| | | <artifactId>javax.mail</artifactId> |
| | | <version>1.6.2</version> <!-- 请检查是否有更新的版本 --> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 匿名访问不鉴权注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface Anonymous |
| | | { |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 数据权限过滤注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface DataScope |
| | | { |
| | | /** |
| | | * 部门表的别名 |
| | | */ |
| | | public String deptAlias() default ""; |
| | | |
| | | /** |
| | | * 用户表的别名 |
| | | */ |
| | | public String userAlias() default ""; |
| | | |
| | | /** |
| | | * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 |
| | | */ |
| | | public String permission() default ""; |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Inherited; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.ruoyi.common.enums.DataSourceType; |
| | | |
| | | /** |
| | | * 自定义多数据源切换注解 |
| | | * |
| | | * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | @Inherited |
| | | public @interface DataSource |
| | | { |
| | | /** |
| | | * 切换数据源名称 |
| | | */ |
| | | public DataSourceType value() default DataSourceType.MASTER; |
| | | } |
New file |
| | |
| | | //package com.ruoyi.common.annotation; |
| | | // |
| | | //import java.lang.annotation.ElementType; |
| | | //import java.lang.annotation.Retention; |
| | | //import java.lang.annotation.RetentionPolicy; |
| | | //import java.lang.annotation.Target; |
| | | //import java.math.BigDecimal; |
| | | //import org.apache.poi.ss.usermodel.HorizontalAlignment; |
| | | //import org.apache.poi.ss.usermodel.IndexedColors; |
| | | //import com.ruoyi.common.utils.poi.ExcelHandlerAdapter; |
| | | // |
| | | ///** |
| | | // * 自定义导出Excel数据注解 |
| | | // * |
| | | // * @author ruoyi |
| | | // */ |
| | | //@Retention(RetentionPolicy.RUNTIME) |
| | | //@Target(ElementType.FIELD) |
| | | //public @interface Excel |
| | | //{ |
| | | // /** |
| | | // * 导出时在excel中排序 |
| | | // */ |
| | | // public int sort() default Integer.MAX_VALUE; |
| | | // |
| | | // /** |
| | | // * 导出到Excel中的名字. |
| | | // */ |
| | | // public String name() default ""; |
| | | // |
| | | // /** |
| | | // * 日期格式, 如: yyyy-MM-dd |
| | | // */ |
| | | // public String dateFormat() default ""; |
| | | // |
| | | // /** |
| | | // * 如果是字典类型,请设置字典的type值 (如: sys_user_sex) |
| | | // */ |
| | | // public String dictType() default ""; |
| | | // |
| | | // /** |
| | | // * 读取内容转表达式 (如: 0=男,1=女,2=未知) |
| | | // */ |
| | | // public String readConverterExp() default ""; |
| | | // |
| | | // /** |
| | | // * 分隔符,读取字符串组内容 |
| | | // */ |
| | | // public String separator() default ","; |
| | | // |
| | | // /** |
| | | // * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化) |
| | | // */ |
| | | // public int scale() default -1; |
| | | // |
| | | // /** |
| | | // * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN |
| | | // */ |
| | | // public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; |
| | | // |
| | | // /** |
| | | // * 导出时在excel中每个列的高度 |
| | | // */ |
| | | // public double height() default 14; |
| | | // |
| | | // /** |
| | | // * 导出时在excel中每个列的宽度 |
| | | // */ |
| | | // public double width() default 16; |
| | | // |
| | | // /** |
| | | // * 文字后缀,如% 90 变成90% |
| | | // */ |
| | | // public String suffix() default ""; |
| | | // |
| | | // /** |
| | | // * 当值为空时,字段的默认值 |
| | | // */ |
| | | // public String defaultValue() default ""; |
| | | // |
| | | // /** |
| | | // * 提示信息 |
| | | // */ |
| | | // public String prompt() default ""; |
| | | // |
| | | // /** |
| | | // * 设置只能选择不能输入的列内容. |
| | | // */ |
| | | // public String[] combo() default {}; |
| | | // |
| | | // /** |
| | | // * 是否需要纵向合并单元格,应对需求:含有list集合单元格) |
| | | // */ |
| | | // public boolean needMerge() default false; |
| | | // |
| | | // /** |
| | | // * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. |
| | | // */ |
| | | // public boolean isExport() default true; |
| | | // |
| | | // /** |
| | | // * 另一个类中的属性名称,支持多级获取,以小数点隔开 |
| | | // */ |
| | | // public String targetAttr() default ""; |
| | | // |
| | | // /** |
| | | // * 是否自动统计数据,在最后追加一行统计数据总和 |
| | | // */ |
| | | // public boolean isStatistics() default false; |
| | | // |
| | | // /** |
| | | // * 导出类型(0数字 1字符串 2图片) |
| | | // */ |
| | | // public ColumnType cellType() default ColumnType.STRING; |
| | | // |
| | | // /** |
| | | // * 导出列头背景颜色 |
| | | // */ |
| | | // public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT; |
| | | // |
| | | // /** |
| | | // * 导出列头字体颜色 |
| | | // */ |
| | | // public IndexedColors headerColor() default IndexedColors.WHITE; |
| | | // |
| | | // /** |
| | | // * 导出单元格背景颜色 |
| | | // */ |
| | | // public IndexedColors backgroundColor() default IndexedColors.WHITE; |
| | | // |
| | | // /** |
| | | // * 导出单元格字体颜色 |
| | | // */ |
| | | // public IndexedColors color() default IndexedColors.BLACK; |
| | | // |
| | | // /** |
| | | // * 导出字段对齐方式 |
| | | // */ |
| | | // public HorizontalAlignment align() default HorizontalAlignment.CENTER; |
| | | // |
| | | // /** |
| | | // * 自定义数据处理器 |
| | | // */ |
| | | // public Class<?> handler() default ExcelHandlerAdapter.class; |
| | | // |
| | | // /** |
| | | // * 自定义数据处理器参数 |
| | | // */ |
| | | // public String[] args() default {}; |
| | | // |
| | | // /** |
| | | // * 字段类型(0:导出导入;1:仅导出;2:仅导入) |
| | | // */ |
| | | // Type type() default Type.ALL; |
| | | // |
| | | // public enum Type |
| | | // { |
| | | // ALL(0), EXPORT(1), IMPORT(2); |
| | | // private final int value; |
| | | // |
| | | // Type(int value) |
| | | // { |
| | | // this.value = value; |
| | | // } |
| | | // |
| | | // public int value() |
| | | // { |
| | | // return this.value; |
| | | // } |
| | | // } |
| | | // |
| | | // public enum ColumnType |
| | | // { |
| | | // NUMERIC(0), STRING(1), IMAGE(2); |
| | | // private final int value; |
| | | // |
| | | // ColumnType(int value) |
| | | // { |
| | | // this.value = value; |
| | | // } |
| | | // |
| | | // public int value() |
| | | // { |
| | | // return this.value; |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * Excel注解集 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.FIELD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface Excels |
| | | { |
| | | // public Excel[] value(); |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.OperatorType; |
| | | |
| | | /** |
| | | * 自定义操作日志记录注解 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | @Target({ ElementType.PARAMETER, ElementType.METHOD }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface Log |
| | | { |
| | | /** |
| | | * 模块 |
| | | */ |
| | | public String title() default ""; |
| | | |
| | | /** |
| | | * 功能 |
| | | */ |
| | | public BusinessType businessType() default BusinessType.OTHER; |
| | | |
| | | /** |
| | | * 操作人类别 |
| | | */ |
| | | public OperatorType operatorType() default OperatorType.MANAGE; |
| | | |
| | | /** |
| | | * 是否保存请求的参数 |
| | | */ |
| | | public boolean isSaveRequestData() default true; |
| | | |
| | | /** |
| | | * 是否保存响应的参数 |
| | | */ |
| | | public boolean isSaveResponseData() default true; |
| | | |
| | | /** |
| | | * 排除指定的请求参数 |
| | | */ |
| | | public String[] excludeParamNames() default {}; |
| | | } |
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java
ruoyi-common/src/main/java/com/ruoyi/common/basic/PageInfo.java
ruoyi-common/src/main/java/com/ruoyi/common/config/FileUploadConfig.java
ruoyi-common/src/main/java/com/ruoyi/common/config/MailProperties.java
ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
ruoyi-common/src/main/java/com/ruoyi/common/config/SmsProperties.java
ruoyi-common/src/main/java/com/ruoyi/common/config/WxConfig.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/AmountConstant.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/DictConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/WxConstant.java
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/FileController.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseModel.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BasePage.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/TTenantResp.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUserApplet.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/TimeRangeQueryBody.java
ruoyi-common/src/main/java/com/ruoyi/common/core/exception/ServiceException.java
ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java
ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java
ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java
ruoyi-common/src/main/java/com/ruoyi/common/core/utils/Constants.java
ruoyi-common/src/main/java/com/ruoyi/common/core/utils/HttpUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/BillTypeEnum.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/DisabledEnum.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/ProcessCategoryEnum.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/StateProcessActionEnum.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/SubmitStatusEnum.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/TaskEventType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/UpdateTypeEnum.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/state/StateErrorCode.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/BlackListException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java
ruoyi-common/src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java
ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java
ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java
ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java
ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java
ruoyi-common/src/main/java/com/ruoyi/common/redis/configure/FastJson2JsonRedisSerializer.java
ruoyi-common/src/main/java/com/ruoyi/common/redis/service/RedisService.java
ruoyi-common/src/main/java/com/ruoyi/common/resp/AccessTokenRespBody.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/CodeGenerateUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/IDCardUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/MultipartFileUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/OrderNos.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/TimeConverter.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/VideoUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/WebUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxAppletTools.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanValidators.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelHandlerAdapter.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java
ruoyi-framework/pom.xml
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java
ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java
ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
ruoyi-generator/pom.xml
ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
ruoyi-generator/src/main/resources/generator.yml
ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
ruoyi-generator/src/main/resources/vm/java/controller.java.vm
ruoyi-generator/src/main/resources/vm/java/domain.java.vm
ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
ruoyi-generator/src/main/resources/vm/java/service.java.vm
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm
ruoyi-generator/src/main/resources/vm/js/api.js.vm
ruoyi-generator/src/main/resources/vm/sql/sql.vm
ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
ruoyi-quartz/pom.xml
ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml
ruoyi-system/pom.xml
ruoyi-system/src/main/java/com/ruoyi/system/bo/DeployBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessAgreeBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessCreateBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessModuleUpdateBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessRefuseBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessStartBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessTaskListBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessTemplatePageBO.java
ruoyi-system/src/main/java/com/ruoyi/system/bo/ProcessUpdateBO.java
ruoyi-system/src/main/java/com/ruoyi/system/code/SubmitTemplateReg.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/BatchBillDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/BillStatisticsDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/CachPayDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/DataScreeningDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/MakeOrderDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/MakeOrderResp.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/OfflinePayCheckDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/OfflinePayDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/RevokeDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/SetContractDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/SignContractDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/SmsByBillDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/SysRoleDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/SysUserUpdateStatusDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TContractDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TDeptUpAndDownDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TExamineDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TFaultRepairMessageDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/THouseDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TInvoiceDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TTenantDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TbillSaveDto.java
ruoyi-system/src/main/java/com/ruoyi/system/dto/TerminateContractDTO.java
ruoyi-system/src/main/java/com/ruoyi/system/export/ContractExport.java
ruoyi-system/src/main/java/com/ruoyi/system/export/OpticalInspectionExport.java
ruoyi-system/src/main/java/com/ruoyi/system/importExcel/TBankFlowImportExcel.java
ruoyi-system/src/main/java/com/ruoyi/system/importExcel/TCheckImportExcel.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/StateProcessExtInstanceMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/StateProcessInstanceActionMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/StateProcessModuleMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/StateProcessTemplateMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/StateTaskCenterMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysFileMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBankFlowMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBannerMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillConfirmMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillDetailMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCheckAcceptRecordMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TContractMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TContractRentTypeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDeptMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDeptToUserMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TFaultAreaDicMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TFaultDescribeDicMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TFaultRepairMessageMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TFlowManagementMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/THouseMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TInformationMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TInvoiceMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TInvoiceToBillMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TItemMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TItemTypeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TOrderBillMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TPayOrderMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TSysConfigMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTenantMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/model/StateProcessExtInstance.java
ruoyi-system/src/main/java/com/ruoyi/system/model/StateProcessInstanceAction.java
ruoyi-system/src/main/java/com/ruoyi/system/model/StateProcessModule.java
ruoyi-system/src/main/java/com/ruoyi/system/model/StateProcessTemplate.java
ruoyi-system/src/main/java/com/ruoyi/system/model/StateTaskCenter.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TBankFlow.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TBanner.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TBill.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TBillConfirm.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TBillDetail.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TCheckAcceptRecord.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TContract.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TContractRentType.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TDept.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TDeptToUser.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TFaultAreaDic.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TFaultDescribeDic.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TFaultRepairMessage.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TFile.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TFlowManagement.java
ruoyi-system/src/main/java/com/ruoyi/system/model/THouse.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TInformation.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TInvoice.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TInvoiceToBill.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TItem.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TItemType.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TOrderBill.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TPayOrder.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TSysConfig.java
ruoyi-system/src/main/java/com/ruoyi/system/model/TTenant.java
ruoyi-system/src/main/java/com/ruoyi/system/query/SysOperLogQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/SysRoleQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/SysUserQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TBankFlowQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TBannerQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TBillAppletQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TBillQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TCheckAcceptRecordAppletQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TCheckAcceptRecordQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TContractAppletQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TContractBillQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TContractQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TDeptQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TExamineAppletQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TFaultAreaDicQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TFaultDescribeDicQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TFaultRepairMessageAppletQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TFaultRepairMessageQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TFlowManagementQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/THouseQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TInformationQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TInvoiceQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TInvoiceToBillQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TItemQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TItemTypeQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TTenantAppletQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TTenantQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/query/TUserHistoryQuery.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/StateProcessExtInstanceService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/StateProcessInstanceActionService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/StateProcessModuleService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/StateProcessTemplateService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/StateTaskCenterService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/SysFileService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TBankFlowService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TBannerService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TBillConfirmService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TBillDetailService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TCheckAcceptRecordService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TContractRentTypeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TContractService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TDeptService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TDeptToUserService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TFaultAreaDicService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TFaultDescribeDicService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TFaultRepairMessageService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TFlowManagementService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/THouseService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TInformationService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TInvoiceService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TInvoiceToBillService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TItemService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TItemTypeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TOrderBillService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TPayOrderService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TSysConfigService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/TTenantService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessExtInstanceServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessInstanceActionServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessModuleServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessTemplateServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateTaskCenterServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysFileServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBankFlowServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBannerServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillConfirmServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillDetailServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCheckAcceptRecordServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractRentTypeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeptServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeptToUserServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TFaultAreaDicServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TFaultDescribeDicServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TFaultRepairMessageServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TFlowManagementServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/THouseServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInformationServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInvoiceServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInvoiceToBillServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TItemServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TItemTypeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TOrderBillServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPayOrderServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysConfigServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTenantServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/task/base/AbstractJob.java
ruoyi-system/src/main/java/com/ruoyi/system/task/base/QuartzManager.java
ruoyi-system/src/main/java/com/ruoyi/system/task/base/TimeJobType.java
ruoyi-system/src/main/java/com/ruoyi/system/task/exceptions/TimeException.java
ruoyi-system/src/main/java/com/ruoyi/system/task/jobs/StateProcessJob.java
ruoyi-system/src/main/java/com/ruoyi/system/task/utils/SpringContextsUtil.java
ruoyi-system/src/main/java/com/ruoyi/system/task/utils/TaskUtil.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/body/resp/AccessTokenRespBody.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/body/resp/Code2SessionRespBody.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/body/resp/RespBody.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/body/resq/Code2SessionResqBody.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/model/WeixinProperties.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/pojo/AppletPhoneEncrypteData.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/pojo/AppletUserDecodeData.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/pojo/AppletUserEncrypteData.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/pojo/Watermark.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/SHA1.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/WebUtils.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/WxAppletTools.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/WxCache.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/WxCacheTemplate.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/WxException.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/WxJsonUtils.java
ruoyi-system/src/main/java/com/ruoyi/system/utils/wx/tools/WxUtils.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/BillVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/CheckAcceptRecordVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/DeptVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/ExamineVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/FaultConcatInfoVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/HouseVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/MyHouseVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/MyToDoVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/PayListVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/ProcessDetailVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/ProcessTaskListVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/RoleInfoVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/SysOperLogVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/SysUserVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TBankFlowStatisticsVo.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TBillVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TCheckAcceptRecordVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TContractAppletVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TContractVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TFaultAreaDicVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TFaultDescribeDicVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TFaultRepairMessageVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TFlowManagementStatisticsVo.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TItemTypeVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TItemVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/TenantVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/UserAddListVO.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/UserInfoVo.java
ruoyi-system/src/main/java/com/ruoyi/system/vo/UserLevelVO.java
ruoyi-system/src/main/resources/mapper/system/StateProcessInstanceActionMapper.xml
ruoyi-system/src/main/resources/mapper/system/StateProcessTemplateMapper.xml
ruoyi-system/src/main/resources/mapper/system/StateTaskCenterMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
ruoyi-system/src/main/resources/mapper/system/TBankFlowMapper.xml
ruoyi-system/src/main/resources/mapper/system/TBannerMapper.xml
ruoyi-system/src/main/resources/mapper/system/TBillConfirmMapper.xml
ruoyi-system/src/main/resources/mapper/system/TBillDetailMapper.xml
ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml
ruoyi-system/src/main/resources/mapper/system/TCheckAcceptRecordMapper.xml
ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
ruoyi-system/src/main/resources/mapper/system/TContractRentTypeMapper.xml
ruoyi-system/src/main/resources/mapper/system/TDeptMapper.xml
ruoyi-system/src/main/resources/mapper/system/TDeptToUserMapper.xml
ruoyi-system/src/main/resources/mapper/system/TFaultAreaDicMapper.xml
ruoyi-system/src/main/resources/mapper/system/TFaultDescribeDicMapper.xml
ruoyi-system/src/main/resources/mapper/system/TFaultRepairMessageMapper.xml
ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml
ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml
ruoyi-system/src/main/resources/mapper/system/TInformationMapper.xml
ruoyi-system/src/main/resources/mapper/system/TInvoiceMapper.xml
ruoyi-system/src/main/resources/mapper/system/TInvoiceToBillMapper.xml
ruoyi-system/src/main/resources/mapper/system/TItemMapper.xml
ruoyi-system/src/main/resources/mapper/system/TItemTypeMapper.xml
ruoyi-system/src/main/resources/mapper/system/TSysConfigMapper.xml
ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml
ruoyi-ui/.editorconfig
ruoyi-ui/.env.development
ruoyi-ui/.env.production
ruoyi-ui/.env.staging
ruoyi-ui/.eslintignore
ruoyi-ui/.eslintrc.js
ruoyi-ui/.gitignore
ruoyi-ui/README.md
ruoyi-ui/babel.config.js
ruoyi-ui/bin/build.bat
ruoyi-ui/bin/package.bat
ruoyi-ui/bin/run-web.bat
ruoyi-ui/build/index.js
ruoyi-ui/package.json
ruoyi-ui/public/favicon.ico
ruoyi-ui/public/html/ie.html
ruoyi-ui/public/index.html
ruoyi-ui/public/robots.txt
ruoyi-ui/src/App.vue
ruoyi-ui/src/api/login.js
ruoyi-ui/src/api/menu.js
ruoyi-ui/src/api/monitor/cache.js
ruoyi-ui/src/api/monitor/job.js
ruoyi-ui/src/api/monitor/jobLog.js
ruoyi-ui/src/api/monitor/logininfor.js
ruoyi-ui/src/api/monitor/online.js
ruoyi-ui/src/api/monitor/operlog.js
ruoyi-ui/src/api/monitor/server.js
ruoyi-ui/src/api/system/config.js
ruoyi-ui/src/api/system/dept.js
ruoyi-ui/src/api/system/dict/data.js
ruoyi-ui/src/api/system/dict/type.js
ruoyi-ui/src/api/system/menu.js
ruoyi-ui/src/api/system/notice.js
ruoyi-ui/src/api/system/post.js
ruoyi-ui/src/api/system/role.js
ruoyi-ui/src/api/system/user.js
ruoyi-ui/src/api/tool/gen.js
ruoyi-ui/src/api/type/type.js
ruoyi-ui/src/assets/401_images/401.gif
ruoyi-ui/src/assets/404_images/404.png
ruoyi-ui/src/assets/404_images/404_cloud.png
ruoyi-ui/src/assets/icons/index.js
ruoyi-ui/src/assets/icons/svg/404.svg
ruoyi-ui/src/assets/icons/svg/bug.svg
ruoyi-ui/src/assets/icons/svg/build.svg
ruoyi-ui/src/assets/icons/svg/button.svg
ruoyi-ui/src/assets/icons/svg/cascader.svg
ruoyi-ui/src/assets/icons/svg/chart.svg
ruoyi-ui/src/assets/icons/svg/checkbox.svg
ruoyi-ui/src/assets/icons/svg/clipboard.svg
ruoyi-ui/src/assets/icons/svg/code.svg
ruoyi-ui/src/assets/icons/svg/color.svg
ruoyi-ui/src/assets/icons/svg/component.svg
ruoyi-ui/src/assets/icons/svg/dashboard.svg
ruoyi-ui/src/assets/icons/svg/date-range.svg
ruoyi-ui/src/assets/icons/svg/date.svg
ruoyi-ui/src/assets/icons/svg/dict.svg
ruoyi-ui/src/assets/icons/svg/documentation.svg
ruoyi-ui/src/assets/icons/svg/download.svg
ruoyi-ui/src/assets/icons/svg/drag.svg
ruoyi-ui/src/assets/icons/svg/druid.svg
ruoyi-ui/src/assets/icons/svg/edit.svg
ruoyi-ui/src/assets/icons/svg/education.svg
ruoyi-ui/src/assets/icons/svg/email.svg
ruoyi-ui/src/assets/icons/svg/example.svg
ruoyi-ui/src/assets/icons/svg/excel.svg
ruoyi-ui/src/assets/icons/svg/exit-fullscreen.svg
ruoyi-ui/src/assets/icons/svg/eye-open.svg
ruoyi-ui/src/assets/icons/svg/eye.svg
ruoyi-ui/src/assets/icons/svg/form.svg
ruoyi-ui/src/assets/icons/svg/fullscreen.svg
ruoyi-ui/src/assets/icons/svg/github.svg
ruoyi-ui/src/assets/icons/svg/guide.svg
ruoyi-ui/src/assets/icons/svg/icon.svg
ruoyi-ui/src/assets/icons/svg/input.svg
ruoyi-ui/src/assets/icons/svg/international.svg
ruoyi-ui/src/assets/icons/svg/job.svg
ruoyi-ui/src/assets/icons/svg/language.svg
ruoyi-ui/src/assets/icons/svg/link.svg
ruoyi-ui/src/assets/icons/svg/list.svg
ruoyi-ui/src/assets/icons/svg/lock.svg
ruoyi-ui/src/assets/icons/svg/log.svg
ruoyi-ui/src/assets/icons/svg/logininfor.svg
ruoyi-ui/src/assets/icons/svg/message.svg
ruoyi-ui/src/assets/icons/svg/money.svg
ruoyi-ui/src/assets/icons/svg/monitor.svg
ruoyi-ui/src/assets/icons/svg/nested.svg
ruoyi-ui/src/assets/icons/svg/number.svg
ruoyi-ui/src/assets/icons/svg/online.svg
ruoyi-ui/src/assets/icons/svg/password.svg
ruoyi-ui/src/assets/icons/svg/pdf.svg
ruoyi-ui/src/assets/icons/svg/people.svg
ruoyi-ui/src/assets/icons/svg/peoples.svg
ruoyi-ui/src/assets/icons/svg/phone.svg
ruoyi-ui/src/assets/icons/svg/post.svg
ruoyi-ui/src/assets/icons/svg/qq.svg
ruoyi-ui/src/assets/icons/svg/question.svg
ruoyi-ui/src/assets/icons/svg/radio.svg
ruoyi-ui/src/assets/icons/svg/rate.svg
ruoyi-ui/src/assets/icons/svg/redis-list.svg
ruoyi-ui/src/assets/icons/svg/redis.svg
ruoyi-ui/src/assets/icons/svg/row.svg
ruoyi-ui/src/assets/icons/svg/search.svg
ruoyi-ui/src/assets/icons/svg/select.svg
ruoyi-ui/src/assets/icons/svg/server.svg
ruoyi-ui/src/assets/icons/svg/shopping.svg
ruoyi-ui/src/assets/icons/svg/size.svg
ruoyi-ui/src/assets/icons/svg/skill.svg
ruoyi-ui/src/assets/icons/svg/slider.svg
ruoyi-ui/src/assets/icons/svg/star.svg
ruoyi-ui/src/assets/icons/svg/swagger.svg
ruoyi-ui/src/assets/icons/svg/switch.svg
ruoyi-ui/src/assets/icons/svg/system.svg
ruoyi-ui/src/assets/icons/svg/tab.svg
ruoyi-ui/src/assets/icons/svg/table.svg
ruoyi-ui/src/assets/icons/svg/textarea.svg
ruoyi-ui/src/assets/icons/svg/theme.svg
ruoyi-ui/src/assets/icons/svg/time-range.svg
ruoyi-ui/src/assets/icons/svg/time.svg
ruoyi-ui/src/assets/icons/svg/tool.svg
ruoyi-ui/src/assets/icons/svg/tree-table.svg
ruoyi-ui/src/assets/icons/svg/tree.svg
ruoyi-ui/src/assets/icons/svg/upload.svg
ruoyi-ui/src/assets/icons/svg/user.svg
ruoyi-ui/src/assets/icons/svg/validCode.svg
ruoyi-ui/src/assets/icons/svg/wechat.svg
ruoyi-ui/src/assets/icons/svg/zip.svg
ruoyi-ui/src/assets/icons/svgo.yml
ruoyi-ui/src/assets/images/dark.svg
ruoyi-ui/src/assets/images/light.svg
ruoyi-ui/src/assets/images/login-background.jpg
ruoyi-ui/src/assets/images/pay.png
ruoyi-ui/src/assets/images/profile.jpg
ruoyi-ui/src/assets/logo/logo.png
ruoyi-ui/src/assets/styles/btn.scss
ruoyi-ui/src/assets/styles/element-ui.scss
ruoyi-ui/src/assets/styles/element-variables.scss
ruoyi-ui/src/assets/styles/index.scss
ruoyi-ui/src/assets/styles/mixin.scss
ruoyi-ui/src/assets/styles/ruoyi.scss
ruoyi-ui/src/assets/styles/sidebar.scss
ruoyi-ui/src/assets/styles/transition.scss
ruoyi-ui/src/assets/styles/variables.scss
ruoyi-ui/src/components/Breadcrumb/index.vue
ruoyi-ui/src/components/Crontab/day.vue
ruoyi-ui/src/components/Crontab/hour.vue
ruoyi-ui/src/components/Crontab/index.vue
ruoyi-ui/src/components/Crontab/min.vue
ruoyi-ui/src/components/Crontab/month.vue
ruoyi-ui/src/components/Crontab/result.vue
ruoyi-ui/src/components/Crontab/second.vue
ruoyi-ui/src/components/Crontab/week.vue
ruoyi-ui/src/components/Crontab/year.vue
ruoyi-ui/src/components/DictData/index.js
ruoyi-ui/src/components/DictTag/index.vue
ruoyi-ui/src/components/Editor/index.vue
ruoyi-ui/src/components/FileUpload/index.vue
ruoyi-ui/src/components/Hamburger/index.vue
ruoyi-ui/src/components/HeaderSearch/index.vue
ruoyi-ui/src/components/IconSelect/index.vue
ruoyi-ui/src/components/IconSelect/requireIcons.js
ruoyi-ui/src/components/ImagePreview/index.vue
ruoyi-ui/src/components/ImageUpload/index.vue
ruoyi-ui/src/components/Pagination/index.vue
ruoyi-ui/src/components/PanThumb/index.vue
ruoyi-ui/src/components/ParentView/index.vue
ruoyi-ui/src/components/RightPanel/index.vue
ruoyi-ui/src/components/RightToolbar/index.vue
ruoyi-ui/src/components/RuoYi/Doc/index.vue
ruoyi-ui/src/components/RuoYi/Git/index.vue
ruoyi-ui/src/components/Screenfull/index.vue
ruoyi-ui/src/components/SizeSelect/index.vue
ruoyi-ui/src/components/SvgIcon/index.vue
ruoyi-ui/src/components/ThemePicker/index.vue
ruoyi-ui/src/components/TopNav/index.vue
ruoyi-ui/src/components/iFrame/index.vue
ruoyi-ui/src/directive/dialog/drag.js
ruoyi-ui/src/directive/dialog/dragHeight.js
ruoyi-ui/src/directive/dialog/dragWidth.js
ruoyi-ui/src/directive/index.js
ruoyi-ui/src/directive/module/clipboard.js
ruoyi-ui/src/directive/permission/hasPermi.js
ruoyi-ui/src/directive/permission/hasRole.js
ruoyi-ui/src/layout/components/AppMain.vue
ruoyi-ui/src/layout/components/IframeToggle/index.vue
ruoyi-ui/src/layout/components/InnerLink/index.vue
ruoyi-ui/src/layout/components/Navbar.vue
ruoyi-ui/src/layout/components/Settings/index.vue
ruoyi-ui/src/layout/components/Sidebar/FixiOSBug.js
ruoyi-ui/src/layout/components/Sidebar/Item.vue
ruoyi-ui/src/layout/components/Sidebar/Link.vue
ruoyi-ui/src/layout/components/Sidebar/Logo.vue
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue
ruoyi-ui/src/layout/components/Sidebar/index.vue
ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue
ruoyi-ui/src/layout/components/TagsView/index.vue
ruoyi-ui/src/layout/components/index.js
ruoyi-ui/src/layout/index.vue
ruoyi-ui/src/layout/mixin/ResizeHandler.js
ruoyi-ui/src/main.js
ruoyi-ui/src/permission.js
ruoyi-ui/src/plugins/auth.js
ruoyi-ui/src/plugins/cache.js
ruoyi-ui/src/plugins/download.js
ruoyi-ui/src/plugins/index.js
ruoyi-ui/src/plugins/modal.js
ruoyi-ui/src/plugins/tab.js
ruoyi-ui/src/router/index.js
ruoyi-ui/src/settings.js
ruoyi-ui/src/store/getters.js
ruoyi-ui/src/store/index.js
ruoyi-ui/src/store/modules/app.js
ruoyi-ui/src/store/modules/dict.js
ruoyi-ui/src/store/modules/permission.js
ruoyi-ui/src/store/modules/settings.js
ruoyi-ui/src/store/modules/tagsView.js
ruoyi-ui/src/store/modules/user.js
ruoyi-ui/src/utils/auth.js
ruoyi-ui/src/utils/dict/Dict.js
ruoyi-ui/src/utils/dict/DictConverter.js
ruoyi-ui/src/utils/dict/DictData.js
ruoyi-ui/src/utils/dict/DictMeta.js
ruoyi-ui/src/utils/dict/DictOptions.js
ruoyi-ui/src/utils/dict/index.js
ruoyi-ui/src/utils/errorCode.js
ruoyi-ui/src/utils/generator/config.js
ruoyi-ui/src/utils/generator/css.js
ruoyi-ui/src/utils/generator/drawingDefault.js
ruoyi-ui/src/utils/generator/html.js
ruoyi-ui/src/utils/generator/icon.json
ruoyi-ui/src/utils/generator/js.js
ruoyi-ui/src/utils/generator/render.js
ruoyi-ui/src/utils/index.js
ruoyi-ui/src/utils/jsencrypt.js
ruoyi-ui/src/utils/permission.js
ruoyi-ui/src/utils/request.js
ruoyi-ui/src/utils/ruoyi.js
ruoyi-ui/src/utils/scroll-to.js
ruoyi-ui/src/utils/validate.js
ruoyi-ui/src/views/components/icons/element-icons.js
ruoyi-ui/src/views/components/icons/index.vue
ruoyi-ui/src/views/components/icons/svg-icons.js
ruoyi-ui/src/views/dashboard/BarChart.vue
ruoyi-ui/src/views/dashboard/LineChart.vue
ruoyi-ui/src/views/dashboard/PanelGroup.vue
ruoyi-ui/src/views/dashboard/PieChart.vue
ruoyi-ui/src/views/dashboard/RaddarChart.vue
ruoyi-ui/src/views/dashboard/mixins/resize.js
ruoyi-ui/src/views/error/401.vue
ruoyi-ui/src/views/error/404.vue
ruoyi-ui/src/views/index.vue
ruoyi-ui/src/views/index_v1.vue
ruoyi-ui/src/views/login.vue
ruoyi-ui/src/views/monitor/cache/index.vue
ruoyi-ui/src/views/monitor/cache/list.vue
ruoyi-ui/src/views/monitor/druid/index.vue
ruoyi-ui/src/views/monitor/job/index.vue
ruoyi-ui/src/views/monitor/job/log.vue
ruoyi-ui/src/views/monitor/logininfor/index.vue
ruoyi-ui/src/views/monitor/online/index.vue
ruoyi-ui/src/views/monitor/operlog/index.vue
ruoyi-ui/src/views/monitor/server/index.vue
ruoyi-ui/src/views/redirect.vue
ruoyi-ui/src/views/register.vue
ruoyi-ui/src/views/system/config/index.vue
ruoyi-ui/src/views/system/dept/index.vue
ruoyi-ui/src/views/system/dict/data.vue
ruoyi-ui/src/views/system/dict/index.vue
ruoyi-ui/src/views/system/menu/index.vue
ruoyi-ui/src/views/system/notice/index.vue
ruoyi-ui/src/views/system/post/index.vue
ruoyi-ui/src/views/system/role/authUser.vue
ruoyi-ui/src/views/system/role/index.vue
ruoyi-ui/src/views/system/role/selectUser.vue
ruoyi-ui/src/views/system/user/authRole.vue
ruoyi-ui/src/views/system/user/index.vue
ruoyi-ui/src/views/system/user/profile/index.vue
ruoyi-ui/src/views/system/user/profile/resetPwd.vue
ruoyi-ui/src/views/system/user/profile/userAvatar.vue
ruoyi-ui/src/views/system/user/profile/userInfo.vue
ruoyi-ui/src/views/tool/build/CodeTypeDialog.vue
ruoyi-ui/src/views/tool/build/DraggableItem.vue
ruoyi-ui/src/views/tool/build/IconsDialog.vue
ruoyi-ui/src/views/tool/build/RightPanel.vue
ruoyi-ui/src/views/tool/build/TreeNodeDialog.vue
ruoyi-ui/src/views/tool/build/index.vue
ruoyi-ui/src/views/tool/gen/basicInfoForm.vue
ruoyi-ui/src/views/tool/gen/editTable.vue
ruoyi-ui/src/views/tool/gen/genInfoForm.vue
ruoyi-ui/src/views/tool/gen/importTable.vue
ruoyi-ui/src/views/tool/gen/index.vue
ruoyi-ui/src/views/tool/swagger/index.vue
ruoyi-ui/vue.config.js
sql/xizang.sql |