Commit 883bd00d by zhangzhijie

统计分析项目初始化

parents
# http://editorconfig.org
root = true
# 空格替代Tab缩进在各种编辑工具下效果一致
[*]
indent_style = space
indent_size = 4
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.java]
indent_style = tab
[*.{json,yml}]
indent_size = 2
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
/target/
.idea/
.mvn/
.classpath
.project
.settings
##filter databfile、sln file##*.mdb
*.ldb
*.sln
##class file##*.com
*.class
*.dll
*.exe
*.o
*.so
# compression file
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.iml
*.ipr
*.iws
# Compiled class file
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.war
*.ear
*.zip
*.tar.gz
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*.bak
### Maven templatepom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
/.idea/
/.idea/
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER smallchill@163.com
RUN mkdir -p /blade
WORKDIR /blade
EXPOSE 8800
ADD ./target/SpringBlade.jar ./app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 启动器
*
* @author Chill
*/
@EnableScheduling
@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
@EnableAsync
@EnableAspectJAutoProxy(exposeProxy = true)
public class Application {
public static void main(String[] args) {
BladeApplication.run(LauncherConstant.APPLICATION_NAME, Application.class, args);
}
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.common.cache;
/**
* 缓存名
*
* @author Chill
*/
public interface CacheNames {
String NOTICE_ONE = "notice:one";
String DICT_VALUE = "dict:value";
String DICT_LIST = "dict:list";
String CAPTCHA_KEY = "blade:auth::captcha:";
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.common.config;
import org.springblade.core.secure.registry.SecureRegistry;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Blade配置
*
* @author Chill
*/
@Configuration
public class BladeConfiguration implements WebMvcConfigurer {
@Bean
public SecureRegistry secureRegistry() {
SecureRegistry secureRegistry = new SecureRegistry();
secureRegistry.setEnabled(true);
secureRegistry.excludePathPatterns("/dddl/**");
secureRegistry.excludePathPatterns("/selectXsByAsjbh");
secureRegistry.excludePathPatterns("/selectThtjByAsjbh");
secureRegistry.excludePathPatterns("/blade-auth/**");
secureRegistry.excludePathPatterns("/api/sys/**");
secureRegistry.excludePathPatterns("/blade-log/**");
secureRegistry.excludePathPatterns("/blade-system/menu/auth-routes");
secureRegistry.excludePathPatterns("/doc.html");
secureRegistry.excludePathPatterns("/js/**");
secureRegistry.excludePathPatterns("/webjars/**");
secureRegistry.excludePathPatterns("/swagger-resources/**");
secureRegistry.excludePathPatterns("/ajzljc/**");
secureRegistry.excludePathPatterns("/refreshCodeCache");
secureRegistry.excludePathPatterns("/reloadSysDict");
secureRegistry.excludePathPatterns("/refreCaCheCode");
secureRegistry.excludePathPatterns("/xsbk/executeBkTask");
secureRegistry.excludePathPatterns("/ajQuery/initTh");
secureRegistry.excludePathPatterns("/hcyprw/getFkfjByXxzjbh");
secureRegistry.excludePathPatterns("/tjpg/*");
secureRegistry.excludePathPatterns("/bbkwp/*");
secureRegistry.excludePathPatterns("/queryCodeByType");
secureRegistry.excludePathPatterns("/whitelist/check");
secureRegistry.excludePathPatterns("/qqzc/flow/getDzqqByAsjbhAndSjh");
secureRegistry.excludePathPatterns("/qqzc/flow/getDzqqByAsjbhAndSjhCount");
secureRegistry.excludePathPatterns("/qqzc/flow/exportDzqqByAsjbhAndSjh");
secureRegistry.excludePathPatterns("/qqzc/flow/getDzqqListByAsjbh");
secureRegistry.excludePathPatterns("/qqzc/flow/getDzqqListByAsjbhCount");
// secureRegistry.excludePathPatterns("/**");
//放开调证请求测试controller
secureRegistry.excludePathPatterns("/qqzc/**");
secureRegistry.excludePathPatterns("/detail/**");
// secureRegistry.excludePathPatterns("/cbxsz/**");
/*secureRegistry.excludePathPatterns("/**");
secureRegistry.excludePathPatterns("/ajDetail/**");
secureRegistry.excludePathPatterns("/tbstAsj/stasj*");
secureRegistry.excludePathPatterns("/matj*");
secureRegistry.excludePathPatterns("/tbstAsj/stasjCj*");
secureRegistry.excludePathPatterns("/tbStRyZp/**");
secureRegistry.excludePathPatterns("/flwsFj*");
secureRegistry.excludePathPatterns("/maMaptj*");
secureRegistry.excludePathPatterns("/getFlwsCountForAutoCheck");
secureRegistry.excludePathPatterns("/getFlwsForAutoSwCheck");
secureRegistry.excludePathPatterns("/ajxq*");
secureRegistry.excludePathPatterns("/ajsp*");*/
return secureRegistry;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/js/**").addResourceLocations("classpath:/js/");
registry.addResourceHandler("doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
package org.springblade.common.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Created by admin on 2021/5/13.
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry){
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowCredentials(true)
.allowedMethods("*")
.maxAge(3600)
;
}
}
package org.springblade.common.config;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.InetAddress;
/**
* 允许跨域请求
*
* @author Administrator
*/
@Component
public class FilterConfig implements HandlerInterceptor {
@Override
public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
throws Exception {
}
public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2)
throws Exception {
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object arg2) throws Exception {
//支持跨域请求
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Methods", "*");
//是否支持cookie跨域
response.setHeader("Access-Control-Allow-Credentials", "true");
//Origin, X-Requested-With, Content-Type, Accept,Access-Token
response.setHeader("Access-Control-Allow-Headers",
"Authorization,Origin, X-Requested-With, Content-Type, Accept,Access-Token,blade-auth");
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
if ("127.0.0.1".equals(ip) || "0:0:0:0:0:0:0:1".equals(ip)) {
ip = InetAddress.getLocalHost().getHostAddress();
}
String url = "http://" + ip + ":" +
request.getServerPort() +
request.getRequestURI();
System.out.println(url);
return true;
}
}
//package org.springblade.common.config.mongo;
//
//import com.mongodb.MongoClientSettings;
//import com.mongodb.MongoCredential;
//import com.mongodb.ServerAddress;
//import com.mongodb.client.MongoClient;
//import com.mongodb.client.MongoClients;
//import com.mongodb.connection.ConnectionPoolSettings;
//import lombok.Getter;
//import lombok.Setter;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.SimpleMongoClientDatabaseFactory;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author szLi
// * @date 2021/11/11 9:54
// */
//@Getter
//@Setter
//public abstract class AbstractMongoConfigure {
// private String database;
//
// private String host;
//
// private int port;
//
// private String authenticationDatabase;
//
// private String username;
//
// private String password;
//
// public SimpleMongoClientDatabaseFactory mongoDbFactory() {
// MongoClientSettings settings = null;
// ConnectionPoolSettings poolSetting=ConnectionPoolSettings.builder().build();
// List<ServerAddress> serverAddressList=new ArrayList<>();
// serverAddressList.add(new ServerAddress(host, port));
// if(StringUtils.isNotBlank(username)) {
// MongoCredential credential = MongoCredential.createScramSha1Credential(username,
// authenticationDatabase, password.toCharArray());
// settings = MongoClientSettings.builder()
// .credential(credential)
// .applyToConnectionPoolSettings(builder->builder.applySettings(poolSetting))
// .applyToClusterSettings(builder -> builder.hosts(serverAddressList)).build();
// }else {
// settings = MongoClientSettings.builder().applyToConnectionPoolSettings(builder->builder.applySettings(poolSetting))
// .applyToClusterSettings(builder -> builder.hosts(serverAddressList)).build();
// }
//
// MongoClient mongoClient= MongoClients.create(settings);
// SimpleMongoClientDatabaseFactory factory = new SimpleMongoClientDatabaseFactory(mongoClient,
// database);
//
// return factory;
// }
//
// public abstract MongoTemplate getMongoTemplate();
//}
//package org.springblade.common.config.mongo;
//
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Primary;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
//import org.springframework.stereotype.Component;
//
///**
// * 主数据源
// *
// * @author szLi
// * @date 2021/11/11 9:56
// */
//@Component
//@ConfigurationProperties(prefix = "spring.data.mongodb.primary")
//@EnableMongoRepositories(basePackages = "org.springblade.founder.*.mongo.primary", mongoTemplateRef = "primaryMongoTemplate")
//public class PrimaryMongoConfigure extends AbstractMongoConfigure{
//
// @Override
// @Primary
// @Bean(name = "primaryMongoTemplate")
// public MongoTemplate getMongoTemplate() {
// return new MongoTemplate(mongoDbFactory());
// }
//
//}
//package org.springblade.common.config.mongo;
//
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
//import org.springframework.stereotype.Component;
//
///**
// * 二号数据源配置
// *
// * @author szLi
// * @date 2021/11/11 10:00
// */
//@Component
//@ConfigurationProperties(prefix = "spring.data.mongodb.secondary")
//@EnableMongoRepositories(basePackages = "org.springblade.founder.*.mongo.secondary", mongoTemplateRef = "secondaryMongoTemplate")
//public class SecondaryMongoConfigure extends AbstractMongoConfigure {
//
// @Override
// @Bean(name = "secondaryMongoTemplate")
// public MongoTemplate getMongoTemplate() {
// return new MongoTemplate(mongoDbFactory());
// }
//}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.common.constant;
/**
* 通用常量
*
* @author Chill
*/
public interface CommonConstant {
/**
* sword 系统名
*/
String SWORD_NAME = "sword";
/**
* saber 系统名
*/
String SABER_NAME = "saber";
/**
* 顶级父节点id
*/
Long TOP_PARENT_ID = 0L;
/**
* 顶级父节点名称
*/
String TOP_PARENT_NAME = "顶级";
/**
* 默认密码
*/
String DEFAULT_PASSWORD = "123456";
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.common.constant;
import org.springblade.core.launch.constant.AppConstant;
/**
* 通用常量
*
* @author Chill
*/
public interface LauncherConstant {
/**
* app name
*/
String APPLICATION_NAME = AppConstant.APPLICATION_NAME_PREFIX + "api";
/**
* sentinel dev 地址
*/
String SENTINEL_DEV_ADDR = "127.0.0.1:8858";
/**
* sentinel prod 地址
*/
String SENTINEL_PROD_ADDR = "192.168.186.129:8858";
/**
* sentinel test 地址
*/
String SENTINEL_TEST_ADDR = "192.168.186.129:8858";
/**
* 动态获取sentinel地址
*
* @param profile 环境变量
* @return addr
*/
static String sentinelAddr(String profile) {
switch (profile) {
case (AppConstant.PROD_CODE):
return SENTINEL_PROD_ADDR;
case (AppConstant.TEST_CODE):
return SENTINEL_TEST_ADDR;
default:
return SENTINEL_DEV_ADDR;
}
}
}
package org.springblade.common.core;
import org.apdplat.word.WordSegmenter;
import org.apdplat.word.segmentation.Word;
import org.lionsoul.jcseg.core.*;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ClipWords{
ISegment seg = null;
static List<String> lists = new ArrayList<String>();
public ClipWords() throws JcsegException, IOException{
JcsegTaskConfig localJcsegTaskConfig = new JcsegTaskConfig();
ADictionary localADictionary = DictionaryFactory.createDefaultDictionary(localJcsegTaskConfig);
//用第二种分词法好,姓名等都能分出来
this.seg = SegmentFactory.createJcseg(2, new Object[] { localJcsegTaskConfig, localADictionary });
}
/**
* 分词后直接进行归类的函数
* @param WordsString:待分的字符串
* @return 返回类型
*/
public SortResult ClipWordSort(String WordsString) throws IOException
{
SortResult SResult=new SortResult();
IWord localIWord = null;
IWord localIWord1 = null;
IWord localIWord2 = null;
IWord QQlocalIWord = null;
String curstr="";
String curstr1="";
String curstr2="";
String cphStr="";
String macStr="";
int i=0;
int j=0;
boolean reswx = false;
//车牌号提取
List<Word> words = WordSegmenter.segWithStopWords(WordsString);//晋A90904
for (int k = 0;k < words.size(); k++) {
if(WordsTpye.isProname(words.get(k).toString())){
if(k+1<words.size()){
String nextWord = words.get(k + 1).toString().trim();if((nextWord.length() == 6|| nextWord.length() == 5)&& WordsTpye.isLetter(nextWord.charAt(0)) && isOnlyNumAndChar(nextWord)){
if(nextWord.length() == 5){
String nextWord2 = words.get(k + 2).toString().trim();
if("挂".equals(nextWord2)||"学".equals(nextWord2)||"警".equals(nextWord2)||"港".equals(nextWord2)||"澳".equals(nextWord2)){
SResult.carid+= words.get(k).toString() + nextWord +nextWord2+ "#";
}
}else{
SResult.carid+= words.get(k).toString() + nextWord + "#";
}
}
}
}
}
isMac(WordsString);//mac网卡
if(lists!=null&&!"".equals(lists)){
for(String mac : lists){
macStr+= mac;
}
if(macStr!=null&&!"".equals(macStr)){
SResult.mac+=macStr;
}
}
lists=new ArrayList<String>();
this.seg.reset(new StringReader(WordsString));
WordsTpye wt=new WordsTpye();
List<IWord> backSpaceWordList = new ArrayList<IWord>(6);//用于查询回退
try
{
while ((localIWord = getNextWord(backSpaceWordList)) != null){
curstr=localIWord.getValue().trim();
i++;
// 长度20以上的都是些垃圾数据
if(curstr.length()>20){
continue;
}
if(WordsTpye.isProname(curstr)){
j=i;
cphStr=curstr;
String str = "";
}else{
if(i==j+1&&!"".equals(cphStr)){
}
else{
// 小于3位的数字直接忽略
if(WordsTpye.isNumeric(curstr)){
if(curstr.length()>=5){
if(WordsTpye.isMobile(curstr)){
SResult.mobile+=curstr;
}
else if(WordsTpye.isYhk(curstr)){
SResult.yhkh+=curstr;
}
else if(WordsTpye.isImsi(curstr)){
SResult.imsi+=curstr;
}
else if(WordsTpye.isIMEI(curstr)){
SResult.imei+=curstr;
}
else if(WordsTpye.isPsnid(curstr)){
SResult.psnid+=curstr;
}
else if(isOnlyNumAndChar(curstr)){
SResult.otherid+=curstr;
}
else{
//针对身份证中包含X情况作判断,otherid不要重复保存分词器读到的17位(少一位X)身份证号
String psnid=curstr+"X";
if(WordsTpye.isPsnid(psnid)==false){
SResult.otherid+=curstr;
}
}
}
}
else{
if(!WordsTpye.isPunctPoint(curstr)){
if(WordsTpye.isPsnid(curstr))
{
SResult.psnid+=curstr.toUpperCase();
}
else if(WordsTpye.isEmail(curstr))
{
SResult.email+=curstr;
}
else if(WordsTpye.isIP(curstr))
{
SResult.ip+=curstr;
}else if(WordsTpye.isVIN(curstr))
{
SResult.vin+=curstr;
}
else if(WordsTpye.isUrl(curstr)|| curstr.indexOf("com")>0||curstr.indexOf("cn")>0|| curstr.indexOf("http")>0|| curstr.indexOf("html")>0||curstr.indexOf("https")>0||curstr.indexOf("HTTP")>0||curstr.indexOf("HTTPS")>0)
{
SResult.url+=curstr;
}else if(WordsTpye.isWxid(curstr))
{
if((localIWord1 = getNextWord(backSpaceWordList) )!= null &&(localIWord1.getValue().trim().startsWith("_")||localIWord1.getValue().trim().startsWith("-"))){
curstr1=localIWord1.getValue().trim();
curstr=curstr+curstr1;
while((localIWord2=getNextWord(backSpaceWordList))!= null&& WordsTpye.isWxhmybf(localIWord2.getValue().trim())&& !WordsTpye.isPunctPoint(localIWord2.getValue().trim())){
curstr2 =localIWord2.getValue().trim();
reswx = WordsTpye.isWxhmybf(curstr2);
if(reswx==true){
curstr=curstr+curstr2;
}
}
//如果wxid_ 后面是纯数字直接保存,如果是加字母加数字需要/2+3
if(WordsTpye.isNumeric(curstr.substring(5))){
SResult.wx+=curstr;
}else{
int ws= (int)Math.ceil((curstr.length()/2)+3);
curstr=curstr.substring(0, ws);
SResult.wx+=curstr;
}
}
}
else if(WordsTpye.isQQZFC(curstr))
{
int cs =0;
while((QQlocalIWord=getNextWord(backSpaceWordList))!= null) {
cs=cs+1;
if(cs>3){
break;
}
if(WordsTpye.isEmail(QQlocalIWord.getValue().trim()))
{
SResult.email += QQlocalIWord.getValue().trim();
break;
}else if(!WordsTpye.isMobile(QQlocalIWord.getValue().trim())&&WordsTpye.isNumeric(QQlocalIWord.getValue().trim())) {
if (WordsTpye.isQQ(QQlocalIWord.getValue().trim())) {
SResult.qq += QQlocalIWord.getValue().trim();
}
break;
}
}
}
else
{
//数字大于5个以上才有可能是号码吧
//没有http的情况下,也有可能有网址
if(getCharCount(curstr,".")>=2){
if(WordsTpye.isUrl("http://"+curstr)||curstr.indexOf("com")>0||curstr.indexOf("cn")>0|| curstr.indexOf("http")>0|| curstr.indexOf("html")>0||curstr.indexOf("https")>0||curstr.indexOf("HTTP")>0||curstr.indexOf("HTTPS")>0){
SResult.url+=curstr;
}
}
}
}
}
}
}
//end while
localIWord = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
//wt.FreeAndNull();
return SResult;
}
/**
* @TODO 判断是否仅包含字母和数字
* @param trim
* @return
*/
private boolean isOnlyNumAndChar(String trim) {
// TODO Auto-generated method stub
String regex = "^[A-Za-z0-9]+$";
Pattern pattern = Pattern.compile(regex);
Matcher mat = pattern.matcher(trim);
return mat.find();
}
/**
* @TODO 获取下一个字符,当且仅当回退list中不存在word时会从分词器中取下一个word
* @param
* @return
* @throws IOException
*/
private IWord getNextWord(List<IWord> backSpaceWordList) throws IOException{
if(0 == backSpaceWordList.size()){
return this.seg.next();
}else{
return backSpaceWordList.remove(0);
}
}
private int getCharCount(String srcs,String mats){
String ts=srcs;
int ri=0;
int p=srcs.indexOf(mats);
while(p>0){
ri++;
ts=ts.substring(p+1);
p=ts.indexOf(mats);
}
return ri;
}
public static void isMac(String title){
String pattern = "(.*)([0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2})(.*)";
// 创建 Pattern 对象
Pattern r = Pattern.compile(pattern);
if (title != null && title != "") {
// 创建 matcher 对象
Matcher m = r.matcher(title);
if (m.matches()) {
lists.add(m.group(2));
if(m.group(1) != null && !"".equals(m.group(1))){
isMac(m.group(1));
}
}
}
}
/**
* 分词测试
*/
public static void main(String[] paramArrayOfString) throws JcsegException, IOException{
String str1="简要案情:姓名:李思文 性别:男 手机号: 18219235955 QQ:617191077 身份证号:36082919870314455X";
ClipWords localJcsegTest = new ClipWords();
SortResult SResult=localJcsegTest.ClipWordSort(str1);
System.out.println("carid="+SResult.carid);
System.out.println("qq="+SResult.qq);
System.out.println("mobie="+SResult.mobile);
System.out.println("psnname="+SResult.psnname);
System.out.println("psnid="+SResult.psnid);
System.out.println("ip="+SResult.ip);
System.out.println("email="+SResult.email);
System.out.println("url="+SResult.url);
System.out.println("otherid="+SResult.otherid);
System.out.println("yhkh="+SResult.yhkh);
System.out.println("imsi="+SResult.imsi);
}
}
package org.springblade.common.core;
/**
* <p>Title: SortResult.java</p>
* <p>Description: 归类结果结构</p> /
* <p>Copyright: HIGHLAND'S Copyright (c) 2014</p>
* <p>Company: HIGHLAND</p>
* @author admin
* @date 2021-12-4
* @version 1.0
*/
public class SortResult{
public String psnname="";
public String psnid="";
public String carid="";
public String mobile="";
public String otherid="";
public String email="";
public String ip="";
public String url="";
public String imsi="";
public String yhkh="";
public String imei="";
public String vin="";
public String mac="";
public String wx="";
public String qq="";
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.common.launch;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.core.launch.service.LauncherService;
import org.springframework.boot.builder.SpringApplicationBuilder;
import java.util.Properties;
/**
* 启动参数拓展
*
* @author smallchil
*/
public class LauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile) {
Properties props = System.getProperties();
props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
}
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.common.tool;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.common.core.ClipWords;
import org.springblade.common.core.SortResult;
import java.util.*;
/**
* 通用工具类
*
* @author Chill
*/
@Api(value = "工具类", tags = "工具类")
public class CommonUtil {
public static String getStrByLenth(String str){
return str.substring(0,str.length() - 1);
}
@ApiOperation(value = "提取标识号", notes = "提取标识号")
public static List<Map<String,Object>> doBshProcess(String info){
List<Map<String,Object>> listResult = new ArrayList<>();
String dostr="";
if(info!=null){
dostr=info.trim();
}
if(dostr.equals("")){
return listResult;
}
dostr=dostr.replaceAll (" ", "");
try{
ClipWords localJcsegTest = new ClipWords();
SortResult SResult=localJcsegTest.ClipWordSort(dostr);
if(SResult.carid!=null&&!SResult.carid.equals("")){
Map map = new HashMap();
map.put("bshlx","carid");
map.put("bsh",SResult.carid);
map.put("bshlxMc","车牌号");
listResult.add(map);
}
if(SResult.mobile!=null&&!SResult.mobile.equals("")){
Map map = new HashMap();
map.put("bshlx","mobile");
map.put("bsh",SResult.mobile);
map.put("bshlxMc","手机号");
listResult.add(map);
}
if(SResult.psnid!=null&&!SResult.psnid.equals("")){
Map map = new HashMap();
map.put("bshlx","personid");
map.put("bsh",SResult.psnid);
map.put("bshlxMc","身份证号码");
listResult.add(map);
}
if(SResult.ip!=null&&!SResult.ip.equals("")) {
Map map = new HashMap();
map.put("bshlx","ip");
map.put("bsh",SResult.ip);
map.put("bshlxMc","ip地址");
listResult.add(map);
}
if(SResult.imei!=null&&!SResult.imei.equals("")) {
Map map = new HashMap();
map.put("bshlx","imei");
map.put("bsh",SResult.imei);
map.put("bshlxMc","imei");
listResult.add(map);
}
if(SResult.vin!=null&&!SResult.vin.equals("")) {//车辆识别号码,简称VIN,是一组由十七个英数组成,用于汽车上的一组独一无二的号码,可以识别汽车的生产商、引擎、底盘序号及其他性能等资料。
Map map = new HashMap();
map.put("bshlx","vin");
map.put("bsh",SResult.vin);
map.put("bshlxMc","车辆识别号码");
listResult.add(map);
}
if(SResult.mac!=null&&!SResult.mac.equals("")) {
Map map = new HashMap();
map.put("bshlx","mac");
map.put("bsh",SResult.mac);
map.put("bshlxMc","mac");
listResult.add(map);
}
if(SResult.email!=null&&!SResult.email.equals("")) {
Map map = new HashMap();
map.put("bshlx","email");
map.put("bsh",SResult.email);
map.put("bshlxMc","email");
listResult.add(map);
}
if(SResult.url!=null&&!SResult.url.equals("")) {
Map map = new HashMap();
map.put("bshlx","url");
map.put("bsh",SResult.url);
map.put("bshlxMc","url");
listResult.add(map);
}
if(SResult.yhkh!=null&&!SResult.yhkh.equals("")) {//银行卡号
Map map = new HashMap();
map.put("bshlx","yhkh");
map.put("bsh",SResult.yhkh);
map.put("bshlxMc","yhkh");
listResult.add(map);
}
if(SResult.imsi!=null&&!SResult.imsi.equals("")) {
Map map = new HashMap();
map.put("bshlx","imsi");
map.put("bsh",SResult.imsi);
map.put("bshlxMc","imsi");
listResult.add(map);
}
if(SResult.qq!=null&&!SResult.qq.equals("")){
Map map = new HashMap();
map.put("bshlx","qq");
map.put("bsh",SResult.qq);
map.put("bshlxMc","qq");
listResult.add(map);
}
if(SResult.wx!=null&&!SResult.wx.equals("")){
Map map = new HashMap();
map.put("bshlx","wx");
map.put("bsh",SResult.wx);
map.put("bshlxMc","微信号");
listResult.add(map);
}
}
catch(Exception e){
System.out.println("doProcess异常:" + e.getMessage());
System.out.println(e.getStackTrace().toString());
}
return removeMapRepeat(listResult,"bsh");
}
/**
* 根据指定key去除重复Map
*
* @param list 传入的list集合
* @param keyName 指定的key
*/
public static List<Map<String, Object>> removeMapRepeat(List<Map<String, Object>> list, String keyName) {
if (list == null || list.isEmpty()) {
return null;
}
//根据属性值进行去重
Set<Map<String, Object>> sets = new TreeSet<>((m1, m2) -> {
Object obj1 = m1.get(keyName);
Object obj2 = m2.get(keyName);
//根据指定的key进行去重
return obj1.toString().compareTo(obj2.toString());
});
sets.addAll(list);
return new ArrayList(sets);
}
public static void main(String[] args) {
String ddd ="我的qq号1213254318,我的手机号18335155543";
// 提取标识号,并且保存
// List<Map<String, Object>> maps = doBshProcess(ddd);
// for (Map<String, Object> item: maps){
// System.out.println(item);
//
//
// }
}
}
package org.springblade.common.tool;
import org.apache.commons.lang.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAdjusters;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.regex.Pattern;
/**
* 日期相关工具类
*
* @author jing
*/
public class DateUtilXX {
public static String getDateStr(Date date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(date);
}
public static String getSysDateStr(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
return sdf.format(new Date());
}
public static String getFirstDayOfYear() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.set(c.get(Calendar.YEAR),0,1);
return sdf.format(c.getTime());
}
public static String getSysDateCnStr(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
return sdf.format(new Date());
}
public static String getDiffDateStr(int num){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, num);
return sdf.format(c.getTime());
}
public static String getNextWorkDay(Date date) {
TemporalAdjuster nextWorkingDay = TemporalAdjusters.ofDateAdjuster(
temporal -> {
DayOfWeek dow = DayOfWeek.of(temporal.get(ChronoField.DAY_OF_WEEK));
int dayToAdd = 1;
if (dow == DayOfWeek.FRIDAY) {
dayToAdd = 3;
}
if (dow == DayOfWeek.SATURDAY) {
dayToAdd = 2;
}
return temporal.plus(dayToAdd, ChronoUnit.DAYS);
});
LocalDate localDate = LocalDate.now().with(nextWorkingDay);
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return localDate.format(fmt);
}
/**
* checkDateFormat 验证日期格式,若日期格式为标准日期则转换成所指定的日期格式
* @param dateStr: 日期字符串
* @param formatPattern: 日期格式
* @return String: 结果日期
* @author lystar
* 2021/9/13 10:53
*/
public static String checkDateFormat(String dateStr, String formatPattern) {
if (StringUtils.isNotBlank(dateStr)) {
SimpleDateFormat dateFormat = new SimpleDateFormat(formatPattern);
try {
dateFormat.parse(dateStr);
} catch (ParseException e) {
String[] REPLACE_STRING = new String[]{"GMT+0800", "GMT+08:00"};
String SPLIT_STRING = "(中国标准时间)";
dateStr = dateStr.split(Pattern.quote(SPLIT_STRING))[0].replace(REPLACE_STRING[0], REPLACE_STRING[1]);
SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd yyyy HH:mm:ss z", Locale.US);
try {
Date date = sdf.parse(dateStr);
return dateFormat.format(date);
} catch (ParseException e1) {
e1.printStackTrace();
return null;
}
}
}
return dateStr;
}
}
package org.springblade.common.tool;
import io.swagger.annotations.Api;
import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author jing
* @date 2021/12/10 -- 17:43
*/
@Api(value = "获取分类单位工具类", tags = "获取分类单位工具类")
public class HqXjDwCommon {
public static Map<String, String> getMapDwLevCode(String dwUnitCode, String userGrade) {
Map<String, String> map = new HashMap<>();
String firstlev = "";
String lev="";
String codeLevCol="";
String dscodeLevCol="";
String unitcode=dwUnitCode;
if ("1".equals(userGrade)) {
firstlev = "1";
lev = "2";
codeLevCol = "CODE_LEV1";
dscodeLevCol = "CODE_LEV2";
}else if ("2".equals(userGrade)) {
firstlev = "2";
lev = "3";
codeLevCol = "CODE_LEV2";
dscodeLevCol = "CODE_LEV3";
} else if ("3".equals(userGrade)) {
firstlev = "3";
lev = "4";
codeLevCol = "CODE_LEV3";
dscodeLevCol = "CODE_LEV4";
} else if ("4".equals(userGrade)) {
firstlev = "4";
lev = "5";
codeLevCol = "CODE_LEV4";
dscodeLevCol = "CODE_LEV5";
}
//userGarde传入数字,是根据单位查询出其所在lev,传入unitcode时应该查哪一级别
map.put("firstlev",firstlev);
map.put("lev",lev);
map.put("codeLevCol",codeLevCol);
map.put("dscodeLevCol",dscodeLevCol);
map.put("unitcode",unitcode);
return map;
}
}
package org.springblade.common.tool;
import lombok.Data;
@Data
public class QgckryBean {
//姓名
private String xm;
//籍贯代码
private String jgssx;
//文化程度
private String whcd;
//曾用名
private String cym;
//人员照片
private String xp;
//婚姻状况
private String hyzk;
//毕业情况?
private String byqk;
//身份证号
private String sfzh;
//民族代码
private String mz;
//性别代码
private String xb;
//户籍地址行政区划代码
private String hkszd;
//出生地详址
private String csdxz;
//服务场所?
private String fwcs;
//出生日期
private String csrq;
//现住址
private String zzxz;
//身高
private String sg;
//证件类型代码
private String cyzjCyzjdm;
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.core.log.config;
import lombok.AllArgsConstructor;
import org.springblade.core.launch.props.BladeProperties;
import org.springblade.core.launch.server.ServerInfo;
import org.springblade.core.log.aspect.ApiLogAspect;
import org.springblade.core.log.event.ApiLogListener;
import org.springblade.core.log.event.ErrorLogListener;
import org.springblade.core.log.event.UsualLogListener;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.modules.system.service.ILogService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 日志工具自动配置
*
* @author Chill
*/
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
public class BladeLogToolAutoConfiguration {
private final ILogService logService;
private final ServerInfo serverInfo;
private final BladeProperties bladeProperties;
@Bean
public ApiLogAspect apiLogAspect() {
return new ApiLogAspect();
}
@Bean
public BladeLogger bladeLogger() {
return new BladeLogger();
}
@Bean
public ApiLogListener apiLogListener() {
return new ApiLogListener(logService, serverInfo, bladeProperties);
}
@Bean
public ErrorLogListener errorEventListener() {
return new ErrorLogListener(logService, serverInfo, bladeProperties);
}
@Bean
public UsualLogListener bladeEventListener() {
return new UsualLogListener(logService, serverInfo, bladeProperties);
}
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.core.log.event;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.launch.props.BladeProperties;
import org.springblade.core.launch.server.ServerInfo;
import org.springblade.core.log.constant.EventConstant;
import org.springblade.core.log.model.LogApi;
import org.springblade.core.log.utils.LogAbstractUtil;
import org.springblade.modules.system.service.ILogService;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import java.util.Map;
/**
* 异步监听日志事件
*
* @author Chill
*/
@Slf4j
@AllArgsConstructor
public class ApiLogListener {
private final ILogService logService;
private final ServerInfo serverInfo;
private final BladeProperties bladeProperties;
@Async
@Order
@EventListener(ApiLogEvent.class)
public void saveApiLog(ApiLogEvent event) {
Map<String, Object> source = (Map<String, Object>) event.getSource();
LogApi logApi = (LogApi) source.get(EventConstant.EVENT_LOG);
LogAbstractUtil.addOtherInfoToLog(logApi, bladeProperties, serverInfo);
logService.saveApiLog(logApi);
}
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.core.log.event;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.launch.props.BladeProperties;
import org.springblade.core.launch.server.ServerInfo;
import org.springblade.modules.system.service.ILogService;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
/**
* 异步监听错误日志事件
*
* @author Chill
*/
@Slf4j
@AllArgsConstructor
public class ErrorLogListener {
private final ILogService logService;
private final ServerInfo serverInfo;
private final BladeProperties bladeProperties;
@Async
@Order
@EventListener(ErrorLogEvent.class)
public void saveErrorLog(ErrorLogEvent event) {
/* Map<String, Object> source = (Map<String, Object>) event.getSource();
LogError logError = (LogError) source.get(EventConstant.EVENT_LOG);
LogAbstractUtil.addOtherInfoToLog(logError, bladeProperties, serverInfo);
logService.saveErrorLog(logError);*/
}
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.core.log.event;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.launch.props.BladeProperties;
import org.springblade.core.launch.server.ServerInfo;
import org.springblade.core.log.constant.EventConstant;
import org.springblade.core.log.model.LogUsual;
import org.springblade.core.log.utils.LogAbstractUtil;
import org.springblade.modules.system.service.ILogService;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import java.util.Map;
/**
* 异步监听日志事件
*
* @author Chill
*/
@Slf4j
@AllArgsConstructor
public class UsualLogListener {
private final ILogService logService;
private final ServerInfo serverInfo;
private final BladeProperties bladeProperties;
@Async
@Order
@EventListener(UsualLogEvent.class)
public void saveUsualLog(UsualLogEvent event) {
Map<String, Object> source = (Map<String, Object>) event.getSource();
LogUsual logUsual = (LogUsual) source.get(EventConstant.EVENT_LOG);
LogAbstractUtil.addOtherInfoToLog(logUsual, bladeProperties, serverInfo);
logService.saveUsualLog(logUsual);
}
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.core.secure;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* AuthInfo
*
* @author Chill
*/
@Data
@ApiModel(description = "认证信息")
public class AuthInfo {
@ApiModelProperty(value = "令牌")
private String accessToken;
@ApiModelProperty(value = "令牌类型")
private String tokenType;
@ApiModelProperty(value = "刷新令牌")
private String refreshToken;
@ApiModelProperty(value = "头像")
private String avatar = "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png";
@ApiModelProperty(value = "角色名")
private String authority;
@ApiModelProperty(value = "用户名")
private String userName;
@ApiModelProperty(value = "账号名")
private String account;
@ApiModelProperty(value = "过期时间")
private long expiresIn;
@ApiModelProperty(value = "许可证")
private String license = "powered by blade";
@ApiModelProperty(value = "用户等级")
private String grade ;
@ApiModelProperty(value = "身份证号")
private String identitycard ;
@ApiModelProperty(value = "单位代码")
private String unitcode ;
@ApiModelProperty(value = "单位名称")
private String unitname ;
@ApiModelProperty(value = "电话")
private String phone ;
@ApiModelProperty(value = "真实姓名")
private String realname ;
@ApiModelProperty(value = "ip")
@TableField(exist = false)
private String ip ;
private String permission;
private String userId;
}
package org.springblade.founder.gnsyrzlog;
import java.lang.annotation.*;
/**
* @Descrption该注解描述方法的操作类型和菜单内容
*/
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@Documented
public @interface LogOper {
/**
* @Description操作类型 为必填项,01:查询, 02:新建, 03:修改,04:删除, 05:登录 ,06:退出,07:文件下载
*/
String czxxLbdm();
/**
* @Description应用名称
*/
String yymcJyqk() default "";
/**
* @Description操作信息简要描述
*/
String czxxJyqk() default "";
}
package org.springblade.founder.gnsyrzlog.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.springblade.founder.gnsyrzlog.pojo.SysGnsyrz;
import org.springframework.stereotype.Component;
@Component
@Mapper
public interface LogDao {
void addGnsyrz(SysGnsyrz sysGnsyrz);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.springblade.founder.gnsyrzlog.mapper.LogDao">
<insert id="addGnsyrz" parameterType="org.springblade.founder.gnsyrzlog.pojo.SysGnsyrz">
INSERT INTO sys_gnsyrz (
rzlsh
,fwsj
,yymc_jyqk
,yh_gmsfhm
,yh_ip
,yhdw_gajgjgdm
,yhdw_gajgmc
,czlxdm
,czxx_jyqk
,czxx_param
,xxsc_pdbz
,xxdjdw_gajgjgdm
,xxdjdw_gajgmc
,xxdjry_xm
,xxdjry_gmsfhm
,xxdjry_lxdh
,djsj
,xxczdw_gajgjgdm
,xxczdw_gajgmc
,xxczry_xm
,xxczry_gmsfhm
,gxsj
,xxlyms
,yymcdm
,ywbhlxdm
,ywbh
,yh_xm
,cxnrlbdm
,cxnrbh
,cxxxjg
)
VALUES(
#{ rzlsh , jdbcType=VARCHAR }
,now()
,#{ yymcJyqk , jdbcType=VARCHAR }
,#{ yhGmsfhm , jdbcType=VARCHAR }
,#{ yhIp , jdbcType=VARCHAR }
,#{ yhdwGajgjgdm , jdbcType=VARCHAR }
,#{ yhdwGajgmc , jdbcType=VARCHAR }
,#{ czlxdm , jdbcType=VARCHAR }
,#{ czxxJyqk , jdbcType=VARCHAR }
,#{ czxxParam , jdbcType=VARCHAR }
,#{ xxscPdbz , jdbcType=VARCHAR }
,#{ xxdjdwGajgjgdm , jdbcType=VARCHAR }
,#{ xxdjdwGajgmc , jdbcType=VARCHAR }
,#{ xxdjryXm , jdbcType=VARCHAR }
,#{ xxdjryGmsfhm , jdbcType=VARCHAR }
,#{ xxdjryLxdh , jdbcType=VARCHAR }
,now()
,#{ xxczdwGajgjgdm , jdbcType=VARCHAR }
,#{ xxczdwGajgmc , jdbcType=VARCHAR }
,#{ xxczryXm , jdbcType=VARCHAR }
,#{ xxczryGmsfhm , jdbcType=VARCHAR }
,now()
,#{ xxlyms , jdbcType=VARCHAR }
,#{ yymcdm , jdbcType=VARCHAR }
,#{ ywbhlxdm , jdbcType=VARCHAR }
,#{ ywbh , jdbcType=VARCHAR }
,#{ yhXm , jdbcType=VARCHAR }
,#{ cxnrlbdm , jdbcType=VARCHAR }
,#{ cxnrbh , jdbcType=VARCHAR }
,#{ cxxxjg , jdbcType=VARCHAR }
)
</insert>
</mapper>
package org.springblade.founder.gnsyrzlog.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author jing
* @date 2021/9/26 -- 16:57
*/
@Data
@ApiModel(value = "SysGnsyrz", description = "功能使用日志")
public class SysGnsyrz {
//日志流水号
@ApiModelProperty(value = "日志流水号")
private String rzlsh;
//访问时间
@ApiModelProperty(value = "访问时间")
private String fwsj;
private String fwsjkssj;
private String fwsjjssj;
//应用名称
@ApiModelProperty(value = "应用名称")
private String yymcJyqk;
//用户_公民身份号码
@ApiModelProperty(value = "用户_公民身份号码")
private String yhGmsfhm;
//用户IP
@ApiModelProperty(value = "用户IP")
private String yhIp;
//用户单位公安机关机构代码
@ApiModelProperty(value = "用户单位公安机关机构代码")
private String yhdwGajgjgdm;
//用户单位名称
@ApiModelProperty(value = "用户单位名称")
private String yhdwGajgmc;
//操作类型代码
@ApiModelProperty(value = "操作类型代码")
private String czlxdm;
//操作信息
@ApiModelProperty(value = "操作信息")
private String czxxJyqk;
private String czxxParam;
//应用名称代码
@ApiModelProperty(value = "应用名称代码")
private String yymcdm;
//业务编号类型代码
@ApiModelProperty(value = "业务编号类型代码")
private String ywbhlxdm;
//业务编号
@ApiModelProperty(value = "业务编号")
private String ywbh;
//用户_姓名
@ApiModelProperty(value = "用户_姓名")
private String yhXm;
//查询内容类别代码
@ApiModelProperty(value = "查询内容类别代码")
private String cxnrlbdm;
//查询内容编号
@ApiModelProperty(value = "查询内容编号")
private String cxnrbh;
//操作(查询)信息结果
@ApiModelProperty(value = "操作(查询)信息结果")
private String cxxxjg;
/**
* 信息删除_判断标识/1-是,0-否/CODE_IF
*/
@ApiModelProperty(value = "信息删除_判断标识")
private String xxscPdbz;
/**
* 信息登记单位_公安机关机构代码/采用GA 380《全国公安机关机构代码编码规则》统一编制的代码/CODE_GXS
*/
@ApiModelProperty(value = "信息登记单位_公安机关机构代码")
private String xxdjdwGajgjgdm;
/**
* 信息登记单位_公安机关名称
*/
@ApiModelProperty(value = "信息登记单位_公安机关名称")
private String xxdjdwGajgmc;
/**
* 信息登记人员_公民身份号码/符合GB 11643《公民身份号码》
*/
@ApiModelProperty(value = "信息登记人员_公民身份号码")
private String xxdjryGmsfhm;
/**
* 信息登记人员_联系电话
*/
@ApiModelProperty(value = "信息登记人员_联系电话")
private String xxdjryLxdh;
/**
* 信息登记人员_姓名
*/
@ApiModelProperty(value = "信息登记人员_姓名")
private String xxdjryXm;
/**
* 信息操作单位_公安机关机构代码/采用GA 380《全国公安机关机构代码编码规则》统一编制的代码/CODE_GXS
*/
@ApiModelProperty(value = "信息操作单位_公安机关机构代码")
private String xxczdwGajgjgdm;
/**
* 信息操作单位_公安机关名称
*/
@ApiModelProperty(value = "信息操作单位_公安机关名称")
private String xxczdwGajgmc;
/**
* 信息操作人员_公民身份号码/符合GB 11643《公民身份号码》
*/
@ApiModelProperty(value = "信息操作人员_公民身份号码")
private String xxczryGmsfhm;
/**
* 信息操作人员_联系电话
*/
@ApiModelProperty(value = "信息操作人员_联系电话")
private String xxczryLxdh;
/**
* 信息操作人员_姓名
*/
@ApiModelProperty(value = "信息操作人员_姓名")
private String xxczryXm;
/**
* 信息入部库时间
*/
@ApiModelProperty(value = "信息入部库时间")
private String xxrbksj;
/**
* 信息入省库时间
*/
@ApiModelProperty(value = "信息入省库时间")
private String xxrsksj;
/**
* 信息来源描述
*/
@ApiModelProperty(value = "信息来源描述")
private String xxlyms;
/**
* 信息入部库_判断标识/1-是,0-否/CODE_IF
*/
@ApiModelProperty(value = "信息入部库_判断标识")
private String xxrbkPdbz;
/**
* 信息入省库_判断标识/1-是,0-否/CODE_IF
*/
@ApiModelProperty(value = "信息入省库_判断标识")
private String xxrskPdbz;
}
package org.springblade.founder.shzy.controller;
import io.swagger.annotations.ApiOperation;
import org.springblade.founder.shzy.entity.TbSfDrsj;
import org.springblade.founder.shzy.entity.TbShzysjDdxx;
import org.springblade.founder.shzy.service.MtxxService;
import org.springblade.founder.utils.R;
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.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/mt")
public class MtxxController {
@Autowired
private MtxxService mtxxService;
@PostMapping("queryMtxxBySjh")
@ApiOperation(value = "美团信息", notes = "美团信息")
public R queryMtxxBySjh(TbShzysjDdxx mtxx) {
try{
return R.ok().data(mtxxService.queryMtxxBySjh(mtxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("queryWlxxBySjh")
@ApiOperation(value = "物流信息", notes = "物流信息")
public R queryWlxxBySjh(TbSfDrsj wlxx) {
try{
return R.ok().data(mtxxService.queryWlxxBySjh(wlxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("doAnalyseWlxxBySjh")
@ApiOperation(value = "物流信息", notes = "物流信息")
public R doAnalyseWlxxBySjh(TbSfDrsj wlxx) {
try{
return R.ok().data(mtxxService.queryWlxxBySjh(wlxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtRqsjBySjh")
@ApiOperation(value = "美团日期统计", notes = "美团日期统计")
public R mtRqsjBySjh(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtRqsjBySjh(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtYuefRqsjBySjh")
@ApiOperation(value = "美团日期统计", notes = "美团日期统计")
public R mtYuefRqsjBySjh(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtYuefRqsjBySjh(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtBrxdCountBySjh")
@ApiOperation(value = "美团本人下单统计", notes = "美团本人下单统计")
public R mtBrxdCountBySjh(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtBrxdCountBySjh(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtShdztjBySjh")
@ApiOperation(value = "美团地址统计", notes = "美团地址统计")
public R mtShdztjBySjh(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtShdztjBySjh(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtQmdtjBySjh")
@ApiOperation(value = "美团亲密度统计", notes = "美团亲密度统计")
public R mtQmdtjBySjh(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtQmdtjBySjh(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtDzListTjBySjh")
@ApiOperation(value = "美团地址列表查询统计", notes = "美团地址列表查询统计")
public R mtDzListTjBySjh(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtDzListTjBySjh(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtQmdListTjBySjh")
@ApiOperation(value = "美团地址列表查询统计", notes = "美团地址列表查询统计")
public R mtQmdListTjBySjh(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtQmdListTjBySjh(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlRqsjBySjh")
@ApiOperation(value = "物流日期统计", notes = "物流日期统计")
public R wlRqsjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlRqsjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlYuefRqsjBySjh")
@ApiOperation(value = "物流月份日期统计", notes = "物流月份日期统计")
public R wlYuefRqsjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlYuefRqsjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlBrjjBySjh")
@ApiOperation(value = "物流本人下单统计", notes = "物流本人下单统计")
public R wlBrjjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlBrjjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlShdztjBySjh")
@ApiOperation(value = "物流地址统计", notes = "物流地址统计")
public R wlShdztjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlShdztjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlSftjBySjh")
@ApiOperation(value = "物流省份统计", notes = "物流省份统计")
public R wlSftjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlSftjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlQmdtjBySjh")
@ApiOperation(value = "物流亲密度统计", notes = "物流亲密度统计")
public R wlQmdtjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlQmdtjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlDzListTjBySjh")
@ApiOperation(value = "物流地址列表查询统计", notes = "物流地址列表查询统计")
public R wlDzListTjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlDzListTjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlQmdListTjBySjh")
@ApiOperation(value = "物流地址列表查询统计", notes = "物流地址列表查询统计")
public R wlQmdListTjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlQmdListTjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlSfListTjBySjh")
@ApiOperation(value = "物流省份列表查询统计", notes = "物流省份列表查询统计")
public R wlSfListTjBySjh(TbSfDrsj tbSfDrsj) {
try{
return R.ok().data(mtxxService.wlSfListTjBySjh(tbSfDrsj));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
}
package org.springblade.founder.shzy.controller;
import io.swagger.annotations.ApiOperation;
import org.springblade.founder.shzy.entity.TbSfDrsj;
import org.springblade.founder.shzy.entity.TbShzysjDdxx;
import org.springblade.founder.shzy.service.MtxxService;
import org.springblade.founder.utils.R;
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.RestController;
@RestController
@RequestMapping(value = "/xhmt")
public class XhMtController {
@Autowired
private MtxxService mtxxService;
@PostMapping("mtQmdtjMclb")
@ApiOperation(value = "美团亲密度统计列表", notes = "美团亲密度统计列表")
public R mtQmdtjMclb(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtQmdtjMclb(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("mtdztjMclb")
@ApiOperation(value = "美团亲密度统计列表", notes = "美团亲密度统计列表")
public R mtdztjMclb(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.mtdztjMclb(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wlQmdtjMclb")
@ApiOperation(value = "物流亲密度统计列表", notes = "物流亲密度统计列表")
public R wlQmdtjMclb(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.wlQmdtjMclb(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("wldztjMclb")
@ApiOperation(value = "物流dz统计列表", notes = "物流dz统计列表")
public R wldztjMclb(TbShzysjDdxx tbShzysjDdxx) {
try{
return R.ok().data(mtxxService.wldztjMclb(tbShzysjDdxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("queryWlxxBySjh")
@ApiOperation(value = "物流信息", notes = "物流信息")
public R queryWlxxBySjh(TbSfDrsj wlxx) {
try{
return R.ok().data(mtxxService.queryWlxxBySjhtest(wlxx));
}catch (Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
}
package org.springblade.founder.shzy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CountNameVo {
/**
* 百分比
*/
private String bfb;
private String maxsj;
/**
* 总数
*/
private Long count;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getBfb() {
return bfb;
}
public void setBfb(String bfb) {
this.bfb = bfb;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
/**
* 名称
*/
private String name;
/**
* 代码
*/
private String code;
}
package org.springblade.founder.shzy.entity;
import lombok.Data;
@Data
public class TbDbKdxx {
/**
* 自增主键
*/
private Integer id;
/**
* 运单号
*/
private String ydh;
/**
* 收货日期
*/
private String shrq;
/**
* 发货人
*/
private String fhr;
/**
* 发货人-手机号码
*/
private String fhrSjhm;
/**
* 发货人-电话号码
*/
private String fhrDhhm;
/**
* 发货人-地址
*/
private String fhrDz;
/**
* 商品名称
*/
private String spmc;
/**
* 数量
*/
private String sl;
/**
* 重量
*/
private String zl;
/**
* 体积
*/
private String tj;
/**
* 出发城市
*/
private String cfcs;
/**
* 到大城市
*/
private String ddcs;
/**
* 发货部门
*/
private String fhbm;
/**
* 收货人
*/
private String shr;
/**
* 收货人-手机号码
*/
private String shrSjhm;
/**
* 收货人-电话号码
*/
private String shrDhhm;
/**
* 收货人-地址
*/
private String shrDz;
}
package org.springblade.founder.shzy.entity;
import lombok.Data;
import java.util.Date;
//物流信息(顺丰)
@Data
public class TbSfDrsj {
private String paramSjh;
private String paramSjh2;
private String paramdz2;
private String id;
/**
* 运单号
*/
private String ydh;
/**
* 寄件时间
*/
private String jjsj;
private String jjsjStart;
private String jjsjEnd;
/**
* 寄件地址
*/
private String jjdz;
/**
* 寄件公司
*/
private String jjgs;
/**
* 寄件联系人
*/
private String jjlxr;
/**
* 寄件电话
*/
private String jjdh;
/**
* 寄件手机号
*/
private String jjsjh;
/**
* 收件地址
*/
private String sjdz;
/**
* 收件公司
*/
private String sjgs;
/**
* 收件联系人
*/
private String sjlxr;
/**
* 收件电话
*/
private String sjdh;
/**
* 收件手机号
*/
private String sjsjh;
/**
* 收件员
*/
private String sjy;
/**
* 原寄地
*/
private String yjd;
/**
* 目的地
*/
private String mdd;
/**
* 寄方客户编号
*/
private String jfkhbm;
/**
* 付款方式
*/
private String fkfs;
/**
*
*/
private String dshkje;
private String tjnr;
private String jfzl;
private String js;
private String yf;
private String pfkhbm;
private String pjy;
private Date lrsj;
private String filename;
private Date rksj;
private Integer qxbj;
private String yjdpd;
private String yjdpm;
private String yjdcd;
private String yjdcm;
private String mddpd;
private String mddpm;
private String mddcd;
private String mddcm;
private int page;
private int limit;
private String yuefrqparam; //月份日期时间
private String rqparam;
private String sfparam; //省份字段查询
private String dzcs;
private String sfbr;
private String qmcs;
private String xdsjStart;
private String xdsjEnd;
private String cxlx="1";
}
package org.springblade.founder.shzy.entity;
import lombok.Data;
import java.util.Date;
//美团信息
@Data
public class TbShzysjDdxx {
/**
* 自增主键
*/
private Integer id;
/**
* 订单ID
*/
private String ddid;
/**
* 收单手机号码
*/
private String xdsjhm;
/**
* 下单时间
*/
private Date xdsj;
private String xdsjStart;
private String xdsjEnd;
/**
* 商品名称
*/
private String spmc;
/**
* 订单行政区划名称
*/
private String ddXzqhmc;
/**
* 收货人
*/
private String shr;
/**
* 收货人手机号码
*/
private String sdrsjhm;
/**
* 收货地址
*/
private String shdz;
/**
* 事件类型
*/
private String sjlx;
/**
* 线索类型
*/
private String xslx;
/**
* 线索数据
*/
private String xssj;
/**
* 数据入库时间
*/
private Date rksj;
/**
* 导入文件名称
*/
private String wjmc;
/**
* 删除标志: 0:有效;1;删除
*/
private String scbz;
private int page;
private int limit;
private String paramSjh;
private String rqparam; //日期时间
private String yuefrqparam; //月份日期时间
private String dzcs;
private String sfbr; //1:是本人 ,2非本人
private String qmcs;
private String sjhone;
private String sjhtwo;
private String shdzone;
private String shdzsjh;
}
package org.springblade.founder.shzy.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.springblade.founder.shzy.entity.CountNameVo;
import org.springblade.founder.shzy.entity.TbSfDrsj;
import org.springblade.founder.shzy.entity.TbShzysjDdxx;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface MtxxMapper {
List<TbShzysjDdxx> queryMtxxBySjh(TbShzysjDdxx tbShzysjDdxx);
int queryMtxxBySjhCount(TbShzysjDdxx tbShzysjDdxx);
List<TbShzysjDdxx> queryMtxxBySjhTj(TbShzysjDdxx tbShzysjDdxx);
List<TbShzysjDdxx> queryMtxxBySjhTj2(TbShzysjDdxx tbShzysjDdxx);
List<TbSfDrsj> queryWlxxBySjh(TbSfDrsj tbSfDrsj);
List<TbSfDrsj> queryWlxxBySjhtest(TbSfDrsj tbSfDrsj);
int queryWlxxBySjhCountTest(TbSfDrsj tbSfDrsj);
int queryWlxxBySjhCount(TbSfDrsj tbSfDrsj);
List<TbSfDrsj> queryWlxxBySjhTj(TbSfDrsj tbSfDrsj);
List<TbSfDrsj> queryWlxxBySjhTj2(TbSfDrsj tbSfDrsj);
//美团日期统计
List<CountNameVo> mtRqsjBySjh(TbShzysjDdxx tbShzysjDdxx);
//美团月份日期统计
List<CountNameVo> mtYuefRqsjBySjh(TbShzysjDdxx tbShzysjDdxx);
//美团本人下单统计
int mtBrxdCountBySjh(TbShzysjDdxx tbShzysjDdxx);
//美团收货地址统计
List<CountNameVo> mtShdztjBySjh(TbShzysjDdxx tbShzysjDdxx);
//美团亲密度统计
List<CountNameVo> mtQmdtjBySjh(TbShzysjDdxx tbShzysjDdxx);
//细化美团亲密度列表
List<CountNameVo> mtQmdtjMclb(TbShzysjDdxx tbShzysjDdxx);
List<CountNameVo> mtdztjMclb(TbShzysjDdxx tbShzysjDdxx);
//end
//细化物流亲密度列表
List<CountNameVo> wlQmdtjMclb(TbShzysjDdxx tbShzysjDdxx);
List<CountNameVo> wldztjMclb(TbShzysjDdxx tbShzysjDdxx);
//end
//物流日期统计
List<CountNameVo> wlRqsjBySjh(TbSfDrsj tbSfDrsj);
//物流月份日期统计
List<CountNameVo> wlYuefRqsjBySjh(TbSfDrsj tbSfDrsj);
//物流本人寄件统计
int wlBrjjBySjh(TbSfDrsj tbSfDrsj);
//物流地址统计
List<CountNameVo> wlShdztjBySjh(TbSfDrsj tbSfDrsj);
//物流省份统计
List<CountNameVo> wlSftjBySjh(TbSfDrsj tbSfDrsj);
//物流亲密度统计
List<CountNameVo> wlQmdtjBySjh(TbSfDrsj tbSfDrsj);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
package org.springblade.founder.shzy.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.springblade.founder.shzy.entity.CountNameVo;
import org.springblade.founder.shzy.entity.TbDbKdxx;
import org.springblade.founder.shzy.entity.TbSfDrsj;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface WlxxMapper {
//德邦
List<TbDbKdxx> queryWlxxBySjh(TbDbKdxx tbDbKdxx);
//德邦
List<TbSfDrsj> queryWlxxBySjh2(TbSfDrsj tbDbKdxx);
int queryWlxxBySjhCount(TbDbKdxx tbDbKdxx);
//物流日期统计
List<CountNameVo> wlRqsjBySjh(TbSfDrsj mtxx);
//物流月份日期统计
List<CountNameVo> wlYuefRqsjBySjh(TbSfDrsj mtxx);
//物流本人寄件统计
int wlBrjjBySjh(TbSfDrsj mtxx);
//物流地址统计
List<CountNameVo> wlShdztjBySjh(TbSfDrsj mtxx);
//物流省份统计
List<CountNameVo> wlSftjBySjh(TbSfDrsj mtxx);
//物流亲密度统计
List<CountNameVo> wlQmdtjBySjh(TbSfDrsj mtxx);
}
package org.springblade.founder.shzy.service;
import org.springblade.founder.shzy.entity.TbSfDrsj;
import org.springblade.founder.shzy.entity.TbShzysjDdxx;
import java.util.List;
import java.util.Map;
public interface MtxxService {
Map<String, Object> queryMtxxBySjh(TbShzysjDdxx mtxx);
Map<String, Object> queryWlxxBySjh(TbSfDrsj mtxx);
Map<String, Object> queryWlxxBySjhtest(TbSfDrsj mtxx);
Map<String, Object> doAnalyseWlxxBySjh(TbSfDrsj mtxx);
Map<String, Object> mtRqsjBySjh(TbShzysjDdxx mtxx);
Map<String, Object> mtYuefRqsjBySjh(TbShzysjDdxx mtxx);
Map<String, Object> mtBrxdCountBySjh(TbShzysjDdxx mtxx);
Map<String, Object> mtShdztjBySjh(TbShzysjDdxx mtxx);
Map<String, Object> mtQmdtjBySjh(TbShzysjDdxx mtxx);
//细化
Map<String, Object> mtQmdtjMclb(TbShzysjDdxx mtxx);
Map<String, Object> mtdztjMclb(TbShzysjDdxx mtxx);
//细化物流
Map<String, Object> wlQmdtjMclb(TbShzysjDdxx mtxx);
Map<String, Object> wldztjMclb(TbShzysjDdxx mtxx);
Map<String, Object> queryXhMtxxBySjh(TbShzysjDdxx mtxx);
//end
Map<String, Object> mtDzListTjBySjh(TbShzysjDdxx mtxx);
Map<String, Object> mtQmdListTjBySjh(TbShzysjDdxx mtxx);
Map<String, Object> wlRqsjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlYuefRqsjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlBrjjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlShdztjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlSftjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlQmdtjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlDzListTjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlQmdListTjBySjh(TbSfDrsj mtxx);
Map<String, Object> wlSfListTjBySjh(TbSfDrsj mtxx);
}
package org.springblade.founder.utils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "全局自定义异常")
public class ApiException extends RuntimeException {
@ApiModelProperty(value = "状态码")
private Integer code;
@ApiModelProperty(value = "异常消息")
private String message;
@Override
public String toString() {
return "AsjxxzbException{" +
"message=" + this.getMessage() +
", code=" + code +
'}';
}
}
package org.springblade.founder.utils;
/**
* 自定义异常类
* @author wsy
* 2018/7/3
*/
public class BaseException extends RuntimeException{
private Throwable exception;
private String message;
/**
* 无参构造函数<br>
*/
public BaseException() {
}
/**
* 带参构造函数,传入String参数
*
* @param msg String
*/
public BaseException(String msg) {
super(msg);
this.message = msg;
}
/**
* 带参构造函数,传入Throwable参数
*
* @param thrown Throwable
*/
public BaseException(Throwable thrown) {
super(thrown);
exception = thrown;
}
/**
* 带参构造函数,传入String和Throwable参数
*
* @param msg String
* @param thrown Throwable
*/
public BaseException(String msg, Throwable thrown) {
super(msg, thrown);
this.message = msg;
this.exception = thrown;
}
public Throwable getException() {
return exception;
}
public void setException(Throwable exception) {
this.exception = exception;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package org.springblade.founder.utils;
import lombok.Data;
import org.springblade.modules.system.entity.XzxtUser;
/**
* @author szLi
* @date 2021/8/25 15:39
*/
@Data
public class BaseModel {
protected String xxscPdbz;
protected String xxdjdwGajgjgdm;
protected String xxdjdwGajgmc;
protected String xxdjryXm;
protected String xxdjryGmsfhm;
protected String xxdjryLxdh;
protected String djsj;
protected String gxsj;
protected String xxczdwGajgjgdm;
protected String xxczdwGajgmc;
protected String xxczryXm;
protected String xxczryGmsfhm;
protected String xxczryLxdh;
protected String xxlyms = "刑侦信息专业应用系统";
protected String xxrsksj;
protected String xxrbksj;
protected String xxrskPdbz;
protected String xxrbkPdbz;
protected String gabxf;
protected int begin;
protected int end;
protected int page;//当前第几页
protected int limit;//每页多少行
//登录人员
public void setDjUser(XzxtUser user){
this.xxdjryXm=user.getRealname();
this.xxdjdwGajgjgdm=user.getUnitcode();
this.xxdjdwGajgmc=user.getUnitname();
this.xxdjryGmsfhm=user.getIdentitycard();
this.xxdjryLxdh=user.getPhone();
this.xxczryXm=user.getRealname();
this.xxczdwGajgjgdm=user.getUnitcode();
this.xxczdwGajgmc=user.getUnitname();
this.xxczryGmsfhm=user.getIdentitycard();
}
// 更新人员
public void setUpUser(XzxtUser user){
this.xxczryXm=user.getRealname();
this.xxczdwGajgjgdm=user.getUnitcode();
this.xxczdwGajgmc=user.getUnitname();
this.xxczryGmsfhm=user.getIdentitycard();
}
}
package org.springblade.founder.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static Date parse(String strDate) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.parse(strDate);
}
public static String getAge(String date) {
try {
Date birthDay = parse(date);
Calendar cal = Calendar.getInstance();
if (cal.before(birthDay)) {
//出生日期晚于当前时间,无法计算
throw new IllegalArgumentException(
"The birthDay is before Now.It's unbelievable!");
}
//当前年份
int yearNow = cal.get(Calendar.YEAR);
//当前月份
int monthNow = cal.get(Calendar.MONTH);
//当前日期
int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH);
cal.setTime(birthDay);
int yearBirth = cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH);
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
//计算整岁数
int age = yearNow - yearBirth;
if (monthNow <= monthBirth) {
if (monthNow == monthBirth) {
if (dayOfMonthNow < dayOfMonthBirth){
//当前日期在生日之前,年龄减一
age--;
}
} else {
age--;//当前月份在生日之前,年龄减一
}
} return age+"";
}catch (Exception e){
}
return "未知";
}
public static String getDateStr(Date date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(date);
}
public static String getDateStr(Date date,String datePattern){
SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
return sdf.format(date);
}
public static String getSysDateStr(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
return sdf.format(new Date());
}
public static String getSysDateCnStr(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
return sdf.format(new Date());
}
/**
* isodate时间格式转换
* @param datetime Thu Jul 29 22:31:27 CST 2010
* @return
*/
public static String getISODateStr(String datetime){
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", java.util.Locale.US);
Date date = null;
try {
date = sdf.parse(datetime);
} catch (ParseException e) {
e.printStackTrace();
}
String newDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
return newDate;
}
public static Date diffDate(Date date, int days){
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE, days);
return calendar.getTime();
}
/**
* 获取环比开始时间
* @param kssj
* @param jssj
* @return
*/
public static String getHbKssj(String kssj, String jssj) {
String hbkssj = "";
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date1 = sdf.parse(kssj);
Date date2 = sdf.parse(jssj);
long mis = date2.getTime() - date1.getTime();
Date date3 = new Date(date1.getTime()-mis);
hbkssj = sdf.format(date3);
} catch (ParseException e) {
e.printStackTrace();
}
return hbkssj;
}
//获取指定格式的时间
public static String format(Date date, String pattern) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(date);
}
//转换时间格式
public static String patternDateToNewPatternDate(String dateStr, String pattern, String newPattern) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date parse = sdf.parse(dateStr);
sdf.applyPattern(newPattern);
return sdf.format(parse);
}
public static String getSj(String dateStr) throws ParseException {
String sj = null;
switch (dateStr.length()){
case 8:
sj = DateUtil.patternDateToNewPatternDate(dateStr, "yyyyMMdd", "yyyy-MM-dd");
break;
case 12:
sj = DateUtil.patternDateToNewPatternDate(dateStr, "yyyyMMddHHmm", "yyyy-MM-dd HH:mm");
break;
case 14:
sj = DateUtil.patternDateToNewPatternDate(dateStr, "yyyyMMddHHmmss", "yyyy-MM-dd HH:mm:ss");
break;
case 18:
sj = dateStr;
break;
}
return sj;
}
public static Date getSjDate(String dateStr) throws ParseException {
Date sj = null;
switch (dateStr.length()){
case 8:
sj = new SimpleDateFormat("yyyyMMdd").parse(dateStr);
break;
case 10:
sj = new SimpleDateFormat("yyyy-MM-dd").parse(dateStr);
break;
case 12:
sj = new SimpleDateFormat("yyyyMMddHHmm").parse(dateStr);
break;
case 14:
sj = new SimpleDateFormat("yyyyMMddHHmmss").parse(dateStr);
break;
case 19:
sj = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr);
break;
}
return sj;
}
}
package org.springblade.founder.utils;
import java.util.HashMap;
import java.util.Map;
/**
* 单位工具类
*
* @author szLi
* @date 2021/12/14
*/
public class DwUtil {
/**
* 当前用户级别(codeLevCol记录的是当前用户单位的级别)的下一级别各个辖区的总数,通过dscodeLevCol进行分组
*
* @param unitcode
* @param userGrade
* @return
*/
public static Map<String, Object> getDwLevCode(String unitcode, String userGrade) {
Map<String, Object> map = new HashMap<>();
String lev;
String codeLevCol;
String dscodeLevCol;
if ("S".equals(userGrade) || "T".equals(userGrade)
|| "1".equals(userGrade)) {
lev = "2";
codeLevCol = "CODE_LEV1";
dscodeLevCol = "CODE_LEV2";
} else if ("D".equals(userGrade) || "2".equals(userGrade)) {
lev = "3";
codeLevCol = "CODE_LEV2";
dscodeLevCol = "CODE_LEV3";
} else if ("X".equals(userGrade) || "3".equals(userGrade)) {
lev = "4";
codeLevCol = "CODE_LEV3";
dscodeLevCol = "CODE_LEV4";
} else {
lev = "5";
codeLevCol = "CODE_LEV4";
dscodeLevCol = "CODE_LEV5";
}
map.put("lev", lev);
map.put("codeLevCol", codeLevCol);
map.put("dscodeLevCol", dscodeLevCol);
map.put("unitcode", unitcode);
return map;
}
}
package org.springblade.founder.utils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class EasyUIPage implements Serializable {
private static final long serialVersionUID = 1L;
public EasyUIPage() {
}
private int page = 1;
private int begin;
private int end;
private int total = 0;
private String sort;
private String order;
private int rownum = 20;
private List<?> rows = new ArrayList();
private String flag;
private String pagePara;
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public void setRows(List<?> rows) {
this.rows = rows;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getBegin() {
return begin;
}
public int getEnd() {
return end;
}
public List<?> getRows() {
return rows;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public void setPagePara(Integer rows) {
if (rows != null) {
this.begin = (this.page - 1) * rows;
this.end = rows;
} else {
this.begin = (this.page - 1) * rownum;
this.end = rownum;
}
}
public void setPageParaOracle(Integer rows) {
if (rows != null) {
this.begin = (this.page - 1) * rows;
this.end = this.page * rows;
} else {
this.begin = (this.page - 1) * rownum;
this.end = this.page * rownum;
}
}
public int getRownum() {
return rownum;
}
public void setRownum(int rownum) {
this.rownum = rownum;
}
/**
* @return the pagePara
*/
public String getPagePara() {
return pagePara;
}
/**
* @param pagePara the pagePara to set
*/
public void setPagePara(String pagePara) {
this.pagePara = pagePara;
}
}
package org.springblade.founder.utils;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
/**
* @Description 全局异常类,省去一堆try catch
* @author zzj
*/
@ControllerAdvice
public class GlobalException extends Exception {
@ExceptionHandler(Exception.class)
@ResponseBody
public R defultExceptionHandler(HttpServletRequest request,Exception e){
e.printStackTrace();
return R.error(e.getMessage());
}
}
package org.springblade.founder.utils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class HMacUtil {
public static void main(String[] args) {
try {
String secret = HMACSHA256("app_id=XZ15000000&app_key=pSFRNTQQXDJKSjzL&xz_token=2d69c3e2da6e8ecc8e977603&timestamp=1591152151950", "zdejRKFNCUSSAIjbvijEdRFxjnzKAI");
System.out.println(secret);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* HMac-SHA256算法加密
*
* @param data
* @param key
* @return
* @throws Exception
*/
public static String HMACSHA256(String data, String key) throws Exception {
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
sha256_HMAC.init(secret_key);
byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
StringBuilder sb = new StringBuilder();
for (byte item : array) {
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
}
return sb.toString();
}
}
package org.springblade.founder.utils;
import com.alibaba.fastjson.JSON;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
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.client.methods.HttpUriRequest;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpClientUtil {
private static RequestConfig requestConfig = null;
static{
// 设置请求和传输超时时间
//setConnectTimeout:设置连接超时时间,单位毫秒。
//setSocketTimeout:请求获取数据的超时时间,单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。
//setConnectionRequestTimeout:设置从connect Manager获取Connection 超时时间,单位毫秒
requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
}
public static String doGet(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpclient = HttpClients.createDefault();
String resultString = "";
CloseableHttpResponse response = null;
try {
// 创建uri
URIBuilder builder = new URIBuilder(url);
if (param != null) {
for (String key : param.keySet()) {
builder.addParameter(key, param.get(key));
}
}
URI uri = builder.build();
// 创建http GET请求
HttpGet httpGet = new HttpGet(uri);
// 执行请求
response = httpclient.execute(httpGet);
// 判断返回状态是否为200
if (response.getStatusLine().getStatusCode() == 200) {
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
}else{
return resultString;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e){
System.out.println("访问思悦质量检查数据发生异常。"+e.getMessage());
e.printStackTrace();
}
}
return resultString;
}
public static String doGet(String url) {
return doGet(url, null);
}
public static String doPost(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建参数列表
if (param != null) {
List<NameValuePair> paramList = new ArrayList<>();
for (String key : param.keySet()) {
paramList.add(new BasicNameValuePair(key, param.get(key)));
}
// 模拟表单
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
httpPost.setEntity(entity);
}
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
return resultString;
}
public static String doPost(String url) {
return doPost(url, null);
}
//请求美亚数据监测接口的的post请求
public static String doPostJson(String url, String json,String token) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type","application/json");
httpPost.setHeader("token",token);
// 创建请求内容
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
return resultString;
}
public static String doRequest(CloseableHttpClient httpclient, HttpUriRequest httpUriRequest, BasicCookieStore cookieStore) throws IOException {
//返回相应
CloseableHttpResponse response = httpclient.execute(httpUriRequest);
//获取response返回的相应实体
HttpEntity entity = response.getEntity();
entity.getContent();
//转码
String res= EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
return res;
}
public static void main(String []args){
HttpClientUtil hu = new HttpClientUtil();
String imgstrs = null;
try {
imgstrs = hu.getJsonString("http://172.18.116.158:8081/data/getPSNRollByRybh?rybh=1506020149992010042416");
} catch (Exception e) {
e.printStackTrace();
}
//System.out.println(imgstrs);
//Map<String,Object> rstmap = new HashMap<String,Object>();
//JSONObject jsonObject = (JSONObject) JSONObject.parse(imgstrs);
//JSONArray jsa = jsonObject.getJSONArray("ret");
//for (int i = 0; i < jsa.size(); i++) {
// JSONObject obj = jsa.getJSONObject(i);
// String position= obj.getString("position");
// String image= obj.getString("image");
// rstmap.put("rfpimg"+i,image);
//}
}
public String getJsonString(String urlPath) throws Exception {
// 设置请求和传输超时时间
URL url = new URL(urlPath);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
connection.connect();
InputStream inputStream = connection.getInputStream();
// 对应的字符编码转换
Reader reader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(reader);
String str = null;
StringBuffer sb = new StringBuffer();
while ((str = bufferedReader.readLine()) != null) {
sb.append(str);
}
reader.close();
connection.disconnect();
return sb.toString();
}
/**
* 将参数拼接为?key1=a&key2=b形式提交
* @param url
* @param headers
* @param jsonParam
* @return
*/
public static String doPostUrlEncodedFormEntity(String url, Map<String, String> headers, String jsonParam) throws Exception{
String resultString = "";
HttpPost httpPost = new HttpPost(url);
/*try{*/
//给httpPost请求设置header
if(null!=headers&&headers.size()>0){
for(String key:headers.keySet()){
httpPost.addHeader(key,headers.get(key));
}
}
// 设置参数解决中文乱码
if (null != jsonParam){
List<NameValuePair> paramList=new ArrayList<>();
Map<String, String> paramMap=(Map<String, String>) JSON.parse(jsonParam);
for(String key:paramMap.keySet()){
paramList.add(new BasicNameValuePair(key,paramMap.get(key)));
}
//模拟表单
UrlEncodedFormEntity entity=new UrlEncodedFormEntity(paramList);
httpPost.setEntity(entity);
}
// 设置请求和传输超时时间
httpPost.setConfig(requestConfig);
//创建客户端连接请求
CloseableHttpClient httpClient = HttpClients.createDefault();
// 发送请求
CloseableHttpResponse result = httpClient.execute(httpPost);
if (result.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
// 读取服务器返回的json数据(然后解析)
resultString = EntityUtils.toString(result.getEntity(), "utf-8");
}
/*}catch (Exception e){
e.printStackTrace();
}finally{
httpPost.releaseConnection();
}*/
return resultString;
}
}
package org.springblade.founder.utils;
import cn.hutool.core.exceptions.ExceptionUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
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.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.util.Map;
@Slf4j
public class HttpUtils {
private static RequestConfig requestConfig = null;
private static String tokenPath="";
static{
// 设置请求和传输超时时间
//setConnectTimeout:设置连接超时时间,单位毫秒。
//setSocketTimeout:请求获取数据的超时时间,单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。
//setConnectionRequestTimeout:设置从connect Manager获取Connection 超时时间,单位毫秒
requestConfig = RequestConfig.custom().setSocketTimeout(120000).setConnectTimeout(120000).build();
}
/**
* 静态属性注册配置文件中的值
* @param tokenPath
*/
@Value("${tokenPath}")
void setTokenPath(String tokenPath){
HttpUtils.tokenPath=tokenPath;
}
private static PoolingHttpClientConnectionManager cm =
new PoolingHttpClientConnectionManager();
public static String ytkdUrl;
@Value("${ytkdUrl}")
public void setYtkdUrl(String ytkdUrl) {
HttpUtils.ytkdUrl = ytkdUrl;
}
public static String doGet(String url) {
// 不是每次创建新的HttpClient对象,而是从连接池中获取HttpClient对象
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(cm).build();
HttpGet httpget = new HttpGet(url);
String entityStr = "";
CloseableHttpResponse response = null;
try {
response = httpClient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
entityStr = EntityUtils.toString(entity,"UTF-8");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printStackTrace();
log.error(ExceptionUtil.getMessage(e));
}
}
return entityStr;
}
public static String doPost(String url){
// 不是每次创建新的HttpClient对象,而是从连接池中获取HttpClient对象
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(cm).build();
HttpPost httpPost = new HttpPost(url);
String entityStr = "";
CloseableHttpResponse response = null;
try {
response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
if (entity != null) {
entityStr = EntityUtils.toString(entity,"UTF-8");
}
} catch (Exception e) {
e.printStackTrace();
log.error(ExceptionUtil.getMessage(e));
} finally {
try {
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printStackTrace();
log.error(ExceptionUtil.getMessage(e));
}
}
return entityStr;
}
/**
* 请求的参数类型为json
* @param url
* @param json
* @return {username:"",pass:""}
*/
public static String doPostJson(String url, Map<String, String> headers, String json) {
// post请求返回结果
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(cm).build();
String jsonResult = null;
HttpPost httpPost = new HttpPost(url);
// 设置请求和传输超时时间
httpPost.setConfig(requestConfig);
if(headers != null) {
for (String key : headers.keySet()) {
httpPost.setHeader(key, headers.get(key));
}
}
try{
//设置参数解决中文乱码
if (null != json){
StringEntity entity = new StringEntity(json,"utf-8");
entity.setContentEncoding("UTF-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);
}
//发送请求
CloseableHttpResponse result = httpClient.execute(httpPost);
if (result.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
// 读取服务器返回的json数据(然后解析)
jsonResult = EntityUtils.toString(result.getEntity(), "utf-8");
}else{
throw new Exception();
}
}catch (Exception e){
e.printStackTrace();
log.error(ExceptionUtil.getMessage(e));
}finally{
httpPost.releaseConnection();
}
return jsonResult;
}
public static String doGetAddHeader(String url, String headerName, String headerValue) {
// 不是每次创建新的HttpClient对象,而是从连接池中获取HttpClient对象
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(cm).build();
HttpGet httpget = new HttpGet(url);
String entityStr = "";
CloseableHttpResponse response = null;
try {
httpget.setHeader(headerName, headerValue);
response = httpClient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
entityStr = EntityUtils.toString(entity,"UTF-8");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printStackTrace();
log.error(ExceptionUtil.getMessage(e));
}
}
return entityStr;
}
}
package org.springblade.founder.utils;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import org.springframework.util.StringUtils;
/**
* 警信通相关接口
* @auther: Lilei
* @date: 2022/8/22 10:12
*/
public class JxtUtil {
private static final String url = "http://10.142.46.128:9080/sms/SMSSendService";
private static final String user_id = "4536";
private static final String user_pwd = "123456";
private static final String sub_code = "0213";
public static R sendService(String phone ,String message) {
if (StringUtils.isEmpty(phone)){
return R.error("用户手机号码为空");
}
if (StringUtils.isEmpty(message)){
return R.error("用户发送消息内容为空");
}
String result = send(phone,message);
if (result.startsWith("0#")){
result = "提交成功," + result;
return R.ok().data("result",result);
}else {
switch (result) {
case "100":
result = "余额不足";
break;
case "101":
result = "账号关闭";
break;
case "102":
result = "短信内容超过195字或为空或内容编码格式不正确";
break;
case "103":
result = "手机号码超过50个或合法的手机号码为空";
break;
case "104":
result = "用户访问时间间隔低于50毫秒";
break;
case "105":
result = "用户访问方式不是post方式";
break;
case "106":
result = "用户名不存在";
break;
case "107":
result = "密码错误";
break;
case "108":
result = "指定访问ip错误";
break;
case "110":
result = "小号不合法";
break;
case "111":
result = "短信内容内有敏感词";
break;
case "-100":
result = "其他未知错误";
break;
}
return R.error(result);
}
}
/* 接口返回代码说明
0#数字#唯一ID 提交成功#提交成功的手机数量#发送唯一标示(状态报告接口将通过此唯一标示提交给个账号)
100 余额不足
101 账号关闭
102 短信内容超过195字或为空或内容编码格式不正确
103 手机号码超过50个或合法的手机号码为空
104 用户访问时间间隔低于50毫秒
105 用户访问方式不是post方式
106 用户名不存在
107 密码错误
108 指定访问ip错误
110 小号不合法
111 短信内容内有敏感词
-100 其他未知错误*/
private static String send(String phone ,String message){
org.apache.commons.httpclient.HttpClient httpClient = new org.apache.commons.httpclient.HttpClient();
PostMethod postMethod = new PostMethod(url);
postMethod.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=GBK");
NameValuePair userId = new NameValuePair("user_id", user_id);
NameValuePair userPwd = new NameValuePair("user_pwd", user_pwd);
NameValuePair mobile = new NameValuePair("mobile", phone);
NameValuePair msg_content = new NameValuePair("msg_content", message);
NameValuePair subCode = new NameValuePair("sub_code", sub_code);
NameValuePair[] data ={userId, userPwd, mobile, msg_content,subCode};
postMethod.setRequestBody(data);
int statusCode = 0;
String result = "";
try{
statusCode = httpClient.executeMethod(postMethod);
System.out.println("statusCode:"+statusCode);
if (statusCode == HttpStatus.SC_OK) {
result = postMethod.getResponseBodyAsString();
//根据返回状态可判断是否发送成功
System.out.println("result:"+result);
}
}catch (Exception e){
e.printStackTrace();
return "警信通接口调用失败";
}
return result;
}
}
package org.springblade.founder.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springblade.core.launch.constant.TokenConstant;
import org.springblade.core.secure.TokenInfo;
import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.modules.system.entity.XzxtUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import static org.springblade.founder.utils.ResultCode.*;
/**
* 连接进行消息发送
* @Author: wcw
* @Date: 2022/11/25 16:01
*/
@Service
public class MessageUtil {
@Value("${messageUrl}")
private String messageUrl;
public void sendMessageToXxtz(String xxzjbh, String xxbt, String xxnr, String jsrSfzh, String fsrSfzh, String xxlx,String xxlj){
//将参数转换成json形式访问
TbXxfwXxdl tbXxfwXxdl = new TbXxfwXxdl();
tbXxfwXxdl.setGlxxid(xxzjbh);
tbXxfwXxdl.setXxbt(xxbt);
tbXxfwXxdl.setXxnr(xxnr);
tbXxfwXxdl.setXxlj(xxlj);
tbXxfwXxdl.setXxlx(xxlx);
tbXxfwXxdl.setLrridentitycard(fsrSfzh);
tbXxfwXxdl.setXxyhidentitycard(jsrSfzh);
// tbXxfwXxdl.setZjhm("142302199901012007");
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("founder.authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
// Map<String, String> param = new HashMap<>(16);
// param.put(TokenConstant.TOKEN_TYPE, TokenConstant.ACCESS_TOKEN);
// param.put(TokenConstant.TENANT_ID, "000000");
// param.put("unitcode","460000000000");
// param.put("grade","");
// param.put("unitname","海南省花果山");
// param.put("identitycard","142302199901012007");
// param.put("realName","admin的真实姓名");
// param.put("phone","19585699958");
// TokenInfo tokenInfo = SecureUtil.createJWT(param, "audience", "issuser", TokenConstant.ACCESS_TOKEN);
// headers.put("blade-auth", "bearer "+tokenInfo.getToken());
// headers.put("blade-auth", "bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJpc3N1c2VyIiwiYXVkIjoiYXVkaWVuY2UiLCJ0ZW5hbnRfaWQiOiI1NDAxMDAwMDAwMDAyMDIxMDkyNzAwMzE2OTg3NTEiLCJyb2xlX25hbWUiOiIiLCJyZWFsTmFtZSI6ImFkbWlu55qE55yf5a6e5aeT5ZCNIiwidW5pdGNvZGUiOiI0NjAwMDAwMDAwMDAiLCJ1c2VyX2lkIjoiNTQwMTAwMDAwMDAwMjAyMTA5MjcwMDMxNjk4NzUxIiwicGhvbmUiOiIxOTU4NTY5OTk1OCIsInVzZXJfbmFtZSI6ImFkbWluIiwidW5pdG5hbWUiOiLmtbfljZfnnIHoirHmnpzlsbEiLCJncmFkZSI6IlMiLCJpZGVudGl0eWNhcmQiOiIxNDIzMDIxOTk5MDEwMTIwMDciLCJ0b2tlbl90eXBlIjoiYWNjZXNzX3Rva2VuIiwiYWNjb3VudCI6ImFkbWluIiwiY2xpZW50X2lkIjoic2FiZXIiLCJleHAiOjE2Njk0ODY4NTEsIm5iZiI6MTY2OTQyOTI1MX0.YpealRKvf399AJyeNoJg276yL1--YbM36HRfBAHRCSwc5Pn2AqbFHhHDMjgBlvFB8pnBVC06FpM8_Yy8NX-aPg");
try {
String resultToken = HttpClient.doPostUrlEncodedFormEntity(messageUrl + "/sendMassage", headers, JSON.toJSONString(tbXxfwXxdl));
if (StringUtils.isNotEmpty(resultToken)) {
//解析数据
JSONObject obj = JSONObject.parseObject(resultToken);
String data = obj.getString("data");
JSONObject objdata = JSONObject.parseObject(data);
System.out.println(objdata.toJSONString());
// objdata.put("code",JZWFW_CODE_SUCCESS);
// objdata.put("info",JZWFW_MSG_SUCCESS);
// return JzResult.ok().data(objdata);
}
}catch (Exception e){
e.printStackTrace();
// return JzResult.error(JZWFW_MSG_FAIL).data("code",JZWFW_CODE_FAIL).data( "info",JZWFW_MSG_FAIL);
}
}
public static void main(String[] args) {
TbXxfwXxdl tbXxfwXxdl = new TbXxfwXxdl();
tbXxfwXxdl.setGlxxid("540000000000202112140031713033");
tbXxfwXxdl.setXxbt("调证服务接口测试开发");
tbXxfwXxdl.setXxnr("长沙市菜市场是测试测试");
tbXxfwXxdl.setXxlj("www.baidu.com");
tbXxfwXxdl.setXxlx("010000");
tbXxfwXxdl.setLrridentitycard("142302199901012007");
tbXxfwXxdl.setXxyhidentitycard("142302199901012007");
tbXxfwXxdl.setZjhm("142302199901012007");
MessageUtil messageUtil = new MessageUtil();
// messageUtil.sendMessageToXxtz(tbXxfwXxdl);
messageUtil.sendMessageToXxtz(tbXxfwXxdl.getGlxxid(),"调证请求已反馈",tbXxfwXxdl.getLrridentitycard(),tbXxfwXxdl.getLrridentitycard(),tbXxfwXxdl.getXxyhidentitycard(),"010000",null);
}
}
package org.springblade.founder.utils;
import java.text.NumberFormat;
/**
* 数字相关工具类
*
* @author szLi
* @date 2021/4/22 21:25
*/
public class NumberUtil {
/**
* 获取a所占b的百分比
* @param a
* @param b
* @return
*/
public static String getPercent(int a, int b){
if(b==0){
return "0.00%";
}
double percent = (double) a/ (double) b;
//获取格式化对象
NumberFormat nt = NumberFormat.getPercentInstance();
//设置百分数精确度2即保留两位小数
nt.setMinimumFractionDigits(2);
return nt.format(percent);
}
}
package org.springblade.founder.utils;
import java.util.List;
import java.util.Map;
/**
* 对象通用类方法
*
* @author szLi
* @date 2020/12/14 11:42
*/
public class Objects {
public static boolean isEmpty(Object obj){
if(obj instanceof List){
return (obj == null || ((List) obj).size()==0);
}
if(obj instanceof Map){
return (obj == null || ((Map) obj).size()==0);
}
return obj==null;
}
public static boolean isNotEmpty(Object obj){
return !isEmpty(obj);
}
}
package org.springblade.founder.utils;
import lombok.Data;
/**
* 分页参数
*
* @author szLi
* @date 2022/3/24
*/
@Data
public class PageModel {
private int page;
private int limit;
private int begin;
private int end;
public void setPagePara() {
this.begin = (this.page - 1) * this.limit;
this.end = this.page * this.limit;
}
}
package org.springblade.founder.utils;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;
public class PropertiesUtil {
public static Properties propertiesUtil(String file){
Properties properties = new Properties();
InputStream inStream = PropertiesUtil.class.getClassLoader().getResourceAsStream(file);
try {
properties.load(inStream);
} catch (IOException e) {
e.printStackTrace();
}
return properties;
}
public static String getConfig(String file,String key){
Properties pros = new Properties();
String value="";
try {
pros.load(new InputStreamReader(Object.class.getResourceAsStream(file),"UTF-8"));
value=pros.get(key).toString();
} catch (IOException e) {
e.printStackTrace();
}
return value;
}
}
package org.springblade.founder.utils;
import java.io.InputStream;
import java.util.Properties;
import java.util.Set;
public class PropertiesUtils {
private Properties properties = new Properties();
public PropertiesUtils(String file) {
try {
InputStream in = PropertiesUtil.class.getClassLoader().getResourceAsStream(file);
this.properties.load(in);
in.close();
}catch (Exception e) {
e.printStackTrace();
}
}
@SuppressWarnings("unchecked")
public Set getKeys() {
return this.properties.keySet();
}
public String getValue(String itemName) {
String str = "";
try {
str = new String(this.properties.getProperty(itemName).getBytes("ISO8859_1"), "GBK");
} catch (Exception e) {
e.printStackTrace();
}
return str;
}
}
package org.springblade.founder.utils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
//统一返回结果的类
@Data
public class R {
@ApiModelProperty(value = "是否成功")
private Boolean success;
@ApiModelProperty(value = "返回码")
private Integer code;
@ApiModelProperty(value = "返回消息")
private String message;
@ApiModelProperty(value = "返回数据")
private Map<String, Object> data = new HashMap<String, Object>();
//把构造方法私有
private R() {}
//成功静态方法
public static R ok() {
R r = new R();
r.setSuccess(true);
r.setCode(ResultCode.SUCCESS);
r.setMessage("成功");
return r;
}
public static R ok(String msg) {
R r = new R();
r.setSuccess(true);
r.setCode(ResultCode.SUCCESS);
r.setMessage(msg);
return r;
}
//失败静态方法
public static R error() {
R r = new R();
r.setSuccess(false);
r.setCode(ResultCode.ERROR);
r.setMessage("失败");
return r;
}
//失败静态方法-携带错误信息
public static R error(String msg) {
R r = new R();
r.setSuccess(false);
r.setCode(ResultCode.ERROR);
r.setMessage(msg);
return r;
}
public R success(Boolean success){
this.setSuccess(success);
return this;
}
public R message(String message){
this.setMessage(message);
return this;
}
public R code(Integer code){
this.setCode(code);
return this;
}
public R data(String key, Object value){
this.data.put(key, value);
return this;
}
public R data(Map<String, Object> map){
this.setData(map);
return this;
}
public R rows(Object object){
this.data("rows",object);
return this;
}
public R total(Object object){
this.data("total",object);
return this;
}
}
package org.springblade.founder.utils;
public interface ResultCode {
public static Integer SUCCESS = 200; //成功
public static Integer ERROR = 201; //失败
}
package org.springblade.founder.utils;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.core.tool.api.R;
import org.springblade.modules.system.entity.XzxtUser;
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.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/sysXxzjbhApi")
@AllArgsConstructor
@Api(value = "系统信息主键编号接口", tags = "系统信息主键编号服务接口,用于前端生成信息主键编号")
public class SysXxzjbhApi {
@Autowired
private SysXxzjbhService xxzjbhService;
@PostMapping("/getXxzjbh")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "生成信息主键编号", notes = "生成一个信息主键编号")
public R recordUpdateValue(){
XzxtUser userXzxt = SecureUtil.getUserXzxt();
String unitCode = userXzxt.getUnitcode();
String xxzjbh = xxzjbhService.getXxzjbh(unitCode,null);
Map<String,Object> r = new HashMap<>();
r.put("xxzjbh",xxzjbh);
return R.data(r);
}
@PostMapping("/getYwzjbh")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "生成业务主键编号", notes = "生成案事件相关人员编号、案件编号等业务主键编号," +
"需要传入对应的表名和编号前缀(人员:P,案件:A,...),返回编号长度为23位。可以传入日期字符串指定日期,日期格式(yyyyMMdd '202103')")
public R recordUpdateValue(String time, String tableName, String prefix){
XzxtUser userXzxt = SecureUtil.getUserXzxt();
String unitCode = userXzxt.getUnitcode();
String ywzjbh = xxzjbhService.getZcxwYwbh(unitCode,time,tableName,prefix);
Map<String,Object> r = new HashMap<>();
r.put("ywzjbh",ywzjbh);
return R.data(r);
}
}
package org.springblade.founder.utils;
import org.springblade.founder.utils.mapper.SysXxzjbhDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service
public class SysXxzjbhService {
@Autowired
private SysXxzjbhDao sysXxzjbhDao;
/**
* 根据传入的单位代码和日期,生成对应的信息主键编号,返回编号长度为30位。
*
* @param unitCode
* @param time 格式(yyyyMMdd '20210309')
* @return 30位长度主键
*/
public String getXxzjbh(String unitCode, String time) {
String xxzjbh = "";
try {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
if (!StringUtils.hasText(unitCode)) {
throw new RuntimeException("单位代码为空,不能生成信息主键编号");
} else if (!StringUtils.hasText(time)) {
time = format.format(new Date());
}
xxzjbh = sysXxzjbhDao.getXxzjbh(unitCode, time);
} catch (Exception e) {
e.printStackTrace();
}
return xxzjbh;
}
public String getXxzjbh(String unitCode) {
return getXxzjbh(unitCode, "");
}
/**
* 根据传入的单位代码和日期,生成对应的信息主键编号,返回编号长度为23位。也可以用来生成人员编号等主键,需要传入对应的表名和编号前缀(人员:P,案件:A,)
*
* @param unitCode
* @param time 格式(yyyyMMdd '202103')
* @param tableName 行为表名
* @param prefix 前缀
* @return 23位长度主键
*/
public String getZcxwYwbh(String unitCode, String time, String tableName, String prefix) {
String xxzjbh = "";
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
if (StringUtils.isEmpty(unitCode)) {
throw new RuntimeException("单位代码为空,不能生成信息主键编号");
} else if (StringUtils.isEmpty(time)) {
time = format.format(new Date());
} else {
try {
format.parse(time);
} catch (ParseException e) {
time = format.format(new Date());
e.printStackTrace();
}
}
xxzjbh = sysXxzjbhDao.getZcxwYwzj(unitCode, time, tableName, prefix);
return xxzjbh;
}
}
package org.springblade.founder.utils;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class TbXxfwXxdl implements Serializable {
//案事件编号
private String asjbh;
//录比反服务标识号
private String fwbsh;
//录比反人员证件号码
private String zjhm;
//录比反车辆牌照号码
private String clpzh;
//录比反物品联系电话
private String lxdh;
//删除标志
private String scbz;
//录入人
private String lrr;
//录入时间
private Date lrsj;
//录入单位代码
private String lrdwdm;
//录入单位名称
private String lrdwmc;
//信息操作单位_公安机关机构代码
private String xxczdwGajgjgdm;
//信息操作单位_公安机关名称
private String xxczdwGajgmc;
//信息操作人员_警号
private String xxczryJh;
//信息操作人员_公民身份号码
private String xxczryGmsfhm;
//改写时间
private Date gxsj;
//ip地址
private String ip;
//消息ID
private String xxid;
//消息内容
private String xxnr;
//消息链接
private String xxlj;
//消息类型(预警消息、工作提示消息、采比反消息等)
private String xxlx;
//是否已读(0:未读1:已读)
private String sfyd;
//消息用户ID
private String xxyhid;
//消息用户警号
private String xxyhjh;
//消息用户单位代码
private String xxyhdwdm;
//消息单位单位名称
private String xxyhdwmc;
//已读时间
private Date ydsj;
//信息标题(采比反信息存案件编号)
private String xxbt;
//消息由案件产生,则添加对应的案件编号,如果消息由人员产生,则添加对应的人员编号.
private String glxxid;
//消息细类,用以区分消息详细内容,采用code码
private String xxxl;
//录入人身份证号码
private String lrridentitycard;
//消息用户身份证号码
private String xxyhidentitycard;
//消息用户姓名
private String xxyhxm;
//更新人
private String gxr;
//消息编号(同一次录入的消息)
private String xxbh;
//消息类型名称
private String xxlxstr;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.founder.utils.mapper.SysXxzjbhDao">
<select id="getXxzjbh" resultType="string">
select FN_XXCJ_XXZJBH(#{unitCode},#{time}) from dual
</select>
<select id="getZcxwYwzj" resultType="string">
select FN_XXCJ_NGZBHZH(#{unitCode},#{tableName},#{time},#{prefix}) from dual;
</select>
</mapper>
package org.springblade.founder.utils.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface SysXxzjbhDao {
public String getXxzjbh(@Param("unitCode") String unitCode, @Param("time") String time);
public String getZcxwYwzj(@Param("unitCode") String unitCode, @Param("time") String time, @Param("tableName") String tableName, @Param("prefix") String prefix);
}
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.modules.auth.controller;
import com.alibaba.fastjson.JSONObject;
import com.wf.captcha.SpecCaptcha;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.secure.AuthInfo;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.RedisUtil;
import org.springblade.core.tool.utils.WebUtil;
import org.springblade.modules.auth.granter.ITokenGranter;
import org.springblade.modules.auth.granter.TokenGranterBuilder;
import org.springblade.modules.auth.granter.TokenParameter;
import org.springblade.modules.auth.utils.SecurityUtil;
import org.springblade.modules.auth.utils.TokenUtil;
import org.springblade.modules.system.entity.SysNewUser;
import org.springblade.modules.system.entity.UserInfoResult;
import org.springblade.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* 认证模块
*
* @author Chill
*/
@RestController
@RequestMapping("blade-auth")
@Api(value = "用户授权认证", tags = "授权接口")
public class AuthController {
private RedisUtil redisUtil;
@Value("${secretKey}")
private String secretKey;
@Autowired
private ISysUserService sysUserService;
@PostMapping("token")
@ApiOperation(value = "获取认证token", notes = "传入租户ID:tenantId,账号:account,密码:password")
public R<AuthInfo> token(@ApiParam(value = "授权类型", required = true) @RequestParam(defaultValue = "password", required = false) String grantType,
@ApiParam(value = "刷新令牌") @RequestParam(required = false) String refreshToken,
@ApiParam(value = "租户ID", required = true) @RequestParam(defaultValue = "000000", required = false) String tenantId,
@ApiParam(value = "账号") @RequestParam(required = false) String account,
@ApiParam(value = "密码") @RequestParam(required = false) String password) {
String userType = Func.toStr(WebUtil.getRequest().getHeader(TokenUtil.USER_TYPE_HEADER_KEY), TokenUtil.DEFAULT_USER_TYPE);
TokenParameter tokenParameter = new TokenParameter();
tokenParameter.getArgs().set("tenantId", "000000")
.set("account", account)
.set("password", password)
.set("grantType", "password")
.set("refreshToken", refreshToken)
.set("userType", userType);
ITokenGranter granter = TokenGranterBuilder.getGranter("password");
// UserInfo userInfo = granter.grant(tokenParameter);
UserInfoResult userInfo = granter.grant(tokenParameter);
if (userInfo == null || userInfo.getUser() == null) {
return R.fail(TokenUtil.USER_NOT_FOUND);
}
return R.data(TokenUtil.createAuthInfo(userInfo));
}
@GetMapping("/captcha")
@ApiOperation(value = "获取验证码")
public R<Kv> captcha() {
SpecCaptcha specCaptcha = new SpecCaptcha(130, 48, 5);
String verCode = specCaptcha.text().toLowerCase();
String key = UUID.randomUUID().toString();
// 存入redis并设置过期时间为30分钟
redisUtil.set(CacheNames.CAPTCHA_KEY + key, verCode, 30L, TimeUnit.MINUTES);
// 将key和base64返回给前端
return R.data(Kv.init().set("key", key).set("image", specCaptcha.toBase64()));
}
//工作桌面单点登录
@PostMapping("sign")
@ApiOperation(value = "单点登录", notes = "传入令牌:token")
public R<AuthInfo> token(
@ApiParam(value = "令牌") @RequestParam() String token) {
UserInfoResult userInfo = new UserInfoResult();
try {
//token解密
token = URLDecoder.decode(token, "UTF-8");//特殊字符转义处理
String userStr = SecurityUtil.decrypt(token, secretKey);
System.out.println("userStr========" + userStr);
if (StringUtils.isNotEmpty(userStr)) {
JSONObject jsonObj = JSONObject.parseObject(userStr);
String username = jsonObj.getString("username");
if (StringUtils.isNotEmpty(username)) {//用户名不为空时继续验证
SysNewUser user = new SysNewUser();
user.setUsername(username);
user.setTrueName(jsonObj.getString("realname"));
user.setIdentitycard(jsonObj.getString("identitycard"));
user.setUnitcode(jsonObj.getString("unitcode"));
user.setUnitname(jsonObj.getString("unitname"));
user.setGrade(jsonObj.getString("grade"));
user.setTelephone(jsonObj.getString("phone"));
user.setPolicemanid(jsonObj.getString("policemanid"));
user.setPermission(jsonObj.getString("permission"));
String id = jsonObj.getString("id");
if (StringUtils.isNotEmpty(id) && id.matches("[0-9]+")) {
// user.setId(Long.parseLong(id));
user.setId(id);
} else {
Map<String, String> requestParam = new HashMap<>();
requestParam.put("identitycard", jsonObj.getString("identitycard"));
requestParam.put("policemanid", jsonObj.getString("policemanid"));
SysNewUser userResult = sysUserService.getUserInfoByParam(requestParam);
if (userResult != null && StringUtils.isNotEmpty(userResult.getId())) {
user.setId(userResult.getId());
}
}
userInfo.setUser(user);
}
}
} catch (Exception e) {
e.printStackTrace();
return R.fail(e.getMessage());
}
if (userInfo == null || userInfo.getUser() == null) {
return R.fail(TokenUtil.USER_NOT_FOUND);
}
return R.data(TokenUtil.createAuthInfo(userInfo));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment